Search in sources :

Example 1 with FacilityTypeDto

use of org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto in project openlmis-stockmanagement by OpenLMIS.

the class HomeFacilityPermissionServiceTest method mockFacilityDto.

private void mockFacilityDto() {
    homeFacilityDto = mock(FacilityDto.class);
    SupportedProgramDto supportedProgramDto = new SupportedProgramDto();
    supportedProgramDto.setId(programId);
    when(homeFacilityDto.getSupportedPrograms()).thenReturn(Collections.singletonList(supportedProgramDto));
    FacilityTypeDto facilityTypeDto = new FacilityTypeDto();
    facilityTypeDto.setId(facilityTypeId);
    when(homeFacilityDto.getType()).thenReturn(facilityTypeDto);
    when(facilityService.findOne(homeFacilityId)).thenReturn(homeFacilityDto);
}
Also used : SupportedProgramDto(org.openlmis.stockmanagement.dto.referencedata.SupportedProgramDto) FacilityTypeDto(org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto) FacilityDto(org.openlmis.stockmanagement.dto.referencedata.FacilityDto)

Example 2 with FacilityTypeDto

use of org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto in project openlmis-stockmanagement by OpenLMIS.

the class ProgramFacilityTypeExistenceService method checkProgramAndFacilityTypeExist.

/**
 * Check program and facility type existence.
 *
 * @param programId      program id.
 * @param facilityTypeId facility type id.
 */
public void checkProgramAndFacilityTypeExist(UUID programId, UUID facilityTypeId) {
    ProgramDto programDto = programReferenceDataService.findOne(programId);
    FacilityTypeDto facilityTypeDto = facilityTypeReferenceDataService.findOne(facilityTypeId);
    if (programDto == null) {
        throw new ValidationMessageException(new Message(ERROR_PROGRAM_NOT_FOUND, programId.toString()));
    }
    if (facilityTypeDto == null) {
        throw new ValidationMessageException(new Message(ERROR_FACILITY_TYPE_NOT_FOUND, facilityTypeId.toString()));
    }
}
Also used : Message(org.openlmis.stockmanagement.util.Message) ValidationMessageException(org.openlmis.stockmanagement.exception.ValidationMessageException) ProgramDto(org.openlmis.stockmanagement.dto.referencedata.ProgramDto) FacilityTypeDto(org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto)

Example 3 with FacilityTypeDto

use of org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto in project openlmis-stockmanagement by OpenLMIS.

the class PhysicalInventoryAdjustmentReasonsValidatorTest method stubFacilityType.

private void stubFacilityType() {
    when(facilityService.findOne(stockEventDto.getFacilityId())).thenReturn(facility);
    FacilityTypeDto facilityType = new FacilityTypeDto();
    facilityType.setId(facilityTypeId);
    when(facility.getType()).thenReturn(facilityType);
}
Also used : FacilityTypeDto(org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto)

Example 4 with FacilityTypeDto

use of org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto in project openlmis-stockmanagement by OpenLMIS.

the class SourceDestinationAssignmentValidatorTest method createContextWithFacility.

private void createContextWithFacility(StockEventDto eventDto) {
    FacilityTypeDto facilityTypeDto = new FacilityTypeDto();
    facilityTypeDto.setId(UUID.randomUUID());
    FacilityDto facilityDto = new FacilityDto();
    facilityDto.setId(eventDto.getFacilityId());
    facilityDto.setType(facilityTypeDto);
    when(facilityService.findOne(eventDto.getFacilityId())).thenReturn(facilityDto);
    setContext(eventDto);
}
Also used : FacilityTypeDto(org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto) FacilityDto(org.openlmis.stockmanagement.dto.referencedata.FacilityDto)

Example 5 with FacilityTypeDto

use of org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto in project openlmis-stockmanagement by OpenLMIS.

the class ProgramFacilityTypeExistenceServiceTest method setUp.

@Before
public void setUp() throws Exception {
    // any program or facility type exist by default
    when(programRefDataService.findOne(any(UUID.class))).thenReturn(new ProgramDto());
    when(facilityTypeRefDataService.findOne(any(UUID.class))).thenReturn(new FacilityTypeDto());
}
Also used : ProgramDto(org.openlmis.stockmanagement.dto.referencedata.ProgramDto) FacilityTypeDto(org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto) UUID(java.util.UUID) UUID.randomUUID(java.util.UUID.randomUUID) Before(org.junit.Before)

Aggregations

FacilityTypeDto (org.openlmis.stockmanagement.dto.referencedata.FacilityTypeDto)5 FacilityDto (org.openlmis.stockmanagement.dto.referencedata.FacilityDto)2 ProgramDto (org.openlmis.stockmanagement.dto.referencedata.ProgramDto)2 UUID (java.util.UUID)1 UUID.randomUUID (java.util.UUID.randomUUID)1 Before (org.junit.Before)1 SupportedProgramDto (org.openlmis.stockmanagement.dto.referencedata.SupportedProgramDto)1 ValidationMessageException (org.openlmis.stockmanagement.exception.ValidationMessageException)1 Message (org.openlmis.stockmanagement.util.Message)1