Search in sources :

Example 1 with JDBCDatasetProperties

use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.

the class JDBCDatasetTestIT method testGetSampleWithValidDesignSchema.

@Test
public void testGetSampleWithValidDesignSchema() {
    JDBCDatasetProperties dataset = createDatasetProperties(true);
    getSampleAction(dataset);
}
Also used : JDBCDatasetProperties(org.talend.components.jdbc.dataset.JDBCDatasetProperties) Test(org.junit.Test)

Example 2 with JDBCDatasetProperties

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) {
        updateSchema(dataset);
    }
    return dataset;
}
Also used : JDBCDatastoreDefinition(org.talend.components.jdbc.datastore.JDBCDatastoreDefinition) JDBCDatasetProperties(org.talend.components.jdbc.dataset.JDBCDatasetProperties) JDBCDatastoreProperties(org.talend.components.jdbc.datastore.JDBCDatastoreProperties)

Example 3 with JDBCDatasetProperties

use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.

the class JDBCDatasetTestIT method testGetSchema.

@Test
public void testGetSchema() {
    JDBCDatasetProperties dataset = createDatasetProperties(false);
    JDBCDatasetRuntime runtime = new JDBCDatasetRuntime();
    runtime.initialize(null, dataset);
    Schema schema = runtime.getSchema();
    Assert.assertNotNull(schema);
    DBTestUtils.testMetadata(schema.getFields(), true);
}
Also used : JDBCDatasetRuntime(org.talend.components.jdbc.runtime.dataprep.JDBCDatasetRuntime) Schema(org.apache.avro.Schema) JDBCDatasetProperties(org.talend.components.jdbc.dataset.JDBCDatasetProperties) Test(org.junit.Test)

Example 4 with JDBCDatasetProperties

use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.

the class JDBCDatasetTestIT method testDoHealthChecks.

@Test
public void testDoHealthChecks() {
    JDBCDatasetProperties dataset = createDatasetProperties(true);
    JDBCDatastoreRuntime runtime = new JDBCDatastoreRuntime();
    runtime.initialize(null, dataset.getDatastoreProperties());
    Iterable<ValidationResult> result = runtime.doHealthChecks(null);
    Assert.assertNotNull(result);
    Iterator<ValidationResult> iterator = result.iterator();
    Assert.assertTrue(iterator.hasNext());
    Assert.assertEquals(ValidationResult.Result.OK, iterator.next().getStatus());
}
Also used : JDBCDatasetProperties(org.talend.components.jdbc.dataset.JDBCDatasetProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) JDBCDatastoreRuntime(org.talend.components.jdbc.runtime.dataprep.JDBCDatastoreRuntime) Test(org.junit.Test)

Example 5 with JDBCDatasetProperties

use of org.talend.components.jdbc.dataset.JDBCDatasetProperties in project components by Talend.

the class JDBCDatasetOracleTestIT method testGetSampleWithoutDesignSchema.

@Ignore
@Test
public void testGetSampleWithoutDesignSchema() {
    JDBCDatasetProperties dataset = createDatasetProperties();
    getSampleAction(dataset);
}
Also used : JDBCDatasetProperties(org.talend.components.jdbc.dataset.JDBCDatasetProperties) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

JDBCDatasetProperties (org.talend.components.jdbc.dataset.JDBCDatasetProperties)28 Test (org.junit.Test)19 JDBCDatastoreProperties (org.talend.components.jdbc.datastore.JDBCDatastoreProperties)12 Schema (org.apache.avro.Schema)8 JDBCDatastoreDefinition (org.talend.components.jdbc.datastore.JDBCDatastoreDefinition)5 JDBCDatasetRuntime (org.talend.components.jdbc.runtime.dataprep.JDBCDatasetRuntime)4 AllSetting (org.talend.components.jdbc.runtime.setting.AllSetting)4 Ignore (org.junit.Ignore)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Response (com.jayway.restassured.response.Response)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 PipelineResult (org.apache.beam.sdk.PipelineResult)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 DatasetRuntime (org.talend.components.common.dataset.runtime.DatasetRuntime)1