Search in sources :

Example 46 with JavaClass

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

the class ClassValidationUtil method validateFlatPrimitiveInterfaceTwoDimArray.

public static void validateFlatPrimitiveInterfaceTwoDimArray(ClassInspectionService classInspectionService, Class<?> clazz) {
    JavaClass flatClass = classInspectionService.inspectClass(clazz);
    validateFlatClass(flatClass);
    assertEquals(CollectionType.ARRAY, flatClass.getCollectionType());
    assertEquals(new Integer(2), flatClass.getArrayDimensions());
    assertTrue(flatClass.isInterface());
    assertEquals("io.atlasmap.java.test.FlatPrimitiveInterface", flatClass.getClassName());
    validateFlatPrimitiveFields(flatClass);
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 47 with JavaClass

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

the class ClassValidationUtil method validateFlatPrimitiveInterface.

public static void validateFlatPrimitiveInterface(ClassInspectionService classInspectionService, Class<?> clazz) {
    JavaClass flatClass = classInspectionService.inspectClass(clazz);
    validateFlatClass(flatClass);
    assertEquals("io.atlasmap.java.test.FlatPrimitiveInterface", flatClass.getClassName());
    validateFlatPrimitiveFields(flatClass);
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 48 with JavaClass

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

the class ClassValidationUtil method validateFlatPrimitiveInterfaceThreeDimArray.

public static void validateFlatPrimitiveInterfaceThreeDimArray(ClassInspectionService classInspectionService, Class<?> clazz) {
    JavaClass flatClass = classInspectionService.inspectClass(clazz);
    validateFlatClass(flatClass);
    assertEquals(CollectionType.ARRAY, flatClass.getCollectionType());
    assertEquals(new Integer(3), flatClass.getArrayDimensions());
    assertTrue(flatClass.isInterface());
    assertEquals("io.atlasmap.java.test.FlatPrimitiveInterface", flatClass.getClassName());
    validateFlatPrimitiveFields(flatClass);
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 49 with JavaClass

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

the class ClassValidationUtil method validateFlatPrimitiveClassArray.

public static void validateFlatPrimitiveClassArray(ClassInspectionService classInspectionService, Class<?> clazz, String className) {
    JavaClass flatClass = classInspectionService.inspectClass(clazz);
    validateFlatClass(flatClass);
    assertEquals(CollectionType.ARRAY, flatClass.getCollectionType());
    assertEquals(new Integer(1), flatClass.getArrayDimensions());
    assertEquals(null, flatClass.getArraySize());
    assertFalse(flatClass.isInterface());
    assertEquals(className, flatClass.getClassName());
    validateFlatPrimitiveFields(flatClass);
}
Also used : JavaClass(io.atlasmap.java.v2.JavaClass)

Example 50 with JavaClass

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

the class ClassValidationUtil method validateSimpleTestAddress.

public static void validateSimpleTestAddress(JavaClass c) {
    assertNotNull(c);
    assertFalse(c.isAnnonymous());
    assertFalse(c.isAnnotation());
    // assertTrue(c.getCollectionType() == null || c.getCollectionT());
    assertFalse(c.isEnumeration());
    assertFalse(c.isInterface());
    assertFalse(c.isLocalClass());
    assertFalse(c.isMemberClass());
    assertFalse(c.isPrimitive());
    assertFalse(c.isSynthetic());
    assertNotNull(c.getUri());
    assertEquals(String.format(AtlasJavaModelFactory.URI_FORMAT, c.getClassName()), c.getUri());
    assertEquals("io.atlasmap.java.test.BaseAddress", c.getClassName());
    assertEquals("io.atlasmap.java.test", c.getPackageName());
    assertNotNull(c.getJavaEnumFields());
    assertNotNull(c.getJavaEnumFields().getJavaEnumField());
    assertEquals(new Integer(0), new Integer(c.getJavaEnumFields().getJavaEnumField().size()));
    assertNotNull(c.getJavaFields());
    assertNotNull(c.getJavaFields().getJavaField());
    assertEquals(new Integer(6), new Integer(c.getJavaFields().getJavaField().size()));
    for (JavaField f : c.getJavaFields().getJavaField()) {
        switch(f.getName()) {
            case "serialVersionUID":
                validateSerialVersionUID(f);
                break;
            case "addressLine1":
                break;
            case "addressLine2":
                break;
            case "city":
                break;
            case "state":
                break;
            case "zipCode":
                break;
            default:
                fail("Unexpected field detected: " + f.getName());
        }
    }
}
Also used : JavaField(io.atlasmap.java.v2.JavaField)

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