Search in sources :

Example 36 with FishingActivityEntity

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);
}
Also used : HashMap(java.util.HashMap) Dataset(eu.europa.ec.fisheries.wsdl.user.types.Dataset) ArrayList(java.util.ArrayList) PaginationDto(eu.europa.ec.fisheries.uvms.commons.rest.dto.PaginationDto) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) FilterFishingActivityReportResultDTO(eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) ArrayList(java.util.ArrayList) List(java.util.List) AreaIdentifierType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 37 with FishingActivityEntity

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);
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 38 with FishingActivityEntity

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());
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FaReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 39 with FishingActivityEntity

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());
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 40 with FishingActivityEntity

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));
}
Also used : FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Aggregations

FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)45 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)14 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)11 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)9 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)8 CatchEvolutionProgressDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO)5 FishingActivityViewDTO (eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)5 SneakyThrows (lombok.SneakyThrows)5 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)5 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 HashMap (java.util.HashMap)4 Geometry (com.vividsolutions.jts.geom.Geometry)3 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)3 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)3 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)3 BaseActivityViewMapper (eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper)3 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)3 FishingActivitySummary (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary)3 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)3