use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.
the class JsonValidationServiceTest method createMockMapping.
protected Mapping createMockMapping() {
// Mock MappedField
MockField inputField = new MockField();
inputField.setName("input.name");
MockField outputField = new MockField();
outputField.setName("out.name");
Mapping mapping = new Mapping();
mapping.setMappingType(MappingType.MAP);
mapping.getInputField().add(inputField);
mapping.getOutputField().add(inputField);
return mapping;
}
use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.
the class JsonValidationServiceTest method testValidateMappingInvalidModuleType.
@Test
public void testValidateMappingInvalidModuleType() {
AtlasMapping mapping = AtlasModelFactory.createAtlasMapping();
mapping.setName("thisis_a_valid.name");
mapping.getDataSource().add(generateDataSource("atlas:xml", DataSourceType.SOURCE));
mapping.getDataSource().add(generateDataSource("atlas:xml", DataSourceType.TARGET));
validations.addAll(sourceValidationService.validateMapping(mapping));
validations.addAll(targetValidationService.validateMapping(mapping));
assertTrue(validationHelper.hasErrors());
assertFalse(validationHelper.hasWarnings());
assertFalse(validationHelper.hasInfos());
}
use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateMapping.
private void generateMapping(AtlasMapping atlasMapping) {
Mapping mapping = AtlasModelFactory.createMapping(MappingType.MAP);
generateInputField(mapping);
generateOutputField(mapping);
mapping.setMappingType(MappingType.MAP);
mapping.setDelimiterString(",");
mapping.setAlias("MapPropertyFieldAlias");
mapping.setDelimiter(",");
mapping.setDescription("description");
mapping.setId("id");
mapping.setLookupTableName("lookupTableName");
mapping.setStrategy("strategy");
mapping.setStrategyClassName("strategyClassName");
atlasMapping.getMappings().getMapping().add(mapping);
}
use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.
the class AtlasMappingUtil method loadMapping.
public AtlasMapping loadMapping(String fileName) throws Exception {
AtlasMapping mapping = null;
if (jaxbContext != null) {
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Path newFilePath = Paths.get(fileName);
mapping = (AtlasMapping) ((javax.xml.bind.JAXBElement<?>) unmarshaller.unmarshal(newFilePath.toFile())).getValue();
}
return mapping;
}
use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.
the class AtlasModuleSupportTest method testListTargetPathsListOfBaseMapping.
@Test
public void testListTargetPathsListOfBaseMapping() {
List<BaseMapping> mappings = null;
assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
mappings = new ArrayList<>();
assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
Mapping mapping = new Mapping();
Field field = new MockField();
field.setPath("MockPath");
mapping.getOutputField().add(field);
mappings.add(mapping);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
Collection collection = null;
mappings.add(collection);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
collection = new Collection();
mappings.add(collection);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
Mappings mapings = new Mappings();
collection.setMappings(mapings);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
}
Aggregations