use of un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxMessageServiceBeanTest method setUp.
@Before
public void setUp() {
FAReportDocument faReportDocument2 = MapperUtil.getFaReportDocument();
faReportDocument2.getRelatedFLUXReportDocument().setPurposeCode(MapperUtil.getCodeType("9", "4fyrh-58fj4-5jtu-58tjr"));
IDType id = faReportDocument2.getRelatedFLUXReportDocument().getReferencedID();
FAReportDocument faReportDocument1 = MapperUtil.getFaReportDocument();
faReportDocument1.getRelatedFLUXReportDocument().setIDS(Arrays.asList(id));
faReportDocument1.getRelatedFLUXReportDocument().setPurposeCode(MapperUtil.getCodeType("3", "4f5yrh-58f7j4-5j5tu-58tj7r"));
fluxFaReportMessage = new FLUXFAReportMessage();
faReportDocuments = Arrays.asList(faReportDocument1, faReportDocument2);
fluxFaReportMessage.setFAReportDocuments(faReportDocuments);
fluxFaReportMessage.setFLUXReportDocument(MapperUtil.getFluxReportDocument());
}
use of un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method getActivityDataFromXML.
private FLUXFAReportMessage getActivityDataFromXML() throws JAXBException {
InputStream is = this.getClass().getClassLoader().getResourceAsStream("fishingActivityViewMapperTest.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(FLUXFAReportMessage.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return (FLUXFAReportMessage) jaxbUnmarshaller.unmarshal(is);
}
use of un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method initFishingActivityEntity.
@Before
@SneakyThrows
public void initFishingActivityEntity() {
FLUXFAReportMessage fluxfaReportMessage = getActivityDataFromXML();
FluxFaReportMessageEntity fluxRepMessageEntity = new FluxFaReportMessageMapper().mapToFluxFaReportMessage(fluxfaReportMessage, FaReportSourceEnum.FLUX, new FluxFaReportMessageEntity());
List<FaReportDocumentEntity> faReportDocuments = new ArrayList<>(fluxRepMessageEntity.getFaReportDocuments());
fishingActivity = faReportDocuments.get(0).getFishingActivities().iterator().next();
}
use of un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxFaReportMessageMapperTest method testFluxFaReportMessageMapper.
@Test
@SneakyThrows
public void testFluxFaReportMessageMapper() {
InputStream is = this.getClass().getClassLoader().getResourceAsStream("fa_flux_message.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(FLUXFAReportMessage.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
FLUXFAReportMessage fluxfaReportMessage = (FLUXFAReportMessage) jaxbUnmarshaller.unmarshal(is);
FluxFaReportMessageEntity fluxRepMessageEntity = new FluxFaReportMessageMapper().mapToFluxFaReportMessage(fluxfaReportMessage, FaReportSourceEnum.FLUX, new FluxFaReportMessageEntity());
List<FaReportDocumentEntity> faReportDocuments = new ArrayList(fluxRepMessageEntity.getFaReportDocuments());
FluxReportDocumentEntity fluxReportDocument = fluxRepMessageEntity.getFluxReportDocument();
assertNotNull(fluxRepMessageEntity);
assertNotNull(fluxReportDocument);
assertNotNull(fluxReportDocument.getFluxFaReportMessage());
assertNotNull(faReportDocuments.get(0));
assertEquals(1, faReportDocuments.size());
}
use of un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapperTest method testMapToFLUXFAReportMessage.
@Test
@Parameters(method = "resources")
public void testMapToFLUXFAReportMessage(String resource) throws Exception {
FLUXFAReportMessage fluxfaReportMessage = sourceToEntity(resource);
FluxFaReportMessageEntity entity = incomingFAReportMapper.mapToFluxFaReportMessage(fluxfaReportMessage, FaReportSourceEnum.MANUAL, new FluxFaReportMessageEntity());
FLUXFAReportMessage target = modelMapper.mapToFLUXFAReportMessage(new ArrayList<>(entity.getFaReportDocuments()));
String controlSource = JAXBUtils.marshallJaxBObjectToString(getFirstElement(fluxfaReportMessage));
String testSource = JAXBUtils.marshallJaxBObjectToString(getFirstElement(target));
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(new org.custommonkey.xmlunit.Diff(clearEmptyTags(controlSource), clearEmptyTags(testSource)));
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue("XML are similar " + diff, diff.similar());
}
Aggregations