Search in sources :

Example 1 with BaseOrderList

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

the class AtlasTestUtil method generateOrderListClass.

public static BaseOrderList generateOrderListClass(Class<? extends BaseOrderList> orderListClazz, Class<? extends BaseOrder> orderClazz, Class<? extends BaseAddress> addressClazz, Class<? extends BaseContact> contactClazz) throws Exception {
    Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(orderListClazz.getName());
    BaseOrderList orderList = (BaseOrderList) targetClazz.newInstance();
    orderList.setNumberOrders(5);
    orderList.setOrderBatchNumber(4123562);
    for (int i = 0; i < 5; i++) {
        BaseOrder baseOrder = generateOrderClass(orderClazz, addressClazz, contactClazz);
        baseOrder.setOrderId(i);
        if (orderList.getOrders() == null) {
            orderList.setOrders(new ArrayList<BaseOrder>());
        }
        orderList.getOrders().add(baseOrder);
    }
    return orderList;
}
Also used : BaseOrder(io.atlasmap.java.test.BaseOrder) BaseOrderList(io.atlasmap.java.test.BaseOrderList)

Example 2 with BaseOrderList

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

the class JavaJavaComplexListTest method testProcessJavaJavaComplexAutoDetectFullTest.

@Test
@Ignore("https://github.com/atlasmap/atlasmap-runtime/issues/229 - Allow default implementation for abstract target field")
public void testProcessJavaJavaComplexAutoDetectFullTest() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-list-autodetect-full.xml"));
    AtlasSession session = context.createSession();
    BaseOrderList sourceOrderList = AtlasTestUtil.generateOrderListClass(SourceOrderList.class, SourceOrder.class, SourceAddress.class, SourceContact.class);
    session.setDefaultSourceDocument(sourceOrderList);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetOrderList);
    AtlasTestUtil.validateOrderList((TargetOrderList) object);
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) NoAbstractTargetOrderList(io.atlasmap.reference.NoAbstractTargetOrderList) TargetOrderList(io.atlasmap.java.test.TargetOrderList) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) BaseOrderList(io.atlasmap.java.test.BaseOrderList) Ignore(org.junit.Ignore) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 3 with BaseOrderList

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

the class AtlasTestUtil method generateOrderListClass.

public static BaseOrderList generateOrderListClass(Class<? extends BaseOrderList> orderListClazz, Class<? extends BaseOrder> orderClazz, Class<? extends BaseAddress> addressClazz, Class<? extends BaseContact> contactClazz) throws Exception {
    Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(orderListClazz.getName());
    BaseOrderList orderList = (BaseOrderList) targetClazz.newInstance();
    orderList.setNumberOrders(5);
    orderList.setOrderBatchNumber(4123562);
    for (int i = 0; i < 5; i++) {
        BaseOrder baseOrder = generateOrderClass(orderClazz, addressClazz, contactClazz);
        baseOrder.setOrderId(i);
        if (orderList.getOrders() == null) {
            orderList.setOrders(new ArrayList<BaseOrder>());
        }
        orderList.getOrders().add(baseOrder);
    }
    return orderList;
}
Also used : BaseOrder(io.atlasmap.java.test.BaseOrder) BaseOrderList(io.atlasmap.java.test.BaseOrderList)

Example 4 with BaseOrderList

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

the class JavaJavaComplexListTest method testProcessJavaJavaComplexAutoDetectBaseTest.

@Test
@Ignore("https://github.com/atlasmap/atlasmap-runtime/issues/229 - Allow default implementation for abstract target field")
public void testProcessJavaJavaComplexAutoDetectBaseTest() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-list-autodetect-base.xml"));
    AtlasSession session = context.createSession();
    BaseOrderList sourceOrderList = AtlasTestUtil.generateOrderListClass(SourceOrderList.class, SourceOrder.class, SourceAddress.class, SourceContact.class);
    session.setDefaultSourceDocument(sourceOrderList);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetOrderList);
    AtlasTestUtil.validateOrderList((TargetOrderList) object);
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) NoAbstractTargetOrderList(io.atlasmap.reference.NoAbstractTargetOrderList) TargetOrderList(io.atlasmap.java.test.TargetOrderList) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) BaseOrderList(io.atlasmap.java.test.BaseOrderList) Ignore(org.junit.Ignore) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 5 with BaseOrderList

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

the class JavaJavaComplexListTest method testProcessJavaJavaComplexAutoDetectBaseNoAbstractTest.

@Test
public void testProcessJavaJavaComplexAutoDetectBaseNoAbstractTest() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-complex-list-autodetect-base-no-abstract.xml"));
    AtlasSession session = context.createSession();
    BaseOrderList sourceOrderList = AtlasTestUtil.generateOrderListClass(SourceOrderList.class, SourceOrder.class, SourceAddress.class, SourceContact.class);
    session.setDefaultSourceDocument(sourceOrderList);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof NoAbstractTargetOrderList);
    AtlasTestUtil.validateOrderList((NoAbstractTargetOrderList) object);
}
Also used : NoAbstractTargetOrderList(io.atlasmap.reference.NoAbstractTargetOrderList) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) BaseOrderList(io.atlasmap.java.test.BaseOrderList) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Aggregations

BaseOrderList (io.atlasmap.java.test.BaseOrderList)5 AtlasContext (io.atlasmap.api.AtlasContext)3 AtlasSession (io.atlasmap.api.AtlasSession)3 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)3 NoAbstractTargetOrderList (io.atlasmap.reference.NoAbstractTargetOrderList)3 File (java.io.File)3 Test (org.junit.Test)3 BaseOrder (io.atlasmap.java.test.BaseOrder)2 TargetOrderList (io.atlasmap.java.test.TargetOrderList)2 Ignore (org.junit.Ignore)2