use of io.atlasmap.json.test.TargetOrder in project atlasmap by atlasmap.
the class JsonJsonComplexTest method testProcessJsonJsonComplexOrderAutodetectUnrooted.
@Test
public void testProcessJsonJsonComplexOrderAutodetectUnrooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJson/atlasmapping-complex-order-autodetect-unrooted.xml").toURI());
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJson/atlas-json-complex-order-autodetect-unrooted.json");
session.setDefaultSourceDocument(source);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
TargetOrder targetObject = testMapper.readValue((String) object, TargetOrder.class);
AtlasTestUtil.validateJsonOrder(targetObject);
}
use of io.atlasmap.json.test.TargetOrder 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);
}
use of io.atlasmap.json.test.TargetOrder in project atlasmap by atlasmap.
the class JsonJsonMultiSourceTest method testProcessComplex.
@Test
public void testProcessComplex() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJson/atlasmapping-multisource-complex.xml").toURI());
AtlasSession session = context.createSession();
String sourceContact = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJson/atlas-json-contact-unrooted.json");
String sourceAddress = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJson/atlas-json-address-unrooted.json");
session.setSourceDocument("con", sourceContact);
session.setSourceDocument("addr", sourceAddress);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
TargetOrder targetOrder = testMapper.readValue((String) object, TargetOrder.class);
AtlasTestUtil.validateJsonOrder(targetOrder);
}
use of io.atlasmap.json.test.TargetOrder in project atlasmap by atlasmap.
the class JsonJsonComplexTest method testProcessJsonJsonComplexOrderAutodetectRooted.
@Test
public void testProcessJsonJsonComplexOrderAutodetectRooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJson/atlasmapping-complex-order-autodetect-rooted.xml").toURI());
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJson/atlas-json-complex-order-autodetect-rooted.json");
session.setDefaultSourceDocument(source);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestRootedMapper testMapper = new AtlasJsonTestRootedMapper();
TargetOrder targetObject = testMapper.readValue((String) object, TargetOrder.class);
AtlasTestUtil.validateJsonOrder(targetObject);
}
Aggregations