コード例 #1
0
  @SuppressWarnings("unchecked")
  public void testLoadCustomers() throws PageExpiredException {
    MeetingBO meeting =
        TestObjectFactory.createMeeting(
            TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);

    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "loadCustomerList");
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(
        CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO,
        createDefaultCollectionSheetDto(),
        request);

    actionPerform();
    verifyForward("load_success");
    List<CustomerView> parentCustomerList =
        (List<CustomerView>)
            SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERSLIST, request);

    Assert.assertEquals(1, parentCustomerList.size());
    Assert.assertEquals(
        "The value for isCenter Hierarchy Exists",
        SessionUtils.getAttribute(CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, request),
        Constants.YES);
  }
コード例 #2
0
 private void createInitialObjects() {
   MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
   center = TestObjectFactory.createWeeklyFeeCenter("Center_Active_test", meeting);
   group =
       TestObjectFactory.createWeeklyFeeGroupUnderCenter(
           "Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
 }
コード例 #3
0
  public void testSuccessfulUpdate_RateFee() throws Exception {
    fee =
        TestObjectFactory.createOneTimeRateFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, 24.0, FeeFormula.AMOUNT, FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("rate", "30");
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "update");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.update_success.toString());

    fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, fee.getFeeId());
    Assert.assertTrue(fee.isActive());
    Assert.assertEquals(30.0, ((RateFeeBO) fee).getRate(), DELTA);
  }
コード例 #4
0
  public void testUpdate() throws Exception {
    fund = createFund("Fund-1");
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.manage.toString());
    addRequestParameter("fundCodeId", fund.getFundId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.previewManage.toString());
    addRequestParameter("fundName", "Fund-2");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.update.toString());
    addRequestParameter("fundName", "Fund-2");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.update_success.toString());
    Assert.assertNull(
        ((FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER)).getFlow(flowKey));
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    Assert.assertNotNull(fund);
    Assert.assertEquals("Fund-2", fund.getFundName());
  }
コード例 #5
0
  public void testSuccessfulUpdate_AmountFee() throws Exception {
    fee =
        TestObjectFactory.createOneTimeAmountFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, "100", FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("amount", "200.0");
    addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString());
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "update");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.update_success.toString());

    fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, fee.getFeeId());
    Assert.assertFalse(fee.isActive());
    Assert.assertEquals(new Money(getCurrency(), "200.0"), ((AmountFeeBO) fee).getFeeAmount());
  }
コード例 #6
0
 private void createCustomers() {
   createParentCustomer();
   group =
       TestObjectFactory.createWeeklyFeeGroupUnderCenter(
           "group", CustomerStatus.GROUP_ACTIVE, center);
   client = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
   StaticHibernateUtil.flushSession();
 }
コード例 #7
0
 @Override
 protected void tearDown() throws Exception {
   reloadMembers();
   TestObjectFactory.removeObject(fund);
   TestObjectFactory.removeObject(fundBO);
   StaticHibernateUtil.closeSession();
   super.tearDown();
 }
コード例 #8
0
  private LoanAccountView getLoanAccountView(final LoanBO account) {
    LoanAccountView accountView = TestObjectFactory.getLoanAccountView(account);
    List<AccountActionDateEntity> actionDates = new ArrayList<AccountActionDateEntity>();
    actionDates.add(account.getAccountActionDate((short) 1));
    accountView.addTrxnDetails(TestObjectFactory.getBulkEntryAccountActionViews(actionDates));

    return accountView;
  }
コード例 #9
0
 @Override
 protected void tearDown() throws Exception {
   TestObjectFactory.cleanUp(savings);
   TestObjectFactory.cleanUp(client1);
   TestObjectFactory.cleanUp(client2);
   TestObjectFactory.cleanUp(group);
   TestObjectFactory.cleanUp(center);
   StaticHibernateUtil.closeSession();
   super.tearDown();
 }
コード例 #10
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   userContext = TestObjectFactory.getContext();
   request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
   addRequestParameter("recordLoanOfficerId", "1");
   addRequestParameter("recordOfficeId", "1");
   ActivityContext ac = TestObjectFactory.getActivityContext();
   request.getSession(false).setAttribute("ActivityContext", ac);
   flowKey = createFlow(request, FundAction.class);
 }
コード例 #11
0
 @Before
 public void setUp() throws Exception {
   userContext = TestObjectFactory.getContext();
   request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
   addRequestParameter("recordLoanOfficerId", "1");
   addRequestParameter("recordOfficeId", "1");
   request
       .getSession(false)
       .setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
   flowKey = createFlow(request, AccountStatusAction.class);
 }
コード例 #12
0
 public void testGetAllSavingsProductsFailure() throws Exception {
   SavingsOfferingBO savingsOffering = createSavingsOfferingBO();
   TestObjectFactory.simulateInvalidConnection();
   try {
     new SavingsPrdBusinessService().getAllSavingsProducts();
     Assert.assertTrue(false);
   } catch (ServiceException e) {
     Assert.assertTrue(true);
     StaticHibernateUtil.closeSession();
     TestObjectFactory.removeObject(savingsOffering);
   }
 }
コード例 #13
0
  @Override
  protected void tearDown() throws Exception {
    try {
      TestObjectFactory.cleanUp(accountBO);
      TestObjectFactory.cleanUp(group);
      TestObjectFactory.cleanUp(center);
    } catch (Exception e) {
      // TODO Whoops, cleanup didnt work, reset db
      TestDatabase.resetMySQLDatabase();
    }

    StaticHibernateUtil.closeSession();
    super.tearDown();
  }
コード例 #14
0
 @Override
 protected void tearDown() throws Exception {
   try {
     TestObjectFactory.cleanUp(fee);
     TestObjectFactory.cleanUp(fee1);
     TestObjectFactory.cleanUp(fee2);
     TestObjectFactory.cleanUp(fee3);
     StaticHibernateUtil.closeSession();
   } catch (Exception e) {
     // TODO Whoops, cleanup didnt work, reset db
     TestDatabase.resetMySQLDatabase();
   }
   super.tearDown();
 }
コード例 #15
0
  public void testSuccessfulManage_RateFee() throws Exception {
    fee =
        TestObjectFactory.createOneTimeRateFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, 24.0, FeeFormula.AMOUNT, FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.manage_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    Assert.assertEquals("24.0", actionForm.getRate());
    Assert.assertEquals(FeeFormula.AMOUNT.getValue().toString(), actionForm.getFeeFormula());
    Assert.assertNull(actionForm.getAmount());

    Assert.assertEquals(
        "The size of master data for status",
        2,
        ((List<MasterDataEntity>) SessionUtils.getAttribute(FeeConstants.STATUSLIST, request))
            .size());
  }
コード例 #16
0
 private void createInitialObjectsForSavings() throws Exception {
   MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
   center = TestObjectFactory.createWeeklyFeeCenter("Center_Active_test", meeting);
   group =
       TestObjectFactory.createWeeklyFeeGroupUnderCenter(
           "Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
   SavingsTestHelper helper = new SavingsTestHelper();
   savingsOffering = helper.createSavingsOffering("prd1", "cdfg");
   savings =
       helper.createSavingsAccount(
           "000100000000017",
           savingsOffering,
           group,
           AccountStates.SAVINGS_ACC_APPROVED,
           userContext);
 }
コード例 #17
0
  public void testSuccessfulEditPreview() throws Exception {
    fee =
        TestObjectFactory.createOneTimeAmountFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, "100", FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("amount", "200.0");
    addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString());
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.editPreview_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    Assert.assertEquals("200.0", actionForm.getAmount());
    Assert.assertEquals(FeeStatus.INACTIVE, actionForm.getFeeStatusValue());
    Assert.assertNull(actionForm.getRate());
    Assert.assertNull(actionForm.getFeeFormula());
  }
コード例 #18
0
  public void testUpdateForDuplicateFundName() throws Exception {
    fund = createFund("Fund-1");
    fundBO = createFund("Fund-2");
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.manage.toString());
    addRequestParameter("fundCodeId", fund.getFundId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.previewManage.toString());
    addRequestParameter("fundName", "Fund-1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.update.toString());
    addRequestParameter("fundName", fundBO.getFundName());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyActionErrors(new String[] {FundConstants.DUPLICATE_FUNDNAME_EXCEPTION});
    verifyForward(ActionForwards.update_failure.toString());
  }
コード例 #19
0
  public void testSuccessfulCreateOneTimeFee() throws Exception {
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "load");
    actionPerform();
    flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("categoryType", FeeCategory.ALLCUSTOMERS.getValue().toString());
    addRequestParameter("currencyId", TestUtils.RUPEE.getCurrencyId().toString());
    addRequestParameter("amount", "100");
    addRequestParameter("feeName", "Customer_One_time");
    addRequestParameter("feeFrequencyType", FeeFrequencyType.ONETIME.getValue().toString());
    addRequestParameter("customerCharge", FeePayment.UPFRONT.getValue().toString());
    addRequestParameter("glCode", GLOCDE_ID);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "create");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.create_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, actionForm.getFeeIdValue());
    Assert.assertEquals("Customer_One_time", fee.getFeeName());
    Assert.assertEquals(FeeCategory.ALLCUSTOMERS.getValue(), fee.getCategoryType().getId());
    Assert.assertEquals(RateAmountFlag.AMOUNT, fee.getFeeType());
    Assert.assertEquals(new Money(getCurrency(), "100.0"), ((AmountFeeBO) fee).getFeeAmount());
    Assert.assertTrue(fee.isOneTime());
    Assert.assertFalse(fee.isCustomerDefaultFee());
    Assert.assertTrue(fee.isActive());
  }
コード例 #20
0
 public void testManage() throws Exception {
   fund = createFund("Fund-1");
   StaticHibernateUtil.closeSession();
   fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
   setRequestPathInfo("/fundAction.do");
   addRequestParameter("method", Methods.manage.toString());
   addRequestParameter("fundCodeId", fund.getFundId().toString());
   addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
   actionPerform();
   verifyNoActionErrors();
   verifyForward(ActionForwards.manage_success.toString());
   StaticHibernateUtil.closeSession();
   fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
   Assert.assertNotNull(fund);
   Assert.assertEquals("Fund-1", fund.getFundName());
   Assert.assertEquals("Fund-1", SessionUtils.getAttribute(FundConstants.OLDFUNDNAME, request));
 }
コード例 #21
0
 private LoanBO getLoanAccount(
     final AccountState state,
     final Date startDate,
     final int disbursalType,
     final LoanOfferingBO loanOfferingBO) {
   return TestObjectFactory.createLoanAccountWithDisbursement(
       "99999999999", client, state, startDate, loanOfferingBO, disbursalType);
 }
コード例 #22
0
 @After
 public void tearDown() throws Exception {
   savings = null;
   group = null;
   center = null;
   TestObjectFactory.removeObject(savingsOffering2);
   StaticHibernateUtil.flushSession();
 }
コード例 #23
0
 @Test
 public void testPersonnelLinkWithSelfLink() throws Exception {
   branchOffice = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
   createPersonnel(branchOffice, PersonnelLevel.LOAN_OFFICER);
   String createdLink = TagGenerator.createHeaderLinks(personnel, true, randomNum);
   Assert.assertEquals(true, createdLink.contains("PersonAction"));
   Assert.assertEquals(true, createdLink.contains("TestBranchOffice"));
 }
コード例 #24
0
 private SavingsBO createSavingsAccount(
     String globalAccountNum, SavingsOfferingBO savingsOffering, AccountState state)
     throws Exception {
   UserContext userContext = new UserContext(Locale.getDefault(), Short.valueOf("1"));
   userContext.setId(PersonnelConstants.SYSTEM_USER);
   userContext.setBranchGlobalNum("1001");
   return TestObjectFactory.createSavingsAccount(
       globalAccountNum, group, state, new Date(), savingsOffering, userContext);
 }
コード例 #25
0
 public void testGetSavingsApplicableRecurrenceTypesFailure() throws Exception {
   TestObjectFactory.simulateInvalidConnection();
   try {
     new SavingsPrdBusinessService().getSavingsApplicableRecurrenceTypes();
     Assert.assertTrue(false);
   } catch (ServiceException e) {
     Assert.assertTrue(true);
   }
 }
コード例 #26
0
 public void testRetrieveDormancyDaysForInvalidConnection() throws Exception {
   TestObjectFactory.simulateInvalidConnection();
   try {
     new SavingsPrdBusinessService().getActiveSavingsProductCategories();
     Assert.assertTrue(false);
   } catch (ServiceException e) {
     Assert.assertTrue(true);
   }
 }
コード例 #27
0
 public void testGetApplicablePrdStatusForInvalidConnection() {
   TestObjectFactory.simulateInvalidConnection();
   try {
     new SavingsPrdBusinessService().getApplicablePrdStatus((short) 1);
     Assert.assertTrue(false);
   } catch (ServiceException e) {
     Assert.assertTrue(true);
   }
 }
コード例 #28
0
 @Test
 public void testTagGeneratorFactoryForPersonnel() throws Exception {
   branchOffice = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
   createPersonnel(branchOffice, PersonnelLevel.LOAN_OFFICER);
   TagGenerator tagGenerator = TagGeneratorFactory.getInstance().getGenerator(personnel);
   tagGenerator = TagGeneratorFactory.getInstance().getGenerator(personnel);
   if (tagGenerator instanceof PersonnelTagGenerator) {
     Assert.assertTrue(true);
   }
 }
コード例 #29
0
 @Test
 public void testFindById() throws Exception {
   createInitialObjects();
   Date currentDate = new Date(System.currentTimeMillis());
   savingsOffering =
       TestObjectFactory.createSavingsProduct(
           "SavingPrd1", "kh6y", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
   savings =
       createSavingsAccount("FFFF", savingsOffering, AccountStates.SAVINGS_ACC_PARTIALAPPLICATION);
   SavingsBO savings1 = service.findById(savings.getAccountId());
   Assert.assertNotNull(savings1);
 }
コード例 #30
0
 private SavingsOfferingBO createSavingsOfferingBO() {
   MeetingBO meetingIntCalc =
       TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
   MeetingBO meetingIntPost =
       TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
   return TestObjectFactory.createSavingsProduct(
       "Savings Product",
       "SAVP",
       ApplicableTo.CLIENTS,
       new Date(System.currentTimeMillis()),
       PrdStatus.SAVINGS_ACTIVE,
       300.0,
       RecommendedAmountUnit.PER_INDIVIDUAL,
       1.2,
       200.0,
       200.0,
       SavingsType.VOLUNTARY,
       InterestCalcType.MINIMUM_BALANCE,
       meetingIntCalc,
       meetingIntPost);
 }