use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class BigQueryDatasetProperties method beforeBqDataset.
public ValidationResult beforeBqDataset() {
BigQueryDatasetDefinition definition = new BigQueryDatasetDefinition();
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(this);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, getClass().getClassLoader())) {
IBigQueryDatasetRuntime runtime = (IBigQueryDatasetRuntime) sandboxedInstance.getInstance();
runtime.initialize(null, this);
List<NamedThing> datasets = new ArrayList<>();
for (String dataset : runtime.listDatasets()) {
datasets.add(new SimpleNamedThing(dataset, dataset));
}
bqDataset.setPossibleValues(datasets);
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 BigQueryDatasetProperties method beforeTableName.
public void beforeTableName() {
BigQueryDatasetDefinition definition = new BigQueryDatasetDefinition();
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(this);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, getClass().getClassLoader())) {
IBigQueryDatasetRuntime runtime = (IBigQueryDatasetRuntime) sandboxedInstance.getInstance();
runtime.initialize(null, this);
List<NamedThing> tables = new ArrayList<>();
for (String table : runtime.listTables()) {
tables.add(new SimpleNamedThing(table, table));
}
this.tableName.setPossibleValues(tables);
} catch (Exception e) {
TalendRuntimeException.build(CommonErrorCodes.UNEXPECTED_EXCEPTION).setAndThrow(e.getMessage());
}
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class CouchbaseOutputDefinitionTest method testGetRuntimeInfo.
@Test
public void testGetRuntimeInfo() {
RuntimeInfo runtime = definition.getRuntimeInfo(ExecutionEngine.DI, null, ConnectorTopology.INCOMING);
Assert.assertEquals(CouchbaseSink.class.getCanonicalName(), runtime.getRuntimeClassName());
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class ElasticsearchDatastoreTestIT method testBasic.
@Test
public void testBasic() throws Exception {
ElasticsearchDatastoreProperties props = createDatastoreProperties();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatastoreRuntime runtime = (DatastoreRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Iterator iterator = runtime.doHealthChecks(null).iterator();
assertTrue(iterator.hasNext());
assertEquals(ValidationResult.OK, iterator.next());
}
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class BigQueryDatastoreDefinitionTest method testRuntimeInfo.
/**
* Check {@link BigQueryDatastoreDefinition#getRuntimeInfo(BigQueryDatastoreProperties) returns RuntimeInfo,
* which runtime class name is "org.talend.components.bigquery.runtime.BigQueryDatastoreRuntime"
*/
@Test
@Ignore("This can't work unless the runtime jar is already installed in maven!")
public void testRuntimeInfo() {
RuntimeInfo runtimeInfo = datastoreDefinition.getRuntimeInfo(null);
assertEquals("org.talend.components.bigquery.runtime.BigQueryDatastoreRuntime", runtimeInfo.getRuntimeClassName());
}
Aggregations