Search in sources :

Example 11 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaFlatPrimitiveElement.

@Test
public void testProcessXmlJavaFlatPrimitiveElement() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-flatprimitive-element.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-flatprimitive-element.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    validateFlatPrimitiveClassPrimitiveFields((TargetFlatPrimitiveClass) object);
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 12 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaBoxedFlatMappingPrimitiveElement.

@Test
public void testProcessXmlJavaBoxedFlatMappingPrimitiveElement() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-boxedflatprimitive-element.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-boxedflatprimitive-element.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 13 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaBoxedFlatMappingPrimitiveElementNS.

@Test
public void testProcessXmlJavaBoxedFlatMappingPrimitiveElementNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-boxedflatprimitive-element-ns.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-boxedflatprimitive-element-ns.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 14 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaBoxedFlatMappingPrimitiveAttribute.

@Test
public void testProcessXmlJavaBoxedFlatMappingPrimitiveAttribute() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-boxedflatprimitive-attribute.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-boxedflatprimitive-attribute.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 15 with TargetFlatPrimitiveClass

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

the class OverloadedFieldActionsTest method testMappingDayOfWeekString.

@Test
public void testMappingDayOfWeekString() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(generateMappingDayOfWeek(String.class));
    AtlasSession session = context.createSession();
    SourceFlatPrimitiveClass src = new SourceFlatPrimitiveClass();
    src.setBoxedStringField("mon");
    session.setInput(src);
    context.process(session);
    Object tgt = session.getOutput();
    assertNotNull(tgt);
    assertTrue(tgt.getClass().isAssignableFrom(TargetFlatPrimitiveClass.class));
    System.out.println(((TargetFlatPrimitiveClass) tgt).getBoxedStringField());
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) SourceFlatPrimitiveClass(io.atlasmap.java.test.SourceFlatPrimitiveClass) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test)

Aggregations

TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)30 AtlasContext (io.atlasmap.api.AtlasContext)24 AtlasSession (io.atlasmap.api.AtlasSession)24 File (java.io.File)22 Test (org.junit.Test)22 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)18 BaseFlatPrimitiveClass (io.atlasmap.java.test.BaseFlatPrimitiveClass)6 SourceFlatPrimitiveClass (io.atlasmap.java.test.SourceFlatPrimitiveClass)3 AtlasException (io.atlasmap.api.AtlasException)2 TargetAddress (io.atlasmap.java.test.TargetAddress)2 TargetOrder (io.atlasmap.java.test.TargetOrder)2 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)2 TargetTestClass (io.atlasmap.java.test.TargetTestClass)2 TestListOrders (io.atlasmap.java.test.TestListOrders)2 BaseOrder (io.atlasmap.java.test.BaseOrder)1 StateEnumClassLong (io.atlasmap.java.test.StateEnumClassLong)1 TargetContact (io.atlasmap.java.test.TargetContact)1 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)1 TargetFlatPrimitive (io.atlasmap.json.test.TargetFlatPrimitive)1 Validation (io.atlasmap.v2.Validation)1