use of io.atlasmap.v2.Mappings in project atlasmap by atlasmap.
the class XmlJsonFlatMappingTest method testCreateXmlJsonFlatFieldMapping.
@Test
public void testCreateXmlJsonFlatFieldMapping() throws Exception {
AtlasMapping atlasMapping = generateXmlJsonFlatMapping();
File path = new File("target/reference-mappings/xmlToJson");
path.mkdirs();
Json.mapper().writeValue(new File(path, "atlasmapping-flatprimitive.xml"), atlasMapping);
}
use of io.atlasmap.v2.Mappings in project atlasmap by atlasmap.
the class JsonValidationServiceMultiplicityTest method testHappyPath.
@Test
public void testHappyPath() throws Exception {
AtlasMapping mapping = mappingUtil.loadMapping("src/test/resources/mappings/atlasmapping-multiplicity-transformation-concatenate-split.json");
assertNotNull(mapping);
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertFalse(validationHelper.hasErrors(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasWarnings(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasInfos(), validationHelper.allValidationsToString());
}
use of io.atlasmap.v2.Mappings in project atlasmap by atlasmap.
the class JsonValidationServiceMultiplicityTest method testCollectionInFieldGroup.
@Test
public void testCollectionInFieldGroup() throws Exception {
AtlasMapping mapping = mappingUtil.loadMapping("src/test/resources/mappings/atlasmapping-multiplicity-transformation-concatenate-split.json");
for (BaseMapping m : mapping.getMappings().getMapping()) {
Mapping entry = (Mapping) m;
if ("concatenate-from-field-group".equals(entry.getId())) {
JsonField f = new JsonField();
f.setCollectionType(CollectionType.LIST);
f.setFieldType(FieldType.STRING);
f.setPath("/sourceStringList<>");
entry.getInputFieldGroup().getField().add(f);
break;
}
}
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertFalse(validationHelper.hasErrors(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasWarnings(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasInfos(), validationHelper.allValidationsToString());
assertEquals(0, validationHelper.getCount());
}
use of io.atlasmap.v2.Mappings in project atlasmap by atlasmap.
the class JsonValidationServiceMultiplicityTest method testCollectionInTargetFields.
@Test
public void testCollectionInTargetFields() throws Exception {
AtlasMapping mapping = mappingUtil.loadMapping("src/test/resources/mappings/atlasmapping-multiplicity-transformation-concatenate-split.json");
for (BaseMapping m : mapping.getMappings().getMapping()) {
Mapping entry = (Mapping) m;
if ("split-into-multiple-fields".equals(entry.getId())) {
JsonField f = new JsonField();
f.setCollectionType(CollectionType.LIST);
f.setFieldType(FieldType.STRING);
f.setPath("/targetStringList<>");
entry.getOutputField().add(f);
break;
}
}
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertFalse(validationHelper.hasErrors(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasWarnings(), validationHelper.allValidationsToString());
assertFalse(validationHelper.hasInfos(), validationHelper.allValidationsToString());
assertEquals(0, validationHelper.getCount());
}
use of io.atlasmap.v2.Mappings in project atlasmap by atlasmap.
the class JsonValidationServiceTest method testValidateMappingHappyPathFromFile.
@Test
public void testValidateMappingHappyPathFromFile() throws Exception {
AtlasMapping mapping = mappingUtil.loadMapping("src/test/resources/mappings/HappyPathMapping.json");
assertNotNull(mapping);
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertFalse(validationHelper.hasErrors());
assertFalse(validationHelper.hasWarnings());
assertFalse(validationHelper.hasInfos());
}
Aggregations