Search in sources :

Example 21 with RFA1aFormDTO

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;
}
Also used : Response(javax.ws.rs.core.Response) RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Example 22 with RFA1aFormDTO

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());
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) Test(org.junit.Test)

Example 23 with RFA1aFormDTO

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);
}
Also used : BaseExceptionResponse(gov.ca.cwds.rest.exception.BaseExceptionResponse) Response(javax.ws.rs.core.Response) BaseExceptionResponse(gov.ca.cwds.rest.exception.BaseExceptionResponse) HashMap(java.util.HashMap) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) IssueDetails(gov.ca.cwds.rest.exception.IssueDetails) WebTarget(javax.ws.rs.client.WebTarget) BaseRFAIntegrationTest(gov.ca.cwds.cals.web.rest.rfa.BaseRFAIntegrationTest) Test(org.junit.Test)

Example 24 with RFA1aFormDTO

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);
}
Also used : RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) Invocation(javax.ws.rs.client.Invocation) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) WebTarget(javax.ws.rs.client.WebTarget) PacketDTO(gov.ca.cwds.cals.service.dto.packet.PacketDTO) Test(org.junit.Test) BaseRFAIntegrationTest(gov.ca.cwds.cals.web.rest.rfa.BaseRFAIntegrationTest)

Example 25 with RFA1aFormDTO

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);
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)

Aggregations

RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)59 Test (org.junit.Test)37 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)30 WebTarget (javax.ws.rs.client.WebTarget)19 IssueDetails (gov.ca.cwds.rest.exception.IssueDetails)15 Response (javax.ws.rs.core.Response)15 BaseExceptionResponse (gov.ca.cwds.rest.exception.BaseExceptionResponse)12 HashMap (java.util.HashMap)12 MinorChildDTO (gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO)11 ClientErrorException (javax.ws.rs.ClientErrorException)11 Map (java.util.Map)10 Set (java.util.Set)10 StateType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType)7 ResidenceDTO (gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)7 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)4 REQUIRED_APPLICANT_DATE_OF_BIRTH (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DATE_OF_BIRTH)4 REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)4 REQUIRED_APPLICANT_DRIVER_LICENSE_STATE (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_STATE)4 REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME)4 REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME)4