use of org.talend.components.jdbc.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties in project components by Talend.
the class JDBCInputProperties method getRuntimeSetting.
@Override
public AllSetting getRuntimeSetting() {
AllSetting setting = new AllSetting();
JDBCDatasetProperties datasetProperties = this.getDatasetProperties();
JDBCDatastoreProperties datastoreProperties = datasetProperties.getDatastoreProperties();
setting.setDriverPaths(datastoreProperties.getCurrentDriverPaths());
setting.setDriverClass(datastoreProperties.getCurrentDriverClass());
setting.setJdbcUrl(datastoreProperties.jdbcUrl.getValue());
setting.setUsername(datastoreProperties.userId.getValue());
setting.setPassword(datastoreProperties.password.getValue());
setting.setSql(datasetProperties.sql.getValue());
setting.setSchema(datasetProperties.main.schema.getValue());
return setting;
}
use of org.talend.components.jdbc.datastore.JDBCDatastoreProperties in project components by Talend.
the class JDBCDatasetProperties method getRuntimeSetting.
@Override
public AllSetting getRuntimeSetting() {
JDBCDatastoreProperties datastoreProperties = this.getDatastoreProperties();
setting.setDriverPaths(datastoreProperties.getCurrentDriverPaths());
setting.setDriverClass(datastoreProperties.getCurrentDriverClass());
setting.setJdbcUrl(datastoreProperties.jdbcUrl.getValue());
setting.setUsername(datastoreProperties.userId.getValue());
setting.setPassword(datastoreProperties.password.getValue());
setting.setSchema(main.schema.getValue());
setting.setSql(getSql());
if (sourceType.getValue() == SourceType.TABLE_NAME) {
setting.setTablename(tableName.getValue());
}
return setting;
}
Aggregations