use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JdbcDatasetRuntimeTest method testBasic.
@Test
public void testBasic() throws Exception {
JDBCDatasetProperties 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(2));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JDBCDatastoreDefinitionTest method testGetRuntimeInfo.
/**
* Run the RuntimeInfo getRuntimeInfo(JDBCDatastoreProperties) method test.
*
* @throws Exception
*
* @generatedBy CodePro at 17-6-23 PM2:14
*/
@Test
public void testGetRuntimeInfo() throws Exception {
AllSetting allSetting = Mockito.mock(AllSetting.class);
Mockito.when(allSetting.getDriverClass()).thenReturn("anyDriverClass");
JDBCDatastoreProperties properties = Mockito.mock(JDBCDatastoreProperties.class);
Mockito.when(properties.getRuntimeSetting()).thenReturn(allSetting);
JDBCDatastoreDefinition fixture = new JDBCDatastoreDefinition();
RuntimeInfo result = fixture.getRuntimeInfo(properties);
assertNotNull(result);
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JDBCOutputDefinitionTest method getRuntimeInfo.
@Test
public void getRuntimeInfo() throws Exception {
AllSetting allSetting = Mockito.mock(AllSetting.class);
Mockito.when(allSetting.getDriverClass()).thenReturn("anyDriverClass");
JDBCOutputProperties anyProperties = Mockito.mock(JDBCOutputProperties.class);
Mockito.when(anyProperties.getRuntimeSetting()).thenReturn(allSetting);
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.BEAM, anyProperties, null);
assertEquals(JDBCOutputDefinition.BEAM_RUNTIME, runtimeInfo.getRuntimeClassName());
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class TJDBCOutputDefinitionTest method testGetRuntimeInfo.
/**
* Run the RuntimeInfo getRuntimeInfo(ExecutionEngine,ComponentProperties,ConnectorTopology) method test.
*
* @throws Exception
*
* @generatedBy CodePro at 17-6-20 PM3:13
*/
@Test
public void testGetRuntimeInfo() throws Exception {
AllSetting allSetting = Mockito.mock(AllSetting.class);
Mockito.when(allSetting.getDriverClass()).thenReturn("anyDriverClass");
TJDBCOutputProperties properties = Mockito.mock(TJDBCOutputProperties.class);
Mockito.when(properties.getRuntimeSetting()).thenReturn(allSetting);
TJDBCOutputDefinition fixture = new TJDBCOutputDefinition();
ExecutionEngine engine = ExecutionEngine.DI;
RuntimeInfo result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.INCOMING);
assertNotNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.INCOMING_AND_OUTGOING);
assertNotNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.NONE);
assertNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.OUTGOING);
assertNull(result);
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class AggregateDefinitionTest method testGetRuntimeInfo.
@Test
public void testGetRuntimeInfo() {
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.BEAM, null, ConnectorTopology.INCOMING_AND_OUTGOING);
assertEquals("org.talend.components.processing.runtime.aggregate.AggregateRuntime", runtimeInfo.getRuntimeClassName());
}
Aggregations