use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aCoreSubmitApplicationTest method submitApplication.
private RFA1aFormDTO submitApplication() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicantDTO = applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
ApplicantDTO secondApplicant = applicantHelper.getValidApplicant();
secondApplicant.setFirstName("John");
StateType driverLicenseState = new StateType();
driverLicenseState.setId("MD");
driverLicenseState.setValue("Maryland");
secondApplicant.setDriverLicenseState(driverLicenseState);
secondApplicant.getEthnicity().setId(2L);
secondApplicant.getEthnicity().setValue("American Indian");
secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
RFA1bFormDTO rfa1bForm = formBHelper.getRfa1bForm();
formBHelper.postRfa1bForm(form.getId(), applicantDTO.getId(), rfa1bForm);
otherAdultHelper.createOtherAdults(form.getId(), secondApplicant);
minorChildHelper.createMinorChildren(form.getId(), applicantDTO);
Response response = statusHelper.submitApplication(form.getId(), FIXTURE_PATH_TO_PRINCIPAL);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
form = formAHelper.getRFA1aForm(form.getId());
return form;
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aCoreSubmitApplicationTest method submitApplicationExtendedTest.
@Test
public void submitApplicationExtendedTest() throws Exception {
if (TestModeUtils.isIntegrationTestsMode()) {
return;
}
RFA1aFormDTO form = submitApplication();
statusHelper.assertSubmitted(form.getId());
String placementHomeId = form.getPlacementHomeId();
assertNotNull(placementHomeId);
String[] substituteCareProviderIds = getSubstituteCareProviderIds(placementHomeId);
testIfPlacementHomeWasCreatedProperly(placementHomeId);
testIfPlacementHomeUCWasCreatedProperly();
testIfPlacementHomeProfileWasCreatedProperly(placementHomeId);
testIfEmergencyContactDetailWasCreatedProperly(placementHomeId);
testIfExternalInterfaceWasCreatedProperly();
testIfBackgroundCheckWasCreatedProperly();
testIfCountyOwnershipWasCreatedProperly(placementHomeId, substituteCareProviderIds);
testIfSubstituteCareProviderRelatedEntitiesWasCreatedProperly(placementHomeId, substituteCareProviderIds);
testIfOtherAdultsWasCreatedProperly(form.getPlacementHomeId());
testIfOtherChildrenWasCreatedProperly(form.getPlacementHomeId(), form);
testIfOtherPeopleScpRelationshipWasCreatedProperly(substituteCareProviderIds[0]);
testIfOtherPeopleScpRelationshipWasCreatedProperly(substituteCareProviderIds[1]);
testIfPlacementFacilityTypeHistoryWasCreatedProperly(form.getPlacementHomeId());
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class ExceptionHandlingResponseTest method businessValidationTest.
@Test
public void businessValidationTest() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
applicantHelper.postApplicant(form.getId(), getApplicantDTO());
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + API.RFA_1A_APPLICANTS);
Response response = target.request(MediaType.APPLICATION_JSON).post(Entity.entity(getApplicantDTO(), MediaType.APPLICATION_JSON_TYPE));
assertEquals(422, response.getStatus());
String entity = response.readEntity(String.class);
Map<String, Object> parameters = new HashMap<>();
BaseExceptionResponse exceptionResponse = clientTestRule.getMapper().readValue(entity, BaseExceptionResponse.class);
Set<IssueDetails> issueDetails = exceptionResponse.getIssueDetails();
IssueDetails detail = issueDetails.iterator().next();
parameters.put("incident_id", detail.getIncidentId());
assertResponseByFixtureTemplate(entity, "fixtures/exception/business-validation-exception.json", parameters);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFAPacketResourceTest method testPacketApi.
@Test
public void testPacketApi() throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
ApplicantDTO applicantDTO = applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
ApplicantDTO secondApplicant = applicantHelper.getValidApplicant();
secondApplicant.setFirstName("John");
StateType driverLicenseState = new StateType();
driverLicenseState.setId("MD");
driverLicenseState.setValue("Maryland");
secondApplicant.setDriverLicenseState(driverLicenseState);
secondApplicant.getEthnicity().setId(2L);
secondApplicant.getEthnicity().setValue("American Indian");
secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
RFA1bFormDTO rfa1bForm = formBHelper.getRfa1bForm();
formBHelper.postRfa1bForm(form.getId(), applicantDTO.getId(), rfa1bForm);
otherAdultHelper.createOtherAdults(form.getId(), secondApplicant);
minorChildHelper.createMinorChildren(form.getId(), applicantDTO);
WebTarget target = clientTestRule.target(API.RFA_PACKET + "/" + form.getId() + "/" + SUMMARY);
Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
PacketDTO packetDTO = invocation.get(PacketDTO.class);
assertNotNull(packetDTO);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class BaseExternalEntityApiHelper method createEntity.
public void createEntity() throws Exception {
RFA1aFormDTO form = helper.createRFA1aForm();
T created = createEntity(form);
assertNotNull(created);
assertNotNull(created.getId());
Long createdEntityId = created.getId();
T found = findEntity(form, createdEntityId);
assertThat(found).isEqualTo(created);
}
Aggregations