Search in sources :

Example 16 with TargetFlatPrimitiveClass

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

the class XmlJavaAutoConversionTest method executeMapping.

protected Object executeMapping(String fileName) throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File(fileName).toURI());
    AtlasSession session = context.createSession();
    String source = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-flatprimitive-attribute-autoconversion.xml");
    session.setDefaultSourceDocument(source);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    return object;
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession)

Example 17 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaFlatPrimitiveElementNSDocumentWithoutNS.

@Test
// reference: [AT-420]
@Ignore
public void testProcessXmlJavaFlatPrimitiveElementNSDocumentWithoutNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-flatprimitive-element-ns-doc-wo-ns.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) Ignore(org.junit.Ignore) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 18 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaFlatPrimitiveAttributeNS.

@Test
public void testProcessXmlJavaFlatPrimitiveAttributeNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-flatprimitive-attribute-ns.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-flatprimitive-attribute-ns.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 19 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaFlatPrimitiveElementNS.

@Test
public void testProcessXmlJavaFlatPrimitiveElementNS() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-flatprimitive-element-ns.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-flatprimitive-element-ns.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 20 with TargetFlatPrimitiveClass

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

the class XmlJavaFlatMappingTest method testProcessXmlJavaFlatPrimitiveAttribute.

@Test
public void testProcessXmlJavaFlatPrimitiveAttribute() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/xmlToJava/atlasmapping-flatprimitive-attribute.xml"));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString("src/test/resources/xmlToJava/atlas-xml-flatprimitive-attribute.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)

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