use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityDepartureViewMapper.
@Test
@SneakyThrows
public void testActivityDepartureViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.DEPARTURE);
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));
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityJointFishingOperationViewMapper.
@Test
@SneakyThrows
public void testActivityJointFishingOperationViewMapper() {
FishingActivity fishingActivity = getFishingActivity();
FishingActivityEntity fishingActivityEntity = FishingActivityMapper.INSTANCE.mapToFishingActivityEntity(fishingActivity, null, new FishingActivityEntity());
fishingActivityEntity.setTypeCode("JOINT_FISHING_OPERATION");
fishingActivityEntity.getAllRelatedFishingActivities().iterator().next().setTypeCode("RELOCATION");
JointFishingOperationViewMapper mapper = new JointFishingOperationViewMapper();
FishingActivityViewDTO dto = mapper.mapFaEntityToFaDto(fishingActivityEntity);
assertNotNull(dto);
assertNotNull(dto.getActivityDetails());
assertNotNull(dto.getCatches());
assertNotNull(dto.getGears());
assertNotNull(dto.getGearProblems());
assertNotNull(dto.getVesselDetails());
assertNotNull(dto.getRelocations());
assertNotNull(dto.getProcessingProducts());
assertNotNull(dto.getLocations());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityLandingViewMapper.
@Test
@SneakyThrows
public void testActivityLandingViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.LANDING);
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));
// printDtoOnConsole(fishingActivityViewDTO, FishingActivityView.Landing.class);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseActivityViewMapperTest method testGetAreas.
@Test
public void testGetAreas() {
FishingActivityEntity entity = new FishingActivityEntity();
FluxLocationEntity fluxLocationEntity = new FluxLocationEntity();
fluxLocationEntity.setFluxLocationIdentifier("id");
fluxLocationEntity.setFluxLocationIdentifierSchemeId("schemeId");
fluxLocationEntity.setTypeCode("AREA");
entity.setFluxLocations(Collections.set(fluxLocationEntity));
AreaDto areas = BaseActivityViewMapper.getAreas(entity);
Map<String, String> stringMap = new HashMap<>();
stringMap.put("id", "id");
stringMap.put("schemeId", "schemeId");
assertEquals(stringMap, areas.getIdentifiers());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripIdSearchBuilder method getFishingActivitySummary.
private FishingActivitySummary getFishingActivitySummary(Set<Integer> uniqueFishingActivityIdList, FishingTripEntity entity) {
FishingActivitySummary fishingActivitySummary = null;
FishingActivityEntity fishingActivityEntity = entity.getFishingActivity();
if (fishingActivityEntity != null && uniqueFishingActivityIdList.add(fishingActivityEntity.getId())) {
fishingActivitySummary = FishingActivityMapper.INSTANCE.mapToFishingActivitySummary(entity.getFishingActivity());
ContactPartyEntity contactParty = getContactParty(fishingActivityEntity);
if (contactParty != null) {
VesselContactPartyType vesselContactParty = FishingActivityMapper.INSTANCE.mapToVesselContactParty(contactParty);
fishingActivitySummary.setVesselContactParty(vesselContactParty);
}
}
return fishingActivitySummary;
}
Aggregations