Search in sources :

Example 6 with TargetOrder

use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.

the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectAttributeNS.

@Test
public void testProcessXmlJavaComplexOrderAutodetectAttributeNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-attribute-ns.xml").toURI());
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-attribute-ns.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetOrder);
    AtlasTestUtil.validateOrder((TargetOrder) object);
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) TargetOrder(io.atlasmap.java.test.TargetOrder) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 7 with TargetOrder

use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.

the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectElement.

@Test
public void testProcessXmlJavaComplexOrderAutodetectElement() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-element.xml").toURI());
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-element.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetOrder);
    AtlasTestUtil.validateOrder((TargetOrder) object);
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) TargetOrder(io.atlasmap.java.test.TargetOrder) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 8 with TargetOrder

use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.

the class XmlJavaComplexTest method testProcessXmlJavaComplexOrderAutodetectElementNS.

@Test
public void testProcessXmlJavaComplexOrderAutodetectElementNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-complex-order-autodetect-element-ns.xml").toURI());
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-complex-order-autodetect-element-ns.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetOrder);
    AtlasTestUtil.validateOrder((TargetOrder) object);
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) TargetOrder(io.atlasmap.java.test.TargetOrder) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 9 with TargetOrder

use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.

the class JavaConstructServiceComplexTest method testConstructTargetParentOrder.

@Test
public void testConstructTargetParentOrder() throws Exception {
    JavaClass javaClass = generateParentOrder("Target");
    Object targetObject = constructService.constructClass(javaClass, null);
    assertNotNull(targetObject);
    assertTrue(targetObject instanceof TargetParentOrder);
    TargetParentOrder parentOrder = (TargetParentOrder) targetObject;
    assertNotNull(parentOrder.getOrder());
    TargetOrder order = (TargetOrder) parentOrder.getOrder();
    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());
    assertNotNull(order.getContact());
    assertTrue(order.getContact() instanceof TargetContact);
    TargetContact contact = (TargetContact) order.getContact();
    assertNull(contact.getFirstName());
    assertNull(contact.getLastName());
    assertNull(contact.getPhoneNumber());
    assertNull(contact.getZipCode());
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass) TargetContact(io.atlasmap.java.test.TargetContact) TargetAddress(io.atlasmap.java.test.TargetAddress) TargetOrder(io.atlasmap.java.test.TargetOrder) TargetParentOrder(io.atlasmap.java.test.TargetParentOrder) Test(org.junit.Test)

Example 10 with TargetOrder

use of io.atlasmap.java.test.TargetOrder in project atlasmap by atlasmap.

the class JavaConstructServiceComplexTest method testConstructTargetOrder.

@Test
public void testConstructTargetOrder() throws Exception {
    Object targetObject = constructService.constructClass(generateOrder("Target"), null);
    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());
    assertNotNull(order.getContact());
    assertTrue(order.getContact() instanceof TargetContact);
    TargetContact contact = (TargetContact) order.getContact();
    assertNull(contact.getFirstName());
    assertNull(contact.getLastName());
    assertNull(contact.getPhoneNumber());
    assertNull(contact.getZipCode());
}
Also used : TargetContact(io.atlasmap.java.test.TargetContact) TargetAddress(io.atlasmap.java.test.TargetAddress) TargetOrder(io.atlasmap.java.test.TargetOrder) Test(org.junit.Test)

Aggregations

TargetOrder (io.atlasmap.java.test.TargetOrder)24 Test (org.junit.Test)21 AtlasContext (io.atlasmap.api.AtlasContext)11 AtlasSession (io.atlasmap.api.AtlasSession)11 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)11 File (java.io.File)11 TargetAddress (io.atlasmap.java.test.TargetAddress)10 TargetContact (io.atlasmap.java.test.TargetContact)7 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)7 BaseOrder (io.atlasmap.java.test.BaseOrder)6 TargetTestClass (io.atlasmap.java.test.TargetTestClass)4 TestListOrders (io.atlasmap.java.test.TestListOrders)4 AtlasException (io.atlasmap.api.AtlasException)3 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)2 JavaClass (io.atlasmap.java.v2.JavaClass)2 JavaField (io.atlasmap.java.v2.JavaField)2 BaseAddress (io.atlasmap.java.test.BaseAddress)1 BaseContact (io.atlasmap.java.test.BaseContact)1 StateEnumClassLong (io.atlasmap.java.test.StateEnumClassLong)1 TargetParentOrder (io.atlasmap.java.test.TargetParentOrder)1