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);
});
}
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);
}
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);
}
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);
}
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);
}
Aggregations