Search in sources :

Example 1 with PGDataSourceFactory

use of com.qlangtech.tis.plugin.ds.postgresql.PGDataSourceFactory in project plugins by qlangtech.

the class TestDataXPostgresqlReader method createDataSource.

public static PGDataSourceFactory createDataSource() {
    PGDataSourceFactory dsFactory = new PGDataSourceFactory();
    dsFactory.dbName = "order1";
    dsFactory.password = "123455*^";
    dsFactory.userName = "admin";
    dsFactory.port = 5432;
    dsFactory.encode = "utf8";
    dsFactory.extraParams = "aa=bb&cc=xxx";
    dsFactory.nodeDesc = "192.168.28.201";
    return dsFactory;
}
Also used : PGDataSourceFactory(com.qlangtech.tis.plugin.ds.postgresql.PGDataSourceFactory)

Example 2 with PGDataSourceFactory

use of com.qlangtech.tis.plugin.ds.postgresql.PGDataSourceFactory in project plugins by qlangtech.

the class TestDataXPostgresqlReader method testTemplateGenerate.

@Test
public void testTemplateGenerate() throws Exception {
    PGDataSourceFactory dsFactory = createDataSource();
    DataXPostgresqlReader reader = new DataXPostgresqlReader() {

        @Override
        public PGDataSourceFactory getDataSourceFactory() {
            return dsFactory;
        }

        @Override
        public Class<?> getOwnerClass() {
            return DataXPostgresqlReader.class;
        }
    };
    reader.setSelectedTabs(TestSelectedTabs.createSelectedTabs(1));
    reader.fetchSize = 333;
    reader.splitPk = true;
    reader.template = DataXPostgresqlReader.getDftTemplate();
    String dataXName = "dataxName";
    ReaderTemplate.validateDataXReader("postgres-datax-reader-assert.json", dataXName, reader);
    reader.fetchSize = null;
    reader.splitPk = null;
    ReaderTemplate.validateDataXReader("postgres-datax-reader-assert-without-option.json", dataXName, reader);
}
Also used : PGDataSourceFactory(com.qlangtech.tis.plugin.ds.postgresql.PGDataSourceFactory) Test(org.junit.Test)

Aggregations

PGDataSourceFactory (com.qlangtech.tis.plugin.ds.postgresql.PGDataSourceFactory)2 Test (org.junit.Test)1