use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.
the class JDBCOutputProperties method getRuntimeSetting.
@Override
public AllSetting getRuntimeSetting() {
// TODO only return the Driver paths is enough to get the getRuntimeInfo works, AllSetting should be removed
// after refactor
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());
return setting;
}
use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.
the class JdbcDatasetRuntimeTest method createDatasetProperties.
/**
* @return the properties for this dataset, fully initialized with the default values.
*/
public static JDBCDatasetProperties createDatasetProperties() {
JDBCDatastoreProperties jdbcDatastoreProperties;
jdbcDatastoreProperties = new JDBCDatastoreProperties("datastore");
jdbcDatastoreProperties.init();
jdbcDatastoreProperties.dbTypes.setValue("DERBY");
jdbcDatastoreProperties.jdbcUrl.setValue(JDBC_URL);
JDBCDatasetProperties inputDatasetProperties = new JDBCDatasetProperties("inputDataset");
inputDatasetProperties.init();
inputDatasetProperties.setDatastoreProperties(jdbcDatastoreProperties);
inputDatasetProperties.sql.setValue("select * from " + TABLE_IN);
return inputDatasetProperties;
}
use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.
the class JdbcDatasetTestIT method createDatasetProperties.
private JDBCDatasetProperties createDatasetProperties(boolean updateSchema) {
JDBCDatastoreDefinition def = new JDBCDatastoreDefinition();
JDBCDatastoreProperties datastore = new JDBCDatastoreProperties("datastore");
datastore.dbTypes.setValue("DERBY");
datastore.afterDbTypes();
datastore.jdbcUrl.setValue(allSetting.getJdbcUrl());
datastore.userId.setValue(allSetting.getUsername());
datastore.password.setValue(allSetting.getPassword());
JDBCDatasetProperties dataset = (JDBCDatasetProperties) def.createDatasetProperties(datastore);
dataset.sql.setValue(DBTestUtils.getSQL(tablename));
if (updateSchema) {
dataset.updateSchema();
}
return dataset;
}
use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.
the class JdbcDatasetTestIT method testUpdateSchema.
@Test
public void testUpdateSchema() {
JDBCDatasetProperties dataset = createDatasetProperties(true);
Schema schema = dataset.main.schema.getValue();
Assert.assertNotNull(schema);
DBTestUtils.testMetadata(schema.getFields(), true);
}
use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.
the class JDBCOutputPropertiesTest method testGetDatasetProperties.
@Test
public void testGetDatasetProperties() {
JDBCOutputProperties fixture = new JDBCOutputProperties("output");
fixture.setDatasetProperties(new JDBCDatasetProperties("dataset"));
Assert.assertNotNull(fixture.getDatasetProperties());
}
Aggregations