use of gov.ca.cwds.data.legacy.cms.entity.ChildClient in project api-core by ca-cwds.
the class OptimisticLockingTest method testNoTimestampPropagationToUI.
@Test
public void testNoTimestampPropagationToUI() throws Exception {
cleanAllAndInsert("/dbunit/OptimisticLocking.xml");
final ChildClientHolder childClientHolder = new ChildClientHolder();
// read entity from DB
executeInTransaction(sessionFactory, (sessionFactory) -> {
Client client = dao.find(ID);
assertNotNull(client);
assertTrue(client instanceof ChildClient);
ChildClient childClient = (ChildClient) client;
assertEquals(AdoptionStatus.NOT_FREE, childClient.getAdoptionStatus());
childClientHolder.setChildClient(childClient);
});
// UI edit
childClientHolder.getChildClient().setLastUpdateTime(null);
childClientHolder.getChildClient().setAdoptionStatus(AdoptionStatus.TOTALLY_FREE);
// recreate entity and attempt to persist
try {
executeInTransaction(sessionFactory, (sessionFactory) -> {
Session session = sessionFactory.getCurrentSession();
ChildClient childClient = childClientHolder.getChildClient();
// populate lastUpdateTime by current time
childClient.setLastUpdateTime(Timestamp.valueOf(LocalDateTime.now()));
dao.update(childClient);
});
fail("OptimisticLockException should be thrown");
} catch (OptimisticLockException e) {
}
}
use of gov.ca.cwds.data.legacy.cms.entity.ChildClient in project api-core by ca-cwds.
the class R10104Test method birthDateAndTribalDateAreNotPresent.
@Test
public void birthDateAndTribalDateAreNotPresent() throws Exception {
ChildClient childClient = ClientTestUtil.childClient(ClientTestUtil.CHILD_CLIENT_ID);
clientEntityAwareDTO.setEntity(childClient);
checkRuleSatisfied(RULE_NAME);
}
use of gov.ca.cwds.data.legacy.cms.entity.ChildClient in project api-core by ca-cwds.
the class R10326Test method testScreeningDateNull.
@Test
public void testScreeningDateNull() throws Exception {
ChildClient childClient = childClient(SOME_DATE);
checkRuleSatisfied(dto(childClient, healthScreening(childClient, null)), RULE_NAME);
}
use of gov.ca.cwds.data.legacy.cms.entity.ChildClient in project api-core by ca-cwds.
the class R10326Test method testScreeningDateEqBirthDate.
@Test
public void testScreeningDateEqBirthDate() throws Exception {
ChildClient childClient = childClient(SOME_DATE);
checkRuleSatisfied(dto(childClient, healthScreening(childClient, SOME_DATE)), RULE_NAME);
}
use of gov.ca.cwds.data.legacy.cms.entity.ChildClient in project api-core by ca-cwds.
the class R10326Test method testBirthDateNull.
@Test
public void testBirthDateNull() throws Exception {
ChildClient childClient = childClient(null);
checkRuleSatisfied(dto(childClient, healthScreening(childClient, SOME_DATE)), RULE_NAME);
}
Aggregations