use of eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class DelimitedPeriodMapperTest method testDelimitedPeriodMapperForFishingTrip.
@Test
public void testDelimitedPeriodMapperForFishingTrip() {
DelimitedPeriod delimitedPeriod = MapperUtil.getDelimitedPeriod();
DelimitedPeriodEntity delimitedPeriodEntity = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod);
assertEquals(delimitedPeriod.getStartDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getStartDate());
assertEquals(delimitedPeriod.getEndDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getEndDate());
assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getDurationMeasure().getValue().intValue());
assertEquals(delimitedPeriod.getDurationMeasure().getUnitCode(), delimitedPeriodEntity.getDurationMeasure().getUnitCode());
assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getCalculatedDuration().intValue());
assertNull(delimitedPeriodEntity.getFishingTrip());
}
use of eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class DelimitedPeriodMapperTest method testDelimitedPeriodMapperForFishingActivity.
@Test
public void testDelimitedPeriodMapperForFishingActivity() {
DelimitedPeriod delimitedPeriod = MapperUtil.getDelimitedPeriod();
DelimitedPeriodEntity delimitedPeriodEntity = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod);
assertEquals(delimitedPeriod.getStartDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getStartDate());
assertEquals(delimitedPeriod.getEndDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getEndDate());
assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getDurationMeasure().getValue().intValue());
assertEquals(delimitedPeriod.getDurationMeasure().getUnitCode(), delimitedPeriodEntity.getDurationMeasure().getUnitCode());
assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getCalculatedDuration().intValue());
assertNull(delimitedPeriodEntity.getFishingActivity());
}
use of eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity 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());
}
Aggregations