Search in sources :

Example 1 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO 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 2 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO 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 3 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO in project cals-api by ca-cwds.

the class ApplicantHelper method getValidApplicant.

public ApplicantDTO getValidApplicant() throws IOException {
    ApplicantDTO applicant = getApplicantDTO();
    RFA1bFormDTO rfa1bForm = new FormBHelper(clientTestRule).getRfa1bForm();
    applicant.setRfa1bForm(rfa1bForm);
    return applicant;
}
Also used : RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Example 4 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO in project cals-api by ca-cwds.

the class RFA1aPrintPDFTest method createRfa1aFormDTO.

private RFA1aFormDTO createRfa1aFormDTO() 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);
    return form;
}
Also used : 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 5 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO in project cals-api by ca-cwds.

the class RFA1bResourceTest method getExternalEntityApiHelper.

@Override
protected BaseExternalEntityApiHelper<RFA1bFormDTO> getExternalEntityApiHelper() {
    TestExternalEntityConfiguration<RFA1bFormDTO> configuration = new TestExternalEntityConfiguration<RFA1bFormDTO>(clientTestRule, RFA1bFormDTO.class, API.RFA_1B_FORMS) {

        @Override
        protected String getFixture() {
            return RFA1B_FORM_FIXTURE;
        }

        @Override
        public GenericType<CollectionDTO<RFA1bFormDTO>> getCollectionDTOGenericType() {
            return new GenericType<CollectionDTO<RFA1bFormDTO>>() {
            };
        }

        @Override
        public void modifyEntity(RFA1bFormDTO rfa1bFormDTO) {
            rfa1bFormDTO.setApplicantFirstName("Petya");
        }
    };
    return new BaseExternalEntityApiHelper<RFA1bFormDTO>(clientTestRule, configuration, formAHelper) {

        @Override
        public RFA1bFormDTO createEntity(RFA1aFormDTO form) throws Exception {
            ApplicantDTO applicantDTO = applicantHelper.getFirstExistedOrPostNewApplicant(form.getId(), applicantHelper.getValidApplicant());
            WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + configuration.getApiPath() + "/" + API.RFA_1A_APPLICANTS + "/" + applicantDTO.getId());
            RFA1bFormDTO entity = configuration.createEntity();
            return target.request(MediaType.APPLICATION_JSON).post(Entity.entity(entity, MediaType.APPLICATION_JSON_TYPE), configuration.getEntityClass());
        }

        public void getEntitiesByFormId() throws Exception {
        }
    };
}
Also used : GenericType(javax.ws.rs.core.GenericType) RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) CollectionDTO(gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) WebTarget(javax.ws.rs.client.WebTarget) TestExternalEntityConfiguration(gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration)

Aggregations

RFA1bFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO)7 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)6 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)5 StateType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType)3 WebTarget (javax.ws.rs.client.WebTarget)3 Test (org.junit.Test)2 RFA1bDao (gov.ca.cwds.cals.persistence.dao.calsns.RFA1bDao)1 RFA1bForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1bForm)1 PacketDTO (gov.ca.cwds.cals.service.dto.packet.PacketDTO)1 CollectionDTO (gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO)1 RFAApplicantAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams)1 RFAOtherAdultAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams)1 BaseRFAIntegrationTest (gov.ca.cwds.cals.web.rest.rfa.BaseRFAIntegrationTest)1 TestExternalEntityConfiguration (gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration)1 ExpectedException (gov.ca.cwds.rest.exception.ExpectedException)1 Invocation (javax.ws.rs.client.Invocation)1 GenericType (javax.ws.rs.core.GenericType)1 Response (javax.ws.rs.core.Response)1