use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class JavaValidationServiceTest method testValidateMappingClassNotFound.
@Test
public void testValidateMappingClassNotFound() throws Exception {
AtlasMapping mapping = mappingUtil.loadMapping("src/test/resources/mappings/HappyPathMapping.xml");
assertNotNull(mapping);
Mapping fieldMapping = (Mapping) mapping.getMappings().getMapping().get(0);
JavaField in = (JavaField) fieldMapping.getInputField().get(0);
in.setClassName("java.lang.String3");
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertTrue(validationHelper.hasErrors());
assertFalse(validationHelper.hasWarnings());
assertFalse(validationHelper.hasInfos());
assertEquals(1, validations.size());
Validation v = validations.get(0);
assertEquals(ValidationScope.MAPPING, v.getScope());
assertEquals("map.firstName.firstName", v.getId());
assertEquals(ValidationStatus.ERROR, v.getStatus());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateCombineMapping.
protected AtlasMapping generateCombineMapping() {
Actions actions = generateActions();
StringList annotations = generateAnnotations();
ModifierList modifierList = generateModifierList();
StringList parameterizedTypes = generateParameterizedTypes();
JavaField inputJavaField = generateJavaField(actions, annotations, modifierList, parameterizedTypes);
JavaField inputJavaFieldB = generateJavaField(actions, annotations, modifierList, parameterizedTypes);
JavaField outputJavaFieldA = generateJavaField(actions, annotations, modifierList, parameterizedTypes);
Mapping fm = (Mapping) AtlasModelFactory.createMapping(MappingType.COMBINE);
fm.getInputField().add(inputJavaField);
fm.getInputField().add(inputJavaFieldB);
fm.getOutputField().add(outputJavaFieldA);
populateMapping(fm, MappingType.COMBINE, "MapPropertyFieldAlias", ",", ",");
populateMappingString(fm, "description", "id", "lookupTableName", "strategy", "strategyClassName");
AtlasMapping mapping = generateAtlasMapping();
mapping.getMappings().getMapping().clear();
mapping.getMappings().getMapping().add(fm);
generateProperties(mapping);
return mapping;
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateLookupTables.
private void generateLookupTables(AtlasMapping atlasMapping) {
LookupTable table = new LookupTable();
table.setName("lookupTable");
table.setDescription("lookupTableDescription");
LookupEntry l1 = new LookupEntry();
l1.setSourceType(FieldType.STRING);
l1.setSourceValue("Foo");
l1.setTargetType(FieldType.STRING);
l1.setTargetValue("Bar");
table.getLookupEntry().add(l1);
atlasMapping.getLookupTables().getLookupTable().add(table);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class JsonMarshallerTest method testJsonMapJavaField.
@Test
public void testJsonMapJavaField() throws Exception {
AtlasMapping atlasMapping = generateAtlasMapping();
// Object to JSON in file
mapper.writerWithDefaultPrettyPrinter().writeValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping.json"), atlasMapping);
AtlasMapping uMapping = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping.json"), AtlasMapping.class);
assertNotNull(uMapping);
validateAtlasMapping(uMapping);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class JsonMarshallerTest method testJsonSeparateJavaField.
@Test
public void testJsonSeparateJavaField() throws Exception {
AtlasMapping atlasMapping = generateSeparateAtlasMapping();
// Object to JSON in file
mapper.writerWithDefaultPrettyPrinter().writeValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-separate.json"), atlasMapping);
AtlasMapping uMapping = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-separate.json"), AtlasMapping.class);
assertNotNull(uMapping);
validateSeparateAtlasMapping(uMapping);
}
Aggregations