Search in sources :

Example 6 with AreaIdentifierType

use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityServiceBeanTest method getFishingActivityListByQuery_emptyResultSet.

@Test
@SneakyThrows
public void getFishingActivityListByQuery_emptyResultSet() throws ServiceException {
    FishingActivityQuery query = new FishingActivityQuery();
    Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
    List<AreaIdentifierType> areaIdentifierTypes = new ArrayList<>();
    searchCriteriaMap.put(SearchFilter.OWNER, "OWNER1");
    Map<SearchFilter, List<String>> searchCriteriaMapMultipleValue = new HashMap<>();
    List<String> purposeCodeList = new ArrayList<>();
    purposeCodeList.add("9");
    searchCriteriaMapMultipleValue.put(SearchFilter.PURPOSE, purposeCodeList);
    PaginationDto pagination = new PaginationDto();
    pagination.setPageSize(4);
    pagination.setOffset(1);
    query.setPagination(pagination);
    query.setSearchCriteriaMap(searchCriteriaMap);
    query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultipleValue);
    when(spatialModule.getFilteredAreaGeom(areaIdentifierTypes)).thenReturn("('MULTIPOINT (10 40, 40 30, 20 20, 30 10)')");
    when(fishingActivityDao.getFishingActivityListByQuery(query)).thenReturn(new ArrayList<FishingActivityEntity>());
    // Trigger
    FilterFishingActivityReportResultDTO filterFishingActivityReportResultDTO = activityService.getFishingActivityListByQuery(query, new ArrayList<Dataset>());
    Mockito.verify(fishingActivityDao, Mockito.times(1)).getFishingActivityListByQuery(Mockito.any(FishingActivityQuery.class));
    // Verify
    assertNotNull(filterFishingActivityReportResultDTO);
}
Also used : HashMap(java.util.HashMap) Dataset(eu.europa.ec.fisheries.wsdl.user.types.Dataset) ArrayList(java.util.ArrayList) PaginationDto(eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) FilterFishingActivityReportResultDTO(eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) ArrayList(java.util.ArrayList) List(java.util.List) AreaIdentifierType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

AreaIdentifierType (eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType)6 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)3 ArrayList (java.util.ArrayList)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 ParseException (com.vividsolutions.jts.io.ParseException)2 FilterFishingActivityReportResultDTO (eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO)2 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)2 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)2 PaginationDto (eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto)2 Dataset (eu.europa.ec.fisheries.wsdl.user.types.Dataset)2 HashMap (java.util.HashMap)2 List (java.util.List)2 SneakyThrows (lombok.SneakyThrows)2 Test (org.junit.Test)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdWithGeometry (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 SpatialModelMapperException (eu.europa.ec.fisheries.uvms.spatial.model.exception.SpatialModelMapperException)1 AreaType (eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaType)1 FilterAreasSpatialRS (eu.europa.ec.fisheries.uvms.spatial.model.schemas.FilterAreasSpatialRS)1