Skip to content

Commit

Permalink
test: add case
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 committed Oct 31, 2023
1 parent 539c6fc commit 3ed80f9
Showing 1 changed file with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.sql.*;

import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.sql.PreparedStatement;
Expand All @@ -49,20 +50,30 @@ public class RequestPreparedStatementTest {
}
}

@Test
public void testRequest() {
@DataProvider(name = "createOption")
Object[][] getCreateParm() {
return new Object[][] { {"NoCompress", "Memory"},
{"NoCompress", "HDD"},
{"Snappy", "Memory"},
{"Snappy", "HDD"} };
}

@Test(dataProvider = "createOption")
public void testRequest(String compressType, String storageMode) {
String dbname = "db" + random.nextInt(100000);
executor.dropDB(dbname);
boolean ok = executor.createDB(dbname);
Assert.assertTrue(ok);
String createTableSql = "create table trans(c1 string,\n" +
String baseSql = "create table trans(c1 string,\n" +
" c3 int,\n" +
" c4 bigint,\n" +
" c5 float,\n" +
" c6 double,\n" +
" c7 timestamp,\n" +
" c8 date,\n" +
" index(key=c1, ts=c7));";
" index(key=c1, ts=c7))\n ";
String createTableSql = String.format("%s OPTIONS (compress_type='%s', storage_mode='%s');",
baseSql, compressType, storageMode);
executor.executeDDL(dbname, createTableSql);
String insertSql = "insert into trans values(\"aa\",23,33,1.4,2.4,1590738993000,\"2020-05-04\");";
PreparedStatement pstmt = null;
Expand Down Expand Up @@ -127,23 +138,25 @@ public void testRequest() {
}
}

@Test
public void testDeploymentRequest() {
@Test(dataProvider = "createOption")
public void testDeploymentRequest(String compressType, String storageMode) {
java.sql.Statement state = executor.getStatement();
String dbname = "db" + random.nextInt(100000);
String deploymentName = "dp_test1";
try {
state.execute("drop database if exists " + dbname + ";");
state.execute("create database " + dbname + ";");
state.execute("use " + dbname + ";");
String createTableSql = "create table trans(c1 string,\n" +
String baseSql = "create table trans(c1 string,\n" +
" c3 int,\n" +
" c4 bigint,\n" +
" c5 float,\n" +
" c6 double,\n" +
" c7 timestamp,\n" +
" c8 date,\n" +
" index(key=c1, ts=c7));";
" index(key=c1, ts=c7))";
String createTableSql = String.format(" %s OPTIONS (compress_type='%s', storage_mode='%s');",
baseSql, compressType, storageMode);
state.execute(createTableSql);
String selectSql = "SELECT c1, c3, sum(c4) OVER w1 as w1_c4_sum FROM trans WINDOW w1 AS " +
"(PARTITION BY trans.c1 ORDER BY trans.c7 ROWS BETWEEN 2 PRECEDING AND CURRENT ROW);";
Expand Down Expand Up @@ -217,20 +230,22 @@ public void testDeploymentRequest() {
}
}

@Test
public void testBatchRequest() {
@Test(dataProvider = "createOption")
public void testBatchRequest(String compressType, String storageMode) {
String dbname = "db" + random.nextInt(100000);
executor.dropDB(dbname);
boolean ok = executor.createDB(dbname);
Assert.assertTrue(ok);
String createTableSql = "create table trans(c1 string,\n" +
String baseSql = "create table trans(c1 string,\n" +
" c3 int,\n" +
" c4 bigint,\n" +
" c5 float,\n" +
" c6 double,\n" +
" c7 timestamp,\n" +
" c8 date,\n" +
" index(key=c1, ts=c7));";
" index(key=c1, ts=c7))";
String createTableSql = String.format(" %s OPTIONS (compress_type='%s', storage_mode='%s');",
baseSql, compressType, storageMode);
executor.executeDDL(dbname, createTableSql);
String insertSql = "insert into trans values(\"aa\",23,33,1.4,2.4,1590738993000,\"2020-05-04\");";
PreparedStatement pstmt = null;
Expand Down

0 comments on commit 3ed80f9

Please sign in to comment.