Search in sources :

Example 6 with FishingTripId

use of eu.europa.ec.fisheries.ers.service.search.FishingTripId 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 7 with FishingTripId

use of eu.europa.ec.fisheries.ers.service.search.FishingTripId 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)

Aggregations

FishingTripId (eu.europa.ec.fisheries.ers.service.search.FishingTripId)7 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)5 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)3 SneakyThrows (lombok.SneakyThrows)3 Test (org.junit.Test)3 FishingTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse)2 BigInteger (java.math.BigInteger)2 HashSet (java.util.HashSet)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdWithGeometryMapper (eu.europa.ec.fisheries.ers.service.mapper.FishingTripIdWithGeometryMapper)1 SortKey (eu.europa.ec.fisheries.ers.service.search.SortKey)1 FishingActivitySummary (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary)1 FishingTripIdWithGeometry (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry)1 PaginationDto (eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto)1 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)1 EnumMap (java.util.EnumMap)1 Query (javax.persistence.Query)1