use of io.atlasmap.json.test.AtlasJsonTestUnrootedMapper in project atlasmap by atlasmap.
the class JavaJsonCombineTest method testProcessCombineNullInput.
@Test
public void testProcessCombineNullInput() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-combine-inputnull.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
sourceContact.setLastName(null);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper mapper = new AtlasJsonTestUnrootedMapper();
io.atlasmap.json.test.TargetContact targetContact = mapper.readValue((String) object, io.atlasmap.json.test.TargetContact.class);
assertNotNull(targetContact);
assertEquals("Ozzie 5551212 81111", targetContact.getFirstName());
assertFalse(session.hasErrors());
}
use of io.atlasmap.json.test.AtlasJsonTestUnrootedMapper in project atlasmap by atlasmap.
the class JavaJsonCombineTest method testProcessCombineSimple.
@Test
public void testProcessCombineSimple() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-combine-simple.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper mapper = new AtlasJsonTestUnrootedMapper();
io.atlasmap.json.test.TargetContact targetContact = mapper.readValue((String) object, io.atlasmap.json.test.TargetContact.class);
assertEquals("Ozzie Smith 5551212 81111", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertNull(targetContact.getZipCode());
assertFalse(session.hasErrors());
}
use of io.atlasmap.json.test.AtlasJsonTestUnrootedMapper in project atlasmap by atlasmap.
the class JavaJsonCombineTest method testProcessCombineSkip.
@Test
public void testProcessCombineSkip() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-combine-skip.xml").toURI());
AtlasSession session = context.createSession();
BaseContact sourceContact = AtlasTestUtil.generateContact(SourceContact.class);
session.setDefaultSourceDocument(sourceContact);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper mapper = new AtlasJsonTestUnrootedMapper();
io.atlasmap.json.test.TargetContact targetContact = mapper.readValue((String) object, io.atlasmap.json.test.TargetContact.class);
assertEquals("Ozzie Smith 5551212 81111", targetContact.getFirstName());
assertNull(targetContact.getLastName());
assertNull(targetContact.getPhoneNumber());
assertNull(targetContact.getZipCode());
assertFalse(session.hasErrors());
}
use of io.atlasmap.json.test.AtlasJsonTestUnrootedMapper in project atlasmap by atlasmap.
the class JavaJsonComplexTest method testProcessJsonJavaComplexOrderAutodetectUnrooted.
@Test
public void testProcessJsonJavaComplexOrderAutodetectUnrooted() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJson/atlasmapping-complex-order-autodetect-unrooted.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();
assertTrue(object instanceof String);
AtlasJsonTestUnrootedMapper testMapper = new AtlasJsonTestUnrootedMapper();
io.atlasmap.json.test.TargetOrder targetObject = testMapper.readValue((String) object, io.atlasmap.json.test.TargetOrder.class);
AtlasTestUtil.validateJsonOrder(targetObject);
}
use of io.atlasmap.json.test.AtlasJsonTestUnrootedMapper 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.xml"));
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);
}
Aggregations