Search in sources :

Example 46 with TargetTestClass

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

the class JavaJavaCollectionTest method testProcessCollectionListSimple.

@Test
public void testProcessCollectionListSimple() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-collection-list-simple.json").toURI());
    TargetTestClass input = new TargetTestClass();
    input.setContactList(new LinkedList<>());
    for (int i = 0; i < 5; i++) {
        input.getContactList().add(new TargetContact());
        input.getContactList().get(i).setFirstName("fname" + i);
    }
    AtlasSession session = context.createSession();
    session.setSourceDocument("io.atlasmap.java.test.TargetTestClass", input);
    context.process(session);
    assertFalse(session.hasErrors(), printAudit(session));
    TargetTestClass object = (TargetTestClass) session.getDefaultTargetDocument();
    assertEquals(5, object.getContactList().size());
    for (int i = 0; i < 5; i++) {
        assertEquals(input.getContactList().get(i).getFirstName(), object.getContactList().get(i).getFirstName());
    }
}
Also used : TargetContact(io.atlasmap.java.test.TargetContact) AtlasContext(io.atlasmap.api.AtlasContext) TargetTestClass(io.atlasmap.java.test.TargetTestClass) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.itests.reference.AtlasMappingBaseTest) Test(org.junit.jupiter.api.Test)

Aggregations

TargetTestClass (io.atlasmap.java.test.TargetTestClass)46 Test (org.junit.jupiter.api.Test)28 AtlasContext (io.atlasmap.api.AtlasContext)26 AtlasSession (io.atlasmap.api.AtlasSession)26 TargetContact (io.atlasmap.java.test.TargetContact)24 File (java.io.File)24 BaseOrder (io.atlasmap.java.test.BaseOrder)15 Test (org.junit.Test)14 AtlasMappingBaseTest (io.atlasmap.itests.reference.AtlasMappingBaseTest)13 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)11 TargetAddress (io.atlasmap.java.test.TargetAddress)10 TargetOrder (io.atlasmap.java.test.TargetOrder)7 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)5 JavaField (io.atlasmap.java.v2.JavaField)5 Field (io.atlasmap.v2.Field)5 TestListOrders (io.atlasmap.java.test.TestListOrders)4 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)4 AtlasException (io.atlasmap.api.AtlasException)3 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)3 FieldGroup (io.atlasmap.v2.FieldGroup)2