Пример #1
0
  /**
   * To verify that pregnancyPack beneficiary should not be deactivated if the error “user number
   * does not exist” is not received for all failed delivery attempts during a scheduling period for
   * a message.
   */
  @Test
  public void verifyFT189() {

    Subscription subscription =
        sh.mksub(SubscriptionOrigin.MCTS_IMPORT, DateTime.now(), SubscriptionPackType.PREGNANCY);

    CallSummaryRecordDto csr =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), "11112233445566"),
            subscription.getSubscriber().getCallingNumber(),
            sh.getContentMessageFile(subscription, 0),
            sh.getWeekId(subscription, 0),
            rh.hindiLanguage().getCode(),
            rh.delhiCircle().getName(),
            FinalCallStatus.FAILED,
            makeStatsMap(StatusCode.OBD_FAILED_SWITCHEDOFF, 3),
            0,
            3);

    Map<String, Object> eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, csr);
    MotechEvent motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    // verify that subscription is still Active
    subscription = subscriptionDataService.findBySubscriptionId(subscription.getSubscriptionId());
    assertEquals(SubscriptionStatus.ACTIVE, subscription.getStatus());

    // verify that call is rescheduled for next retry.
    assertEquals(1, callRetryDataService.count());

    List<CallRetry> retries = callRetryDataService.retrieveAll();

    assertEquals(subscription.getSubscriptionId(), retries.get(0).getSubscriptionId());
    assertEquals(CallStage.RETRY_1, retries.get(0).getCallStage());
    assertEquals(DayOfTheWeek.today().nextDay(), retries.get(0).getDayOfTheWeek());

    csr =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), "11112233445566"),
            subscription.getSubscriber().getCallingNumber(),
            sh.getContentMessageFile(subscription, 0),
            sh.getWeekId(subscription, 0),
            rh.hindiLanguage().getCode(),
            rh.delhiCircle().getName(),
            FinalCallStatus.FAILED,
            makeStatsMap(StatusCode.OBD_FAILED_INVALIDNUMBER, 3),
            0,
            3);

    eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, csr);
    motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    // verify that subscription is still Active, it is not deactivated because call was not failed
    // due to invalid number for all retries.
    subscription = subscriptionDataService.findBySubscriptionId(subscription.getSubscriptionId());
    assertEquals(SubscriptionStatus.ACTIVE, subscription.getStatus());
  }
Пример #2
0
  @Test
  public void verifyFT141() {

    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    // To check that NMS shall retry OBD message for which delivery fails for the first time with
    // two message per
    // week configuration.

    Subscription subscription =
        sh.mksub(SubscriptionOrigin.MCTS_IMPORT, DateTime.now(), SubscriptionPackType.PREGNANCY);
    String contentFileName = sh.getContentMessageFile(subscription, 0);

    csrDataService.create(
        new CallSummaryRecord(
            new RequestId(subscription.getSubscriptionId(), "11112233445566").toString(),
            subscription.getSubscriber().getCallingNumber(),
            "w1_1.wav",
            "w1_1",
            rh.hindiLanguage().getCode(),
            rh.delhiCircle().getName(),
            FinalCallStatus.FAILED,
            makeStatsMap(StatusCode.OBD_FAILED_BUSY, 1),
            0,
            10,
            3));
    Map<Integer, Integer> callStats = new HashMap<>();
    callStats.put(StatusCode.OBD_FAILED_BUSY.getValue(), 1);
    CallSummaryRecordDto record =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), timestamp),
            subscription.getSubscriber().getCallingNumber(),
            contentFileName,
            "XXX",
            rh.hindiLanguage().getCode(),
            rh.delhiCircle().getName(),
            FinalCallStatus.FAILED,
            callStats,
            0,
            3);

    Map<String, Object> eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, record);
    MotechEvent motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    assertEquals(1, callRetryDataService.count());

    List<CallRetry> retries = callRetryDataService.retrieveAll();

    assertEquals(subscription.getSubscriptionId(), retries.get(0).getSubscriptionId());
    assertEquals(CallStage.RETRY_1, retries.get(0).getCallStage());
    assertEquals(DayOfTheWeek.today().nextDay(), retries.get(0).getDayOfTheWeek());
  }
Пример #3
0
  @Test
  public void verifyFT144() {

    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    // To check that NMS shall retry the OBD messages which failed as IVR did not attempt OBD for
    // those messages.

    Subscription subscription =
        sh.mksub(SubscriptionOrigin.MCTS_IMPORT, DateTime.now(), SubscriptionPackType.CHILD);
    String contentFileName = sh.getContentMessageFile(subscription, 0);
    CallRetry retry =
        callRetryDataService.create(
            new CallRetry(
                subscription.getSubscriptionId(),
                subscription.getSubscriber().getCallingNumber(),
                DayOfTheWeek.today(),
                CallStage.RETRY_1,
                contentFileName,
                "XXX",
                "XXX",
                "XX",
                SubscriptionOrigin.MCTS_IMPORT));

    Map<Integer, Integer> callStats = new HashMap<>();
    callStats.put(StatusCode.OBD_FAILED_NOATTEMPT.getValue(), 1);
    CallSummaryRecordDto record =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), timestamp),
            subscription.getSubscriber().getCallingNumber(),
            contentFileName,
            "XXX",
            "XXX",
            "XX",
            FinalCallStatus.FAILED,
            callStats,
            0,
            1);

    Map<String, Object> eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, record);
    MotechEvent motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    // There should be one calls to retry since the one above was the last failed with No attempt
    assertEquals(1, callRetryDataService.count());

    List<CallRetry> retries = callRetryDataService.retrieveAll();

    assertEquals(subscription.getSubscriptionId(), retries.get(0).getSubscriptionId());
    assertEquals(CallStage.RETRY_2, retries.get(0).getCallStage());
    assertEquals(DayOfTheWeek.today().nextDay(), retries.get(0).getDayOfTheWeek());
  }
Пример #4
0
  /**
   * To check that NMS shall retry OBD message for which second OBD retry fails with single message
   * per week configuration.
   */
  @Test
  public void verifyFT139() {
    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    // Create a record in the CallRetry table marked as "retry_2" and verify it is updated as
    // "retry_last" in
    // CallRetry table

    Subscription subscription =
        sh.mksub(SubscriptionOrigin.MCTS_IMPORT, DateTime.now().minusDays(3));
    String contentFileName = sh.getContentMessageFile(subscription, 0);
    CallRetry retry =
        callRetryDataService.create(
            new CallRetry(
                subscription.getSubscriptionId(),
                subscription.getSubscriber().getCallingNumber(),
                DayOfTheWeek.today(),
                CallStage.RETRY_2,
                contentFileName,
                "XXX",
                "XXX",
                "XX",
                SubscriptionOrigin.MCTS_IMPORT));

    Map<Integer, Integer> callStats = new HashMap<>();
    CallSummaryRecordDto record =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), timestamp),
            subscription.getSubscriber().getCallingNumber(),
            contentFileName,
            "XXX",
            "XXX",
            "XX",
            FinalCallStatus.FAILED,
            callStats,
            0,
            5);

    Map<String, Object> eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, record);
    MotechEvent motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    // There should be one calls to retry since the retry 2 was failed.
    assertEquals(1, callRetryDataService.count());

    List<CallRetry> retries = callRetryDataService.retrieveAll();

    assertEquals(subscription.getSubscriptionId(), retries.get(0).getSubscriptionId());
    assertEquals(CallStage.RETRY_LAST, retries.get(0).getCallStage());
    assertEquals(DayOfTheWeek.today().nextDay(), retries.get(0).getDayOfTheWeek());
  }
Пример #5
0
  /*
   * To verify that childPack Subscription should not be marked completed after just first retry.
   */
  @Test
  public void verifyFT187() {
    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    SubscriptionHelper sh =
        new SubscriptionHelper(
            subscriptionService,
            subscriberDataService,
            subscriptionPackDataService,
            languageDataService,
            circleDataService,
            stateDataService,
            districtDataService,
            districtService);

    int days = sh.childPack().getWeeks() * 7;
    Subscription sub =
        sh.mksub(
            SubscriptionOrigin.MCTS_IMPORT,
            DateTime.now().minusDays(days),
            SubscriptionPackType.CHILD);

    callRetryDataService.create(
        new CallRetry(
            sub.getSubscriptionId(),
            sub.getSubscriber().getCallingNumber(),
            DayOfTheWeek.today(),
            CallStage.RETRY_1,
            "w48_1.wav",
            "w48_1",
            "XXX",
            "XX",
            SubscriptionOrigin.MCTS_IMPORT));

    int index = sh.getLastMessageIndex(sub);
    CallSummaryRecordDto r =
        new CallSummaryRecordDto(
            new RequestId(sub.getSubscriptionId(), timestamp),
            sub.getSubscriber().getCallingNumber(),
            sh.getContentMessageFile(sub, index),
            sh.getWeekId(sub, index),
            sh.getLanguageCode(sub),
            sh.getCircle(sub),
            FinalCallStatus.FAILED,
            makeStatsMap(StatusCode.OBD_FAILED_SWITCHEDOFF, 10),
            120,
            1);

    Map<String, Object> eventParams = new HashMap<>();
    eventParams.put(CSR_PARAM_KEY, r);
    MotechEvent motechEvent = new MotechEvent(PROCESS_SUMMARY_RECORD_SUBJECT, eventParams);
    csrService.processCallSummaryRecord(motechEvent);

    // There should be one calls to retry since the retry 2 was failed.
    assertEquals(1, callRetryDataService.count());

    List<CallRetry> retries = callRetryDataService.retrieveAll();

    assertEquals(sub.getSubscriptionId(), retries.get(0).getSubscriptionId());
    assertEquals(CallStage.RETRY_2, retries.get(0).getCallStage());
    assertEquals(DayOfTheWeek.today().nextDay(), retries.get(0).getDayOfTheWeek());

    // verify that subscription is still Active, as last message was not delivered successfully and
    // retries
    // are left
    sub = subscriptionDataService.findBySubscriptionId(sub.getSubscriptionId());
    assertEquals(SubscriptionStatus.ACTIVE, sub.getStatus());
  }