Search in sources :

Example 1 with JDBCInputDefinition

use of org.talend.components.jdbc.dataprep.JDBCInputDefinition 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));
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) JDBCInputDefinition(org.talend.components.jdbc.dataprep.JDBCInputDefinition) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JDBCOutputProperties(org.talend.components.jdbc.datastream.JDBCOutputProperties) JDBCInputProperties(org.talend.components.jdbc.dataprep.JDBCInputProperties) JDBCOutputDefinition(org.talend.components.jdbc.datastream.JDBCOutputDefinition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 JDBCInputDefinition (org.talend.components.jdbc.dataprep.JDBCInputDefinition)1 JDBCInputProperties (org.talend.components.jdbc.dataprep.JDBCInputProperties)1 JDBCOutputDefinition (org.talend.components.jdbc.datastream.JDBCOutputDefinition)1 JDBCOutputProperties (org.talend.components.jdbc.datastream.JDBCOutputProperties)1 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)1 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)1