use of gov.ca.cwds.data.persistence.cms.Client in project API by ca-cwds.
the class NonLACountyTriggersTest method testForClientCreatedCountyOwnershipTest.
/*
* Test for checking the Client CountyOnwership created
*/
@SuppressWarnings("javadoc")
@Test
public void testForClientCreatedCountyOwnershipTest() throws Exception {
gov.ca.cwds.rest.api.domain.cms.Client ClientDomain = MAPPER.readValue(fixture("fixtures/legacy/business/rules/nonLaCountyTrigger/clientValid.json"), gov.ca.cwds.rest.api.domain.cms.Client.class);
Client toCreate = new Client("ABC1234567", ClientDomain, "ABC");
when(countyOwnershipDao.create(any(CountyOwnership.class))).thenAnswer(new Answer<CountyOwnership>() {
@Override
public CountyOwnership answer(InvocationOnMock invocation) throws Throwable {
CountyOwnership report = (CountyOwnership) invocation.getArguments()[0];
countyOwnership = report;
return report;
}
});
nonLaCountyTriggers.createClientCountyTrigger(toCreate);
Assert.assertNotNull(countyOwnership);
assertThat(countyOwnership.getEntityCode(), is(equalTo("C")));
}
use of gov.ca.cwds.data.persistence.cms.Client in project API by ca-cwds.
the class ClientService method update.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
* gov.ca.cwds.rest.api.Request)
*/
@Override
public gov.ca.cwds.rest.api.domain.cms.Client update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Client;
gov.ca.cwds.rest.api.domain.cms.Client client = (gov.ca.cwds.rest.api.domain.cms.Client) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Client managed = new Client((String) primaryKey, client, lastUpdatedId);
managed = clientDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.Client(managed, true);
} catch (EntityNotFoundException e) {
LOGGER.info("Client not found : {}", client);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.Client in project API by ca-cwds.
the class ClientDaoIT method testFind.
// TODO: #138438305: move to jobs project.
// @SuppressWarnings("javadoc")
// @Test
// public void testFindAllUpdatedAfterNamedQueryExists() throws Exception {
// Query query =
// session.getNamedQuery("gov.ca.cwds.data.persistence.cms.Client.findAllUpdatedAfter");
// assertThat(query, is(notNullValue()));
// }
// TODO: #138438305: move to jobs project.
// @SuppressWarnings("javadoc")
// @Test
// public void testFindAllUpdatedAfterReturnsCorrectList() throws Exception {
// Query query =
// session.getNamedQuery("gov.ca.cwds.data.persistence.cms.Client.findAllUpdatedAfter")
// .setDate("after", TIMESTAMP_FORMAT.parse("2004-01-02 00:00:00"));
//
// @SuppressWarnings("unchecked")
// final List<Client> list = query.list();
// System.out.println("size of query list is: " + list.size());
// for (Client c : list) {
// System.out.println("id " + c.getId() + " " + c.getSensitivityIndicator() + " "
// + c.getSoc158SealedClientIndicator() + " " + c.getLastUpdatedTime());
// }
//
// assertThat(query.list().size(), is(1));
// }
@Override
@Test
public void testFind() {
String id = "AaiU7IW0Rt";
Client found = clientDao.find(id);
assertThat(found.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.Client in project API by ca-cwds.
the class ClientDaoIT method testFindEntityNotFoundException.
@Override
@Test
public void testFindEntityNotFoundException() throws Exception {
String id = "9999999ZZZ";
Client found = clientDao.find(id);
assertThat(found, is(nullValue()));
}
use of gov.ca.cwds.data.persistence.cms.Client in project API by ca-cwds.
the class ClientDaoIT method testCreateExistingEntityException.
@Override
@Test
public void testCreateExistingEntityException() throws Exception {
thrown.expect(EntityExistsException.class);
Client vc = validClient();
Client pers = new Client(vc.getAdjudicatedDelinquentIndicator(), vc.getAdoptionStatusCode(), vc.getAlienRegistrationNumber(), vc.getBirthCity(), vc.getBirthCountryCodeType(), vc.getBirthDate(), vc.getBirthFacilityName(), vc.getBirthStateCodeType(), vc.getBirthplaceVerifiedIndicator(), vc.getChildClientIndicatorVar(), vc.getClientIndexNumber(), vc.getCommentDescription(), vc.getCommonFirstName(), vc.getCommonLastName(), vc.getCommonMiddleName(), vc.getConfidentialityActionDate(), vc.getConfidentialityInEffectIndicator(), vc.getCreationDate(), vc.getCurrCaChildrenServIndicator(), vc.getCurrentlyOtherDescription(), vc.getCurrentlyRegionalCenterIndicator(), vc.getDeathDate(), vc.getDeathDateVerifiedIndicator(), vc.getDeathPlace(), vc.getDeathReasonText(), vc.getDriverLicenseNumber(), vc.getDriverLicenseStateCodeType(), vc.getEmailAddress(), vc.getEstimatedDobCode(), vc.getEthUnableToDetReasonCode(), vc.getFatherParentalRightTermDate(), vc.getGenderCode(), vc.getHealthSummaryText(), vc.getHispUnableToDetReasonCode(), vc.getHispanicOriginCode(), "AaiU7IW0Rt", vc.getImmigrationCountryCodeType(), vc.getImmigrationStatusType(), vc.getIncapacitatedParentCode(), vc.getIndividualHealthCarePlanIndicator(), vc.getLimitationOnScpHealthIndicator(), vc.getLiterateCode(), vc.getMaritalCohabitatnHstryIndicatorVar(), vc.getMaritalStatusType(), vc.getMilitaryStatusCode(), vc.getMotherParentalRightTermDate(), vc.getNamePrefixDescription(), vc.getNameType(), vc.getOutstandingWarrantIndicator(), vc.getPrevCaChildrenServIndicator(), vc.getPrevOtherDescription(), vc.getPrevRegionalCenterIndicator(), vc.getPrimaryEthnicityType(), vc.getPrimaryLanguageType(), vc.getReligionType(), vc.getSecondaryLanguageType(), vc.getSensitiveHlthInfoOnFileIndicator(), vc.getSensitivityIndicator(), vc.getSoc158PlacementCode(), vc.getSoc158SealedClientIndicator(), vc.getSocialSecurityNumChangedCode(), vc.getSocialSecurityNumber(), vc.getSuffixTitleDescription(), vc.getTribalAncestryClientIndicatorVar(), vc.getTribalMembrshpVerifctnIndicatorVar(), vc.getUnemployedParentCode(), vc.getZippyCreatedIndicator(), null);
clientDao.create(pers);
}
Aggregations