Search in sources :

Example 46 with Client

use of gov.ca.cwds.data.legacy.cms.entity.Client in project api-core by ca-cwds.

the class ClientOtherEthnicitiesTest method testFindEthnicitiesByClient.

@Test
public void testFindEthnicitiesByClient() throws Exception {
    cleanAllAndInsert("/dbunit/ClientOtherEthnicities.xml");
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        Session session = sessionFactory.getCurrentSession();
        Client client1 = session.load(Client.class, "05gLqgG10R");
        Set<ClientOtherEthnicity> result1 = client1.getOtherEthnicities();
        assertNotNull(result1);
        assertTrue(result1.size() == 2);
        Client client2 = session.load(Client.class, "fG5y8Sdg3F");
        Set<ClientOtherEthnicity> result2 = client2.getOtherEthnicities();
        assertNotNull(result2);
        assertTrue(result2.size() == 0);
    });
}
Also used : ClientOtherEthnicity(gov.ca.cwds.data.legacy.cms.entity.ClientOtherEthnicity) Client(gov.ca.cwds.data.legacy.cms.entity.Client) Session(org.hibernate.Session) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Example 47 with Client

use of gov.ca.cwds.data.legacy.cms.entity.Client in project api-core by ca-cwds.

the class ClientDaoTest method testCreate.

@Test
public void testCreate() throws Exception {
    final String expectedFilePath = "/dbunit/Client/insert/Client_after_insert.xml";
    cleanAll(expectedFilePath);
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        NameType nameType = nameTypeDao.find((short) 1313);
        assertNotNull(nameType);
        assertEquals("Legal", nameType.getShortDescription().trim());
        assertTrue(nameType.getSystemId().equals(new Short((short) 1313)));
        Client c = new Client();
        c.setIdentifier("AaiU7IW0Rt");
        // ADJDEL_IND
        c.setAdjudicatedDelinquentIndicator(false);
        // ADPTN_STCD
        c.setAdoptionStatus(AdoptionStatus.NOT_FREE);
        // ALN_REG_NO
        c.setAlienRegistrationNumber("AlienRegNum");
        // BIRTH_DT
        c.setBirthDate(LocalDate.of(1972, 8, 17));
        c.setBirthFacilityName("BirthFacilityName");
        // BIRTH_CITY
        c.setBirthCity("Sacramento");
        // CHLD_CLT_B
        c.setChildClientIndicator(false);
        // COM_FST_NM
        c.setCommonFirstName("Tumbling");
        // COM_LST_NM
        c.setCommonLastName("Lazenby");
        // COM_MID_NM
        c.setCommonMiddleName("Midname");
        // CONF_EFIND
        c.setConfidentialityInEffectIndicator(false);
        // CREATN_DT
        c.setCreationDate(LocalDate.of(2004, 8, 17));
        // DRV_LIC_NO
        c.setDriverLicenseNumber("license");
        // GENDER_CD
        c.setGender(Gender.MALE);
        // INCAPC_CD
        c.setIncapacitatedParentStatus(IncapacitatedParentStatus.UNKNOWN);
        // LITRATE_CD
        c.setLiterateStatus(LiterateStatus.UNKNOWN);
        // MAR_HIST_B
        c.setMaritalCohabitationHistoryIndicator(false);
        // MILT_STACD
        c.setMilitaryStatus(MilitaryStatus.NO_INFORMATION_AVAILABLE);
        // NMPRFX_DSC
        c.setNamePrefixDescription("prefix");
        // NAME_TPC
        c.setNameType(nameType);
        // SENSTV_IND
        c.setSensitivity(Sensitivity.NOT_APPLICABLE);
        // SS_NO
        c.setSocialSecurityNumber("977000271");
        // SSN_CHG_CD
        c.setSocialSecurityNumberChangedCode("O");
        // SUFX_TLDSC
        c.setSuffixTitleDescription("Jr.");
        // UNEMPLY_CD
        c.setParentUnemployedStatus(ParentUnemployedStatus.UNKNOWN);
        // COMMNT_DSC
        c.setCommentDescription("CommentDescription");
        // EST_DOB_CD
        c.setDateOfBirthStatus(DateOfBirthStatus.ESTIMATED);
        // HISP_CD
        c.setHispanicOrigin(HispanicOrigin.UNDETERMINED);
        // COTH_DESC
        c.setCurrentlyOtherDescription("CurrentlyOtherDescription");
        c.setPreviousOtherDescription("PreviousOtherDescription");
        // SOCPLC_CD
        c.setSoc158placementsStatus(Soc158placementsStatus.NO_SOC_158_PLACEMENTS);
        // LST_UPD_ID
        c.setLastUpdateId("0Rt");
        // B_STATE_C
        c.setBirthStateCode((short) 0);
        // B_CNTRY_C
        c.setBirthCountryCode((short) 0);
        // I_CNTRY_C
        c.setImmigrationCountryCode((short) 0);
        // D_STATE_C
        c.setDriverLicenseStateCode((short) 0);
        // IMGT_STC
        c.setImmigrationStatusCode((short) 0);
        // MRTL_STC
        c.setMaritalStatusCode((short) 0);
        // P_ETHNCTYC
        c.setPrimaryEthnicityCode((short) 0);
        // S_LANG_TC
        c.setSecondaryLanguageCode((short) 0);
        // P_LANG_TPC
        c.setPrimaryLanguageCode((short) 0);
        // RLGN_TPC
        c.setReligionCode((short) 0);
        dao.create(c);
    });
    IDataSet expectedDataSet = readXmlDataSet(expectedFilePath);
    ITable expectedTable = expectedDataSet.getTable("CLIENT_T");
    IDataSet actualDataSet = dbUnitConnection.createDataSet(new String[] { "CLIENT_T" });
    ITable actualTable = actualDataSet.getTable("CLIENT_T");
    assertTableEquals(expectedTable, actualTable);
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) ITable(org.dbunit.dataset.ITable) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) Client(gov.ca.cwds.data.legacy.cms.entity.Client) IDataSet(org.dbunit.dataset.IDataSet) Test(org.junit.Test) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)

Example 48 with Client

use of gov.ca.cwds.data.legacy.cms.entity.Client in project api-core by ca-cwds.

the class ClientDaoTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    cleanAllAndInsert("/dbunit/Client/update/Client_before_update.xml");
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        NameType nameType = nameTypeDao.find((short) 1314);
        assertNotNull(nameType);
        assertEquals("Maiden", nameType.getShortDescription().trim());
        assertTrue(nameType.getSystemId().equals((short) 1314));
        Client c = dao.find("AaiU7IW0Rt");
        assertEquals(0, c.getBirthStateCode());
        // NAME_TPC
        c.setNameType(nameType);
        dao.update(c);
    });
    IDataSet expectedDataSet = readXmlDataSet("/dbunit/Client/update/Client_after_update.xml");
    ITable expectedTable = expectedDataSet.getTable("CLIENT_T");
    IDataSet actualDataSet = dbUnitConnection.createDataSet(new String[] { "CLIENT_T" });
    ITable actualTable = actualDataSet.getTable("CLIENT_T");
    assertTableEquals(expectedTable, actualTable);
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) ITable(org.dbunit.dataset.ITable) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) Client(gov.ca.cwds.data.legacy.cms.entity.Client) IDataSet(org.dbunit.dataset.IDataSet) Test(org.junit.Test) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)

Example 49 with Client

use of gov.ca.cwds.data.legacy.cms.entity.Client in project api-core by ca-cwds.

the class R06751Test method testStartDateGtBirthDate.

@Test
public void testStartDateGtBirthDate() throws Exception {
    Client client = client(SOME_DATE);
    checkRuleSatisfied(dto(client, clientServiceProvider(client, SOME_DATE.plusDays(1))), RULE_NAME);
}
Also used : Client(gov.ca.cwds.data.legacy.cms.entity.Client) Test(org.junit.Test)

Example 50 with Client

use of gov.ca.cwds.data.legacy.cms.entity.Client in project api-core by ca-cwds.

the class R06751Test method testStartDateEqBirthDate.

@Test
public void testStartDateEqBirthDate() throws Exception {
    Client client = client(SOME_DATE);
    checkRuleSatisfied(dto(client, clientServiceProvider(client, SOME_DATE)), RULE_NAME);
}
Also used : Client(gov.ca.cwds.data.legacy.cms.entity.Client) Test(org.junit.Test)

Aggregations

Client (gov.ca.cwds.data.legacy.cms.entity.Client)127 Test (org.junit.Test)105 ChildClientEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ChildClientEntityAwareDTO)21 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)14 ChildClient (gov.ca.cwds.data.legacy.cms.entity.ChildClient)13 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)10 DasHistory (gov.ca.cwds.data.legacy.cms.entity.DasHistory)6 SafetyAlert (gov.ca.cwds.data.legacy.cms.entity.SafetyAlert)6 SchoolOriginHistory (gov.ca.cwds.data.legacy.cms.entity.SchoolOriginHistory)6 ClientOtherEthnicity (gov.ca.cwds.data.legacy.cms.entity.ClientOtherEthnicity)4 NameType (gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType)4 Session (org.hibernate.Session)4 Timestamp (java.sql.Timestamp)3 DeliveredService (gov.ca.cwds.data.legacy.cms.entity.DeliveredService)2 OptimisticLockException (javax.persistence.OptimisticLockException)2 IDataSet (org.dbunit.dataset.IDataSet)2 ITable (org.dbunit.dataset.ITable)2 ClientConditionUtils.toClientCondition (gov.ca.cwds.authorizer.util.ClientConditionUtils.toClientCondition)1 FacilityChildParameterObject (gov.ca.cwds.cals.web.rest.parameter.FacilityChildParameterObject)1 ClientEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ClientEntityAwareDTO)1