use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJavaFlatMappingTest method testProcessXmlJavaBoxedFlatMappingPrimitiveAttribute.
@Test
public void testProcessXmlJavaBoxedFlatMappingPrimitiveAttribute() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-boxedflatprimitive-attribute.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-boxedflatprimitive-attribute.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetFlatPrimitiveClass);
validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlXmlFlatMappingTest method testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttributeNS.
@Test
public void testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttributeNS() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-boxedflatprimitive-elementToAttribute-ns.xml"));
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-boxedflatprimitive-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<XmlFlatBoxedPrimitiveAttribute> xmlFPE = AtlasXmlTestHelper.unmarshal((String) object, XmlFlatBoxedPrimitiveAttribute.class);
AtlasTestUtil.validateXmlFlatPrimitiveBoxedPrimitiveAttributeFields(xmlFPE.getValue());
}
use of io.atlasmap.api.AtlasContext 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.AtlasContext 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.AtlasContext 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);
}
Aggregations