Search in sources :

Example 6 with FishingTripResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse 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);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) FishingTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse) 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

FishingTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse)6 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)3 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)3 FishingTripId (eu.europa.ec.fisheries.ers.service.search.FishingTripId)2 SortKey (eu.europa.ec.fisheries.ers.service.search.SortKey)2 BigInteger (java.math.BigInteger)2 ArrayList (java.util.ArrayList)2 EnumMap (java.util.EnumMap)2 SneakyThrows (lombok.SneakyThrows)2 Test (org.junit.Test)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdWithGeometryMapper (eu.europa.ec.fisheries.ers.service.mapper.FishingTripIdWithGeometryMapper)1 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)1 FishingActivitySummary (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary)1 FishingTripIdWithGeometry (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry)1 FishingTripRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripRequest)1 IUserRoleInterceptor (eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)1 Dataset (eu.europa.ec.fisheries.wsdl.user.types.Dataset)1