use of org.mifos.customers.util.helpers.CustomerStatusFlag in project head by mifos.
the class EditCustomerStatusActionStrutsTest method testUpdateStatusFailureWhenGroupHasActiveClientsWhenCenterIsInactiveWhileChangingStatusCancelToPartial.
@Test
public void testUpdateStatusFailureWhenGroupHasActiveClientsWhenCenterIsInactiveWhileChangingStatusCancelToPartial() throws Exception {
// setup
createInitialObjects(CustomerStatus.CENTER_ACTIVE, CustomerStatus.GROUP_CANCELLED, CustomerStatus.CLIENT_CLOSED);
CustomerService customerService = ApplicationContextProvider.getBean(CustomerService.class);
CustomerStatusFlag customerStatusFlag = CustomerStatusFlag.GROUP_CANCEL_BLACKLISTED;
CustomerNoteEntity customerNote = new CustomerNoteEntity("Made Inactive", new java.util.Date(), center.getPersonnel(), center);
customerService.updateCenterStatus((CenterBO) center, CustomerStatus.CENTER_INACTIVE, customerStatusFlag, customerNote);
invokeLoadAndPreviewSuccessfully(CustomerStatus.GROUP_PARTIAL, null);
setRequestPathInfo("/editCustomerStatusAction.do");
addRequestParameter("method", Methods.updateStatus.toString());
addRequestParameter("input", "group");
// exercise
actionPerform();
// verification
Assert.assertNotNull(request.getAttribute(Constants.CURRENTFLOWKEY));
verifyActionErrors(new String[] { GroupConstants.CENTER_INACTIVE });
cleanInitialObjects();
}
use of org.mifos.customers.util.helpers.CustomerStatusFlag in project head by mifos.
the class CustomerPersistenceIntegrationTest method ignore_testFindCustomerWithNoAssocationsLoadedDoesntReturnInactiveCenter.
public void ignore_testFindCustomerWithNoAssocationsLoadedDoesntReturnInactiveCenter() throws Exception {
meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
center = TestObjectFactory.createWeeklyFeeCenter("Inactive Center", meeting);
StaticHibernateUtil.flushSession();
CustomerStatusFlag customerStatusFlag = CustomerStatusFlag.GROUP_CANCEL_BLACKLISTED;
CustomerNoteEntity customerNote = new CustomerNoteEntity("Made Inactive", new java.util.Date(), center.getPersonnel(), center);
CustomerService customerService = ApplicationContextProvider.getBean(CustomerService.class);
customerService.updateCenterStatus((CenterBO) center, CustomerStatus.CENTER_INACTIVE, customerStatusFlag, customerNote);
CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
verifyCustomerNotLoaded(center.getCustomerId(), center.getDisplayName());
}
use of org.mifos.customers.util.helpers.CustomerStatusFlag in project head by mifos.
the class GroupStatusChangeIntegrationTest method givenGroupIsPendingAndContainsClientsInPartialStateThenWhenTransitioningToCancelledStateAllClientsAreTransitionedToPartial.
@Test
public void givenGroupIsPendingAndContainsClientsInPartialStateThenWhenTransitioningToCancelledStateAllClientsAreTransitionedToPartial() throws Exception {
// setup
CenterBO existingCenter = new CenterBuilder().with(existingMeeting).withName("Center-IntegrationTest").with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
GroupBO existingPendingGroup = new GroupBuilder().withName("newGroup").withStatus(CustomerStatus.GROUP_PENDING).withParentCustomer(existingCenter).formedBy(existingUser).build();
IntegrationTestObjectMother.createGroup(existingPendingGroup, existingMeeting);
ClientBO existingPartialClient = new ClientBuilder().withName("partialClient").withStatus(CustomerStatus.CLIENT_PARTIAL).withParentCustomer(existingPendingGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingPartialClient, existingMeeting);
ClientBO existingPendingClient = new ClientBuilder().withName("pendingClient").withStatus(CustomerStatus.CLIENT_PENDING).withParentCustomer(existingPendingGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingPendingClient, existingMeeting);
existingPendingGroup = this.customerDao.findGroupBySystemId(existingPendingGroup.getGlobalCustNum());
existingPendingGroup.setUserContext(TestUtils.makeUser());
StaticHibernateUtil.startTransaction();
existingPartialClient = this.customerDao.findClientBySystemId(existingPartialClient.getGlobalCustNum());
existingPendingClient = this.customerDao.findClientBySystemId(existingPendingClient.getGlobalCustNum());
CustomerStatusFlag customerStatusFlag = CustomerStatusFlag.GROUP_CANCEL_BLACKLISTED;
CustomerNoteEntity customerNote = new CustomerNoteEntity("Made Inactive", new java.util.Date(), existingPendingGroup.getPersonnel(), existingPendingGroup);
// exercise test
customerService.updateGroupStatus(existingPendingGroup, existingPendingGroup.getStatus(), CustomerStatus.GROUP_CANCELLED, customerStatusFlag, customerNote);
// verification
assertThat(existingPendingGroup.getStatus(), is(CustomerStatus.GROUP_CANCELLED));
assertThat(existingPendingClient.getStatus(), is(CustomerStatus.CLIENT_PENDING));
assertThat(existingPartialClient.getStatus(), is(CustomerStatus.CLIENT_PARTIAL));
}
use of org.mifos.customers.util.helpers.CustomerStatusFlag in project head by mifos.
the class ClientStatusChangeIntegrationTest method givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive.
@Test
public void givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive() throws Exception {
// setup
CenterBO existingCenter = new CenterBuilder().with(existingMeeting).withName("Center-IntegrationTest").with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
GroupBO existingCancelledGroup = new GroupBuilder().withName("newGroup").withStatus(CustomerStatus.GROUP_CANCELLED).withParentCustomer(existingCenter).formedBy(existingUser).build();
IntegrationTestObjectMother.createGroup(existingCancelledGroup, existingMeeting);
ClientBO existingPartialClient = new ClientBuilder().withStatus(CustomerStatus.CLIENT_PARTIAL).withParentCustomer(existingCancelledGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingPartialClient, existingMeeting);
existingCancelledGroup = this.customerDao.findGroupBySystemId(existingCancelledGroup.getGlobalCustNum());
existingPartialClient = this.customerDao.findClientBySystemId(existingPartialClient.getGlobalCustNum());
existingPartialClient.setUserContext(TestUtils.makeUser());
CustomerStatusFlag customerStatusFlag = null;
CustomerNoteEntity customerNote = new CustomerNoteEntity("go active", new Date(), existingPartialClient.getPersonnel(), existingPartialClient);
// exercise test
try {
customerService.updateClientStatus(existingPartialClient, existingPartialClient.getStatus(), CustomerStatus.CLIENT_ACTIVE, customerStatusFlag, customerNote);
fail("should fail validation");
} catch (CustomerException expected) {
assertThat(expected.getKey(), is(ClientConstants.ERRORS_GROUP_CANCELLED));
assertThat(existingPartialClient.getStatus(), is(CustomerStatus.CLIENT_PARTIAL));
}
}
Aggregations