use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.
the class JavaConstructServiceComplexTest method testConstructTargetOrderFiltered.
@Test
public void testConstructTargetOrderFiltered() throws Exception {
JavaClass javaClass = generateOrder("Target");
Object targetObject = constructService.constructClass(javaClass, Arrays.asList("address"));
assertNotNull(targetObject);
assertTrue(targetObject instanceof TargetOrder);
TargetOrder order = (TargetOrder) targetObject;
assertNotNull(order.getAddress());
assertTrue(order.getAddress() instanceof TargetAddress);
TargetAddress address = (TargetAddress) order.getAddress();
assertNull(address.getAddressLine1());
assertNull(address.getAddressLine2());
assertNull(address.getCity());
assertNull(address.getState());
assertNull(address.getZipCode());
assertNull(order.getContact());
}
use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.
the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectAttribute.
@Test
public void testProcessXmlJavaComplexOrderAutodetectAttribute() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-attribute.xml").toURI());
AtlasSession session = context.createSession();
String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-attribute.xml");
session.setDefaultSourceDocument(sourceXml);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
AtlasTestUtil.validateOrder((TargetOrder) object);
}
use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.
the class JavaJavaComplexTest method testProcessJavaJavaComplexAutoDetectFull.
@Test
public void testProcessJavaJavaComplexAutoDetectFull() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-autodetect-full.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());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
AtlasTestUtil.validateOrder((TargetOrder) object);
}
use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.
the class JavaJavaComplexTest method testProcessJavaJavaComplexWithAbstractBasic.
@Test
public void testProcessJavaJavaComplexWithAbstractBasic() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-abstract.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());
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetOrder);
TargetOrder targetOrder = (TargetOrder) object;
assertNotNull(targetOrder.getOrderId());
assertEquals(new Integer(8765309), targetOrder.getOrderId());
// Address should _not_ be populated
assertNull(targetOrder.getAddress());
// Contact should only have firstName populated
assertNotNull(targetOrder.getContact());
assertTrue(targetOrder.getContact() instanceof TargetContact);
TargetContact targetContact = (TargetContact) targetOrder.getContact();
assertNotNull(targetContact.getFirstName());
assertEquals("Ozzie", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertNull(targetContact.getZipCode());
}
use of io.atlasmap.java.test.TargetOrder 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