use of gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration 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());
}
};
}
use of gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration 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 {
}
};
}
use of gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration 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 {
}
};
}
Aggregations