Search in sources :

Example 11 with TargetContact

use of io.atlasmap.java.test.TargetContact 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());
}
Also used : TargetContact(io.atlasmap.java.test.TargetContact) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 12 with TargetContact

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

the class XmlJavaCombineTest method testProcessCombineSkip.

@Test
public void testProcessCombineSkip() throws Exception {
    AtlasSession session = processCombineMapping("src/test/resources/xmlToJava/atlasmapping-combine-skip.xml", new String(Files.readAllBytes(Paths.get("src/test/resources/xmlToJava/atlas-xml-combine.xml"))));
    TargetContact targetContact = (TargetContact) session.getDefaultTargetDocument();
    assertEquals("Ozzie Smith 5551212 81111", targetContact.getFirstName());
    assertNull(targetContact.getLastName());
    assertNull(targetContact.getPhoneNumber());
    assertNull(targetContact.getZipCode());
    assertFalse(session.hasErrors());
}
Also used : TargetContact(io.atlasmap.java.test.TargetContact) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 13 with TargetContact

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

the class XmlJavaCombineTest method testProcessCombineSimple.

@Test
public void testProcessCombineSimple() throws Exception {
    AtlasSession session = processCombineMapping("src/test/resources/xmlToJava/atlasmapping-combine-simple.xml", new String(Files.readAllBytes(Paths.get("src/test/resources/xmlToJava/atlas-xml-combine.xml"))));
    TargetContact targetContact = (TargetContact) session.getDefaultTargetDocument();
    assertEquals("Ozzie    Smith   5551212                                                                                            81111", targetContact.getFirstName());
    assertNull(targetContact.getLastName());
    assertNull(targetContact.getPhoneNumber());
    assertNull(targetContact.getZipCode());
    assertFalse(session.hasErrors());
}
Also used : TargetContact(io.atlasmap.java.test.TargetContact) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 14 with TargetContact

use of io.atlasmap.java.test.TargetContact 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 15 with TargetContact

use of io.atlasmap.java.test.TargetContact 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

TargetContact (io.atlasmap.java.test.TargetContact)32 Test (org.junit.Test)30 AtlasSession (io.atlasmap.api.AtlasSession)25 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)25 AtlasContext (io.atlasmap.api.AtlasContext)13 File (java.io.File)13 TargetTestClass (io.atlasmap.java.test.TargetTestClass)8 BaseContact (io.atlasmap.java.test.BaseContact)7 TargetOrder (io.atlasmap.java.test.TargetOrder)7 TargetAddress (io.atlasmap.java.test.TargetAddress)6 BaseOrder (io.atlasmap.java.test.BaseOrder)4 SourceContact (io.atlasmap.java.test.SourceContact)4 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)3 AtlasException (io.atlasmap.api.AtlasException)2 TestListOrders (io.atlasmap.java.test.TestListOrders)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 BaseAddress (io.atlasmap.java.test.BaseAddress)1 StateEnumClassLong (io.atlasmap.java.test.StateEnumClassLong)1 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)1