use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.
the class TJDBCRowProperties method getRuntimeSetting.
@Override
public AllSetting getRuntimeSetting() {
AllSetting setting = new AllSetting();
CommonUtils.setReferenceInfoAndConnectionInfo(setting, referencedComponent, connection);
setting.setTablename(this.tableSelection.tablename.getValue());
setting.setSql(this.sql.getValue());
setting.setDieOnError(this.dieOnError.getValue());
setting.setCommitEvery(this.commitEvery.getValue());
setting.setPropagateQueryResultSet(this.propagateQueryResultSet.getValue());
setting.setUseColumn(this.useColumn.getValue());
setting.setUsePreparedStatement(this.usePreparedStatement.getValue());
setting.setIndexs(this.preparedStatementTable.indexs.getValue());
setting.setTypes(this.preparedStatementTable.types.getValue());
setting.setValues(this.preparedStatementTable.values.getValue());
setting.setUseDataSource(this.useDataSource.getValue());
setting.setDataSource(this.dataSource.getValue());
setting.setSchema(main.schema.getValue());
return setting;
}
use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.
the class JDBCDatastoreTest method testGetSchemaNames.
@Test
public void testGetSchemaNames() throws Exception {
JDBCDatastoreProperties properties = new JDBCDatastoreProperties("input");
properties.init();
List<?> dbTypes = properties.dbTypes.getPossibleValues();
assertTrue("the list should not be empty", dbTypes != null && !dbTypes.isEmpty());
assertTrue("The size of list is not right", dbTypes.size() == 3);
assertTrue("The first element is not right", "MYSQL".equals(dbTypes.get(0)));
assertTrue("The second element is not right", "DERBY".equals(dbTypes.get(1)));
assertTrue("The default value is not right", "MYSQL".equals(properties.dbTypes.getValue()));
AllSetting setting = properties.getRuntimeSetting();
assertTrue("the driver class is not right : " + setting.getDriverClass(), "org.gjt.mm.mysql.Driver".equals(setting.getDriverClass()));
assertTrue("the driver paths is not right : " + setting.getDriverPaths(), setting.getDriverPaths() != null && !setting.getDriverPaths().isEmpty() && "mvn:org.talend.libraries/mysql-connector-java-5.1.30-bin/6.0.0/jar".equals(setting.getDriverPaths().get(0)));
properties.dbTypes.setValue("DERBY");
properties.afterDbTypes();
setting = properties.getRuntimeSetting();
assertTrue("the driver class is not right : " + setting.getDriverClass(), "org.apache.derby.jdbc.ClientDriver".equals(setting.getDriverClass()));
assertTrue("the driver paths is not right : " + setting.getDriverPaths(), setting.getDriverPaths() != null && !setting.getDriverPaths().isEmpty() && "mvn:org.apache.derby/derby/10.12.1.1".equals(setting.getDriverPaths().get(0)));
}
use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.
the class JDBCInputPropertiesTest method testGetRuntimeSetting.
/**
* Run the AllSetting getRuntimeSetting() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 17-6-23 AM11:58
*/
@Test
public void testGetRuntimeSetting() throws Exception {
JDBCInputProperties fixture = new JDBCInputProperties("");
JDBCDatasetProperties dataset = new JDBCDatasetProperties("dataset");
JDBCDatastoreProperties datastore = new JDBCDatastoreProperties("datastore");
datastore.init();
dataset.setDatastoreProperties(datastore);
fixture.setDatasetProperties(dataset);
AllSetting result = fixture.getRuntimeSetting();
assertNotNull(result);
}
use of org.talend.components.jdbc.runtime.setting.AllSetting in project components by Talend.
the class JDBCDatasetPropertiesTest method testGetRuntimeSetting.
@Test
public void testGetRuntimeSetting() {
dataset.setDatastoreProperties(new JDBCDatastoreProperties("datastore"));
dataset.sourceType.setValue(SourceType.TABLE_NAME);
AllSetting setting = dataset.getRuntimeSetting();
Assert.assertNotNull(setting);
}
use of org.talend.components.jdbc.runtime.setting.AllSetting 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());
}
Aggregations