use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectAttributeNS.
@Test
public void testProcessXmlJavaComplexOrderAutodetectAttributeNS() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-attribute-ns.xml").toURI());
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-attribute-ns.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
AtlasTestUtil.validateOrder((TargetOrder) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectElement.
@Test
public void testProcessXmlJavaComplexOrderAutodetectElement() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-element.xml").toURI());
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-element.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
AtlasTestUtil.validateOrder((TargetOrder) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectElementNS.
@Test
public void testProcessXmlJavaComplexOrderAutodetectElementNS() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-element-ns.xml").toURI());
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-element-ns.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
AtlasTestUtil.validateOrder((TargetOrder) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJsonAutoConversionTest method processXmlJsonFlatMappingAutoConversion.
protected void processXmlJsonFlatMappingAutoConversion(String mappingFile, String inputFile, int num) throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File(mappingFile).toURI());
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString(inputFile);
session.setDefaultSourceDocument(source);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
TargetFlatPrimitive targetObject = testMapper.readValue((String) object, TargetFlatPrimitive.class);
switch(num) {
case 1:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion1(targetObject);
break;
case 2:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion2(targetObject);
break;
case 3:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion3(targetObject);
break;
case 4:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion4(targetObject);
break;
case 5:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion5(targetObject);
break;
case 6:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion6(targetObject);
break;
case 7:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion7(targetObject);
break;
default:
fail("Unexpected number: " + num);
}
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class XmlJsonComplexTest method processXmlToJsonOrder.
protected void processXmlToJsonOrder(String mappingFile, String inputFile, boolean rooted) throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File(mappingFile).toURI());
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString(inputFile);
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
TargetOrder targetObject = null;
if (rooted) {
AtlasJsonTestRootedMapper testMapper = new AtlasJsonTestRootedMapper();
targetObject = testMapper.readValue((String) object, TargetOrder.class);
} else {
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
targetObject = testMapper.readValue((String) object, TargetOrder.class);
}
AtlasTestUtil.validateJsonOrder(targetObject);
}
Aggregations