Search in sources :

Example 6 with AtlasJsonTestRootedMapper

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

the class JsonJsonComplexTest method testProcessJsonJsonComplexOrderAutodetectRooted.

@Test
public void testProcessJsonJsonComplexOrderAutodetectRooted() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/jsonToJson/atlasmapping-complex-order-autodetect-rooted.xml").toURI());
    AtlasSession session = context.createSession();
    String source = AtlasTestUtil.loadFileAsString("src/test/resources/jsonToJson/atlas-json-complex-order-autodetect-rooted.json");
    session.setDefaultSourceDocument(source);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof String);
    AtlasJsonTestRootedMapper testMapper = new AtlasJsonTestRootedMapper();
    TargetOrder targetObject = testMapper.readValue((String) object, TargetOrder.class);
    AtlasTestUtil.validateJsonOrder(targetObject);
}
Also used : AtlasJsonTestRootedMapper(io.atlasmap.json.test.AtlasJsonTestRootedMapper) AtlasContext(io.atlasmap.api.AtlasContext) TargetOrder(io.atlasmap.json.test.TargetOrder) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 7 with AtlasJsonTestRootedMapper

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

the class JavaJsonComplexTest method testProcessJavaJsonComplexOrderAutodetectRooted.

@Test
public void testProcessJavaJsonComplexOrderAutodetectRooted() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-complex-order-autodetect-rooted.xml").toURI());
    AtlasSession session = context.createSession();
    BaseOrder source = AtlasTestUtil.generateOrderClass(SourceOrder.class, SourceAddress.class, SourceContact.class);
    session.setDefaultSourceDocument(source);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof String);
    AtlasJsonTestRootedMapper testMapper = new AtlasJsonTestRootedMapper();
    io.atlasmap.json.test.TargetOrder targetObject = testMapper.readValue((String) object, io.atlasmap.json.test.TargetOrder.class);
    AtlasTestUtil.validateJsonOrder(targetObject);
}
Also used : AtlasJsonTestRootedMapper(io.atlasmap.json.test.AtlasJsonTestRootedMapper) BaseOrder(io.atlasmap.java.test.BaseOrder) AtlasContext(io.atlasmap.api.AtlasContext) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) Test(org.junit.Test) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest)

Example 8 with AtlasJsonTestRootedMapper

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

the class JavaJsonFlatMappingTest method testProcessJavaJsonBoxedFlatMappingPrimitiveRooted.

@Test
public void testProcessJavaJsonBoxedFlatMappingPrimitiveRooted() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-boxedflatprimitive-rooted.xml"));
    AtlasSession session = context.createSession();
    session.setDefaultSourceDocument(generateFlatPrimitiveClassBoxedPrimitiveFieldsBoxedValues(SourceFlatPrimitiveClass.class));
    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);
    AtlasTestUtil.validateJsonFlatPrimitiveBoxedPrimitiveFields(targetObject);
}
Also used : TargetFlatPrimitive(io.atlasmap.json.test.TargetFlatPrimitive) AtlasJsonTestRootedMapper(io.atlasmap.json.test.AtlasJsonTestRootedMapper) AtlasContext(io.atlasmap.api.AtlasContext) SourceFlatPrimitiveClass(io.atlasmap.java.test.SourceFlatPrimitiveClass) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Aggregations

AtlasContext (io.atlasmap.api.AtlasContext)8 AtlasSession (io.atlasmap.api.AtlasSession)8 AtlasJsonTestRootedMapper (io.atlasmap.json.test.AtlasJsonTestRootedMapper)8 File (java.io.File)8 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)6 Test (org.junit.Test)6 TargetFlatPrimitive (io.atlasmap.json.test.TargetFlatPrimitive)5 SourceFlatPrimitiveClass (io.atlasmap.java.test.SourceFlatPrimitiveClass)2 TargetOrder (io.atlasmap.json.test.TargetOrder)2 BaseOrder (io.atlasmap.java.test.BaseOrder)1 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)1