From c7ad63e06df6e14cc96418c0ae1f50c53e576741 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 7 Jun 2021 16:14:47 +0800 Subject: [PATCH] remove test cases not available for master branch --- .../jdbc/TSDBPreparedStatementTest.java | 290 ------------------ 1 file changed, 290 deletions(-) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java index 277ca447f5..121392c83e 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java @@ -98,297 +98,7 @@ public class TSDBPreparedStatementTest { result = pstmt_insert.executeUpdate(); Assert.assertEquals(1, result); } - - @Test - public void executeTest() throws SQLException { - Statement stmt = conn.createStatement(); - - int numOfRows = 1000; - - for (int loop = 0; loop < 10; loop++){ - stmt.execute("drop table if exists weather_test"); - stmt.execute("create table weather_test(ts timestamp, f1 nchar(4), f2 float, f3 double, f4 timestamp, f5 int, f6 bool, f7 binary(10))"); - - TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? values(?, ?, ?, ?, ?, ?, ?, ?)"); - Random r = new Random(); - s.setTableName("weather_test"); - - ArrayList ts = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - ts.add(System.currentTimeMillis() + i); - } - s.setTimestamp(0, ts); - - int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s2.add(null); - }else{ - s2.add("分支" + i % 4); - } - } - s.setNString(1, s2, 4); - - random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s3.add(null); - }else{ - s3.add(r.nextFloat()); - } - } - s.setFloat(2, s3); - - random = 10 + r.nextInt(5); - ArrayList s4 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s4.add(null); - }else{ - s4.add(r.nextDouble()); - } - } - s.setDouble(3, s4); - - random = 10 + r.nextInt(5); - ArrayList ts2 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - ts2.add(null); - }else{ - ts2.add(System.currentTimeMillis() + i); - } - } - s.setTimestamp(4, ts2); - - random = 10 + r.nextInt(5); - ArrayList vals = new ArrayList<>(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - vals.add(null); - }else{ - vals.add(r.nextInt()); - } - } - s.setInt(5, vals); - - random = 10 + r.nextInt(5); - ArrayList sb = new ArrayList<>(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - sb.add(null); - }else{ - sb.add(i % 2 == 0 ? true : false); - } - } - s.setBoolean(6, sb); - - random = 10 + r.nextInt(5); - ArrayList s5 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s5.add(null); - }else{ - s5.add("test" + i % 10); - } - } - s.setString(7, s5, 10); - - s.columnDataAddBatch(); - s.columnDataExecuteBatch(); - s.columnDataCloseBatch(); - - String sql = "select * from weather_test"; - PreparedStatement statement = conn.prepareStatement(sql); - ResultSet rs = statement.executeQuery(); - int rows = 0; - while(rs.next()) { - rows++; - } - Assert.assertEquals(numOfRows, rows); - } - } - - @Test - public void bindDataSelectColumnTest() throws SQLException { - Statement stmt = conn.createStatement(); - - int numOfRows = 1000; - - for (int loop = 0; loop < 10; loop++){ - stmt.execute("drop table if exists weather_test"); - stmt.execute("create table weather_test(ts timestamp, f1 nchar(4), f2 float, f3 double, f4 timestamp, f5 int, f6 bool, f7 binary(10))"); - - TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? (ts, f1, f7) values(?, ?, ?)"); - Random r = new Random(); - s.setTableName("weather_test"); - - ArrayList ts = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - ts.add(System.currentTimeMillis() + i); - } - s.setTimestamp(0, ts); - - int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s2.add(null); - }else{ - s2.add("分支" + i % 4); - } - } - s.setNString(1, s2, 4); - - random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - if(i % random == 0) { - s3.add(null); - }else{ - s3.add("test" + i % 10); - } - } - s.setString(2, s3, 10); - - s.columnDataAddBatch(); - s.columnDataExecuteBatch(); - s.columnDataCloseBatch(); - - String sql = "select * from weather_test"; - PreparedStatement statement = conn.prepareStatement(sql); - ResultSet rs = statement.executeQuery(); - int rows = 0; - while(rs.next()) { - rows++; - } - Assert.assertEquals(numOfRows, rows); - } - } - - @Test - public void bindDataWithSingleTagTest() throws SQLException { - Statement stmt = conn.createStatement(); - - String types[] = new String[] {"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; - - for (String type : types) { - stmt.execute("drop table if exists weather_test"); - stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t " + type + ")"); - - int numOfRows = 1; - - TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?) values(?, ?, ?)"); - Random r = new Random(); - s.setTableName("w1"); - - switch(type) { - case "tinyint": - case "smallint": - case "int": - case "bigint": - s.setTagInt(0, 1); - break; - case "float": - s.setTagFloat(0, 1.23f); - break; - case "double": - s.setTagDouble(0, 3.14159265); - break; - case "bool": - s.setTagBoolean(0, true); - break; - case "binary(10)": - s.setTagString(0, "test"); - break; - case "nchar(10)": - s.setTagNString(0, "test"); - break; - default: - break; - } - - - ArrayList ts = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - ts.add(System.currentTimeMillis() + i); - } - s.setTimestamp(0, ts); - - int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - s2.add("分支" + i % 4); - } - s.setNString(1, s2, 10); - - random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - s3.add("test" + i % 4); - } - s.setString(2, s3, 10); - - s.columnDataAddBatch(); - s.columnDataExecuteBatch(); - s.columnDataCloseBatch(); - - String sql = "select * from weather_test"; - PreparedStatement statement = conn.prepareStatement(sql); - ResultSet rs = statement.executeQuery(); - int rows = 0; - while(rs.next()) { - rows++; - } - Assert.assertEquals(numOfRows, rows); - } - } - - - @Test - public void bindDataWithMultipleTagsTest() throws SQLException { - Statement stmt = conn.createStatement(); - - stmt.execute("drop table if exists weather_test"); - stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t1 int, t2 binary(10))"); - - int numOfRows = 1; - - TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?,?) (ts, f2) values(?, ?)"); - s.setTableName("w2"); - s.setTagInt(0, 1); - s.setTagString(1, "test"); - - - ArrayList ts = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - ts.add(System.currentTimeMillis() + i); - } - s.setTimestamp(0, ts); - - ArrayList s2 = new ArrayList(); - for(int i = 0; i < numOfRows; i++) { - s2.add("test" + i % 4); - } - s.setString(1, s2, 10); - s.columnDataAddBatch(); - s.columnDataExecuteBatch(); - s.columnDataCloseBatch(); - - String sql = "select * from weather_test"; - PreparedStatement statement = conn.prepareStatement(sql); - ResultSet rs = statement.executeQuery(); - int rows = 0; - while(rs.next()) { - rows++; - } - Assert.assertEquals(numOfRows, rows); - - } - @Test public void setBoolean() throws SQLException { pstmt_insert.setTimestamp(1, new Timestamp(System.currentTimeMillis())); -- GitLab