use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class KafkaDatasetTestIT method testBasic.
@Test
public void testBasic() throws Exception {
KafkaDatasetProperties props = createDatasetProperties();
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(0));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class KafkaDatasetProperties method beforeTopic.
public ValidationResult beforeTopic() {
KafkaDatasetDefinition definition = new KafkaDatasetDefinition();
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(this);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, getClass().getClassLoader())) {
IKafkaDatasetRuntime runtime = (IKafkaDatasetRuntime) sandboxedInstance.getInstance();
runtime.initialize(null, this);
this.topic.setPossibleValues(new ArrayList(runtime.listTopic()));
return ValidationResult.OK;
} catch (Exception e) {
return new ValidationResult(new ComponentException(e));
}
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JmsDatastoreDefinitionTest method testGetRuntimeInfo.
@Test
public void testGetRuntimeInfo() {
RuntimeInfo runtimeInfo = datastoreDefinition.getRuntimeInfo(null);
assertEquals("org.talend.components.jms.runtime_1_1.DatastoreRuntime", runtimeInfo.getRuntimeClassName());
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JmsOutputDefinitionTest method testGetRuntimeInfo.
/**
* Check {@link JmsOutputDefinition#getRuntimeInfo(ComponentProperties properties, ConnectorTopology connectorTopology)
* returns RuntimeInfo,
* which runtime class name is "org.talend.components.jms.runtime_1_1.JmsSource"
*/
@Test
public void testGetRuntimeInfo() {
RuntimeInfo runtimeInfo = outputDefinition.getRuntimeInfo(ExecutionEngine.BEAM, null, null);
assertEquals("org.talend.components.jms.runtime_1_1.JmsSource", runtimeInfo.getRuntimeClassName());
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class WindowDefinitionTest method testRuntimeInfo.
/**
* Checks the {@link RuntimeInfo} of the definition.
*/
@Test
@Ignore("This can't work unless the runtime jar is already installed in maven!")
public void testRuntimeInfo() {
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(null, null, null);
assertEquals("org.talend.components.processing.runtime.window.WindowRuntime", runtimeInfo.getRuntimeClassName());
}
Aggregations