use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class JavaJavaCollectionTest method testProcessCollectionArray.
@Test
public void testProcessCollectionArray() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-collection-array.xml").toURI());
AtlasSession session = context.createSession();
BaseOrder sourceOrder = AtlasTestUtil.generateOrderClass(SourceOrder.class, SourceAddress.class, SourceContact.class);
session.setDefaultSourceDocument(sourceOrder);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
TargetTestClass object = (TargetTestClass) session.getDefaultTargetDocument();
assertEquals(TargetTestClass.class.getName(), object.getClass().getName());
assertEquals(20, object.getContactArray().length);
for (int i = 0; i < 20; i++) {
TargetContact contact = object.getContactArray()[i];
if (i == 6 || i == 19) {
assertEquals("Ozzie", contact.getFirstName());
} else {
assertNull(contact);
}
}
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class JavaJavaCombineTest method processCombineMapping.
protected AtlasSession processCombineMapping(String mappingFile, BaseContact sourceContact) throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File(mappingFile).toURI());
AtlasSession session = context.createSession();
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertEquals(TargetContact.class.getName(), object.getClass().getName());
return session;
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class JavaJavaComplexListTest method testProcessJavaJavaComplexAutoDetectFullTest.
@Test
@Ignore("https://github.com/atlasmap/atlasmap-runtime/issues/229 - Allow default implementation for abstract target field")
public void testProcessJavaJavaComplexAutoDetectFullTest() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-list-autodetect-full.xml"));
AtlasSession session = context.createSession();
BaseOrderList sourceOrderList = AtlasTestUtil.generateOrderListClass(SourceOrderList.class, SourceOrder.class, SourceAddress.class, SourceContact.class);
session.setDefaultSourceDocument(sourceOrderList);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrderList);
AtlasTestUtil.validateOrderList((TargetOrderList) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class JsonJavaFlatMappingTest method testProcessJsonJavaFlatPrimitiveRooted.
@Test
public void testProcessJsonJavaFlatPrimitiveRooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJava/atlasmapping-flatprimitive-rooted.xml"));
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJava/atlas-json-flatprimitive-rooted.json");
session.setDefaultSourceDocument(source);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetFlatPrimitiveClass);
validateFlatPrimitiveClassPrimitiveFields((TargetFlatPrimitiveClass) object);
}
use of io.atlasmap.api.AtlasContext in project atlasmap by atlasmap.
the class JsonJavaFlatMappingTest method testProcessJsonJavaBoxedFlatMappingPrimitiveRooted.
@Test
public void testProcessJsonJavaBoxedFlatMappingPrimitiveRooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJava/atlasmapping-boxedflatprimitive-rooted.xml"));
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJava/atlas-json-boxedflatprimitive-rooted.json");
session.setDefaultSourceDocument(source);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetFlatPrimitiveClass);
validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
Aggregations