use of io.atlasmap.v2.AtlasMapping 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.AtlasMapping in project atlasmap by atlasmap.
the class AtlasModuleSupportTest method testListTargetPathsAtlasMapping.
@Test
public void testListTargetPathsAtlasMapping() {
AtlasMapping atlasMapping = null;
assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
atlasMapping = new AtlasMapping();
assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
Mappings mappings = new Mappings();
atlasMapping.setMappings(mappings);
assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
Mapping mapping = new Mapping();
mappings.getMapping().add(mapping);
assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
class MockMapping extends Mappings {
private static final long serialVersionUID = 1L;
@Override
public List<BaseMapping> getMapping() {
return null;
}
}
Mappings mockMapping = new MockMapping();
atlasMapping.setMappings(mockMapping);
assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class AtlasMappingServiceTest method testLoadMappingFileAtlasMappingFormatAtlasValidationException.
@Test(expected = AtlasValidationException.class)
public void testLoadMappingFileAtlasMappingFormatAtlasValidationException() throws AtlasValidationException {
File file = Paths.get("src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping2.json").toFile();
AtlasMapping atlasMapping = atlasMappingService.loadMapping(file, AtlasMappingFormat.JSON);
assertNotNull(atlasMapping);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class AtlasMappingServiceTest method testLoadMappingString.
@Test
public void testLoadMappingString() throws AtlasValidationException {
String filename = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping.xml";
AtlasMapping atlasMapping = atlasMappingService.loadMapping(filename);
assertNotNull(atlasMapping);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class AtlasMappingServiceTest method testLoadMappingURI.
@Test
public void testLoadMappingURI() throws Exception {
URI uri = Paths.get("src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping.xml").toUri();
AtlasMapping atlasMapping = atlasMappingService.loadMapping(uri);
assertNotNull(atlasMapping);
}
Aggregations