use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.
the class BaseModuleValidationService method populateConversionConcerns.
protected void populateConversionConcerns(String mappingId, AtlasConversionInfo converterAnno, String inputFieldName, String outFieldName, List<Validation> validations) {
if (converterAnno == null || converterAnno.concerns() == null) {
return;
}
for (AtlasConversionConcern atlasConversionConcern : converterAnno.concerns()) {
String message = atlasConversionConcern.getMessage(converterAnno);
if (AtlasConversionConcern.NONE.equals(atlasConversionConcern)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.INFO);
validations.add(validation);
} else if (atlasConversionConcern.equals(AtlasConversionConcern.RANGE) || atlasConversionConcern.equals(AtlasConversionConcern.FORMAT) || atlasConversionConcern.equals(AtlasConversionConcern.FRACTIONAL_PART) || atlasConversionConcern.equals(AtlasConversionConcern.TIMEZONE)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.WARN);
validations.add(validation);
} else if (atlasConversionConcern.equals(AtlasConversionConcern.UNSUPPORTED)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.ERROR);
validations.add(validation);
}
}
}
use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.
the class DoubleConverterTest method checkAnnotations.
@Test
public void checkAnnotations() throws Exception {
Class<?> aClass = DoubleConverter.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.DOUBLE) == 0);
assertNotNull(atlasConversionInfo.targetType());
for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
assertNotNull(atlasConversionConcern.value());
}
}
}
}
}
use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.
the class FloatConverterTest method checkAnnotations.
@Test
public void checkAnnotations() throws Exception {
Class<?> aClass = FloatConverter.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.FLOAT) == 0);
assertNotNull(atlasConversionInfo.targetType());
for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
assertNotNull(atlasConversionConcern.value());
}
}
}
}
}
use of io.atlasmap.spi.AtlasConversionConcern in project atlasmap by atlasmap.
the class BooleanConverterTest method checkAnnotations.
@Test
public void checkAnnotations() throws Exception {
Class<?> aClass = BooleanConverter.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.BOOLEAN) == 0);
assertNotNull(atlasConversionInfo.targetType());
for (AtlasConversionConcern atlasConversionConcern : atlasConversionInfo.concerns()) {
assertNotNull(atlasConversionConcern.getMessage(atlasConversionInfo));
assertNotNull(atlasConversionConcern.value());
}
}
}
}
}
use of io.atlasmap.spi.AtlasConversionConcern 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());
}
}
}
}
}
Aggregations