Search in sources :

Example 11 with AtlasConversionInfo

use of io.atlasmap.spi.AtlasConversionInfo 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 12 with AtlasConversionInfo

use of io.atlasmap.spi.AtlasConversionInfo 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.jupiter.api.Test)

Example 13 with AtlasConversionInfo

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

the class ByteConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = ByteConverter.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.BYTE) == 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.jupiter.api.Test)

Example 14 with AtlasConversionInfo

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

the class CharSequenceConverterTest method checkAnnotations.

@Test
public void checkAnnotations() throws Exception {
    Class<?> aClass = CharSequenceConverter.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.jupiter.api.Test)

Example 15 with AtlasConversionInfo

use of io.atlasmap.spi.AtlasConversionInfo 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.jupiter.api.Test)

Aggregations

AtlasConversionInfo (io.atlasmap.spi.AtlasConversionInfo)22 Method (java.lang.reflect.Method)14 AtlasConversionConcern (io.atlasmap.spi.AtlasConversionConcern)12 Annotation (java.lang.annotation.Annotation)10 Test (org.junit.jupiter.api.Test)9 AtlasConversionException (io.atlasmap.api.AtlasConversionException)7 BigDecimal (java.math.BigDecimal)5 Field (io.atlasmap.v2.Field)4 FieldType (io.atlasmap.v2.FieldType)4 Validation (io.atlasmap.v2.Validation)4 ValidationScope (io.atlasmap.v2.ValidationScope)4 ValidationStatus (io.atlasmap.v2.ValidationStatus)4 Arrays (java.util.Arrays)4 List (java.util.List)4 Optional (java.util.Optional)4 AtlasConversionService (io.atlasmap.api.AtlasConversionService)2 AtlasConverter (io.atlasmap.api.AtlasConverter)2 JavaField (io.atlasmap.java.v2.JavaField)2 AtlasConverter (io.atlasmap.spi.AtlasConverter)2 AtlasModuleDetail (io.atlasmap.spi.AtlasModuleDetail)2