use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JavaXmlCombineTest method testProcessCombineOutOfOrder.
@Test
public void testProcessCombineOutOfOrder() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToXml/atlasmapping-combine-outoforder.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());
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JavaXmlSeparateTest method testProcessSeparateSkip.
@Test
public void testProcessSeparateSkip() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToXml/atlasmapping-separate-skip.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
sourceContact.setFirstName("Dr. Mr. Ozzie L. Smith Jr.");
sourceContact.setLastName(null);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
JAXBElement<XmlContactAttribute> targetContact = AtlasXmlTestHelper.unmarshal((String) object, XmlContactAttribute.class);
AtlasTestUtil.validateXmlContactAttribute(targetContact.getValue());
assertFalse(session.hasErrors());
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JavaXmlSeparateTest method testProcessSeparateOutOfOrder.
@Test
public void testProcessSeparateOutOfOrder() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToXml/atlasmapping-separate-outoforder.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
sourceContact.setFirstName("Dr. Mr. Ozzie L. Smith Jr.");
sourceContact.setLastName(null);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
JAXBElement<XmlContactAttribute> targetContact = AtlasXmlTestHelper.unmarshal((String) object, XmlContactAttribute.class);
AtlasTestUtil.validateXmlContactAttribute(targetContact.getValue());
assertFalse(session.hasErrors());
}
use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.
the class JsonJavaCombineTest method testProcessCombineSimple.
@Test
public void testProcessCombineSimple() throws Exception {
AtlasSession session = processCombineMapping("src/test/resources/jsonToJava/atlasmapping-combine-simple.xml", new String(Files.readAllBytes(Paths.get("src/test/resources/jsonToJava/atlas-json-combine.json"))));
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 JsonJavaCombineTest method testProcessCombineSkip.
@Test
public void testProcessCombineSkip() throws Exception {
AtlasSession session = processCombineMapping("src/test/resources/jsonToJava/atlasmapping-combine-skip.xml", new String(Files.readAllBytes(Paths.get("src/test/resources/jsonToJava/atlas-json-combine.json"))));
TargetContact targetContact = (TargetContact) session.getDefaultTargetDocument();
assertEquals("Ozzie Smith 5551212 81111", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertNull(targetContact.getZipCode());
assertFalse(session.hasErrors());
}
Aggregations