use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JavaJavaCombineTest method testProcessCombineSimple.
@Test
public void testProcessCombineSimple() throws Exception {
AtlasSession session = processCombineMapping("src/test/resources/javaToJava/atlasmapping-combine-simple.xml", AtlasTestUtil.generateContact(SourceContact.class));
TargetContact targetContact = (TargetContact) session.getDefaultTargetDocument();
assertEquals("Ozzie Smith 5551212 81111", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertNull(targetContact.getZipCode());
assertFalse(session.hasErrors());
}
use of io.atlasmap.api.AtlasSession 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.AtlasSession 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.AtlasSession 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);
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JavaXmlCombineTest method testProcessCombineSimple.
@Test
public void testProcessCombineSimple() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToXml/atlasmapping-combine-simple.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
JAXBElement<XmlContactAttribute> targetContact = AtlasXmlTestHelper.unmarshal((String) object, XmlContactAttribute.class);
assertEquals("Ozzie Smith 5551212 81111", targetContact.getValue().getFirstName());
assertNull(targetContact.getValue().getLastName());
assertNull(targetContact.getValue().getPhoneNumber());
assertNull(targetContact.getValue().getZipCode());
assertFalse(session.hasErrors());
}
Aggregations