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);
}
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()));
}
}
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);
}
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);
}
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());
}
Aggregations