Search in sources :

Example 11 with FluxLocationEntity

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

the class BaseMapperTest method testMapFluxLocations.

@Test
@SneakyThrows
public void testMapFluxLocations() {
    FluxLocationEntity entity1 = new FluxLocationEntity();
    entity1.setTypeCode("LOCATION");
    entity1.setRfmoCode("RFMO1");
    FluxLocationEntity entity2 = new FluxLocationEntity();
    entity2.setTypeCode("DUMMY");
    entity2.setRfmoCode("RFMO2");
    Set<FluxLocationDto> fluxLocationDtos = BaseMapper.mapFromFluxLocation(newSet(entity1, entity2), FluxLocationEnum.LOCATION);
    assertEquals(1, fluxLocationDtos.size());
    assertEquals("RFMO1", fluxLocationDtos.iterator().next().getRfmoCode());
}
Also used : FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) BaseUnitilsTest(eu.europa.ec.fisheries.uvms.BaseUnitilsTest) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 12 with FluxLocationEntity

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

the class BaseMapperTest method testMapFromFluxLocation.

@Test
public void testMapFromFluxLocation() {
    FluxLocationEntity locationEntity_1 = FluxLocationEntity.builder().fluxLocationIdentifier("id1").fluxLocationIdentifierSchemeId("scheme1").build();
    FluxLocationEntity locationEntity_2 = FluxLocationEntity.builder().fluxLocationIdentifier("id1").fluxLocationIdentifierSchemeId("scheme1").build();
    HashSet<FluxLocationEntity> fluxLocationEntities = Sets.newHashSet(locationEntity_1, locationEntity_2);
    assertEquals(1, fluxLocationEntities.size());
    Set<FluxLocationDto> fluxLocationDtos = BaseMapper.mapFromFluxLocation(fluxLocationEntities);
    assertEquals(1, fluxLocationDtos.size());
}
Also used : FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) BaseUnitilsTest(eu.europa.ec.fisheries.uvms.BaseUnitilsTest) Test(org.junit.Test)

Example 13 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity 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 14 with FluxLocationEntity

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

the class FluxLocationMapperTest method testFluxLocationMapper.

@Test
public void testFluxLocationMapper() {
    FLUXLocation fluxLocation = MapperUtil.getFluxLocation();
    FluxLocationEntity fluxLocationEntity = FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(fluxLocation);
    assertEquals(fluxLocation.getTypeCode().getListID(), fluxLocationEntity.getTypeCodeListId());
    assertEquals(fluxLocation.getTypeCode().getValue(), fluxLocationEntity.getTypeCode());
    assertEquals(fluxLocation.getCountryID().getValue(), fluxLocationEntity.getCountryId());
    assertEquals(fluxLocation.getCountryID().getSchemeID(), fluxLocationEntity.getCountryIdSchemeId());
    assertEquals(fluxLocation.getRegionalFisheriesManagementOrganizationCode().getValue(), fluxLocationEntity.getRfmoCode());
    assertEquals(fluxLocation.getSpecifiedPhysicalFLUXGeographicalCoordinate().getLongitudeMeasure().getValue().intValue(), fluxLocationEntity.getLongitude().intValue());
    assertEquals(fluxLocation.getSpecifiedPhysicalFLUXGeographicalCoordinate().getLatitudeMeasure().getValue().intValue(), fluxLocationEntity.getLatitude().intValue());
    assertEquals(fluxLocation.getSpecifiedPhysicalFLUXGeographicalCoordinate().getAltitudeMeasure().getValue().intValue(), fluxLocationEntity.getAltitude().intValue());
    assertEquals(fluxLocation.getSpecifiedPhysicalFLUXGeographicalCoordinate().getSystemID().getValue(), fluxLocationEntity.getSystemId());
    assertEquals(fluxLocation.getID().getValue(), fluxLocationEntity.getFluxLocationIdentifier());
    assertEquals(fluxLocation.getID().getSchemeID(), fluxLocationEntity.getFluxLocationIdentifierSchemeId());
    assertEquals(fluxLocation.getGeopoliticalRegionCode().getValue(), fluxLocationEntity.getGeopoliticalRegionCode());
    assertEquals(fluxLocation.getGeopoliticalRegionCode().getListID(), fluxLocationEntity.getGeopoliticalRegionCodeListId());
    assertTrue(fluxLocationEntity.getName().startsWith(fluxLocation.getNames().get(0).getValue()));
    assertEquals(fluxLocation.getSovereignRightsCountryID().getValue(), fluxLocationEntity.getSovereignRightsCountryCode());
    assertEquals(fluxLocation.getJurisdictionCountryID().getValue(), fluxLocationEntity.getJurisdictionCountryCode());
    assertNull(fluxLocationEntity.getFishingActivity());
}
Also used : FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 15 with FluxLocationEntity

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

the class FluxLocationMapperTest method mapToFluxLocationDTOTest.

@Test
public void mapToFluxLocationDTOTest() {
    FluxLocationEntity fluxLocationEntity = getFluxLocationEntityMock();
    FluxLocationDto locationDto = FluxLocationMapper.INSTANCE.mapEntityToFluxLocationDto(fluxLocationEntity);
    assertNotNull(locationDto);
}
Also used : FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Aggregations

FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)16 Test (org.junit.Test)7 HashSet (java.util.HashSet)5 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)5 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)4 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)3 ArrayList (java.util.ArrayList)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2 BaseUnitilsTest (eu.europa.ec.fisheries.uvms.BaseUnitilsTest)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)1 FluxLocationCatchTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.FluxLocationCatchTypeEnum)1 DestinationLocationDto (eu.europa.ec.fisheries.ers.service.dto.facatch.DestinationLocationDto)1