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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations