add s2t test case
This commit is contained in:
+69
@@ -0,0 +1,69 @@
|
|||||||
|
package com.alibaba.datax.plugin.writer.tdenginewriter;
|
||||||
|
|
||||||
|
import com.alibaba.datax.core.Engine;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
public class Stream2TDengineTest {
|
||||||
|
|
||||||
|
private String host2 = "192.168.56.105";
|
||||||
|
private String precision;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void s2t_case1() throws Throwable {
|
||||||
|
// given
|
||||||
|
createSupTable("ms");
|
||||||
|
|
||||||
|
// when
|
||||||
|
String[] params = {"-mode", "standalone", "-jobid", "-1", "-job", "src/test/resources/defaultJob.json"};
|
||||||
|
System.setProperty("datax.home", "../target/datax/datax");
|
||||||
|
Engine.entry(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void s2t_case2() throws Throwable {
|
||||||
|
// given
|
||||||
|
createSupTable("us");
|
||||||
|
|
||||||
|
// when
|
||||||
|
String[] params = {"-mode", "standalone", "-jobid", "-1", "-job", "src/test/resources/defaultJob.json"};
|
||||||
|
System.setProperty("datax.home", "../target/datax/datax");
|
||||||
|
Engine.entry(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void s2t_case3() throws Throwable {
|
||||||
|
// given
|
||||||
|
createSupTable("ns");
|
||||||
|
|
||||||
|
// when
|
||||||
|
String[] params = {"-mode", "standalone", "-jobid", "-1", "-job", "src/test/resources/defaultJob.json"};
|
||||||
|
System.setProperty("datax.home", "../target/datax/datax");
|
||||||
|
Engine.entry(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void createSupTable(String precision) throws SQLException {
|
||||||
|
|
||||||
|
final String url = "jdbc:TAOS-RS://" + host2 + ":6041/";
|
||||||
|
try (Connection conn = DriverManager.getConnection(url, "root", "taosdata")) {
|
||||||
|
Statement stmt = conn.createStatement();
|
||||||
|
|
||||||
|
stmt.execute("drop database if exists db2");
|
||||||
|
stmt.execute("create database if not exists db2 precision '" + precision + "'");
|
||||||
|
stmt.execute("create table db2.stb2(ts1 timestamp, ts2 timestamp,ts3 timestamp,ts4 timestamp,ts5 timestamp," +
|
||||||
|
"ts6 timestamp,ts7 timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 float, f6 double," +
|
||||||
|
"f7 bool, f8 binary(100), f9 nchar(100)) tags(t1 timestamp,t2 timestamp,t3 timestamp,t4 timestamp," +
|
||||||
|
"t5 timestamp,t6 timestamp,t7 timestamp, t8 tinyint, t9 smallint, t10 int, t11 bigint, t12 float," +
|
||||||
|
"t13 double, t14 bool, t15 binary(100), t16 nchar(100))");
|
||||||
|
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
{
|
||||||
|
"job": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"reader": {
|
||||||
|
"name": "streamreader",
|
||||||
|
"parameter": {
|
||||||
|
"column": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "tb1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:01"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:02.123",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:03.123456",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSSSSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:04.123456789",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSSSSSSSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:05.123"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:06.123456"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:07.123456789"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"random": "0, 10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"random": "0, 100"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"random": "0, 1000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"random": "0, 10000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "double",
|
||||||
|
"random": "0, 10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "double",
|
||||||
|
"random": "10, 20"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bool",
|
||||||
|
"random": "0, 50"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bytes",
|
||||||
|
"random": "0, 10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"random": "0, 10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:01"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:02.123",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:03.123456",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSSSSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"value": "2022-02-20 12:00:04.123456789",
|
||||||
|
"dateFormat": "yyyy-MM-dd HH:mm:ss.SSSSSSSSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:05.123"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:06.123456"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "2022-02-20 12:00:07.123456789"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"value": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"value": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "long",
|
||||||
|
"value": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "double",
|
||||||
|
"value": 5.55
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "double",
|
||||||
|
"value": 6.666666
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bool",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bytes",
|
||||||
|
"value": "abcABC123"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"value": "北京朝阳望京"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sliceRecordCount": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"writer": {
|
||||||
|
"name": "tdenginewriter",
|
||||||
|
"parameter": {
|
||||||
|
"username": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"column": [
|
||||||
|
"tbname",
|
||||||
|
"ts1",
|
||||||
|
"ts2",
|
||||||
|
"ts3",
|
||||||
|
"ts4",
|
||||||
|
"ts5",
|
||||||
|
"ts6",
|
||||||
|
"ts7",
|
||||||
|
"f1",
|
||||||
|
"f2",
|
||||||
|
"f3",
|
||||||
|
"f4",
|
||||||
|
"f5",
|
||||||
|
"f6",
|
||||||
|
"f7",
|
||||||
|
"f8",
|
||||||
|
"f9",
|
||||||
|
"t1",
|
||||||
|
"t2",
|
||||||
|
"t3",
|
||||||
|
"t4",
|
||||||
|
"t5",
|
||||||
|
"t6",
|
||||||
|
"t7",
|
||||||
|
"t8",
|
||||||
|
"t9",
|
||||||
|
"t10",
|
||||||
|
"t11",
|
||||||
|
"t12",
|
||||||
|
"t13",
|
||||||
|
"t14",
|
||||||
|
"t15",
|
||||||
|
"t16"
|
||||||
|
],
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"table": [
|
||||||
|
"stb2"
|
||||||
|
],
|
||||||
|
"jdbcUrl": "jdbc:TAOS-RS://192.168.56.105:6041/db2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"batchSize": 100,
|
||||||
|
"ignoreTagsUnmatched": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"setting": {
|
||||||
|
"speed": {
|
||||||
|
"channel": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,30 @@
|
|||||||
select tablespace_name from dba_data_files;
|
select tablespace_name
|
||||||
|
from dba_data_files;
|
||||||
|
|
||||||
create tablespace test datafile '/home/dmdba/dmdbms/data/DAMENG/test.dbf' size 32 autoextend on next 1 maxsize 1024;
|
create
|
||||||
|
tablespace test datafile '/home/dmdba/dmdbms/data/DAMENG/test.dbf' size 32 autoextend on next 1 maxsize 1024;
|
||||||
|
|
||||||
create user TESTUSER identified by test123456 default tablespace test;
|
create
|
||||||
|
user TESTUSER identified by test123456 default tablespace test;
|
||||||
|
|
||||||
grant dba to TESTUSER;
|
grant dba to TESTUSER;
|
||||||
|
|
||||||
select * from user_tables;
|
select *
|
||||||
|
from user_tables;
|
||||||
|
|
||||||
drop table if exists stb1;
|
drop table if exists stb1;
|
||||||
|
|
||||||
create table stb1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 float, f6 double, f7 NUMERIC(10,2), f8 BIT, f9 VARCHAR(100), f10 VARCHAR2(200));
|
create table stb1
|
||||||
|
(
|
||||||
|
ts timestamp,
|
||||||
|
f1 tinyint,
|
||||||
|
f2 smallint,
|
||||||
|
f3 int,
|
||||||
|
f4 bigint,
|
||||||
|
f5 float,
|
||||||
|
f6 double,
|
||||||
|
f7 NUMERIC(10, 2),
|
||||||
|
f8 BIT,
|
||||||
|
f9 VARCHAR(100),
|
||||||
|
f10 VARCHAR2(200)
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user