use of io.atlasmap.java.test.BaseAddress in project atlasmap by atlasmap.
the class AtlasTestUtil method generateAddress.
public static BaseAddress generateAddress(Class<? extends BaseAddress> addressClass) throws Exception {
Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(addressClass.getName());
BaseAddress newObject = (BaseAddress) targetClazz.newInstance();
newObject.setAddressLine1("123 Main St");
newObject.setAddressLine2("Suite 42b");
newObject.setCity("Anytown");
newObject.setState("NY");
newObject.setZipCode("90210");
return newObject;
}
use of io.atlasmap.java.test.BaseAddress in project atlasmap by atlasmap.
the class JavaJavaMultiSourceTest method testProcessBasic.
@Test
public void testProcessBasic() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-multisource-basic.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
BaseAddress sourceAddress = AtlasTestUtil.generateAddress(SourceAddress.class);
session.setSourceDocument("con", sourceContact);
session.setSourceDocument("addr", sourceAddress);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertEquals(TargetContact.class.getName(), object.getClass().getName());
TargetContact targetContact = (TargetContact) object;
assertEquals("Ozzie", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertEquals("90210", targetContact.getZipCode());
}
use of io.atlasmap.java.test.BaseAddress in project atlasmap by atlasmap.
the class AtlasTestUtil method generateAddress.
public static BaseAddress generateAddress(Class<? extends BaseAddress> addressClass) throws Exception {
Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(addressClass.getName());
BaseAddress newObject = (BaseAddress) targetClazz.newInstance();
newObject.setAddressLine1("123 Main St");
newObject.setAddressLine2("Suite 42b");
newObject.setCity("Anytown");
newObject.setState("NY");
newObject.setZipCode("90210");
return newObject;
}
use of io.atlasmap.java.test.BaseAddress in project atlasmap by atlasmap.
the class JavaJavaMultiSourceTest method testProcessComplex.
@Test
public void testProcessComplex() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-multisource-complex.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
BaseAddress sourceAddress = AtlasTestUtil.generateAddress(SourceAddress.class);
session.setSourceDocument("con", sourceContact);
session.setSourceDocument("addr", sourceAddress);
context.process(session);
assertFalse(printAudit(session), session.hasErrors());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertEquals(TargetOrder.class.getName(), object.getClass().getName());
TargetOrder targetOrder = (TargetOrder) object;
AtlasTestUtil.validateOrder(targetOrder);
}
Aggregations