use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class JsonJsonFlatMappingTest method generateDataSource.
protected DataSource generateDataSource(String uri, DataSourceType type) {
DataSource ds = new DataSource();
ds.setUri(uri);
ds.setDataSourceType(type);
return ds;
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class JavaValidationServiceTest method generateDataSource.
protected DataSource generateDataSource(String uri, DataSourceType type, String docId) {
DataSource ds = new DataSource();
ds.setUri(uri);
ds.setDataSourceType(type);
ds.setId(docId);
return ds;
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateDataSource.
private DataSource generateDataSource(String id, String uri, DataSourceType type) {
DataSource dataSource = new DataSource();
dataSource.setId(id);
dataSource.setUri(uri);
dataSource.setDataSourceType(type);
return dataSource;
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class DefaultAtlasContextTest method testInit.
// (expected = AtlasException.class)
@Test
public void testInit() throws AtlasException {
File file = Paths.get("src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping.json").toFile();
DefaultAtlasContext ctx = new DefaultAtlasContext(DefaultAtlasContextFactory.getInstance(), file.toURI());
ctx.init();
DataSource dataSource = new DataSource();
dataSource.setUri("URI");
mapping.getDataSource().add(dataSource);
dataSource = new DataSource();
dataSource.setUri(null);
mapping.getDataSource().add(dataSource);
dataSource = new DataSource();
dataSource.setUri("java:source");
dataSource.setDataSourceType(DataSourceType.SOURCE);
dataSource.setId("io.atlasmap.core.DefaultAtlasContext.constants.docId");
mapping.getDataSource().add(dataSource);
dataSource = new DataSource();
dataSource.setUri("java:target");
dataSource.setDataSourceType(DataSourceType.TARGET);
dataSource.setId("io.atlasmap.core.DefaultAtlasContext.constants.docId");
mapping.getDataSource().add(dataSource);
dataSource = new DataSource();
dataSource.setUri("java:target");
dataSource.setDataSourceType(DataSourceType.TARGET);
dataSource.setId("io.atlasmap.core.DefaultAtlasContext.constants.docId");
mapping.getDataSource().add(dataSource);
ctx = new DefaultAtlasContext(DefaultAtlasContextFactory.getInstance(), mapping);
ctx.getTargetModules().put("io.atlasmap.core.DefaultAtlasContext.constants.docId", new ConstantModule());
ctx.init();
@SuppressWarnings("unchecked") Map<String, AtlasModule> targetModules = spy(Map.class);
when(targetModules.put(any(String.class), any(AtlasModule.class))).thenThrow(new RuntimeException("mockException"));
ctx.setTargetModules(targetModules);
ctx.init();
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class BaseValidatorTest method getAtlasMappingFullValid.
protected AtlasMapping getAtlasMappingFullValid() {
AtlasMapping mapping = AtlasModelFactory.createAtlasMapping();
mapping.setName("thisis_a_valid.name");
DataSource src = new DataSource();
src.setDataSourceType(DataSourceType.SOURCE);
src.setUri("atlas:java?2");
DataSource tgt = new DataSource();
tgt.setDataSourceType(DataSourceType.TARGET);
tgt.setUri("atlas:java?3");
mapping.getDataSource().add(src);
mapping.getDataSource().add(tgt);
Mapping mapFieldMapping = AtlasModelFactory.createMapping(MappingType.MAP);
MockField inputField = AtlasModelFactory.createMockField();
inputField.setFieldType(FieldType.STRING);
inputField.setCustom("java.lang.String");
inputField.setName("inputName");
mapFieldMapping.getInputField().add(inputField);
MockField outputField = AtlasModelFactory.createMockField();
outputField.setFieldType(FieldType.STRING);
outputField.setCustom("java.lang.String");
outputField.setName("outputName");
mapFieldMapping.getOutputField().add(outputField);
Mapping separateMapping = AtlasModelFactory.createMapping(MappingType.SEPARATE);
MockField sIJavaField = AtlasModelFactory.createMockField();
sIJavaField.setFieldType(FieldType.STRING);
sIJavaField.setCustom("java.lang.String");
sIJavaField.setName("inputName");
separateMapping.getInputField().add(sIJavaField);
MockField sOJavaField = AtlasModelFactory.createMockField();
sOJavaField.setFieldType(FieldType.STRING);
sOJavaField.setCustom("java.lang.String");
sOJavaField.setName("outputName");
sOJavaField.setIndex(0);
separateMapping.getOutputField().add(sOJavaField);
mapping.getMappings().getMapping().add(mapFieldMapping);
mapping.getMappings().getMapping().add(separateMapping);
return mapping;
}
Aggregations