use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ClassValidationUtil method validateFlatPrimitiveClassTwoDimArray.
public static void validateFlatPrimitiveClassTwoDimArray(ClassInspectionService classInspectionService, Class<?> clazz, String className) {
JavaClass flatClass = classInspectionService.inspectClass(clazz);
validateFlatClass(flatClass);
assertEquals(CollectionType.ARRAY, flatClass.getCollectionType());
assertEquals(new Integer(2), flatClass.getArrayDimensions());
assertEquals(null, flatClass.getArraySize());
assertFalse(flatClass.isInterface());
assertEquals(className, flatClass.getClassName());
validateFlatPrimitiveFields(flatClass);
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ClassValidationUtil method validateFlatPrimitiveClassThreeDimArray.
public static void validateFlatPrimitiveClassThreeDimArray(ClassInspectionService classInspectionService, Class<?> clazz, String className) {
JavaClass flatClass = classInspectionService.inspectClass(clazz);
validateFlatClass(flatClass);
assertEquals(CollectionType.ARRAY, flatClass.getCollectionType());
assertEquals(new Integer(3), flatClass.getArrayDimensions());
assertFalse(flatClass.isInterface());
assertEquals(className, flatClass.getClassName());
validateFlatPrimitiveFields(flatClass);
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ComplexClassInspectTest method testComplexClassSourceOrder.
@Test
public void testComplexClassSourceOrder() {
JavaClass c = classInspectionService.inspectClass(SourceOrder.class);
assertNotNull(c);
assertEquals("io.atlasmap.java.test.SourceOrder", c.getClassName());
assertEquals(String.format(AtlasJavaModelFactory.URI_FORMAT, "io.atlasmap.java.test.SourceOrder"), c.getUri());
validateComplexClass(c);
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ComplexClassInspectTest method testComplexClassTargetOrder.
@Test
public void testComplexClassTargetOrder() {
JavaClass c = classInspectionService.inspectClass(TargetOrder.class);
assertNotNull(c);
assertEquals("io.atlasmap.java.test.TargetOrder", c.getClassName());
assertEquals(String.format(AtlasJavaModelFactory.URI_FORMAT, "io.atlasmap.java.test.TargetOrder"), c.getUri());
validateComplexClass(c);
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ClassInspectionServiceTest method testDateTimeViaGetter.
@Test
public void testDateTimeViaGetter() {
JavaClass javaClass = classInspectionService.inspectClass(DateTimeGetter.class);
assertEquals(14, javaClass.getJavaFields().getJavaField().size());
for (JavaField field : javaClass.getJavaFields().getJavaField()) {
if ("year".equals(field.getName())) {
assertEquals("java.time.Year", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getYear", field.getGetMethod());
} else if ("month".equals(field.getName())) {
assertEquals("java.time.Month", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getMonth", field.getGetMethod());
} else if ("yearMonth".equals(field.getName())) {
assertEquals("java.time.YearMonth", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getYearMonth", field.getGetMethod());
} else if ("monthDay".equals(field.getName())) {
assertEquals("java.time.MonthDay", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getMonthDay", field.getGetMethod());
} else if ("localDate".equals(field.getName())) {
assertEquals("java.time.LocalDate", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getLocalDate", field.getGetMethod());
} else if ("localTime".equals(field.getName())) {
assertEquals("java.time.LocalTime", field.getClassName());
assertEquals(FieldType.TIME, field.getFieldType());
assertEquals("getLocalTime", field.getGetMethod());
} else if ("localDateTime".equals(field.getName())) {
assertEquals("java.time.LocalDateTime", field.getClassName());
assertEquals(FieldType.DATE_TIME, field.getFieldType());
assertEquals("getLocalDateTime", field.getGetMethod());
} else if ("zonedDateTime".equals(field.getName())) {
assertEquals("java.time.ZonedDateTime", field.getClassName());
assertEquals(FieldType.DATE_TIME_TZ, field.getFieldType());
assertEquals("getZonedDateTime", field.getGetMethod());
} else if ("calendar".equals(field.getName())) {
assertEquals("java.util.Calendar", field.getClassName());
assertEquals(FieldType.DATE_TIME_TZ, field.getFieldType());
assertEquals("getCalendar", field.getGetMethod());
} else if ("date".equals(field.getName())) {
assertEquals("java.util.Date", field.getClassName());
assertEquals(FieldType.DATE_TIME, field.getFieldType());
assertEquals("getDate", field.getGetMethod());
} else if ("gregorianCalendar".equals(field.getName())) {
assertEquals("java.util.GregorianCalendar", field.getClassName());
assertEquals(FieldType.DATE_TIME_TZ, field.getFieldType());
assertEquals("getGregorianCalendar", field.getGetMethod());
} else if ("sqlDate".equals(field.getName())) {
assertEquals("java.sql.Date", field.getClassName());
assertEquals(FieldType.DATE, field.getFieldType());
assertEquals("getSqlDate", field.getGetMethod());
} else if ("sqlTime".equals(field.getName())) {
assertEquals("java.sql.Time", field.getClassName());
assertEquals(FieldType.TIME, field.getFieldType());
assertEquals("getSqlTime", field.getGetMethod());
} else if ("sqlTimestamp".equals(field.getName())) {
assertEquals("java.sql.Timestamp", field.getClassName());
assertEquals(FieldType.DATE_TIME, field.getFieldType());
assertEquals("getSqlTimestamp", field.getGetMethod());
} else {
fail("Unsupported field was detected: " + field);
}
}
}
Aggregations