Search in sources :

Example 1 with FACatchDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchReportServiceBeanTest method testGetCatchesTableForCatchDetailsScreen.

@Test
@SneakyThrows
public void testGetCatchesTableForCatchDetailsScreen() throws ServiceException {
    FishingActivityQuery query = new FishingActivityQuery();
    List<GroupCriteria> groupByFields = new ArrayList<>();
    groupByFields.add(GroupCriteria.DATE_DAY);
    groupByFields.add(GroupCriteria.FAO_AREA);
    groupByFields.add(GroupCriteria.TERRITORY);
    groupByFields.add(GroupCriteria.EFFORT_ZONE);
    groupByFields.add(GroupCriteria.GFCM_GSA);
    groupByFields.add(GroupCriteria.GFCM_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.ICES_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.RFMO);
    groupByFields.add(GroupCriteria.SPECIES);
    query.setGroupByFields(groupByFields);
    Map<SearchFilter, String> searchCriteriaMap = new EnumMap<SearchFilter, String>(SearchFilter.class);
    searchCriteriaMap.put(SearchFilter.TRIP_ID, "NOR-TRP-20160517234053706");
    query.setSearchCriteriaMap(searchCriteriaMap);
    when(faCatchDao.getGroupedFaCatchData(query, Boolean.FALSE)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
    when(faCatchDao.getGroupedFaCatchData(query, Boolean.TRUE)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
    // when(vesselIdentifiersDao.getLatestVesselIdByTrip("NOR-TRP-20160517234053706")).thenReturn(MapperUtil.getVesselIdentifiersList());
    // Trigger
    FACatchDetailsDTO faCatchDetailsDTO = faCatchReportService.getCatchDetailsScreen("NOR-TRP-20160517234053706");
    Mockito.verify(faCatchDao, Mockito.times(2)).getGroupedFaCatchData(Mockito.any(FishingActivityQuery.class), Mockito.any(Boolean.class));
    // Verify
    assertNotNull(faCatchDetailsDTO);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) FACatchDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO) EnumMap(java.util.EnumMap) GroupCriteria(eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 2 with FACatchDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchReportServiceBean method getCatchDetailsScreen.

/**
 * This method gets DTO representing catch details screen. It will hve 2 summary tables for catches and landing
 * @param tripId data for this trip should be returned
 * @return
 * @throws ServiceException
 */
@Override
public FACatchDetailsDTO getCatchDetailsScreen(String tripId) throws ServiceException {
    FACatchDetailsDTO faCatchDetailsDTO = new FACatchDetailsDTO();
    faCatchDetailsDTO.setCatches(getCatchDetailsScreenTable(tripId, false));
    faCatchDetailsDTO.setLanding(getCatchDetailsScreenTable(tripId, true));
    return faCatchDetailsDTO;
}
Also used : FACatchDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO)

Aggregations

FACatchDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO)2 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)1 GroupCriteria (eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria)1 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 SneakyThrows (lombok.SneakyThrows)1 Test (org.junit.Test)1