Skip to content

Commit b018847

Browse files
committed
AJ-654:fix broken case
1 parent 1337f0b commit b018847

File tree

7 files changed

+78
-20
lines changed

7 files changed

+78
-20
lines changed

test/com/xxdb/DBConnectionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ public void test_DBConnection_not_login() throws IOException, InterruptedExcepti
24202420
}catch(Exception ex){
24212421
re = ex.getMessage();
24222422
}
2423-
assertEquals(true,re.contains("getGroupList() => Only administrators execute function getGroupList' script: 'getGroupList();"));
2423+
assertEquals(true,re.contains("getGroupList() => Only administrators execute function getGroupList"));
24242424
}
24252425
@Test
24262426
public void TestPartitionTable() throws IOException, InterruptedException {
@@ -4167,7 +4167,7 @@ public void test_insert_into_decimal_arrayvector() throws Exception {
41674167
assertEquals("[[1.000,3.000,100000.000],[-1.000,0.000,0.123]]",res.getColumn(2).getString());
41684168
assertEquals("[[1,3,100000],[-1,0,0]]",res.getColumn(3).getString());
41694169
assertEquals("[[1.0,3.0,100000.0],[-1.0,0.0,0.1]]",res.getColumn(4).getString());
4170-
assertEquals("[[1.0000,3.0000,100000.000],[-1.0000,0.0000,0.12345]]",res.getColumn(5).getString());
4170+
assertEquals("[[1.0000,3.0000,100000.0000],[-1.0000,0.0000,0.1235]]",res.getColumn(5).getString());
41714171
assertEquals("[[1.00000000,3.00001000,100000.00000000],[-1.00000000,0.00000000,0.12345679]]",res.getColumn(6).getString());
41724172

41734173
}
@@ -4824,7 +4824,7 @@ public void test_upload_error() throws IOException {
48244824
}catch(Exception e){
48254825
re = e.getMessage();
48264826
}
4827-
assertEquals(true, re.contains("''table_upload_tb3' is a shared variable and can't be overwritten.' variable: 'table_upload_tb1,table_upload_tb,table_upload_tb3'"));
4827+
assertEquals(true, re.contains("table_upload_tb3' is a shared variable and can't be overwritten"));
48284828
}
48294829
//@Test
48304830
public void test_upload_error_1() throws IOException {

test/com/xxdb/MultithreadedTableWriterTest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void test_MultithreadedTableWriter_memory_dbname_wrong() throws Exception
188188
"", "tt", false, false, null, 10000, 1,
189189
5, "date");
190190
}catch (Exception e) {
191-
assertEquals(HOST+":"+PORT+" Server response: 'Syntax Error: [line #1] Cannot recognize the token tt' script: 'schema(tt)'",e.getMessage());
191+
assertEquals(true,e.getMessage().contains("Server response: 'Syntax Error: [line #1] Cannot recognize the token tt"));
192192
}
193193
conn.run("undef(`t1,SHARED)");
194194
}
@@ -257,7 +257,7 @@ public void test_MultithreadedTableWriter_dfs_dbname_wrong() throws Exception {
257257
5, "tradeDate");
258258
}catch (Exception e) {
259259
//assertEquals(HOST+":"+PORT+" Server response: 'table file does not exist: s/pt.tbl' script: 'schema(loadTable(\"s\",\"pt\"))'",e.getMessage());
260-
assertTrue(e.getMessage().contains("table file does not exist: s/pt.tbl' script: 'schema(loadTable(\"s\",\"pt\"))"));
260+
assertTrue(e.getMessage().contains("table file does not exist: s/pt.tbl"));
261261
}
262262
}
263263

@@ -856,7 +856,7 @@ public void test_ChunkInTransaction_insert() throws Exception {
856856
Thread.sleep(20000);
857857
MultithreadedTableWriter.Status status1=mutithreadTableWriter1.getStatus();
858858
MultithreadedTableWriter.Status status=mutithreadTableWriter2.getStatus();
859-
if (status.getErrorInfo().toString().contains(HOST+":"+PORT+" Server response: '<ChunkInTransaction>filepath '/test_MultithreadedTableWriter")){
859+
if (status.getErrorInfo().toString().contains(HOST+":"+PORT+" Server response: <ChunkInTransaction>")){
860860
assertEquals("",status1.getErrorInfo().toString());
861861
assertEquals("A5",status.getErrorCode());
862862
assertTrue(status.sendFailedRows >0);
@@ -870,7 +870,7 @@ public void test_ChunkInTransaction_insert() throws Exception {
870870
assertEquals(1000,status1.unsentRows+status.sendFailedRows+status.sentRows);
871871

872872
}else {
873-
assertTrue(status1.getErrorInfo().toString().contains(HOST+":"+PORT+" Server response: '<ChunkInTransaction>The openChunks operation failed because the chunk '/test_MultithreadedTableWriter"));
873+
assertTrue(status1.getErrorInfo().toString().contains(HOST+":"+PORT+" Server response: <ChunkInTransaction>The openChunks operation failed because the chunk '/test_MultithreadedTableWriter"));
874874
assertEquals("A5",status1.getErrorCode());
875875
assertTrue(status1.sendFailedRows >0);
876876
assertEquals(true,status1.hasError());
@@ -6304,7 +6304,14 @@ public void writeCompletion(Table callbackTable){
63046304
conn.close();
63056305

63066306
}
6307-
6307+
@Test(timeout = 120000)
6308+
public void test_run()throws Exception {
6309+
DBConnection conn= new DBConnection(false, false, false, true);
6310+
conn.connect(HOST, PORT, "admin", "123456");
6311+
DBConnection conn1= new DBConnection(false, false, false, true);
6312+
conn1.connect(CONTROLLER_HOST, CONTROLLER_PORT, "admin", "123456");
6313+
conn.run("share table(100:0, [`col0], [INT]) as table1");
6314+
}
63086315
@Test(timeout = 120000)
63096316
public void test_MultithreadedTableWriter_Callback_memoryTable_single_thread_false()throws Exception {
63106317
DBConnection conn= new DBConnection(false, false, false, true);
@@ -6430,9 +6437,9 @@ public void test_MultithreadedTableWriter_Callback_dfs_multiple_thread_false()t
64306437
DBConnection conn1= new DBConnection(false, false, false, true);
64316438
conn1.connect(CONTROLLER_HOST, CONTROLLER_PORT, "admin", "123456");
64326439
StringBuilder sb = new StringBuilder();
6433-
sb.append("dbName = 'dfs://test_MultithreadedTableWriter';\n" +
6440+
sb.append("dbName = \"dfs://test_MultithreadedTableWriter\";\n" +
64346441
"if(existsDatabase(dbName)){\n" +
6435-
"\tdropDB(dbName);\n" +
6442+
"dropDB(dbName);\n" +
64366443
"}\n" +
64376444
"db = database(dbName, HASH, [STRING, 10], engine=\"TSDB\");\n"+
64386445
"dummy = table(100:0, [`id], [STRING]);\n" +

test/com/xxdb/SimpleDBConnectionPoolTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void test_SimpleDBConnectionPool_config_userId_null() throws IOException,
140140
}catch(Exception ex){
141141
re = ex.getMessage();
142142
}
143-
assertEquals(true,re.contains("getGroupList() => Only administrators execute function getGroupList' script: 'getGroupList();"));
143+
assertEquals(true,re.contains("Only administrators execute function getGroupList"));
144144
}
145145
@Test
146146
public void test_SimpleDBConnectionPool_config_userId_not_admin() throws IOException, InterruptedException {
@@ -186,7 +186,7 @@ public void test_SimpleDBConnectionPool_config_password_null() throws IOExceptio
186186
}catch(Exception ex){
187187
re = ex.getMessage();
188188
}
189-
assertEquals(true,re.contains("getGroupList() => Only administrators execute function getGroupList' script: 'getGroupList();"));
189+
assertEquals(true,re.contains("getGroupList() => Only administrators execute function getGroupList"));
190190
}
191191

192192
@Test
@@ -509,7 +509,7 @@ public void test_SimpleDBConnectionPool_config_set() throws IOException, Interru
509509
config1.setUserId("admin");
510510
config1.setPassword("123456");
511511
config1.setInitialPoolSize(5);
512-
config1.setInitialScript("null");
512+
config1.setInitialScript("1");
513513
config1.setCompress(true);
514514
config1.setUseSSL(true);
515515
config1.setUsePython(true);
@@ -523,7 +523,7 @@ public void test_SimpleDBConnectionPool_config_set() throws IOException, Interru
523523
assertEquals("admin",config1.getUserId());
524524
assertEquals("123456",config1.getPassword());
525525
assertEquals(5,config1.getInitialPoolSize());
526-
assertEquals("null",config1.getInitialScript());
526+
assertEquals("1",config1.getInitialScript());
527527
assertEquals(true,config1.isUseSSL());
528528
assertEquals(true,config1.isUsePython());
529529
assertEquals(true,config1.isCompress());

test/com/xxdb/compatibility_testing/release130/MultithreadedTableWriterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void test_MultithreadedTableWriter_memory_tbname_wrong() throws Exception
203203
"t1", "t1", false, false, null, 10000, 1,
204204
5, "date");
205205
}catch (Exception e) {
206-
assertTrue(e.getMessage().contains("table file does not exist: t1/t1.tbl' script: 'schema(loadTable(\"t1\",\"t1\"))"));
206+
assertTrue(e.getMessage().contains("table file does not exist: t1/t1.tbl"));
207207
}
208208
conn.run("undef(`t1,SHARED)");
209209
}

test/com/xxdb/data/BasicTableTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.xxdb.io.Long2;
88
import com.xxdb.io.ProgressListener;
99
import org.junit.Assert;
10+
import org.junit.Before;
1011
import org.junit.Test;
1112

1213
import java.io.IOException;
@@ -22,6 +23,29 @@
2223
import static org.junit.Assert.*;
2324

2425
public class BasicTableTest {
26+
@Before
27+
public void setUp() throws IOException {
28+
DBConnection conn = new DBConnection();
29+
conn.connect(HOST, PORT, "admin", "123456");
30+
conn.run("def getAllShare(){\n" +
31+
"\treturn select name from objs(true) where shared=1\n" +
32+
"\t}\n" +
33+
"\n" +
34+
"def clearShare(){\n" +
35+
"\tlogin(`admin,`123456)\n" +
36+
"\tallShare=exec name from pnodeRun(getAllShare)\n" +
37+
"\tfor(i in allShare){\n" +
38+
"\t\ttry{\n" +
39+
"\t\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],clearTablePersistence,objByName(i))\n" +
40+
"\t\t\t}catch(ex1){}\n" +
41+
"\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],undef,i,SHARED)\n" +
42+
"\t}\n" +
43+
"\ttry{\n" +
44+
"\t\tPST_DIR=rpc(getControllerAlias(),getDataNodeConfig{getNodeAlias()})['persistenceDir']\n" +
45+
"\t}catch(ex1){}\n" +
46+
"}\n" +
47+
"clearShare()");
48+
}
2549
@Test
2650
public void test_table_alltype(){
2751
BasicTable table1 = createBasicTable();

test/com/xxdb/route/AutoFitTableUpsertTest.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import com.xxdb.data.*;
55
import com.xxdb.route.AutoFitTableUpsert;
66
import com.xxdb.route.AutoFitTableAppender;
7+
import org.junit.After;
8+
import org.junit.Before;
79
import org.junit.Test;
810

911
import java.io.IOException;
@@ -25,7 +27,32 @@ public class AutoFitTableUpsertTest {
2527
static String[] host_list= bundle.getString("HOSTS").split(",");
2628
static int[] port_list = Arrays.stream(bundle.getString("PORTS").split(",")).mapToInt(Integer::parseInt).toArray();
2729
//String[] highAvailabilitySites = {"192.168.0.57:9002","192.168.0.57:9003","192.168.0.57:9004","192.168.0.57:9005"};
28-
30+
@Before
31+
public void setUp() throws IOException {
32+
conn = new DBConnection();
33+
conn.connect(HOST, PORT, "admin", "123456");
34+
conn.run("def getAllShare(){\n" +
35+
"\treturn select name from objs(true) where shared=1\n" +
36+
"\t}\n" +
37+
"\n" +
38+
"def clearShare(){\n" +
39+
"\tlogin(`admin,`123456)\n" +
40+
"\tallShare=exec name from pnodeRun(getAllShare)\n" +
41+
"\tfor(i in allShare){\n" +
42+
"\t\ttry{\n" +
43+
"\t\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],clearTablePersistence,objByName(i))\n" +
44+
"\t\t\t}catch(ex1){}\n" +
45+
"\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],undef,i,SHARED)\n" +
46+
"\t}\n" +
47+
"\ttry{\n" +
48+
"\t\tPST_DIR=rpc(getControllerAlias(),getDataNodeConfig{getNodeAlias()})['persistenceDir']\n" +
49+
"\t}catch(ex1){}\n" +
50+
"}\n" +
51+
"clearShare()");
52+
}
53+
@After
54+
public void after() throws IOException, InterruptedException {
55+
}
2956
@Test
3057
public void test_tableUpsert_DP_baseNull() throws Exception {
3158
conn = new DBConnection();

test/com/xxdb/streaming/reverse/ThreadedClientsubscribeReverseTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ public void test_subscribe_other_user_unallow() throws IOException{
10471047
client.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, true, filter1, true, 100, 5, "test1", "123456");
10481048
fail("no exception thrown");
10491049
}catch (Exception e){
1050-
assertEquals(HOST+":"+PORT+" Server response: 'No access to shared table [Trades]. Contact an administrator. RefId:S03009' function: 'publishTable'",e.getMessage());
1050+
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]."));
10511051
}
10521052
}
10531053

@@ -1072,7 +1072,7 @@ public void test_subscribe_other_some_user() throws IOException, InterruptedExce
10721072
client.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, true, filter1, true, 100, 5, "test1", "123456");
10731073
fail("no exception thrown");
10741074
}catch (Exception e){
1075-
assertEquals(HOST+":"+PORT+" Server response: 'No access to shared table [Trades]. Contact an administrator. RefId:S03009' function: 'publishTable'",e.getMessage());
1075+
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]."));
10761076
System.out.println(e.getMessage());
10771077
}
10781078

@@ -1553,7 +1553,7 @@ public void test_StreamDeserializer_pair_filters_subscribe_isomate_table_StreamD
15531553
StreamDeserializer streamFilter = new StreamDeserializer(tables, conn);
15541554
fail("no exception thrown");
15551555
}catch(Exception ex){
1556-
assertEquals(HOST+":"+PORT+" Server response: 'schema() => The function [schema] expects 1 argument(s), but the actual number of arguments is: 0' script: 'schema()'",ex.getMessage());
1556+
assertEquals(true,ex.getMessage().contains("schema() => The function [schema] expects 1 argument(s), but the actual number of arguments is: 0"));
15571557
}
15581558
}
15591559

@@ -1579,7 +1579,7 @@ public void test_StreamDeserializer_pair_filters_subscribe_isomate_table_StreamD
15791579
StreamDeserializer streamFilter = new StreamDeserializer(tables, conn);
15801580
fail("no exception thrown");
15811581
}catch(Exception ex){
1582-
assertEquals(HOST+":"+PORT+" Server response: 'Syntax Error: [line #1] Cannot recognize the token test2' script: 'schema(test2)'",ex.getMessage());
1582+
assertEquals(true,ex.getMessage().contains("Cannot recognize the token test2"));
15831583
}
15841584
}
15851585

0 commit comments

Comments
 (0)