Search in sources :

Example 61 with AtlasSession

use of io.atlasmap.api.AtlasSession 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 62 with AtlasSession

use of io.atlasmap.api.AtlasSession 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 63 with AtlasSession

use of io.atlasmap.api.AtlasSession 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 64 with AtlasSession

use of io.atlasmap.api.AtlasSession 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 65 with AtlasSession

use of io.atlasmap.api.AtlasSession in project atlasmap by atlasmap.

the class XmlXmlFlatMappingTest method testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttributeNS.

@Test
public void testProcessXmlXmlBoxedFlatMappingPrimitiveElementToAttributeNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToXml/atlasmapping-boxedflatprimitive-elementToAttribute-ns.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToXml/atlas-xml-boxedflatprimitive-element-ns.xml");
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof String);
    JAXBElement<XmlFlatBoxedPrimitiveAttribute> xmlFPE = AtlasXmlTestHelper.unmarshal((String) object, XmlFlatBoxedPrimitiveAttribute.class);
    AtlasTestUtil.validateXmlFlatPrimitiveBoxedPrimitiveAttributeFields(xmlFPE.getValue());
}
Also used : AtlasContext(io.atlasmap.api.AtlasContext) XmlFlatBoxedPrimitiveAttribute(io.atlasmap.xml.test.v2.XmlFlatBoxedPrimitiveAttribute) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Aggregations

AtlasSession (io.atlasmap.api.AtlasSession)157 AtlasContext (io.atlasmap.api.AtlasContext)140 Test (org.junit.Test)134 File (java.io.File)129 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)123 TargetContact (io.atlasmap.java.test.TargetContact)31 BaseContact (io.atlasmap.java.test.BaseContact)26 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)25 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)24 TargetFlatPrimitive (io.atlasmap.json.test.TargetFlatPrimitive)13 BaseOrder (io.atlasmap.java.test.BaseOrder)12 TargetOrder (io.atlasmap.java.test.TargetOrder)11 TargetTestClass (io.atlasmap.java.test.TargetTestClass)11 AtlasMapping (io.atlasmap.v2.AtlasMapping)9 XmlContactAttribute (io.atlasmap.xml.test.v2.XmlContactAttribute)9 AtlasJsonTestRootedMapper (io.atlasmap.json.test.AtlasJsonTestRootedMapper)8 BaseFlatPrimitiveClass (io.atlasmap.java.test.BaseFlatPrimitiveClass)7 SourceFlatPrimitiveClass (io.atlasmap.java.test.SourceFlatPrimitiveClass)7 URL (java.net.URL)4 Message (org.apache.camel.Message)4