use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.
the class FreedomExtractorTest method getDataMediaPairForOracle.
private List<DataMediaPair> getDataMediaPairForOracle(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 oracleMedia = getOracleMedia();
oracleMedia.setId(tableId + i);
pair.setSource(oracleMedia);
DbDataMedia mysqlMedia = getMysqlMedia();
mysqlMedia.setId(tableId + i + count);
pair.setTarget(mysqlMedia);
pairs.add(pair);
}
return pairs;
}
use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.
the class DbLoadActionTest method generatorDataMediaPairForOracle.
private List<DataMediaPair> generatorDataMediaPairForOracle(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 mysqlMedia = getMysqlMedia();
mysqlMedia.setId(2L);
pair.setSource(mysqlMedia);
DbDataMedia oracleMedia = getOracleMedia();
oracleMedia.setId(1L);
pair.setTarget(oracleMedia);
pairs.add(pair);
}
return pairs;
}
use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.
the class BaseDbTest method getMysqlMedia.
public DbDataMedia getMysqlMedia() {
DbMediaSource dbMediaSource = new DbMediaSource();
dbMediaSource.setId(10L);
dbMediaSource.setDriver("com.mysql.jdbc.Driver");
dbMediaSource.setUsername("xxxxx");
dbMediaSource.setPassword("xxxxx");
dbMediaSource.setUrl("jdbc:mysql://127.0.0.1:3306/srf");
dbMediaSource.setEncode("UTF-8");
dbMediaSource.setType(DataMediaType.MYSQL);
DbDataMedia dataMedia = new DbDataMedia();
dataMedia.setSource(dbMediaSource);
dataMedia.setId(1L);
dataMedia.setName("columns");
dataMedia.setNamespace("srf");
return dataMedia;
}
use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.
the class BaseDbTest method getOracleMedia.
public DbDataMedia getOracleMedia() {
DbMediaSource dbMediaSource = new DbMediaSource();
dbMediaSource.setId(11L);
dbMediaSource.setDriver("oracle.jdbc.OracleDriver");
dbMediaSource.setUsername("xxxxx");
dbMediaSource.setPassword("xxxxx");
dbMediaSource.setUrl("jdbc:oracle:thin:@127.0.0.1:1521:crmgsb");
dbMediaSource.setEncode("UTF-8");
dbMediaSource.setType(DataMediaType.ORACLE);
DbDataMedia dataMedia = new DbDataMedia();
dataMedia.setSource(dbMediaSource);
dataMedia.setId(2L);
dataMedia.setName("columns");
dataMedia.setNamespace("srf");
return dataMedia;
}
use of com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia in project otter by alibaba.
the class DbDialectTableTest method testOracleTable.
@Test
public void testOracleTable() {
DbDataMedia oracleMedia = getOracleMedia();
DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, oracleMedia.getSource());
Table table = dbDialect.findTable(oracleMedia.getNamespace(), oracleMedia.getName());
want.object(table).notNull();
System.out.println("tableName = " + table.getName());
Column[] columns = table.getColumns();
for (Column column : columns) {
System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired());
}
}
Aggregations