コード例 #1
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /**
   * 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
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /*
   *To verify 72Weeks Pack is marked completed after the Service Pack runs for its scheduled duration.
   */
  @Test
  public void verifyFT165() {
    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    int days = sh.pregnancyPack().getWeeks() * 7;
    Subscription sub =
        sh.mksub(
            SubscriptionOrigin.MCTS_IMPORT,
            DateTime.now().minusDays(days),
            SubscriptionPackType.PREGNANCY);
    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),
            rh.hindiLanguage().getCode(),
            sh.getCircle(sub),
            FinalCallStatus.SUCCESS,
            makeStatsMap(StatusCode.OBD_SUCCESS_CALL_CONNECTED, 1),
            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);
    sub = subscriptionDataService.findBySubscriptionId(sub.getSubscriptionId());
    assertTrue(SubscriptionStatus.COMPLETED == sub.getStatus());
  }
コード例 #3
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /**
   * To verify that beneficiary(via mcts import) will be deactivated if he/she has MSISDN number
   * added to the DND database.
   */
  @Test
  public void verifyFT177() {

    Subscription subscription =
        sh.mksub(SubscriptionOrigin.MCTS_IMPORT, DateTime.now().minusDays(14));

    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.REJECTED,
            makeStatsMap(StatusCode.OBD_DNIS_IN_DND, 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 created via MCTS-import is still Deactivated with reason "do not
    // disturb"
    subscription = subscriptionDataService.findBySubscriptionId(subscription.getSubscriptionId());
    assertEquals(SubscriptionStatus.DEACTIVATED, subscription.getStatus());
    assertEquals(DeactivationReason.DO_NOT_DISTURB, subscription.getDeactivationReason());
  }
コード例 #4
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /*
   * NMS_FT_163
   * To verify pregnancyPack Pack created via IVR, shouldn't get deactivated due to reason DND.
   */
  @Test
  public void verifyFT163() {

    Subscription subscription2 = sh.mksub(SubscriptionOrigin.IVR, DateTime.now().minusDays(14));

    CallSummaryRecordDto csr =
        new CallSummaryRecordDto(
            new RequestId(subscription2.getSubscriptionId(), "11112233445566"),
            subscription2.getSubscriber().getCallingNumber(),
            sh.getContentMessageFile(subscription2, 0),
            sh.getWeekId(subscription2, 0),
            rh.hindiLanguage().getCode(),
            rh.delhiCircle().getName(),
            FinalCallStatus.REJECTED,
            makeStatsMap(StatusCode.OBD_DNIS_IN_DND, 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 created via IVR is still Active
    subscription2 = subscriptionDataService.findBySubscriptionId(subscription2.getSubscriptionId());
    assertEquals(SubscriptionStatus.ACTIVE, subscription2.getStatus());
  }
コード例 #5
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  @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());
  }
コード例 #6
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  @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());
  }
コード例 #7
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /**
   * 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());
  }
コード例 #8
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /**
   * To check that NMS shall not retry OBD message for which all OBD attempts(1 actual+1 retry)
   * fails with two message per week configuration.
   */
  @Test
  public void verifyFT142() {

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

    // Create a record in the CallRetry table marked as "retry 1" and verify it is erased from the
    // CallRetry table

    Subscription subscription =
        sh.mksub(
            SubscriptionOrigin.MCTS_IMPORT,
            DateTime.now().minusDays(3),
            SubscriptionPackType.PREGNANCY);
    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<>();
    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 no calls to retry since the one above was the last try
    assertEquals(0, callRetryDataService.count());
  }
コード例 #9
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /*
   * To verify 48Weeks Pack is marked completed after the Service Pack runs for its scheduled
   * duration including one retry.
   */
  @Test
  public void verifyFT168() {
    String timestamp = DateTime.now().toString(TIME_FORMATTER);

    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),
            rh.hindiLanguage().getCode(),
            sh.getCircle(sub),
            FinalCallStatus.SUCCESS,
            makeStatsMap(StatusCode.OBD_SUCCESS_CALL_CONNECTED, 1),
            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);
    sub = subscriptionDataService.findBySubscriptionId(sub.getSubscriptionId());
    assertTrue(SubscriptionStatus.COMPLETED == sub.getStatus());

    // verify call retry entry is also deleted from the database
    CallRetry retry = callRetryDataService.findBySubscriptionId(sub.getSubscriptionId());
    assertNull(retry);
  }
コード例 #10
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  @Test
  public void verifyFT149() {

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

    // To check that NMS shall not retry the OBD messages which failed due to user number in dnd.

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

    Map<Integer, Integer> callStats = new HashMap<>();
    callStats.put(StatusCode.OBD_DNIS_IN_DND.getValue(), 1);
    CallSummaryRecordDto record =
        new CallSummaryRecordDto(
            new RequestId(subscription.getSubscriptionId(), timestamp),
            subscription.getSubscriber().getCallingNumber(),
            contentFileName,
            "XXX",
            "XXX",
            "XX",
            FinalCallStatus.REJECTED,
            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 no calls to retry since the one above was the last rejected with DND reason
    assertEquals(0, callRetryDataService.count());
    subscription = subscriptionService.getSubscription(subscription.getSubscriptionId());
    assertTrue(SubscriptionStatus.DEACTIVATED == subscription.getStatus());
  }
コード例 #11
0
ファイル: CsrServiceBundleIT.java プロジェクト: tstalka/mim
  /*
   * 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());
  }