use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityServiceBeanTest method getFishingActivityListByQuery_emptyResultSet.
@Test
@SneakyThrows
public void getFishingActivityListByQuery_emptyResultSet() throws ServiceException {
FishingActivityQuery query = new FishingActivityQuery();
Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
List<AreaIdentifierType> areaIdentifierTypes = new ArrayList<>();
searchCriteriaMap.put(SearchFilter.OWNER, "OWNER1");
Map<SearchFilter, List<String>> searchCriteriaMapMultipleValue = new HashMap<>();
List<String> purposeCodeList = new ArrayList<>();
purposeCodeList.add("9");
searchCriteriaMapMultipleValue.put(SearchFilter.PURPOSE, purposeCodeList);
PaginationDto pagination = new PaginationDto();
pagination.setPageSize(4);
pagination.setOffset(1);
query.setPagination(pagination);
query.setSearchCriteriaMap(searchCriteriaMap);
query.setSearchCriteriaMapMultipleValues(searchCriteriaMapMultipleValue);
when(spatialModule.getFilteredAreaGeom(areaIdentifierTypes)).thenReturn("('MULTIPOINT (10 40, 40 30, 20 20, 30 10)')");
when(fishingActivityDao.getFishingActivityListByQuery(query)).thenReturn(new ArrayList<FishingActivityEntity>());
// Trigger
FilterFishingActivityReportResultDTO filterFishingActivityReportResultDTO = activityService.getFishingActivityListByQuery(query, new ArrayList<Dataset>());
Mockito.verify(fishingActivityDao, Mockito.times(1)).getFishingActivityListByQuery(Mockito.any(FishingActivityQuery.class));
// Verify
assertNotNull(filterFishingActivityReportResultDTO);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class TripCatchEvolutionTest method testHandleCumulatedCatchNoDeletion.
@Test
public void testHandleCumulatedCatchNoDeletion() {
FaReportDocumentEntity faReportDocumentEntity = ActivityDataUtil.getFaReportDocumentEntity(FaReportDocumentType.DECLARATION.name(), "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), null, null, "new");
FishingActivityEntity fishingActivityEntity = ActivityDataUtil.getFishingActivityEntity(FishingActivityTypeEnum.FISHING_OPERATION.name(), "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity, null);
FaCatchEntity faCatchEntity = ActivityDataUtil.getFaCatchEntity(fishingActivityEntity, "LOADED", "FA_CATCH_TYPE", "COD", "FAO_SPECIES", 11112D, 11112.0D, "KGM", "BFT", "WEIGHT_MEANS", null);
faCatchEntity.setCalculatedWeightMeasure(11112D);
CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivityEntity, FaReportDocumentType.DECLARATION, new HashMap<String, Double>());
handleCumulatedCatchNoDeletion(faCatchEntity, catchEvolutionProgressDTO, new HashMap<String, Double>());
assertTrue(!catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().isEmpty());
assertEquals(catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().get(0).getSpeciesCode(), "COD");
assertTrue(catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().get(0).getWeight() == 11112D);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testFaReportDocumentMapper.
@Test
public void testFaReportDocumentMapper() {
FAReportDocument faReportDocument = MapperUtil.getFaReportDocument();
FaReportDocumentEntity faReportDocumentEntity = FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, FaReportSourceEnum.FLUX);
assertFaReportDocumentFields(faReportDocument, faReportDocumentEntity);
assertNotNull(faReportDocumentEntity.getFaReportIdentifiers());
FaReportIdentifierEntity faReportIdentifierEntity = faReportDocumentEntity.getFaReportIdentifiers().iterator().next();
assertNotNull(faReportDocumentEntity);
assertEquals(faReportDocument.getRelatedReportIDs().get(0).getValue(), faReportIdentifierEntity.getFaReportIdentifierId());
assertEquals(faReportDocument.getRelatedReportIDs().get(0).getSchemeID(), faReportIdentifierEntity.getFaReportIdentifierSchemeId());
assertFaReportDocumentFields(faReportDocument, faReportIdentifierEntity.getFaReportDocument());
assertNotNull(faReportDocumentEntity.getFishingActivities());
FishingActivityEntity fishingActivityEntity = faReportDocumentEntity.getFishingActivities().iterator().next();
assertNotNull(fishingActivityEntity);
assertFaReportDocumentFields(faReportDocument, fishingActivityEntity.getFaReportDocument());
assertNotNull(faReportDocumentEntity.getFluxReportDocument());
assertFaReportDocumentFields(faReportDocument, faReportDocumentEntity.getFluxReportDocument().getFaReportDocument());
assertNotNull(faReportDocumentEntity.getVesselTransportMeans());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapperTest method testFishingActivityMapper.
@Test
public void testFishingActivityMapper() {
FishingActivity fishingActivity = MapperUtil.getFishingActivity();
FishingActivityEntity fishingActivityEntity = new FishingActivityEntity();
FishingActivityMapper.INSTANCE.mapToFishingActivityEntity(fishingActivity, null, fishingActivityEntity);
assertFishingActivityFields(fishingActivity, fishingActivityEntity);
assertNull(fishingActivityEntity.getFaReportDocument());
assertNotNull(fishingActivityEntity.getFishingGears());
FishingGearEntity fishingGearEntity = fishingActivityEntity.getFishingGears().iterator().next();
assertNotNull(fishingGearEntity);
assertFishingActivityFields(fishingActivity, fishingGearEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFishingTrips());
FishingTripEntity fishingTripEntity = fishingActivityEntity.getFishingTrips().iterator().next();
assertNotNull(fishingTripEntity);
assertFishingActivityFields(fishingActivity, fishingTripEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFaCatchs());
FaCatchEntity faCatchEntity = fishingActivityEntity.getFaCatchs().iterator().next();
assertNotNull(faCatchEntity);
assertFishingActivityFields(fishingActivity, faCatchEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getSourceVesselCharId());
assertFishingActivityFields(fishingActivity, fishingActivityEntity.getSourceVesselCharId().getFishingActivitiesForSourceVesselCharId());
assertNotNull(fishingActivityEntity.getDestVesselCharId());
assertFishingActivityFields(fishingActivity, fishingActivityEntity.getDestVesselCharId().getFishingActivitiesForDestVesselCharId());
assertNotNull(fishingActivityEntity.getDelimitedPeriods());
DelimitedPeriodEntity delimitedPeriodEntity = fishingActivityEntity.getDelimitedPeriods().iterator().next();
assertNotNull(delimitedPeriodEntity);
assertFishingActivityFields(fishingActivity, delimitedPeriodEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFluxCharacteristics());
FluxCharacteristicEntity fluxCharacteristicEntity = fishingActivityEntity.getFluxCharacteristics().iterator().next();
assertNotNull(fluxCharacteristicEntity);
assertFishingActivityFields(fishingActivity, fluxCharacteristicEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFluxLocations());
FluxLocationEntity fluxLocationEntity = fishingActivityEntity.getFluxLocations().iterator().next();
assertNotNull(fluxLocationEntity);
assertFishingActivityFields(fishingActivity, fluxLocationEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getAllRelatedFishingActivities());
FishingActivityEntity relatedFishingActivityEntity = fishingActivityEntity.getAllRelatedFishingActivities().iterator().next();
assertNotNull(relatedFishingActivityEntity);
assertFishingActivityFields(fishingActivity.getRelatedFishingActivities().get(0), relatedFishingActivityEntity);
assertNotNull(fishingActivityEntity.getFishingActivityIdentifiers());
FishingActivityIdentifierEntity fishingActivityIdentifierEntity = fishingActivityEntity.getFishingActivityIdentifiers().iterator().next();
assertNotNull(fishingActivityIdentifierEntity);
assertEquals(fishingActivity.getIDS().get(0).getValue(), fishingActivityIdentifierEntity.getFaIdentifierId());
assertEquals(fishingActivity.getIDS().get(0).getSchemeID(), fishingActivityIdentifierEntity.getFaIdentifierSchemeId());
assertFishingActivityFields(fishingActivity, fishingActivityIdentifierEntity.getFishingActivity());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapperTest method testMapToFishingActivityReportDTOList.
@Test
public void testMapToFishingActivityReportDTOList() {
FishingActivityEntity entity = MapperUtil.getFishingActivityEntity();
assertNotNull(entity);
// assertNotNull(FishingActivityMapper.INSTANCE.mapToFishingActivityReportDTO(entity));
}
Aggregations