Search in sources :

Example 1 with TargetAddress

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

the class JavaConstructServiceComplexArrayTest method testConstructTargetOrderArray.

@Test
public void testConstructTargetOrderArray() throws Exception {
    Object targetObject = constructService.constructClass(generateOrderArray("Target"), null);
    assertNotNull(targetObject);
    assertTrue(targetObject instanceof TargetOrderArray);
    TargetOrderArray orderArray = (TargetOrderArray) targetObject;
    for (int i = 0; i < orderArray.getOrders().length; i++) {
        TargetOrder order = (TargetOrder) orderArray.getOrders()[i];
        assertNotNull(order);
        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) TargetOrderArray(io.atlasmap.java.test.TargetOrderArray) Test(org.junit.Test)

Example 2 with TargetAddress

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

the class DocumentJavaFieldWriterTest method testSimpleWrite.

@Test
public void testSimpleWrite() throws Exception {
    addClassForFieldPath("/", TargetAddress.class);
    write(createField("/addressLine1", "1234 some street."));
    write(createField("/addressLine2", "po box wherever"));
    write(createField("/city", "Round Rock"));
    write(createField("/state", "VA"));
    write(createField("/zipCode", "12345-6789"));
    TargetAddress o = (TargetAddress) writer.getRootObject();
    ensureNotNullAndClass(o, TargetAddress.class);
    assertEquals("1234 some street.", o.getAddressLine1());
    assertEquals("po box wherever", o.getAddressLine2());
    assertEquals("Round Rock", o.getCity());
    assertEquals("VA", o.getState());
    assertEquals("12345-6789", o.getZipCode());
}
Also used : TargetAddress(io.atlasmap.java.test.TargetAddress) Test(org.junit.Test)

Example 3 with TargetAddress

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

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

Example 5 with TargetAddress

use of io.atlasmap.java.test.TargetAddress 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());
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass) TargetAddress(io.atlasmap.java.test.TargetAddress) TargetOrder(io.atlasmap.java.test.TargetOrder) Test(org.junit.Test)

Aggregations

TargetAddress (io.atlasmap.java.test.TargetAddress)10 TargetOrder (io.atlasmap.java.test.TargetOrder)9 Test (org.junit.Test)7 TargetContact (io.atlasmap.java.test.TargetContact)6 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)5 AtlasException (io.atlasmap.api.AtlasException)3 TargetTestClass (io.atlasmap.java.test.TargetTestClass)3 TestListOrders (io.atlasmap.java.test.TestListOrders)3 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)2 JavaClass (io.atlasmap.java.v2.JavaClass)2 BaseOrder (io.atlasmap.java.test.BaseOrder)1 StateEnumClassLong (io.atlasmap.java.test.StateEnumClassLong)1 TargetParentOrder (io.atlasmap.java.test.TargetParentOrder)1 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)1 JavaField (io.atlasmap.java.v2.JavaField)1 AtlasInternalSession (io.atlasmap.spi.AtlasInternalSession)1 Field (io.atlasmap.v2.Field)1 LookupTable (io.atlasmap.v2.LookupTable)1 LinkedList (java.util.LinkedList)1 Before (org.junit.Before)1