Search in sources :

Example 6 with AtlasConversionConcern

use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.

the class StringConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = StringConverter.class;
    Method[] methods = aClass.getMethods();
    for (Method method : methods) {
        if (method.isSynthetic()) {
            // We are running in Eclipse or jacoco
            continue;
        }
        if (method.getName().startsWith("convert")) {
            Annotation[] annotations = method.getDeclaredAnnotations();
            assertNotNull(annotations);
            assertTrue(annotations.length > 0);
            for (Annotation annotation : annotations) {
                assertTrue(AtlasConversionInfo.class.isAssignableFrom(annotation.annotationType()));
                AtlasConversionInfo atlasConversionInfo = (AtlasConversionInfo) annotation;
                assertNotNull(atlasConversionInfo.sourceType());
                assertTrue(atlasConversionInfo.sourceType().compareTo(FieldType.STRING) == 0);
                assertNotNull(atlasConversionInfo.targetType());
                for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
                    assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
                    assertNotNull(atlasConversionConcern.value());
                }
            }
        }
    }
}
Also used : AtlasConversionInfo(io.atlasmap.spi.AtlasConversionInfo) AtlasConversionConcern(io.atlasmap.spi.AtlasConversionConcern) Method(java.lang.reflect.Method) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Example 7 with AtlasConversionConcern

use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.

the class IntegerConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = IntegerConverter.class;
    Method[] methods = aClass.getMethods();
    for (Method method : methods) {
        if (method.isSynthetic()) {
            // We are running in Eclipse or jacoco
            continue;
        }
        if (method.getName().startsWith("convert")) {
            Annotation[] annotations = method.getDeclaredAnnotations();
            assertNotNull(annotations);
            assertTrue(annotations.length > 0);
            for (Annotation annotation : annotations) {
                assertTrue(AtlasConversionInfo.class.isAssignableFrom(annotation.annotationType()));
                AtlasConversionInfo atlasConversionInfo = (AtlasConversionInfo) annotation;
                assertNotNull(atlasConversionInfo.sourceType());
                assertTrue(atlasConversionInfo.sourceType().compareTo(FieldType.INTEGER) == 0);
                assertNotNull(atlasConversionInfo.targetType());
                for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
                    assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
                    assertNotNull(atlasConversionConcern.value());
                }
            }
        }
    }
}
Also used : AtlasConversionInfo(io.atlasmap.spi.AtlasConversionInfo) AtlasConversionConcern(io.atlasmap.spi.AtlasConversionConcern) Method(java.lang.reflect.Method) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Example 8 with AtlasConversionConcern

use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.

the class LongConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = LongConverter.class;
    Method[] methods = aClass.getMethods();
    for (Method method : methods) {
        if (method.isSynthetic()) {
            // We are running in Eclipse or jacoco
            continue;
        }
        if (method.getName().startsWith("convert")) {
            Annotation[] annotations = method.getDeclaredAnnotations();
            assertNotNull(annotations);
            assertTrue(annotations.length > 0);
            for (Annotation annotation : annotations) {
                assertTrue(AtlasConversionInfo.class.isAssignableFrom(annotation.annotationType()));
                AtlasConversionInfo atlasConversionInfo = (AtlasConversionInfo) annotation;
                assertNotNull(atlasConversionInfo.sourceType());
                assertTrue(atlasConversionInfo.sourceType().compareTo(FieldType.LONG) == 0);
                assertNotNull(atlasConversionInfo.targetType());
                for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
                    assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
                    assertNotNull(atlasConversionConcern.value());
                }
            }
        }
    }
}
Also used : AtlasConversionInfo(io.atlasmap.spi.AtlasConversionInfo) AtlasConversionConcern(io.atlasmap.spi.AtlasConversionConcern) Method(java.lang.reflect.Method) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Example 9 with AtlasConversionConcern

use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.

the class ShortConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = ShortConverter.class;
    Method[] methods = aClass.getMethods();
    for (Method method : methods) {
        if (method.isSynthetic()) {
            // We are running in Eclipse or jacoco
            continue;
        }
        if (method.getName().startsWith("convert")) {
            Annotation[] annotations = method.getDeclaredAnnotations();
            assertNotNull(annotations);
            assertTrue(annotations.length > 0);
            for (Annotation annotation : annotations) {
                assertTrue(AtlasConversionInfo.class.isAssignableFrom(annotation.annotationType()));
                AtlasConversionInfo atlasConversionInfo = (AtlasConversionInfo) annotation;
                assertNotNull(atlasConversionInfo.sourceType());
                assertTrue(atlasConversionInfo.sourceType().compareTo(FieldType.SHORT) == 0);
                assertNotNull(atlasConversionInfo.targetType());
                for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
                    assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
                    assertNotNull(atlasConversionConcern.value());
                }
            }
        }
    }
}
Also used : AtlasConversionInfo(io.atlasmap.spi.AtlasConversionInfo) AtlasConversionConcern(io.atlasmap.spi.AtlasConversionConcern) Method(java.lang.reflect.Method) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Example 10 with AtlasConversionConcern

use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.

the class CharacterConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = CharacterConverter.class;
    Method[] methods = aClass.getMethods();
    for (Method method : methods) {
        if (method.isSynthetic()) {
            // We are running in Eclipse or jacoco
            continue;
        }
        if (method.getName().startsWith("convert")) {
            Annotation[] annotations = method.getDeclaredAnnotations();
            assertNotNull(annotations);
            assertTrue(annotations.length > 0);
            for (Annotation annotation : annotations) {
                assertTrue(AtlasConversionInfo.class.isAssignableFrom(annotation.annotationType()));
                AtlasConversionInfo atlasConversionInfo = (AtlasConversionInfo) annotation;
                assertNotNull(atlasConversionInfo.sourceType());
                assertTrue(atlasConversionInfo.sourceType().compareTo(FieldType.CHAR) == 0);
                assertNotNull(atlasConversionInfo.targetType());
                for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
                    assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
                    assertNotNull(atlasConversionConcern.value());
                }
            }
        }
    }
}
Also used : AtlasConversionInfo(io.atlasmap.spi.AtlasConversionInfo) AtlasConversionConcern(io.atlasmap.spi.AtlasConversionConcern) Method(java.lang.reflect.Method) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Aggregations

AtlasConversionConcern (io.atlasmap.spi.AtlasConversionConcern)10 AtlasConversionInfo (io.atlasmap.spi.AtlasConversionInfo)9 Annotation (java.lang.annotation.Annotation)9 Method (java.lang.reflect.Method)9 Test (org.junit.Test)9 Validation (io.atlasmap.v2.Validation)1