Search in sources :

Example 1 with FacilityDTO

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

the class FacilityResourceTest method testGetFacilityByFacilityIdWithZeroInCountyAndFacilityType.

@Test
public void testGetFacilityByFacilityIdWithZeroInCountyAndFacilityType() throws Exception {
    WebTarget target = clientTestRule.target(Constants.API.FACILITIES + "/BITrEV40OU");
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    FacilityDTO facilityDTO = invocation.get(FacilityDTO.class);
    String fixture = fixture("fixtures/facility/facility-by-id-with-zero-in-county-and-facility-type-response.json");
    assertEqualsResponse(fixture, transformDTOtoJSON(facilityDTO));
}
Also used : Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) FacilityDTO(gov.ca.cwds.cals.service.dto.FacilityDTO) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 2 with FacilityDTO

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

the class FacilityResourceTest method testGetFacilityWithLastCapacityChanged.

@Test
public void testGetFacilityWithLastCapacityChanged() throws Exception {
    WebTarget target = clientTestRule.target(Constants.API.FACILITIES + "/" + FACILITY_FROM_LIS_ID);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    FacilityDTO facilityDTO = invocation.get(FacilityDTO.class);
    assertEquals(2006, facilityDTO.getCapacityLastChanged().getYear());
    assertEquals(10, facilityDTO.getCapacityLastChanged().getMonthValue());
    assertEquals(13, facilityDTO.getCapacityLastChanged().getDayOfMonth());
}
Also used : Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) FacilityDTO(gov.ca.cwds.cals.service.dto.FacilityDTO) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 3 with FacilityDTO

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

the class FacilityResourceTest method testGetFacilityByLicenseNumber.

@Test
public void testGetFacilityByLicenseNumber() throws Exception {
    WebTarget target = clientTestRule.target(Constants.API.FACILITIES + "/" + LICENSE_NUMBER);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    FacilityDTO facilityDTO = invocation.get(FacilityDTO.class);
    String fixture = fixture("fixtures/facility/facility-by-license-number-response.json");
    assertEqualsResponse(fixture, transformDTOtoJSON(facilityDTO));
}
Also used : Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) FacilityDTO(gov.ca.cwds.cals.service.dto.FacilityDTO) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 4 with FacilityDTO

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

the class FacilityResourceTest method testGetFacilityByFacilityId.

@Test
public void testGetFacilityByFacilityId() throws Exception {
    WebTarget target = clientTestRule.target(Constants.API.FACILITIES + "/" + FACILITY_ID);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    FacilityDTO facilityDTO = invocation.get(FacilityDTO.class);
    String fixture = fixture("fixtures/facility/facility-by-id-response.json");
    assertEqualsResponse(fixture, transformDTOtoJSON(facilityDTO));
}
Also used : Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) FacilityDTO(gov.ca.cwds.cals.service.dto.FacilityDTO) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 5 with FacilityDTO

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

the class FacilityService method loadFacilityFromCwsCms.

private FacilityDTO loadFacilityFromCwsCms(FacilityParameterObject parameterObject) {
    FacilityDTO facilityDto = cwsFacilityService.loadFacilityFromCwsCms(parameterObject);
    if (parameterObject.isExpanded()) {
        List<FacilityChildDTO> facilityChildren = cwsFacilityService.findFacilityChildrenByFacilityId(parameterObject.getFacilityId());
        List<FacilityInspectionDTO> inspections = fasFacilityService.findInspectionsByFacilityId(facilityDto.getLicenseNumber());
        List<ComplaintDTO> complaints = fasFacilityService.findComplaintsByFacilityId(facilityDto.getLicenseNumber());
        facilityDto = facilityMapper.toExpandedFacilityDTO(facilityDto, facilityChildren, inspections, complaints);
    }
    return facilityDto;
}
Also used : FacilityInspectionDTO(gov.ca.cwds.cals.service.dto.FacilityInspectionDTO) FacilityDTO(gov.ca.cwds.cals.service.dto.FacilityDTO) FacilityChildDTO(gov.ca.cwds.cals.service.dto.FacilityChildDTO) ComplaintDTO(gov.ca.cwds.cals.service.dto.ComplaintDTO)

Aggregations

FacilityDTO (gov.ca.cwds.cals.service.dto.FacilityDTO)6 BaseCalsApiIntegrationTest (gov.ca.cwds.cals.BaseCalsApiIntegrationTest)4 Invocation (javax.ws.rs.client.Invocation)4 WebTarget (javax.ws.rs.client.WebTarget)4 Test (org.junit.Test)4 ComplaintDTO (gov.ca.cwds.cals.service.dto.ComplaintDTO)2 FacilityChildDTO (gov.ca.cwds.cals.service.dto.FacilityChildDTO)2 FacilityInspectionDTO (gov.ca.cwds.cals.service.dto.FacilityInspectionDTO)2 FacilityInformation (gov.ca.cwds.cals.persistence.model.fas.FacilityInformation)1