Search in sources :

Example 11 with BaseFlatPrimitiveClass

use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.

the class MultidocFlatMappingTest method generateFlatPrimitiveClass.

private 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;
}
Also used : BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass)

Example 12 with BaseFlatPrimitiveClass

use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.

the class XmlJavaFlatMappingTest 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;
}
Also used : BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass)

Example 13 with BaseFlatPrimitiveClass

use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.

the class AtlasTestUtil method generateFlatPrimitiveClass.

public static BaseFlatPrimitiveClass generateFlatPrimitiveClass(Class<? extends BaseFlatPrimitiveClass> clazz) throws Exception {
    Class<?> targetClazz = AtlasTestUtil.class.getClassLoader().loadClass(clazz.getName());
    BaseFlatPrimitiveClass newObject = (BaseFlatPrimitiveClass) targetClazz.newInstance();
    newObject.setIntField(2);
    newObject.setShortField((short) 3);
    newObject.setLongField(4L);
    newObject.setDoubleField(5d);
    newObject.setFloatField(6f);
    newObject.setBooleanField(true);
    newObject.setCharField('8');
    newObject.setByteField((byte) 57);
    return newObject;
}
Also used : BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass)

Example 14 with BaseFlatPrimitiveClass

use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.

the class JavaJavaAutoConversionTest method executeMapping.

protected Object executeMapping(String fileName) throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File(fileName).toURI());
    AtlasSession session = context.createSession();
    BaseFlatPrimitiveClass sourceObject = AtlasTestUtil.generateFlatPrimitiveClass(SourceFlatPrimitiveClass.class);
    session.setDefaultSourceDocument(sourceObject);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    return object;
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession)

Example 15 with BaseFlatPrimitiveClass

use of io.atlasmap.java.test.BaseFlatPrimitiveClass in project atlasmap by atlasmap.

the class JavaJsonAutoConversionTest method executeMapping2.

protected Object executeMapping2(String fileName) throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File(fileName).toURI());
    AtlasSession session = context.createSession();
    BaseFlatPrimitiveClass sourceObject = AtlasTestUtil.generateFlatPrimitiveClass(SourceFlatPrimitiveClass.class);
    session.setDefaultSourceDocument(sourceObject);
    context.process(session);
    assertFalse(printAudit(session), session.hasErrors());
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    return object;
}
Also used : TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession)

Aggregations

BaseFlatPrimitiveClass (io.atlasmap.java.test.BaseFlatPrimitiveClass)22 AtlasContext (io.atlasmap.api.AtlasContext)7 AtlasSession (io.atlasmap.api.AtlasSession)7 File (java.io.File)7 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)6 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)4 Test (org.junit.Test)4 AtlasJsonTestUnrootedMapper (io.atlasmap.json.test.AtlasJsonTestUnrootedMapper)2 TargetFlatPrimitive (io.atlasmap.json.test.TargetFlatPrimitive)2 Validation (io.atlasmap.v2.Validation)1 Validations (io.atlasmap.v2.Validations)1