use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aCornerCasesSubmitApplicationTest method changeStatusBackToDraftTest.
@Test
public void changeStatusBackToDraftTest() throws Exception {
if (TestModeUtils.isIntegrationTestsMode()) {
return;
}
RFA1aFormDTO form = formAHelper.createRFA1aForm();
applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
Response response = statusHelper.submitApplication(form.getId(), FIXTURE_PATH_TO_PRINCIPAL);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
statusHelper.assertSubmitted(form.getId());
response = statusHelper.changeApplicationStatusTo(RFAApplicationStatus.DRAFT, form.getId());
assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
statusHelper.assertSubmitted(form.getId());
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aFormsResourceTest method updateApplicationFormTest.
@Test
public void updateApplicationFormTest() throws Exception {
RFA1aFormDTO rfaFormCreate = formAHelper.createRFA1aForm();
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + rfaFormCreate.getId());
rfaFormCreate.setOtherTypeDescription("newOtherTypeDescription");
RFA1aFormDTO rfaFormGet = target.request(MediaType.APPLICATION_JSON).put(Entity.entity(rfaFormCreate, MediaType.APPLICATION_JSON_TYPE), RFA1aFormDTO.class);
assertNotNull(rfaFormGet);
assertEquals(rfaFormCreate, rfaFormGet);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aMinorChildrenResourceTest method restoreUnselectedValueBackTest.
@Test
public void restoreUnselectedValueBackTest() throws Exception {
String inputFixture = "{\"relationship_to_applicants\": []}";
RFA1aFormDTO form = formAHelper.createRFA1aForm();
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + API.RFA_1A_MINOR_CHILDREN);
MinorChildDTO minorChildDTO = clientTestRule.getMapper().readValue(inputFixture, MinorChildDTO.class);
MinorChildDTO postMinorChildDTO = target.request(MediaType.APPLICATION_JSON).post(Entity.entity(minorChildDTO, MediaType.APPLICATION_JSON_TYPE), MinorChildDTO.class);
String removeArrayFixture = "{\n" + " \"id\" : %s\n" + ", \"relationship_to_applicants\":null" + "}";
minorChildDTO = clientTestRule.getMapper().readValue(String.format(removeArrayFixture, postMinorChildDTO.getId()), MinorChildDTO.class);
target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + API.RFA_1A_MINOR_CHILDREN + "/" + postMinorChildDTO.getId());
MinorChildDTO putMinorChildDTO = target.request(MediaType.APPLICATION_JSON).put(Entity.entity(minorChildDTO, MediaType.APPLICATION_JSON_TYPE), MinorChildDTO.class);
String finalFixture = "{\n" + " \"id\" : %s\n" + "}";
JSONAssert.assertEquals(String.format(finalFixture, putMinorChildDTO.getId()), clientTestRule.getMapper().writeValueAsString(putMinorChildDTO), JSONCompareMode.STRICT);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aMinorChildrenResourceTest method checkInputOutput.
private void checkInputOutput(String inputFixture, String expectedOutputFixture) throws Exception {
RFA1aFormDTO form = formAHelper.createRFA1aForm();
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + API.RFA_1A_MINOR_CHILDREN);
MinorChildDTO minorChildDTO = clientTestRule.getMapper().readValue(inputFixture, MinorChildDTO.class);
MinorChildDTO postMinorChildDTO = target.request(MediaType.APPLICATION_JSON).post(Entity.entity(minorChildDTO, MediaType.APPLICATION_JSON_TYPE), MinorChildDTO.class);
target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "/" + API.RFA_1A_MINOR_CHILDREN + "/" + postMinorChildDTO.getId());
MinorChildDTO getMinorChildDTO = target.request(MediaType.APPLICATION_JSON).get(MinorChildDTO.class);
JSONAssert.assertEquals(String.format(expectedOutputFixture, getMinorChildDTO.getId()), clientTestRule.getMapper().writeValueAsString(getMinorChildDTO), JSONCompareMode.STRICT);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aPrintPDFTest method getPDFTest.
@Ignore
@Test
public void getPDFTest() throws Exception {
// For integration test only
if (!TestModeUtils.isIntegrationTestsMode()) {
return;
}
RFA1aFormDTO form = createRfa1aFormDTO();
WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form.getId() + "?" + QueryParams.EXPANDED + "=true");
RFA1aFormDTO getExpandedFormResponse = target.request(MediaType.APPLICATION_JSON).get(RFA1aFormDTO.class);
assertNotNull(getExpandedFormResponse);
Response response = target.request("application/pdf").get();
assertNotNull(response);
System.out.println(response.getLength());
assertEquals(Status.OK.getStatusCode(), response.getStatus());
}
Aggregations