Search in sources :

Example 1 with LIC198bFormDTO

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

the class LIC198bResourceTest method getLIC198bFormApplicantTest.

@Test
public void getLIC198bFormApplicantTest() throws Exception {
    RFA1aFormDTO form1a = formAHelper.createRFA1aForm();
    LIC198bFormDTO created = getExternalEntityApiHelper().createEntity(form1a);
    ApplicantDTO applicantDTO = applicantHelper.getFirstExistedOrPostNewApplicant(form1a.getId(), applicantHelper.getValidApplicant());
    WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form1a.getId() + "/" + getExternalEntityApiHelper().getConfiguration().getApiPath() + "/" + API.RFA_1A_APPLICANTS + "/" + applicantDTO.getId());
    LIC198bFormDTO found = target.request().get(getExternalEntityApiHelper().getConfiguration().getEntityClass());
    assertThat(found).isEqualTo(created);
}
Also used : LIC198bFormDTO(gov.ca.cwds.cals.service.dto.rfa.lic198b.LIC198bFormDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test)

Example 2 with LIC198bFormDTO

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

the class LIC198bResourceTest method getExternalEntityApiHelper.

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

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

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

        @Override
        public void modifyEntity(LIC198bFormDTO lic198bFormDTO) {
            lic198bFormDTO.getIdentifyingData().getPersonName().setFirstName("Petya");
        }
    };
    return new BaseExternalEntityApiHelper<LIC198bFormDTO>(clientTestRule, configuration, formAHelper) {

        @Override
        public LIC198bFormDTO createEntity(RFA1aFormDTO form) throws IOException {
            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());
            LIC198bFormDTO entity = configuration.createEntity();
            return target.request(MediaType.APPLICATION_JSON).post(Entity.entity(entity, MediaType.APPLICATION_JSON_TYPE), configuration.getEntityClass());
        }
    };
}
Also used : GenericType(javax.ws.rs.core.GenericType) LIC198bFormDTO(gov.ca.cwds.cals.service.dto.rfa.lic198b.LIC198bFormDTO) 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

ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)2 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)2 LIC198bFormDTO (gov.ca.cwds.cals.service.dto.rfa.lic198b.LIC198bFormDTO)2 WebTarget (javax.ws.rs.client.WebTarget)2 CollectionDTO (gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO)1 TestExternalEntityConfiguration (gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration)1 GenericType (javax.ws.rs.core.GenericType)1 Test (org.junit.Test)1