use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDaoTest method testGetFishingTripIdsForMatchingFilterCriteria_noFilters.
@Test
@SneakyThrows
public void testGetFishingTripIdsForMatchingFilterCriteria_noFilters() throws Exception {
dbSetupTracker.skipNextLaunch();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
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);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDaoTest method testGetCountOfFishingTripsForMatchingFilterCriteria.
@Test
@SneakyThrows
public void testGetCountOfFishingTripsForMatchingFilterCriteria() throws Exception {
dbSetupTracker.skipNextLaunch();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
searchCriteriaMap.put(SearchFilter.ACTIVITY_TYPE, "DEPARTURE");
searchCriteriaMap.put(SearchFilter.SOURCE, "FLUX");
searchCriteriaMap.put(SearchFilter.OWNER, "OWNER1");
searchCriteriaMap.put(SearchFilter.FROM, "OWNER1");
searchCriteriaMap.put(SearchFilter.PERIOD_START, "2012-05-27T07:47:31");
searchCriteriaMap.put(SearchFilter.PERIOD_END, "2018-05-27T07:47:31");
searchCriteriaMap.put(SearchFilter.REPORT_TYPE, "DECLARATION");
searchCriteriaMap.put(SearchFilter.AREAS, "J");
searchCriteriaMap.put(SearchFilter.GEAR, "GEAR_TYPE");
searchCriteriaMap.put(SearchFilter.SPECIES, "BFT");
searchCriteriaMap.put(SearchFilter.QUANTITY_MIN, "0");
searchCriteriaMap.put(SearchFilter.QUANTITY_MAX, "50");
searchCriteriaMap.put(SearchFilter.MASTER, "MARK");
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);
Integer fishingTripCount = dao.getCountOfFishingTripsForMatchingFilterCriteria(query);
System.out.println("Count : " + fishingTripCount);
assertEquals(true, fishingTripCount >= 1);
}
use of eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDaoTest method testGetFishingTripsForMatchingFilterCriteria.
@Test
@SneakyThrows
public void testGetFishingTripsForMatchingFilterCriteria() throws Exception {
dbSetupTracker.skipNextLaunch();
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");
activityTypeValues.add("ARRIVAL");
FishingActivityQuery query = new FishingActivityQuery();
query.setSearchCriteriaMap(searchCriteriaMap);
query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultiVal);
searchCriteriaMapMultiVal.put(SearchFilter.ACTIVITY_TYPE, activityTypeValues);
List<FishingTripEntity> list = dao.getFishingTripsForMatchingFilterCriteria(query);
System.out.println("done:" + list.size());
assertNotNull(list);
}
Aggregations