use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class BigQueryInputDefinitionTest method testRuntimeInfo.
@Test
@Ignore("This can't work unless the runtime jar is already installed in maven!")
public void testRuntimeInfo() {
RuntimeInfo runtimeInfo = inputDefinition.getRuntimeInfo(ExecutionEngine.BEAM, null, null);
assertEquals("org.talend.components.bigquery.runtime.BigQueryInputRuntime", runtimeInfo.getRuntimeClassName());
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class BigQueryDatasetTestIT method testBasic.
@Test
public void testBasic() throws Exception {
BigQueryDatasetProperties props = createDatasetProperties();
props.sourceType.setValue(SourceType.QUERY);
props.query.setValue("SELECT * FROM [bigquery-public-data:samples.shakespeare] LIMIT 1");
props.useLegacySql.setValue(true);
final List<IndexedRecord> consumed = new ArrayList<>();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatasetRuntime runtime = (DatasetRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Schema s = runtime.getSchema();
assertThat(s, not(nullValue()));
runtime.getSample(100, new Consumer<IndexedRecord>() {
@Override
public void accept(IndexedRecord ir) {
consumed.add(ir);
}
});
}
assertThat(consumed, hasSize(1));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class SandboxedSimpleFileIODatasetRuntimeTest method testBasic.
@Test
public void testBasic() throws Exception {
File input = folder.newFile("stuff.csv");
try (FileWriter fw = new FileWriter(input)) {
fw.write("1;one");
}
SimpleFileIODatasetProperties props = createDatasetProperties();
props.path.setValue(input.toURI().toString());
final List<IndexedRecord> consumed = new ArrayList<>();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatasetRuntime runtime = (DatasetRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Schema s = runtime.getSchema();
assertThat(s, not(nullValue()));
runtime.getSample(100, new Consumer<IndexedRecord>() {
@Override
public void accept(IndexedRecord ir) {
consumed.add(ir);
}
});
}
assertThat(consumed, hasSize(1));
assertThat(consumed.get(0).get(0), is((Object) "1"));
assertThat(consumed.get(0).get(1), is((Object) "one"));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class SimpleFileIODatasetRuntimeTest method testBasic.
@Test
public void testBasic() throws Exception {
File input = folder.newFile("stuff.csv");
try (FileWriter fw = new FileWriter(input)) {
fw.write("1;one");
}
SimpleFileIODatasetProperties props = createDatasetProperties();
props.path.setValue(input.toURI().toString());
final List<IndexedRecord> consumed = new ArrayList<>();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatasetRuntime runtime = (DatasetRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Schema s = runtime.getSchema();
assertThat(s, not(nullValue()));
runtime.getSample(100, new Consumer<IndexedRecord>() {
@Override
public void accept(IndexedRecord ir) {
consumed.add(ir);
}
});
}
assertThat(consumed, hasSize(1));
assertThat(consumed.get(0).get(0), is((Object) "1"));
assertThat(consumed.get(0).get(1), is((Object) "one"));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class ElasticsearchInputDefinitionTest method testRuntimeInfo.
/**
* Check {@link ElasticsearchInputDefinition#getRuntimeInfo(ComponentProperties, ConnectorTopology)} returns RuntimeInfo,
* which runtime class name is "org.talend.components.elasticsearch.runtime_2_4.ElasticsearchInputRuntime"
*/
@Test
@Ignore("This can't work unless the runtime jar is already installed in maven!")
public void testRuntimeInfo() {
RuntimeInfo runtimeInfo = inputDefinition.getRuntimeInfo(ExecutionEngine.BEAM, null, null);
assertEquals("org.talend.components.elasticsearch.runtime_2_4.ElasticsearchInputRuntime", runtimeInfo.getRuntimeClassName());
}
Aggregations