Search in sources :

Example 6 with FishingActivityEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class TripCatchEvolutionTest method testFishingActivityCalculatedDateComparator.

@Test
public void testFishingActivityCalculatedDateComparator() {
    FishingActivityEntity fishingActivityEntity1 = new FishingActivityEntity();
    fishingActivityEntity1.setCalculatedStartTime(new Date(1000002));
    FishingActivityEntity fishingActivityEntity2 = new FishingActivityEntity();
    fishingActivityEntity2.setCalculatedStartTime(new Date(1000000));
    FishingActivityEntity fishingActivityEntity3 = new FishingActivityEntity();
    fishingActivityEntity3.setCalculatedStartTime(new Date(1000001));
    FishingActivityEntity fishingActivityEntity4 = new FishingActivityEntity();
    fishingActivityEntity4.setCalculatedStartTime(null);
    List<FishingActivityEntity> fishingActivities = Arrays.asList(fishingActivityEntity1, fishingActivityEntity2, fishingActivityEntity3, fishingActivityEntity4);
    Collections.sort(fishingActivities, new FishingActivityCalculatedDateComparator());
    Assert.assertEquals(fishingActivities.get(0).getCalculatedStartTime().getTime(), fishingActivityEntity2.getCalculatedStartTime().getTime());
    Assert.assertEquals(fishingActivities.get(2).getCalculatedStartTime().getTime(), fishingActivityEntity1.getCalculatedStartTime().getTime());
    Assert.assertEquals(fishingActivities.get(3).getCalculatedStartTime(), null);
}
Also used : FishingActivityCalculatedDateComparator(eu.europa.ec.fisheries.ers.service.facatch.evolution.FishingActivityCalculatedDateComparator) Date(java.util.Date) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 7 with FishingActivityEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FaReportDocumentMapperTest method testFaReportDocumentMapperNullReturns.

@Test
public void testFaReportDocumentMapperNullReturns() {
    Set<FishingActivityEntity> fishingActivityEntities = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
    assertTrue(fishingActivityEntities.size() == 0);
    Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = FaReportDocumentMapper.INSTANCE.getVesselTransportMeansEntity(null, new FaReportDocumentEntity());
    assertNull(vesselTransportMeansEntityList);
    Set<FishingActivityEntity> fishingActivityEntities1 = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
    assertTrue(fishingActivityEntities1.size() == 0);
    Set<FaReportIdentifierEntity> faReportIdentifierEntities = FaReportDocumentMapper.INSTANCE.mapToFAReportIdentifierEntities(null, new FaReportDocumentEntity());
    assertTrue(faReportIdentifierEntities.size() == 0);
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) FaReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 8 with FishingActivityEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapperTest method testSpeciesCodeWithNullShouldNotBeMapped.

@Test
public void testSpeciesCodeWithNullShouldNotBeMapped() {
    FaCatchEntity faCatchEntity = new FaCatchEntity();
    faCatchEntity.setSpeciesCode(null);
    FishingActivityEntity fa = FishingActivityEntity.builder().build();
    fa.setFaCatchs(newSet(faCatchEntity));
    List<String> speciesCode = FishingActivityMapper.INSTANCE.getSpeciesCode(fa);
    assertEquals(0, speciesCode.size());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 9 with FishingActivityEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapperTest method testSpeciesCodeWithDuplicatedShouldFilterDuplicates.

@Test
public void testSpeciesCodeWithDuplicatedShouldFilterDuplicates() {
    FaCatchEntity faCatchEntity = new FaCatchEntity();
    faCatchEntity.setSpeciesCode("2222");
    AapProductEntity aapProductEntity = new AapProductEntity();
    aapProductEntity.setSpeciesCode("2222");
    AapProcessEntity aapProcessEntity = new AapProcessEntity();
    aapProcessEntity.setAapProducts(newSet(aapProductEntity));
    faCatchEntity.setAapProcesses(newSet(aapProcessEntity));
    FishingActivityEntity fa = FishingActivityEntity.builder().build();
    fa.setFaCatchs(newSet(faCatchEntity));
    List<String> speciesCode = FishingActivityMapper.INSTANCE.getSpeciesCode(fa);
    assertEquals(1, speciesCode.size());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 10 with FishingActivityEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityViewMapperTest method testActivityRelocationViewMapper.

@Test
@SneakyThrows
public void testActivityRelocationViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.RELOCATION);
    FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
    Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
    fishingActivityEntity.setFaCatchs(faCatches);
    FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
    assertNotNull(fishingActivityViewDTO.getActivityDetails());
    assertNotNull(fishingActivityViewDTO.getReportDetails());
    assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) BaseActivityViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

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