Search in sources :

Example 21 with TargetFlatPrimitive

use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.

the class XmlJsonFlatMappingTest method processXmlToJsonRooted.

protected void processXmlToJsonRooted(String mappingFile, String inputFile, boolean boxed) throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File(mappingFile));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString(inputFile);
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof String);
    AtlasJsonTestRootedMapper testMapper = new AtlasJsonTestRootedMapper();
    TargetFlatPrimitive targetObject = testMapper.readValue((String) object, TargetFlatPrimitive.class);
    if (boxed) {
        AtlasTestUtil.validateJsonFlatPrimitiveBoxedPrimitiveFields(targetObject);
    } else {
        AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFields(targetObject);
    }
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) AtlasJsonTestRootedMapper(io.atlasmap.json.test.AtlasJsonTestRootedMapper) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession)

Example 22 with TargetFlatPrimitive

use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.

the class XmlJsonFlatMappingTest method processXmlToJsonUnrooted.

protected void processXmlToJsonUnrooted(String mappingFile, String inputFile, boolean boxed) throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File(mappingFile));
    AtlasSession session = context.createSession();
    String sourceXml = AtlasTestUtil.loadFileAsString(inputFile);
    session.setDefaultSourceDocument(sourceXml);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof String);
    AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
    TargetFlatPrimitive targetObject = testMapper.readValue((String) object, TargetFlatPrimitive.class);
    if (boxed) {
        AtlasTestUtil.validateJsonFlatPrimitiveBoxedPrimitiveFields(targetObject);
    } else {
        AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFields(targetObject);
    }
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) AtlasContext(io.atlasmap.api.AtlasContext) AtlasJsonTestUnrootedMapper(io.atlasmap.json.test.AtlasJsonTestUnrootedMapper) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession)

Example 23 with TargetFlatPrimitive

use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.

the class JsonJsonAutoConversionTest method testProcessJsonJsonFlatFieldMappingAutoConversion7.

@Test
public void testProcessJsonJsonFlatFieldMappingAutoConversion7() throws Exception {
    TargetFlatPrimitive targetObject = executeMapping("src/test/resources/jsonToJson/atlasmapping-flatprimitive-unrooted-autoconversion-7.xml");
    AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion7(targetObject);
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 24 with TargetFlatPrimitive

use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.

the class JsonJsonAutoConversionTest method testProcessJsonJsonFlatFieldMappingAutoConversion5.

@Test
public void testProcessJsonJsonFlatFieldMappingAutoConversion5() throws Exception {
    TargetFlatPrimitive targetObject = executeMapping("src/test/resources/jsonToJson/atlasmapping-flatprimitive-unrooted-autoconversion-5.xml");
    AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion5(targetObject);
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 25 with TargetFlatPrimitive

use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.

the class JsonJsonAutoConversionTest method testProcessJsonJsonFlatFieldMappingAutoConversion3.

@Test
public void testProcessJsonJsonFlatFieldMappingAutoConversion3() throws Exception {
    TargetFlatPrimitive targetObject = executeMapping("src/test/resources/jsonToJson/atlasmapping-flatprimitive-unrooted-autoconversion-3.xml");
    AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion3(targetObject);
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Aggregations

TargetFlatPrimitive (io.atlasmap.json.test.TargetFlatPrimitive)40 AtlasContext (io.atlasmap.api.AtlasContext)26 AtlasSession (io.atlasmap.api.AtlasSession)26 File (java.io.File)26 AtlasMappingBaseTest (io.atlasmap.itests.reference.AtlasMappingBaseTest)16 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)16 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)16 Test (org.junit.Test)16 Test (org.junit.jupiter.api.Test)16 AtlasJsonTestRootedMapper (io.atlasmap.json.test.AtlasJsonTestRootedMapper)10 SourceFlatPrimitiveClass (io.atlasmap.java.test.SourceFlatPrimitiveClass)8 BaseFlatPrimitiveClass (io.atlasmap.java.test.BaseFlatPrimitiveClass)4 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)2