Search in sources :

Example 21 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class TJDBCCommitProperties method getRuntimeSetting.

@Override
public AllSetting getRuntimeSetting() {
    AllSetting setting = new AllSetting();
    CommonUtils.setReferenceInfo(setting, referencedComponent);
    setting.setCloseConnection(this.closeConnection.getValue());
    return setting;
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting)

Example 22 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class JdbcRuntimeInfoTest method createPropsWithDriverName.

/**
 * Creates instance of {@link RuntimeSettingProvider} with specified driver class name
 *
 * @param driverName driver class name
 * @return new instance of {@link RuntimeSettingProvider}
 */
private static RuntimeSettingProvider createPropsWithDriverName(String driverName) {
    AllSetting allSetting = Mockito.mock(AllSetting.class);
    Mockito.when(allSetting.getDriverClass()).thenReturn(driverName);
    RuntimeSettingProvider runtimeSettingProvider = Mockito.mock(RuntimeSettingProvider.class);
    Mockito.when(runtimeSettingProvider.getRuntimeSetting()).thenReturn(allSetting);
    return runtimeSettingProvider;
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting)

Example 23 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting 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);
}
Also used : ExecutionEngine(org.talend.components.api.component.runtime.ExecutionEngine) AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) Test(org.junit.Test)

Example 24 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class TJDBCCloseProperties method getRuntimeSetting.

@Override
public AllSetting getRuntimeSetting() {
    AllSetting setting = new AllSetting();
    CommonUtils.setReferenceInfo(setting, referencedComponent);
    return setting;
}
Also used : AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting)

Example 25 with AllSetting

use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.

the class CommonUtilsTest method testSetCommonConnectionInfo.

@Test
public void testSetCommonConnectionInfo() {
    JDBCConnectionModule module = new JDBCConnectionModule("module");
    module.jdbcUrl.setValue("url");
    AllSetting setting = new AllSetting();
    CommonUtils.setCommonConnectionInfo(setting, module);
    Assert.assertEquals("url", setting.getJdbcUrl());
}
Also used : JDBCConnectionModule(org.talend.components.jdbc.module.JDBCConnectionModule) AllSetting(org.talend.components.jdbc.runtime.setting.AllSetting) Test(org.junit.Test)

Aggregations

AllSetting (org.talend.components.jdbc.runtime.setting.AllSetting)56 Test (org.junit.Test)38 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)11 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)7 JDBCDatastoreProperties (org.talend.components.jdbc.datastore.JDBCDatastoreProperties)6 JDBCDatasetProperties (org.talend.components.jdbc.dataset.JDBCDatasetProperties)4 Connection (java.sql.Connection)3 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 JarEntry (java.util.jar.JarEntry)1 JarInputStream (java.util.jar.JarInputStream)1 BeforeClass (org.junit.BeforeClass)1 JDBCAvroRegistryString (org.talend.components.jdbc.avro.JDBCAvroRegistryString)1 JDBCConnectionModule (org.talend.components.jdbc.module.JDBCConnectionModule)1 TJDBCConnectionDefinition (org.talend.components.jdbc.tjdbcconnection.TJDBCConnectionDefinition)1