Search in sources :

Example 86 with Date

use of java.sql.Date in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering.

@Test
public void testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(-2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product1", "SAVP", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, null, 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 87 with Date

use of java.sql.Date in project head by mifos.

the class LoanPrdBusinessServiceIntegrationTest method createLoanOfferingBO.

private LoanOfferingBO createLoanOfferingBO(String prdOfferingName, String shortName) {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO frequency = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    return TestObjectFactory.createLoanOffering(prdOfferingName, shortName, ApplicableTo.GROUPS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, 3, InterestType.FLAT, frequency);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) Date(java.sql.Date)

Example 88 with Date

use of java.sql.Date in project head by mifos.

the class ClientTransferActionStrutsTest method createObjectsForTransferringClientInGroup.

private void createObjectsForTransferringClientInGroup() throws Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    MeetingBO meeting1 = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    center1 = TestObjectFactory.createWeeklyFeeCenter("Center1", meeting1);
    group1 = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group2", CustomerStatus.GROUP_ACTIVE, center1);
    client = TestObjectFactory.createClient("Client11", CustomerStatus.CLIENT_ACTIVE, group, null, (String) null, new Date(1222333444000L));
    StaticHibernateUtil.flushSession();
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) Date(java.sql.Date)

Example 89 with Date

use of java.sql.Date in project head by mifos.

the class ClientIntegrationTest method testGenerateScheduleForClient_OnClientCreate.

@Test
public void testGenerateScheduleForClient_OnClientCreate() throws Exception {
    SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct("Offering1", "s1", SavingsType.MANDATORY, ApplicableTo.GROUPS, new Date(System.currentTimeMillis()));
    createParentObjects(CustomerStatus.GROUP_ACTIVE);
    accountBO = TestObjectFactory.createSavingsAccount("globalNum", center, AccountState.SAVINGS_ACTIVE, new java.util.Date(), savingsOffering, TestObjectFactory.getContext());
    Assert.assertEquals(0, accountBO.getAccountActionDates().size());
    client = createClient(CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());
    Assert.assertEquals(1, accountBO.getAccountCustomFields().size());
    Assert.assertEquals(10, accountBO.getAccountActionDates().size());
    for (AccountActionDateEntity actionDate : accountBO.getAccountActionDates()) {
        Assert.assertEquals(client.getCustomerId(), actionDate.getCustomer().getCustomerId());
        Assert.assertTrue(true);
    }
    client = TestObjectFactory.getClient(client.getCustomerId());
    group = TestObjectFactory.getGroup(group.getCustomerId());
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) Date(java.sql.Date) Test(org.junit.Test)

Example 90 with Date

use of java.sql.Date in project head by mifos.

the class ClientIntegrationTest method testSuccessfulCreateInActiveState_WithAssociatedSavingsOffering.

@Test
public void testSuccessfulCreateInActiveState_WithAssociatedSavingsOffering() throws Exception {
    savingsOffering1 = TestObjectFactory.createSavingsProduct("offering1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
    StaticHibernateUtil.flushSession();
    List<SavingsOfferingBO> selectedOfferings = new ArrayList<SavingsOfferingBO>();
    selectedOfferings.add(savingsOffering1);
    String name = "Client 1";
    Short povertyStatus = Short.valueOf("41");
    ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "Client", "", "1", "");
    clientNameDetailDto.setNames(ClientRules.getNameSequence());
    ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
    spouseNameDetailView.setNames(ClientRules.getNameSequence());
    ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), povertyStatus);
    client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.CLIENT_ACTIVE, null, null, null, null, null, selectedOfferings, personnel, new OfficePersistence().getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE), getMeeting(), personnel, null, null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
    legacyClientDao.saveClient(client);
    StaticHibernateUtil.flushSession();
    client = TestObjectFactory.getClient(client.getCustomerId());
    Assert.assertEquals(name, client.getDisplayName());
    Assert.assertEquals(1, client.getOfferingsAssociatedInCreate().size());
    Assert.assertEquals(2, client.getAccounts().size());
    for (AccountBO account : client.getAccounts()) {
        if (account instanceof SavingsBO) {
            Assert.assertEquals(savingsOffering1.getPrdOfferingId(), ((SavingsBO) account).getSavingsOffering().getPrdOfferingId());
            Assert.assertNotNull(account.getGlobalAccountNum());
            Assert.assertTrue(true);
        }
    }
    StaticHibernateUtil.flushSession();
    client = TestObjectFactory.getClient(client.getCustomerId());
    savingsOffering1 = null;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) ArrayList(java.util.ArrayList) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Date(java.sql.Date) Test(org.junit.Test)

Aggregations

Date (java.sql.Date)689 Test (org.junit.Test)286 PreparedStatement (java.sql.PreparedStatement)127 ResultSet (java.sql.ResultSet)122 Timestamp (java.sql.Timestamp)117 Connection (java.sql.Connection)107 Money (org.mifos.framework.util.helpers.Money)83 ArrayList (java.util.ArrayList)66 SQLException (java.sql.SQLException)60 Properties (java.util.Properties)60 Time (java.sql.Time)55 PDate (org.apache.phoenix.schema.types.PDate)55 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)50 LocalDate (java.time.LocalDate)42 BigDecimal (java.math.BigDecimal)41 MeetingBO (org.mifos.application.meeting.business.MeetingBO)39 Test (org.testng.annotations.Test)39 Calendar (java.util.Calendar)36 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)30 DateWritable (org.apache.hadoop.hive.serde2.io.DateWritable)28