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);
}
}
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);
}
}
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);
}
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);
}
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);
}
Aggregations