use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class DocumentJavaFieldWriterTest method testSimpleClassLookup.
@Test
public void testSimpleClassLookup() throws Exception {
addClassForFieldPath("/", TargetTestClass.class);
addClassForFieldPath("/address", TargetAddress.class);
write("/address/addressLine1", "123 any street");
TargetTestClass o = (TargetTestClass) writer.getRootObject();
ensureNotNullAndClass(o, TargetTestClass.class);
ensureNotNullAndClass(o.getAddress(), TargetAddress.class);
assertEquals("123 any street", o.getAddress().getAddressLine1());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class DocumentJavaFieldWriterTest method testClassLookupReflection.
@Test
public void testClassLookupReflection() throws Exception {
addClassForFieldPath("/", TargetTestClass.class);
write("/address/addressLine1", "123 any street");
TargetTestClass o = (TargetTestClass) writer.getRootObject();
ensureNotNullAndClass(o, TargetTestClass.class);
ensureNotNullAndClass(o.getAddress(), TargetAddress.class);
assertEquals("123 any street", o.getAddress().getAddressLine1());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaJavaComplexTest method testProcessComplexBasicNullContact.
@Test
public void testProcessComplexBasicNullContact() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-simple.xml").toURI());
AtlasSession session = context.createSession();
BaseOrder sourceOrder = AtlasTestUtil.generateOrderClass(SourceOrder.class, SourceAddress.class, SourceContact.class);
sourceOrder.setContact(null);
session.setDefaultSourceDocument(sourceOrder);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
TargetTestClass object = (TargetTestClass) session.getDefaultTargetDocument();
assertEquals(TargetTestClass.class.getName(), object.getClass().getName());
assertEquals(TargetContact.class.getName(), object.getContact().getClass().getName());
assertNull(object.getContact().getFirstName());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaJavaComplexTest method testProcessComplexBasic.
@Test
public void testProcessComplexBasic() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-simple.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(TargetContact.class.getName(), object.getContact().getClass().getName());
assertEquals("Ozzie", object.getContact().getFirstName());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaJavaCollectionTest method testProcessCollectionList.
@Test
public void testProcessCollectionList() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-collection-list.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.getContactList().size());
for (int i = 0; i < 20; i++) {
TargetContact contact = object.getContactList().get(i);
if (i == 4 || i == 19) {
assertEquals("Ozzie", contact.getFirstName());
} else {
assertNull(contact);
}
}
}
Aggregations