use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlFlatPrimitiveAttributeToElementNoMappedBoxedFieldsNS.
@Test
public void testProcessXmlXmlFlatPrimitiveAttributeToElementNoMappedBoxedFieldsNS() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-flatprimitive-attributeToElement-noboxed-ns.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-flatprimitive-attribute-ns.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
JAXBElement<XmlFlatPrimitiveElement> xmlFPE = AtlasXmlTestHelper.unmarshal((String) object, XmlFlatPrimitiveElement.class);
AtlasTestUtil.validateXmlFlatPrimitiveElement(xmlFPE.getValue());
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlFlatPrimitiveAttributeToElement.
@Test
public void testProcessXmlXmlFlatPrimitiveAttributeToElement() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-flatprimitive-attributeToElement.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-flatprimitive-attribute.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><XmlFPE><intField>2</intField><shortField>1</shortField><longField>30000</longField><doubleField>50000000.0</doubleField><floatField>40000000.0</floatField><booleanField>false</booleanField><charField>a</charField><byteField>99</byteField><boxedBooleanField/><boxedByteField/><boxedCharField/><boxedDoubleField/><boxedFloatField/><boxedIntField/><boxedLongField/><boxedStringField/></XmlFPE>", object);
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlFlatPrimitiveElementToAttributeNoBoxed.
@Test
public void testProcessXmlXmlFlatPrimitiveElementToAttributeNoBoxed() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-flatprimitive-elementToAttribute-noboxed.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-flatprimitive-element.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><XmlFPA booleanField=\"false\" byteField=\"99\" charField=\"a\" doubleField=\"50000000.0\" floatField=\"40000000.0\" intField=\"2\" longField=\"30000\" shortField=\"1\"/>", object);
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlFlatPrimitiveElementToAtributeNoMappedBoxedFieldsNS.
@Test
public void testProcessXmlXmlFlatPrimitiveElementToAtributeNoMappedBoxedFieldsNS() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-flatprimitive-elementToAttribute-noboxed-ns.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-flatprimitive-element-ns.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
JAXBElement<XmlFlatPrimitiveAttribute> xmlFPA = AtlasXmlTestHelper.unmarshal((String) object, XmlFlatPrimitiveAttribute.class);
AtlasTestUtil.validateXmlFlatPrimitiveAttribute(xmlFPA.getValue());
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttribute.
@Test
public void testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttribute() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-boxedflatprimitive-elementToAttribute.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-boxedflatprimitive-element.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><XmlFBPA boxedBooleanField=\"true\" boxedByteField=\"87\" boxedCharField=\"z\" boxedDoubleField=\"90000000.0\" boxedFloatField=\"70000000.0\" boxedIntField=\"5\" boxedLongField=\"20000\" boxedShortField=\"5\"/>", object);
}
Aggregations