use of org.talend.components.jdbc.datastore.JDBCDatastoreProperties in project components by Talend.
the class JdbcComponentTestIT method initializeJDBCDatasetProperties.
@Test
public void initializeJDBCDatasetProperties() throws java.io.IOException {
// given
SerPropertiesDto propDto = new SerPropertiesDto();
propDto.setProperties(new JDBCDatasetProperties("").init().toSerialized());
propDto.setDependencies(singletonList(new JDBCDatastoreProperties("").init().toSerialized()));
// when
Response response = //
given().content(propDto).contentType(ServiceConstants.JSONIO_CONTENT_TYPE).accept(//
ServiceConstants.UI_SPEC_CONTENT_TYPE).expect().statusCode(200).log().ifError().post(getVersionPrefix() + "/properties/uispec");
// then
ObjectNode jdbcProperties = mapper.readerFor(ObjectNode.class).readValue(response.asInputStream());
assertNotNull(jdbcProperties.get("jsonSchema"));
assertNotNull(jdbcProperties.get("properties"));
assertNotNull(jdbcProperties.get("uiSchema"));
assertEquals("JDBCDataset", jdbcProperties.get("properties").get("@definitionName").textValue());
}
use of org.talend.components.jdbc.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties 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.datastore.JDBCDatastoreProperties in project components by Talend.
the class JDBCOutputPropertiesTest method testGetRuntimeSetting.
@Test
public void testGetRuntimeSetting() {
JDBCOutputProperties fixture = new JDBCOutputProperties("output");
JDBCDatasetProperties dataset = new JDBCDatasetProperties("dataset");
JDBCDatastoreProperties datastore = new JDBCDatastoreProperties("datastore");
datastore.init();
dataset.setDatastoreProperties(datastore);
fixture.setDatasetProperties(dataset);
AllSetting result = fixture.getRuntimeSetting();
assertNotNull(result);
}
Aggregations