use of no.difi.meldingsutveksling.noarkexchange.schema.ObjectFactory in project efm-integrasjonspunkt by felleslosninger.
the class WebsakPutMessageRequestMapperTest method tryMapper.
@Test
public void tryMapper() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), bos);
byte[] bytes = bos.toByteArray();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
StreamSource source = new StreamSource(new ByteArrayInputStream(bytes));
no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType value = unmarshaller.unmarshal(source, no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class).getValue();
System.out.println(value.getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.schema.ObjectFactory in project efm-integrasjonspunkt by felleslosninger.
the class P360PutMessageRequestMapperTest method mapFromEphortePutMessageToP360PutMessage.
@Disabled("Work in progress")
@Test
public void mapFromEphortePutMessageToP360PutMessage() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType p360Request = mapper.mapFrom(putMessageRequestType).getValue();
assertFalse(PayloadUtil.isEmpty(p360Request.getPayload()));
// assertTrue(p360Request.getPayload().contains("Melding"));
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), writer);
String xml = writer.toString();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
// System.out.println(xml);
no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType p360result = unmarshaller.unmarshal(new StringSource(xml), no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class).getValue();
System.out.println(p360result.getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.schema.ObjectFactory in project efm-integrasjonspunkt by felleslosninger.
the class WebsakPutMessageRequestMapperTest method mapFromEphortePutMessageToWebsakPutMessage.
@Test()
public void mapFromEphortePutMessageToWebsakPutMessage() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType websakRequest = mapper.mapFrom(putMessageRequestType).getValue();
assertFalse(PayloadUtil.isEmpty(websakRequest.getPayload()));
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), writer);
String xml = writer.toString();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType websakResult = unmarshaller.unmarshal(new StringSource(xml), no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class).getValue();
System.out.println(websakResult.getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.schema.ObjectFactory in project efm-integrasjonspunkt by felleslosninger.
the class P360PutMessageRequestMapperTest method tryMapper.
@Test
public void tryMapper() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), bos);
byte[] bytes = bos.toByteArray();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
StreamSource source = new StreamSource(new ByteArrayInputStream(bytes));
no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType value = unmarshaller.unmarshal(source, no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType.class).getValue();
System.out.println(value.getPayload());
}
Aggregations