use of io.atlasmap.v2.DataSource in project java-docs-samples by GoogleCloudPlatform.
the class QuickstartSample method main.
/**
* List available data sources for the BigQuery Data Transfer service.
*/
public static void main(String... args) throws Exception {
// Sets your Google Cloud Platform project ID.
// String projectId = "YOUR_PROJECT_ID";
String projectId = args[0];
// GOOGLE_APPLICATION_CREDENTIALS environment variable.
try (DataTransferServiceClient client = DataTransferServiceClient.create()) {
// Request the list of available data sources.
String parent = String.format("projects/%s", projectId);
ListDataSourcesRequest request = ListDataSourcesRequest.newBuilder().setParent(parent).build();
ListDataSourcesPagedResponse response = client.listDataSources(request);
// Print the results.
System.out.println("Supported Data Sources:");
for (DataSource dataSource : response.iterateAll()) {
System.out.println(dataSource.getDisplayName());
System.out.printf("\tID: %s%n", dataSource.getDataSourceId());
System.out.printf("\tFull path: %s%n", dataSource.getName());
System.out.printf("\tDescription: %s%n", dataSource.getDescription());
}
}
}
use of io.atlasmap.v2.DataSource in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method processSources.
/**
* Gets list of output data shapes for preceding steps.
*
* @return list of datasources from preceding steps
*/
private List<DataSource> processSources() {
List<DataSource> sources = new ArrayList<>();
precedingSteps.stream().filter(s -> s.getStep().getAction().isPresent()).forEach(s -> {
DataShape outDataShape = s.getStep().getAction().get().getOutputDataShape().get();
// Steps with "ANY" or "NONE" are ignored for sources and only those that have proper datashape are used
if (outDataShape.getKind() != DataShapeKinds.ANY && outDataShape.getKind() != DataShapeKinds.NONE) {
sources.add(createDataSource(outDataShape, s, DataSourceType.SOURCE));
}
});
return sources;
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class XmlFieldReaderTest method mockDataSources.
private void mockDataSources(String docId, AtlasInternalSession session) {
AtlasMapping atlasMapping = mock(AtlasMapping.class);
List<DataSource> dataSources = new ArrayList<>();
XmlDataSource xmlDataSource = new XmlDataSource();
xmlDataSource.setId(docId);
xmlDataSource.setDataSourceType(DataSourceType.SOURCE);
XmlNamespaces atlasNamespaces = new XmlNamespaces();
XmlNamespace xmlNamespaceQ = new XmlNamespace();
xmlNamespaceQ.setAlias("q");
xmlNamespaceQ.setUri("http://www.example.com/q/");
XmlNamespace xmlNamespaceX = new XmlNamespace();
xmlNamespaceX.setAlias("");
xmlNamespaceX.setUri("http://www.example.com/x/");
XmlNamespace xmlNamespaceY = new XmlNamespace();
xmlNamespaceY.setAlias("y");
xmlNamespaceY.setUri("http://www.example.com/y/");
atlasNamespaces.getXmlNamespace().add(xmlNamespaceQ);
atlasNamespaces.getXmlNamespace().add(xmlNamespaceX);
atlasNamespaces.getXmlNamespace().add(xmlNamespaceY);
xmlDataSource.setXmlNamespaces(atlasNamespaces);
dataSources.add(xmlDataSource);
when(atlasMapping.getDataSource()).thenReturn(dataSources);
when(session.getMapping()).thenReturn(atlasMapping);
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class AtlasEndpointTest method testDocId.
@Test
public void testDocId() throws Exception {
List<DataSource> ds = new ArrayList<>();
DataSource source = new DataSource();
source.setDataSourceType(DataSourceType.SOURCE);
source.setId("my-source-doc");
ds.add(source);
DataSource target = new DataSource();
target.setDataSourceType(DataSourceType.TARGET);
target.setId("my-target-doc");
ds.add(target);
perform(ds, "my-source-doc", "my-target-doc", false);
}
use of io.atlasmap.v2.DataSource in project atlasmap by atlasmap.
the class AtlasEndpointTest method noConversionIfJavaDataSource.
@Test(expected = ComparisonFailure.class)
public void noConversionIfJavaDataSource() throws Exception {
final List<DataSource> dataSources = new ArrayList<>();
final DataSource dataSource = new DataSource();
dataSource.setDataSourceType(DataSourceType.SOURCE);
dataSource.setUri("atlas:java:some.Type");
dataSources.add(dataSource);
perform(dataSources, null, null, true);
}
Aggregations