use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.
the class JavaJsonFlatMappingTest method testProcessJavaJsonBoxedFlatMappingPrimitiveUnrooted.
@Test
public void testProcessJavaJsonBoxedFlatMappingPrimitiveUnrooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-boxedflatprimitive-unrooted.json"));
AtlasSession session = context.createSession();
session.setDefaultSourceDocument(generateFlatPrimitiveClassBoxedPrimitiveFieldsBoxedValues(SourceFlatPrimitiveClass.class));
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);
AtlasTestUtil.validateJsonFlatPrimitiveBoxedPrimitiveFields(targetObject);
}
use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.
the class JavaJsonFlatMappingTest method testProcessJavaJsonFlatPrimitiveRooted.
@Test
public void testProcessJavaJsonFlatPrimitiveRooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-flatprimitive-rooted.json"));
AtlasSession session = context.createSession();
session.setDefaultSourceDocument(generateFlatPrimitiveClass(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.validateJsonFlatPrimitivePrimitiveFields(targetObject);
}
use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.
the class XmlJsonAutoConversionTest method processXmlJsonFlatMappingAutoConversion.
protected void processXmlJsonFlatMappingAutoConversion(String mappingFile, String inputFile, int num) throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File(mappingFile).toURI());
AtlasSession session = context.createSession();
String source = AtlasTestUtil.loadFileAsString(inputFile);
session.setDefaultSourceDocument(source);
context.process(session);
assertFalse(session.hasErrors(), printAudit(session));
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
TargetFlatPrimitive targetObject = testMapper.readValue((String) object, TargetFlatPrimitive.class);
switch(num) {
case 1:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion1(targetObject);
break;
case 2:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion2(targetObject);
break;
case 3:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion3(targetObject);
break;
case 4:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion4(targetObject);
break;
case 5:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion5(targetObject);
break;
case 6:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion6(targetObject);
break;
case 7:
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion7(targetObject);
break;
default:
fail("Unexpected number: " + num);
}
}
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.json");
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion3(targetObject);
}
use of io.atlasmap.json.test.TargetFlatPrimitive in project atlasmap by atlasmap.
the class JsonJsonAutoConversionTest method testProcessJsonJsonFlatFieldMappingAutoConversion1.
@Test
public void testProcessJsonJsonFlatFieldMappingAutoConversion1() throws Exception {
TargetFlatPrimitive targetObject = executeMapping("src/test/resources/jsonToJson/atlasmapping-flatprimitive-unrooted-autoconversion-1.json");
AtlasTestUtil.validateJsonFlatPrimitivePrimitiveFieldAutoConversion1(targetObject);
}
Aggregations