Search in sources :

Example 1 with FLUXFAReportMessage

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());
}
Also used : FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument) Before(org.junit.Before)

Example 2 with FLUXFAReportMessage

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);
}
Also used : FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 3 with FLUXFAReportMessage

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();
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) ArrayList(java.util.ArrayList) FluxFaReportMessageEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity) Before(org.junit.Before) SneakyThrows(lombok.SneakyThrows)

Example 4 with FLUXFAReportMessage

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());
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) FluxFaReportMessageEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 5 with FLUXFAReportMessage

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());
}
Also used : DetailedDiff(org.custommonkey.xmlunit.DetailedDiff) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) RecursiveElementNameAndTextQualifier(org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier) FluxFaReportMessageEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity) Parameters(junitparams.Parameters) Test(org.junit.Test)

Aggregations

FLUXFAReportMessage (un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage)10 Test (org.junit.Test)4 FluxFaReportMessageEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity)3 InputStream (java.io.InputStream)3 JAXBContext (javax.xml.bind.JAXBContext)3 Unmarshaller (javax.xml.bind.Unmarshaller)3 SneakyThrows (lombok.SneakyThrows)3 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)2 ArrayList (java.util.ArrayList)2 JMSException (javax.jms.JMSException)2 TextMessage (javax.jms.TextMessage)2 Before (org.junit.Before)2 FLUXFAQueryMessage (un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage)2 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)2 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)1 ActivityModuleException (eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)1 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)1 MapToSubscriptionRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.MapToSubscriptionRequest)1 SetFLUXFAReportOrQueryMessageRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.SetFLUXFAReportOrQueryMessageRequest)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1