Search in sources :

Example 6 with JavaClass

use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.

the class JavaServiceTest method testGetClass.

@Test
public void testGetClass() throws Exception {
    Response res = javaService.getClass(JavaService.class.getName());
    Object entity = res.getEntity();
    assertEquals(byte[].class, entity.getClass());
    JavaClass javaClass = Json.mapper().readValue((byte[]) entity, JavaClass.class);
    assertEquals(JavaService.class.getName(), javaClass.getClassName());
}
Also used : Response(javax.ws.rs.core.Response) JavaClass(io.atlasmap.java.v2.JavaClass) Test(org.junit.Test)

Example 7 with JavaClass

use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.

the class JavaConstructServiceTest method generatePrimitive.

protected JavaClass generatePrimitive(String className) {
    JavaClass j = new JavaClass();
    j.setClassName(className);
    return j;
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 8 with JavaClass

use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.

the class JavaConstructServiceTest method generateJavaClassInvalidNullClassName.

protected JavaClass generateJavaClassInvalidNullClassName() {
    JavaClass j = new JavaClass();
    j.setClassName(null);
    return j;
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 9 with JavaClass

use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.

the class JavaConstructServiceTest method generateJavaClassCollection.

protected JavaClass generateJavaClassCollection(String className, CollectionType collectionType, Integer arrayDimensions, Integer arraySize) {
    JavaClass j = new JavaClass();
    j.setClassName(className);
    j.setCollectionType(collectionType);
    if (CollectionType.ARRAY.equals(collectionType)) {
        j.setArrayDimensions(arrayDimensions);
        j.setArraySize(arraySize);
    }
    return j;
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 10 with JavaClass

use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.

the class JavaConstructServiceTest method testConstructClassCollectionMap.

@Test
public void testConstructClassCollectionMap() throws Exception {
    JavaClass javaClass = generateJavaClassCollection("java.lang.String", CollectionType.MAP, null, null);
    javaClass.setCollectionClassName("java.util.HashMap");
    Object stringMap = constructService.constructClass(javaClass, null);
    assertNotNull(stringMap);
    assertTrue(stringMap instanceof HashMap<?, ?>);
    assertTrue(((HashMap<?, ?>) stringMap).isEmpty());
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass) Test(org.junit.Test)

Aggregations

JavaClass (io.atlasmap.java.v2.JavaClass)47 JavaField (io.atlasmap.java.v2.JavaField)21 Test (org.junit.Test)18 ClassInspectionService (io.atlasmap.java.inspect.ClassInspectionService)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 IOException (java.io.IOException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 TargetAddress (io.atlasmap.java.test.TargetAddress)2 TargetOrder (io.atlasmap.java.test.TargetOrder)2 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)2 ModifierList (io.atlasmap.java.v2.ModifierList)2 BaseMapping (io.atlasmap.v2.BaseMapping)2 Field (io.atlasmap.v2.Field)2 Method (java.lang.reflect.Method)2 ApplicationPath (javax.ws.rs.ApplicationPath)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 AtlasException (io.atlasmap.api.AtlasException)1 AtlasValidationException (io.atlasmap.api.AtlasValidationException)1 DocumentJavaFieldWriter (io.atlasmap.java.core.DocumentJavaFieldWriter)1