use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery 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);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBeanTest method testFilterFishingTrips.
@Test
@SneakyThrows
public void testFilterFishingTrips() throws ServiceException, JsonProcessingException {
Map<SearchFilter, String> searchMap = new HashMap<>();
searchMap.put(SearchFilter.REPORT_TYPE, "NOTIFICATION");
searchMap.put(SearchFilter.PERIOD_START, "2012-05-27T07:47:31");
searchMap.put(SearchFilter.PERIOD_END, "2017-05-27T07:47:31");
Map<SearchFilter, List<String>> searchCriteriaMapMultiVal = new HashMap<>();
List<String> activityTypeValues = new ArrayList<>();
activityTypeValues.add("FISHING_OPERATION");
activityTypeValues.add("DEPARTURE");
searchCriteriaMapMultiVal.put(SearchFilter.ACTIVITY_TYPE, activityTypeValues);
FishingActivityQuery query = new FishingActivityQuery();
query.setSearchCriteriaMap(searchMap);
query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultiVal);
when(fishingTripDao.getFishingTripIdsForMatchingFilterCriteria(any(FishingActivityQuery.class))).thenReturn(MapperUtil.getFishingTripIdSet());
when(fishingTripDao.getCountOfFishingTripsForMatchingFilterCriteria(any(FishingActivityQuery.class))).thenReturn(new Integer(2));
when(fishingActivityDao.getFishingActivityListByQuery(any(FishingActivityQuery.class))).thenReturn(MapperUtil.getFishingActivityEntityList());
// Trigger
FishingTripResponse response = fishingTripService.filterFishingTrips(query);
assertNotNull(response);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FaCatchDaoTest method testGetFACatchSummaryReportString.
@Test
public void testGetFACatchSummaryReportString() throws Exception {
dbSetupTracker.skipNextLaunch();
FishingActivityQuery query = new FishingActivityQuery();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
List<GroupCriteria> groupByFields = new ArrayList<>();
groupByFields.add(GroupCriteria.DATE_MONTH);
groupByFields.add(GroupCriteria.SPECIES);
query.setGroupByFields(groupByFields);
searchCriteriaMap.put(SearchFilter.SOURCE, "FLUX");
query.setSearchCriteriaMap(searchCriteriaMap);
// FACatchSummaryHelper faCatchSummaryHelper = FACatchSummaryHelper.createFACatchSummaryHelper();
// System.out.println( faCatchSummaryHelper.printJsonstructure(query));
Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> faCatchSummaryCustomEntityListMap = dao.getGroupedFaCatchData(query, false);
assertNotNull(faCatchSummaryCustomEntityListMap);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityDaoTest method testGetCountForFishingActivityListByQuery.
@Test
@SneakyThrows
public void testGetCountForFishingActivityListByQuery() throws Exception {
dbSetupTracker.skipNextLaunch();
FishingActivityQuery query = new FishingActivityQuery();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
Map<SearchFilter, List<String>> searchCriteriaMapMultiVal = new HashMap<>();
List<String> activityTypeValues = new ArrayList<>();
activityTypeValues.add("FISHING_OPERATION");
activityTypeValues.add("DEPARTURE");
searchCriteriaMapMultiVal.put(SearchFilter.ACTIVITY_TYPE, activityTypeValues);
List<String> purposeCodeValues = new ArrayList<>();
purposeCodeValues.add("5");
purposeCodeValues.add("9");
searchCriteriaMapMultiVal.put(SearchFilter.PURPOSE, purposeCodeValues);
query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultiVal);
searchCriteriaMap.put(SearchFilter.OWNER, "OWNER1");
searchCriteriaMap.put(SearchFilter.PERIOD_START, "2012-05-27T07:47:31");
searchCriteriaMap.put(SearchFilter.PERIOD_END, "2015-05-27T07:47:31");
searchCriteriaMap.put(SearchFilter.VESSEL_NAME, "vessel1");
searchCriteriaMap.put(SearchFilter.VESSEL_IDENTIFIRE, "CFR123");
searchCriteriaMap.put(SearchFilter.REPORT_TYPE, "DECLARATION");
searchCriteriaMap.put(SearchFilter.GEAR, "GEAR_TYPE");
searchCriteriaMap.put(SearchFilter.SPECIES, "PLE");
searchCriteriaMap.put(SearchFilter.MASTER, "MARK");
searchCriteriaMap.put(SearchFilter.AREAS, "27.4.b");
searchCriteriaMap.put(SearchFilter.QUANTITY_MIN, "0");
searchCriteriaMap.put(SearchFilter.QUANTITY_MAX, "25");
searchCriteriaMap.put(SearchFilter.SOURCE, "FLUX");
SortKey sortingDto = new SortKey();
sortingDto.setSortBy(SearchFilter.PURPOSE);
sortingDto.setReversed(false);
query.setSorting(sortingDto);
query.setSearchCriteriaMap(searchCriteriaMap);
PaginationDto pagination = new PaginationDto();
pagination.setPageSize(2);
pagination.setOffset(1);
query.setPagination(pagination);
SortKey sortingDto2 = new SortKey();
sortingDto2.setSortBy(SearchFilter.OCCURRENCE);
sortingDto2.setReversed(false);
query.setSorting(sortingDto2);
int size = dao.getCountForFishingActivityListByQuery(query);
System.out.println("done:" + size);
// assertNotEquals(0, size);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDaoTest method testGetFishingTripIdsForMatchingFilterCriteria.
@Test
@SneakyThrows
public void testGetFishingTripIdsForMatchingFilterCriteria() throws Exception {
dbSetupTracker.skipNextLaunch();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
searchCriteriaMap.put(SearchFilter.ACTIVITY_TYPE, "DEPARTURE");
Map<SearchFilter, List<String>> searchCriteriaMapMultiVal = new HashMap<>();
List<String> purposeCodeValues = new ArrayList<>();
purposeCodeValues.add("9");
purposeCodeValues.add("1");
purposeCodeValues.add("5");
purposeCodeValues.add("3");
FishingActivityQuery query = new FishingActivityQuery();
query.setSearchCriteriaMap(searchCriteriaMap);
query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultiVal);
searchCriteriaMapMultiVal.put(SearchFilter.PURPOSE, purposeCodeValues);
Set<FishingTripId> fishingTripIdSet = dao.getFishingTripIdsForMatchingFilterCriteria(query);
FishingTripId fishingTripId = new FishingTripId("NOR-TRP-20160517234053706", "EU_TRIP_ID");
assertEquals(true, fishingTripIdSet.contains(fishingTripId));
assertNotNull(fishingTripIdSet);
}
Aggregations