Search in sources :

Example 16 with DbDataMedia

use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.

the class DatabaseExtractorTest method getDataMediaPairForMysql.

private List<DataMediaPair> getDataMediaPairForMysql(long tableId, int count) {
    List<DataMediaPair> pairs = new ArrayList<DataMediaPair>();
    for (int i = 0; i < count; i++) {
        DataMediaPair pair = new DataMediaPair();
        pair.setId(Long.valueOf(i));
        pair.setPullWeight(1L);
        pair.setPushWeight(1L);
        DbDataMedia mysqlMedia = getMysqlMedia();
        mysqlMedia.setId(tableId + i);
        pair.setSource(mysqlMedia);
        DbDataMedia oracleMedia = getOracleMedia();
        oracleMedia.setId(tableId + i + count);
        pair.setTarget(oracleMedia);
        pairs.add(pair);
    }
    return pairs;
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) DbDataMedia(com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia)

Example 17 with DbDataMedia

use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.

the class DbLoadActionTest method generatorDataMediaPairForMysql.

private List<DataMediaPair> generatorDataMediaPairForMysql(int count) {
    List<DataMediaPair> pairs = new ArrayList<DataMediaPair>();
    for (int i = 0; i < count; i++) {
        DataMediaPair pair = new DataMediaPair();
        int index = i + 1;
        pair.setId(Long.valueOf(index));
        pair.setPullWeight(count - Long.valueOf(index));
        pair.setPushWeight(count - Long.valueOf(index));
        DbDataMedia oracleMedia = getOracleMedia();
        oracleMedia.setId(2L);
        pair.setSource(oracleMedia);
        DbDataMedia mysqlMedia = getMysqlMedia();
        mysqlMedia.setId(1L);
        pair.setTarget(mysqlMedia);
        pairs.add(pair);
    }
    return pairs;
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) DbDataMedia(com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia)

Aggregations

DbDataMedia (com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia)17 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)10 ArrayList (java.util.ArrayList)10 BaseDbTest (com.alibaba.otter.node.etl.BaseDbTest)8 Test (org.testng.annotations.Test)8 DbDialect (com.alibaba.otter.node.etl.common.db.dialect.DbDialect)5 DbMediaSource (com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource)3 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)3 BatchObject (com.alibaba.otter.shared.etl.model.BatchObject)3 Identity (com.alibaba.otter.shared.etl.model.Identity)3 PreparedStatement (java.sql.PreparedStatement)3 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)3 TransactionStatus (org.springframework.transaction.TransactionStatus)3 TransactionCallback (org.springframework.transaction.support.TransactionCallback)3 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 SqlTemplate (com.alibaba.otter.node.etl.common.db.dialect.SqlTemplate)2 PipelineParameter (com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter)2 EventData (com.alibaba.otter.shared.etl.model.EventData)2 RowBatch (com.alibaba.otter.shared.etl.model.RowBatch)2 Column (org.apache.ddlutils.model.Column)2