use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JDBCConnectionTestIT method testDynamicLibLoad.
// we want to test the dynamic library loading with the field driverPath, but fail, so seems that no way to test it
// now
@Ignore
@Test
public void testDynamicLibLoad() {
TJDBCConnectionDefinition definition = new TJDBCConnectionDefinition();
TJDBCConnectionProperties properties = DBTestUtils.createCommonJDBCConnectionProperties(allSetting, definition);
// the maven path below is a library at my local repository, you can change it to any jdbc driver which exists in your
// maven repository for running the test. I can't use derby for test as i have added the derby dependency in the pom file.
properties.connection.driverTable.drivers.setValue(Arrays.asList("mvn:org.talend.libraries/mysql-connector-java-5.1.30-bin/6.0.0"));
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.NONE);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, definition.getClass().getClassLoader())) {
sandboxedInstance.getInstance();
Class.forName("org.gjt.mm.mysql.Driver");
} catch (ClassNotFoundException e) {
Assert.fail("can't find the jdbc driver class, fail to load the library");
}
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class JdbcInputOutputRuntimeTest method testBasic.
@Test
public void testBasic() {
JDBCInputProperties inputProperties = new JDBCInputProperties("input");
inputProperties.init();
inputProperties.setDatasetProperties(JdbcDatasetRuntimeTest.createDatasetProperties());
JDBCInputDefinition inputDefinition = new JDBCInputDefinition();
RuntimeInfo inputRI = inputDefinition.getRuntimeInfo(ExecutionEngine.BEAM, inputProperties, ConnectorTopology.OUTGOING);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(inputRI, getClass().getClassLoader())) {
assertThat(si.getInstance().getClass().getCanonicalName(), is(JDBCInputDefinition.BEAM_RUNTIME));
}
inputRI = inputDefinition.getRuntimeInfo(ExecutionEngine.DI, inputProperties, ConnectorTopology.OUTGOING);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(inputRI, getClass().getClassLoader())) {
assertThat(si.getInstance().getClass().getCanonicalName(), is(JDBCInputDefinition.DI_RUNTIME));
}
JDBCOutputProperties outputProperties = new JDBCOutputProperties("output");
outputProperties.init();
outputProperties.setDatasetProperties(JdbcDatasetRuntimeTest.createDatasetProperties());
JDBCOutputDefinition outputDefinition = new JDBCOutputDefinition();
RuntimeInfo outputRI = outputDefinition.getRuntimeInfo(ExecutionEngine.BEAM, outputProperties, ConnectorTopology.INCOMING);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(outputRI, getClass().getClassLoader())) {
assertThat(si.getInstance().getClass().getCanonicalName(), is(JDBCOutputDefinition.BEAM_RUNTIME));
}
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class TSnowflakeCloseDefinitionTest method testGetRuntime.
/**
* Check {@link TSnowflakeCloseDefinition#getRuntimeInfo(ExecutionEngine, ComponentProperties, ConnectorTopology)} returns instance of {@link SnowflakeCloseSourceOrSink}
*/
@Test
public void testGetRuntime() {
RuntimeInfo runtimeInfo = snowflakeCloseDefinition.getRuntimeInfo(ExecutionEngine.DI, null, ConnectorTopology.NONE);
SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, snowflakeCloseDefinition.getClass().getClassLoader());
SourceOrSink source = (SourceOrSink) sandboxedInstance.getInstance();
assertThat(source, is(instanceOf(SnowflakeCloseSourceOrSink.class)));
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class TSnowflakeInputDefinitionTest method testGetRuntimeInfo.
@Test
public void testGetRuntimeInfo() throws Exception {
RuntimeInfo runtimeInfo;
runtimeInfo = inputDefinition.getRuntimeInfo(ExecutionEngine.DI, null, ConnectorTopology.OUTGOING);
assertNotNull(runtimeInfo);
}
use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.
the class TJDBCRowDefinitionTest method testGetRuntimeInfo.
/**
* Run the RuntimeInfo getRuntimeInfo(ExecutionEngine,ComponentProperties,ConnectorTopology) method test.
*
* @throws Exception
*
* @generatedBy CodePro at 17-6-20 PM3:14
*/
@Test
public void testGetRuntimeInfo() throws Exception {
AllSetting allSetting = Mockito.mock(AllSetting.class);
Mockito.when(allSetting.getDriverClass()).thenReturn("anyDriverClass");
TJDBCRowProperties properties = Mockito.mock(TJDBCRowProperties.class);
Mockito.when(properties.getRuntimeSetting()).thenReturn(allSetting);
TJDBCRowDefinition fixture = new TJDBCRowDefinition();
ExecutionEngine engine = ExecutionEngine.DI;
RuntimeInfo result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.INCOMING);
assertNotNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.OUTGOING);
assertNotNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.NONE);
assertNotNull(result);
result = fixture.getRuntimeInfo(engine, properties, ConnectorTopology.INCOMING_AND_OUTGOING);
assertNotNull(result);
}
Aggregations