use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.
the class JavaJsonFlatMappingTest method generateFlatPrimitiveClass.
protected BaseFlatPrimitiveClass generateFlatPrimitiveClass(Class<? extends BaseFlatPrimitiveClass> clazz) throws Exception {
Class<?> targetClazz = this.getClass().getClassLoader().loadClass(clazz.getName());
BaseFlatPrimitiveClass newObject = (BaseFlatPrimitiveClass) targetClazz.newInstance();
newObject.setBooleanField(false);
newObject.setByteField((byte) 99);
newObject.setCharField('a');
newObject.setDoubleField(50000000d);
newObject.setFloatField(40000000f);
newObject.setIntField(2);
newObject.setLongField(30000L);
newObject.setShortField((short) 1);
return newObject;
}
use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.
the class JavaJavaFlatMappingTest method testProcessJavaJavaFlatFieldMapping.
@Test
public void testProcessJavaJavaFlatFieldMapping() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-flatprimitive.xml").toURI());
AtlasSession session = context.createSession();
BaseFlatPrimitiveClass sourceClass = generateFlatPrimitiveClass(SourceFlatPrimitiveClass.class);
session.setDefaultSourceDocument(sourceClass);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetFlatPrimitiveClass);
validateFlatPrimitiveClassPrimitiveFields((TargetFlatPrimitiveClass) object);
}
use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.
the class JavaJavaFlatMappingTest method testProcessJavaJavaFlatFieldMappingBoxedPrimitives.
@Test
public void testProcessJavaJavaFlatFieldMappingBoxedPrimitives() throws Exception {
AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-flatprimitive-boxed.xml").toURI());
AtlasSession session = context.createSession();
BaseFlatPrimitiveClass sourceClass = generateFlatPrimitiveClassBoxedPrimitiveFieldsBoxedValues(SourceFlatPrimitiveClass.class);
session.setDefaultSourceDocument(sourceClass);
context.process(session);
Object object = session.getDefaultTargetDocument();
assertNotNull(object);
assertTrue(object instanceof TargetFlatPrimitiveClass);
validateFlatPrimitiveClassBoxedPrimitiveFields((TargetFlatPrimitiveClass) object);
}
use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.
the class JavaJavaFlatMappingTest method generateFlatPrimitiveClass.
protected BaseFlatPrimitiveClass generateFlatPrimitiveClass(Class<? extends BaseFlatPrimitiveClass> clazz) throws Exception {
Class<?> targetClazz = this.getClass().getClassLoader().loadClass(clazz.getName());
BaseFlatPrimitiveClass newObject = (BaseFlatPrimitiveClass) targetClazz.newInstance();
newObject.setBooleanField(false);
newObject.setByteField((byte) 99);
newObject.setCharField('a');
newObject.setDoubleField(50000000d);
newObject.setFloatField(40000000f);
newObject.setIntField(2);
newObject.setLongField(30000L);
newObject.setShortField((short) 1);
return newObject;
}
use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.
the class JsonJavaFlatMappingTest method generateFlatPrimitiveClassBoxedPrimitiveFieldsBoxedValues.
protected BaseFlatPrimitiveClass generateFlatPrimitiveClassBoxedPrimitiveFieldsBoxedValues(Class<? extends BaseFlatPrimitiveClass> clazz) throws Exception {
Class<?> targetClazz = this.getClass().getClassLoader().loadClass(clazz.getName());
BaseFlatPrimitiveClass newObject = (BaseFlatPrimitiveClass) targetClazz.newInstance();
newObject.setBoxedBooleanField(Boolean.valueOf(Boolean.TRUE));
newObject.setBoxedByteField(new Byte((byte) 87));
newObject.setBoxedCharField(new Character('z'));
newObject.setBoxedDoubleField(new Double(90000000d));
newObject.setBoxedFloatField(new Float(70000000f));
newObject.setBoxedIntField(new Integer(5));
newObject.setBoxedLongField(new Long(20000L));
newObject.setBoxedShortField(new Short((short) 5));
return newObject;
}
Aggregations