Esempio n. 1
0
  /*
   *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());
  }
Esempio n. 2
0
  @Before
  public void doTheNeedful() {

    testingService.clearDatabase();

    rh =
        new RegionHelper(
            languageDataService,
            circleDataService,
            stateDataService,
            districtDataService,
            districtService);

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

    sh.childPack();
    sh.pregnancyPack();
    csrService.buildMessageDurationCache();
  }
  @Before
  public void setUp() {
    testingService.clearDatabase();

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

    subscriptionHelper.pregnancyPack();
    subscriptionHelper.childPack();
  }