Search in sources :

Example 1 with BaseAddress

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

the class AtlasTestUtil method generateAddress.

public static BaseAddress generateAddress(Class<? extends BaseAddress> addressClass) throws Exception {
    Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(addressClass.getName());
    BaseAddress newObject = (BaseAddress) targetClazz.newInstance();
    newObject.setAddressLine1("123 Main St");
    newObject.setAddressLine2("Suite 42b");
    newObject.setCity("Anytown");
    newObject.setState("NY");
    newObject.setZipCode("90210");
    return newObject;
}
Also used : BaseAddress(io.atlasmap.java.test.BaseAddress)

Example 2 with BaseAddress

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

the class JavaJavaMultiSourceTest method testProcessBasic.

@Test
public void testProcessBasic() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-multisource-basic.xml").toURI());
    AtlasSession session = context.createSession();
    BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
    BaseAddress sourceAddress = AtlasTestUtil.generateAddress(SourceAddress.class);
    session.setSourceDocument("con", sourceContact);
    session.setSourceDocument("addr", sourceAddress);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertEquals(TargetContact.class.getName(), object.getClass().getName());
    TargetContact targetContact = (TargetContact) object;
    assertEquals("Ozzie", targetContact.getFirstName());
    assertNull(targetContact.getLastName());
    assertNull(targetContact.getPhoneNumber());
    assertEquals("90210", targetContact.getZipCode());
}
Also used : BaseContact(io.atlasmap.java.test.BaseContact) TargetContact(io.atlasmap.java.test.TargetContact) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) BaseAddress(io.atlasmap.java.test.BaseAddress) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 3 with BaseAddress

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

the class AtlasTestUtil method generateAddress.

public static BaseAddress generateAddress(Class<? extends BaseAddress> addressClass) throws Exception {
    Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(addressClass.getName());
    BaseAddress newObject = (BaseAddress) targetClazz.newInstance();
    newObject.setAddressLine1("123 Main St");
    newObject.setAddressLine2("Suite 42b");
    newObject.setCity("Anytown");
    newObject.setState("NY");
    newObject.setZipCode("90210");
    return newObject;
}
Also used : BaseAddress(io.atlasmap.java.test.BaseAddress)

Example 4 with BaseAddress

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

the class JavaJavaMultiSourceTest method testProcessComplex.

@Test
public void testProcessComplex() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-multisource-complex.xml").toURI());
    AtlasSession session = context.createSession();
    BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
    BaseAddress sourceAddress = AtlasTestUtil.generateAddress(SourceAddress.class);
    session.setSourceDocument("con", sourceContact);
    session.setSourceDocument("addr", sourceAddress);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertEquals(TargetOrder.class.getName(), object.getClass().getName());
    TargetOrder targetOrder = (TargetOrder) object;
    AtlasTestUtil.validateOrder(targetOrder);
}
Also used : BaseContact(io.atlasmap.java.test.BaseContact) AtlasContext(io.atlasmap.api.AtlasContext) TargetOrder(io.atlasmap.java.test.TargetOrder) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) BaseAddress(io.atlasmap.java.test.BaseAddress) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Aggregations

BaseAddress (io.atlasmap.java.test.BaseAddress)4 AtlasContext (io.atlasmap.api.AtlasContext)2 AtlasSession (io.atlasmap.api.AtlasSession)2 BaseContact (io.atlasmap.java.test.BaseContact)2 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)2 File (java.io.File)2 Test (org.junit.Test)2 TargetContact (io.atlasmap.java.test.TargetContact)1 TargetOrder (io.atlasmap.java.test.TargetOrder)1