Search in sources :

Example 21 with SearchFilter

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PaginationDto(eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) SortKey(eu.europa.ec.fisheries.ers.service.search.SortKey) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 22 with SearchFilter

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) FishingTripId(eu.europa.ec.fisheries.ers.service.search.FishingTripId) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 23 with SearchFilter

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) FishingTripId(eu.europa.ec.fisheries.ers.service.search.FishingTripId) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 24 with SearchFilter

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 25 with SearchFilter

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)29 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)19 ArrayList (java.util.ArrayList)18 List (java.util.List)17 Test (org.junit.Test)17 SneakyThrows (lombok.SneakyThrows)16 HashMap (java.util.HashMap)14 EnumMap (java.util.EnumMap)9 SortKey (eu.europa.ec.fisheries.ers.service.search.SortKey)8 PaginationDto (eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto)7 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)7 FilterMap (eu.europa.ec.fisheries.ers.service.search.FilterMap)4 FishingTripId (eu.europa.ec.fisheries.ers.service.search.FishingTripId)4 GroupCriteria (eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria)4 Map (java.util.Map)4 FishingTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse)3 FaCatchSummaryCustomProxy (eu.europa.ec.fisheries.ers.fa.dao.proxy.FaCatchSummaryCustomProxy)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)2 FilterFishingActivityReportResultDTO (eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO)2 FilterDetails (eu.europa.ec.fisheries.ers.service.search.FilterDetails)2