提交 7c3b649c 编写于 作者: J jiacy-jcy

[TD-5992]<test>:testcase for jdbc setconfigtest

上级 a69bc54a
...@@ -14,217 +14,238 @@ public class SetConfigurationInJNITest { ...@@ -14,217 +14,238 @@ public class SetConfigurationInJNITest {
private String host = "127.0.0.1"; private String host = "127.0.0.1";
private String dbname = "test_set_config"; private String dbname = "test_set_config";
// @Test @Test
// public void setConfigInUrl() { public void setConfigInUrl() {
// try { try {
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata&debugFlag=143&rpcTimer=500"); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata&debugFlag=143&rpcTimer=500");
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// public void setConfigInProperties() { public void setConfigInProperties() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// props.setProperty("debugFlag", "143"); props.setProperty("debugFlag", "143");
// props.setProperty("r pcTimer", "500"); props.setProperty("r pcTimer", "500");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case1:set debugFlag=135 //test case1:set debugFlag=135
// //expect:debugFlag:135 //expect:debugFlag:135
// //result:pass //result:pass
// public void setConfigfordebugFlag() { public void setConfigfordebugFlag() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set debugFlag=135 //set debugFlag=135
// props.setProperty("debugFlag", "135"); props.setProperty("debugFlag", "135");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case2:set debugFlag=abc (wrong type) //test case2:set debugFlag=abc (wrong type)
// //expect:debugFlag:135 //expect:debugFlag:135
// //result:pass //result:pass
// public void setConfigforwrongtype() { public void setConfigforwrongtype() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set debugFlag=135 //set debugFlag=135
// props.setProperty("debugFlag", "abc"); props.setProperty("debugFlag", "abc");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case3:set rpcTimer=0 (smaller than the boundary conditions) //test case3:set rpcTimer=0 (smaller than the boundary conditions)
// //expect:rpcTimer:300 //expect:rpcTimer:300
// //result:pass //result:pass
// public void setConfigrpcTimer() { public void setConfigrpcTimer() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set rpcTimer=0 //set rpcTimer=0
// props.setProperty("rpcTimer", "0"); props.setProperty("rpcTimer", "0");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case4:set rpcMaxTime=10000 (bigger than the boundary conditions) //test case4:set rpcMaxTime=10000 (bigger than the boundary conditions)
// //expect:rpcMaxTime:600 //expect:rpcMaxTime:600
// //result:pass //result:pass
// public void setConfigforrpcMaxTime() { public void setConfigforrpcMaxTime() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set rpcMaxTime=10000 //set rpcMaxTime=10000
// props.setProperty("rpcMaxTime", "10000"); props.setProperty("rpcMaxTime", "10000");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case5:set numOfThreadsPerCore=aaa (wrong type) //test case5:set numOfThreadsPerCore=aaa (wrong type)
// //expect:numOfThreadsPerCore:1.0 //expect:numOfThreadsPerCore:1.0
// //result:pass //result:pass
// public void setConfigfornumOfThreadsPerCore() { public void setConfigfornumOfThreadsPerCore() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set numOfThreadsPerCore=aaa //set numOfThreadsPerCore=aaa
// props.setProperty("numOfThreadsPerCore", "aaa"); props.setProperty("numOfThreadsPerCore", "aaa");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// //test case6:set numOfThreadsPerCore=100000 (bigger than the boundary conditions) //test case6:set numOfThreadsPerCore=100000 (bigger than the boundary conditions)
// //expect:numOfThreadsPerCore:1.0 //expect:numOfThreadsPerCore:1.0
// //result:pass //result:pass
// public void setConfignumOfThreadsPerCore() { public void setConfignumOfThreadsPerCore() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// //set numOfThreadsPerCore=100000 //set numOfThreadsPerCore=100000
// props.setProperty("numOfThreadsPerCore", "100000"); props.setProperty("numOfThreadsPerCore", "100000");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
// @Test @Test
// // test case7:set both true and wrong config(debugFlag=0,rpcDebugFlag=143,cDebugFlag=143,rpcTimer=100000) // test case7:set both true and wrong config(debugFlag=0,rpcDebugFlag=143,cDebugFlag=143,rpcTimer=100000)
// // expect:rpcDebugFlag:143,cDebugFlag:143,rpcTimer:300 // expect:rpcDebugFlag:143,cDebugFlag:143,rpcTimer:300
// // result:pass // result:pass
// public void setConfigformaxTmrCtrl() { public void setConfigformaxTmrCtrl() {
// try { try {
// Properties props = new Properties(); Properties props = new Properties();
// props.setProperty("debugFlag", "0"); props.setProperty("debugFlag", "0");
// props.setProperty("rpcDebugFlag", "143"); props.setProperty("rpcDebugFlag", "143");
// props.setProperty("cDebugFlag", "143"); props.setProperty("cDebugFlag", "143");
// props.setProperty("rpcTimer", "100000"); props.setProperty("rpcTimer", "100000");
// Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props); Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata", props);
// Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.execute("create database if not exists " + dbname); stmt.execute("create database if not exists " + dbname);
// stmt.execute("use " + dbname); stmt.execute("use " + dbname);
// stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))"); stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
// stmt.execute("drop database if exists " + dbname); stmt.execute("drop database if exists " + dbname);
// stmt.close(); stmt.close();
// conn.close(); conn.close();
// } catch (SQLException e) { } catch (SQLException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
@Test
//test case 8:use url to set with wrong type(debugFlag=abc,rpcTimer=abc)
//expect:default value
//result:pass
public void setConfigInUrlwithwrongtype() {
try {
Connection conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/?user=root&password=taosdata&debugFlag=abc&rpcTimer=abc");
Statement stmt = conn.createStatement();
stmt.execute("drop database if exists " + dbname);
stmt.execute("create database if not exists " + dbname);
stmt.execute("use " + dbname);
stmt.execute("create table weather(ts timestamp, f1 int) tags(loc nchar(10))");
stmt.execute("drop database if exists " + dbname);
stmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Test @Test
//test case 8:use url to set with wrong type(debugFlag=abc,rpcTimer=abc) //test case 8:use url to set with wrong type(debugFlag=abc,rpcTimer=abc)
//expect:default value //expect:default value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册