Search in sources :

Example 26 with RFA1aFormDTO

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

the class BaseExternalEntityApiHelper method getEntityById.

public void getEntityById() throws Exception {
    RFA1aFormDTO form = helper.createRFA1aForm();
    T created = createEntity(form);
    Long createdEntityId = created.getId();
    T found = findEntity(form, createdEntityId);
    assertThat(found).isEqualTo(created);
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)

Example 27 with RFA1aFormDTO

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

the class BaseInternalEntityApiHelper method getEntityNotFound.

@Override
public void getEntityNotFound() throws Exception {
    RFA1aFormDTO rfa1aForm = helper.createRFA1aForm();
    WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + rfa1aForm.getId() + "/" + configuration.getApiPath());
    Response response = target.request(MediaType.APPLICATION_JSON).get();
    assertEquals(404, response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) BaseExceptionResponse(gov.ca.cwds.rest.exception.BaseExceptionResponse) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) WebTarget(javax.ws.rs.client.WebTarget)

Example 28 with RFA1aFormDTO

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

the class DraftApplicationsTest method createInProgressForm.

private RFA1aFormDTO createInProgressForm() throws IOException {
    WebTarget target = clientTestRule.target(API.RFA_1A_FORMS);
    RFA1aFormDTO rfaForm = target.request(MediaType.APPLICATION_JSON).post(Entity.entity(new RFA1aFormDTO(), MediaType.APPLICATION_JSON_TYPE), RFA1aFormDTO.class);
    applicantHelper.postApplicant(rfaForm.getId(), applicantHelper.getApplicant());
    return rfaForm;
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) WebTarget(javax.ws.rs.client.WebTarget)

Example 29 with RFA1aFormDTO

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

the class RFA1cResourceTest method getExternalEntityApiHelper.

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

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

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

        @Override
        public void modifyEntity(RFA1cFormDTO rfa1cFormDTO) {
            CountyType applicationCounty = new CountyType();
            applicationCounty.setId(35L);
            applicationCounty.setValue("San Benito");
            rfa1cFormDTO.setApplicationCounty(applicationCounty);
        }
    };
    return new BaseExternalEntityApiHelper<RFA1cFormDTO>(clientTestRule, configuration, formAHelper) {

        @Override
        public RFA1cFormDTO createEntity(RFA1aFormDTO form) throws Exception {
            RFA1cFormDTO rfa1cFormDTO = super.createEntity(form);
            try {
                super.createEntity(form);
                Assert.fail();
            } catch (BadRequestException e) {
            // ok
            }
            return rfa1cFormDTO;
        }

        @Override
        public void getEntitiesByFormId() throws Exception {
        }
    };
}
Also used : GenericType(javax.ws.rs.core.GenericType) RFA1cFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1cFormDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) BadRequestException(javax.ws.rs.BadRequestException) CollectionDTO(gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO) CountyType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.CountyType) TestExternalEntityConfiguration(gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration)

Example 30 with RFA1aFormDTO

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

the class FormAHelper method createRfa1aForm.

public RFA1aFormDTO createRfa1aForm() throws Exception {
    RFA1aFormDTO form = new RFA1aFormDTO();
    CountyType county = new CountyType();
    county.setId(34L);
    county.setValue("Sacramento");
    form.setApplicationCounty(county);
    form.setInitialApplication(false);
    form.setOtherTypeDescription("otherDescription");
    return form;
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) CountyType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.CountyType)

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