Skip to content

Commit c688827

Browse files
committed
fix test case
1 parent 6acf4b2 commit c688827

8 files changed

Lines changed: 24 additions & 23 deletions

test/com/xxdb/Prepare.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ public static void clear_env() throws IOException {
2626
"for(i in a){\n" +
2727
"\ttry{stopPublishTable(i.subscriber.split(\":\")[0],int(i.subscriber.split(\":\")[1]),i.tableName,i.actions)}catch(ex){}\n" +
2828
"}");
29-
conn.run("streamT = exec name from getStreamTables() where shared=true\n" +
30-
"for(i in streamT){\n" +
31-
"\ttry{\n" +
32-
"\t\tdropStreamTable(i)\n" +
33-
"\t\t}catch(ex){}\n" +
34-
"\t}");
3529
conn.run("res = getStreamingSQLStatus()\n" +
3630
" for(sqlStream in res){\n" +
3731
" try{unsubscribeStreamingSQL(, sqlStream.queryId)}catch(ex){print ex}\n" +
@@ -42,6 +36,12 @@ public static void clear_env() throws IOException {
4236
" try{revokeStreamingSQLTable(`t2)}catch(ex){print ex}\n" +
4337
" try{revokeStreamingSQLTable(`bondFilter)}catch(ex){print ex}\n" +
4438
" try{revokeStreamingSQLTable(`bestBondQuotation)}catch(ex){print ex}\n" );
39+
conn.run("streamT = exec name from getStreamTables() where shared=true\n" +
40+
"for(i in streamT){\n" +
41+
"\ttry{\n" +
42+
"\t\tdropStreamTable(i)\n" +
43+
"\t\t}catch(ex){}\n" +
44+
"\t}");
4545
conn.run("def getAllShare(){\n" +
4646
"\treturn select name from objs(true) where shared=1\n" +
4747
"\t}\n" +

test/com/xxdb/streaming/client/cep/EventClientTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,13 +2133,13 @@ public void test_EventClient_subscribe_filter_1() throws IOException, Interrupt
21332133
"appendEvent(inputSerializer, [event1, event2, event3, event4]);";
21342134
conn.run(script2);
21352135
sleep(2000);
2136-
BasicTable bt2 = (BasicTable)conn.run("select * from outputTable;");
2136+
BasicTable bt2 = (BasicTable)conn.run("select * from outputTable order by intv;");
21372137
Assert.assertEquals(4,bt2.rows());
21382138
Assert.assertEquals("boolv intv\n" +
21392139
"----- ----\n" +
2140-
"true 3 \n" +
21412140
"false 1 \n" +
2142-
"true 4 \n" +
2143-
"false 2 \n", bt2.getString());
2141+
"false 2 \n" +
2142+
"true 3 \n" +
2143+
"true 4 \n", bt2.getString());
21442144
}
21452145
}

test/com/xxdb/streaming/client/cep/EventSenderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ public void test_EventSender_sendEvent_eventType_null() throws IOException, Int
13531353
}catch(Exception ex){
13541354
re1 = ex.getMessage();
13551355
}
1356-
Assert.assertEquals("serialize event Fail for unknown eventType ",re1);
1356+
Assert.assertEquals("serialize event fail for unknown eventType ",re1);
13571357
}
13581358

13591359
@Test
@@ -2940,7 +2940,7 @@ public void test_EventSender_appendEventWithResponse_timeout_negative() throws
29402940
}catch(Exception ex){
29412941
re = ex.getMessage();
29422942
}
2943-
Assert.assertEquals("timeout must be positive.",re);
2943+
Assert.assertEquals("The param 'timeout' cannot be less than or equal to 0.",re);
29442944
}
29452945

29462946
@Test
@@ -2957,7 +2957,7 @@ public void test_EventSender_appendEventWithResponse_timeout_0() throws IOExcep
29572957
}catch(Exception ex){
29582958
re = ex.getMessage();
29592959
}
2960-
Assert.assertEquals("timeout must be positive.",re);
2960+
Assert.assertEquals("The param 'timeout' cannot be less than or equal to 0.",re);
29612961
}
29622962

29632963

test/com/xxdb/streaming/client/streamingSQL/StreamingSQLClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public void test_StreamingSQLClient_registerStreamingSQL_queryId_null() throws I
319319
Assert.assertNotNull(re1.getColumn("registerTime").get(0).getString());
320320
Assert.assertEquals("SQL_REGISTERED", re1.getColumn("status").get(0).getString());
321321
Assert.assertEquals(sqlStr1, re1.getColumn("sqlQuery").get(0).getString());
322-
Assert.assertEquals("t1,t2", re1.getColumn("involvedTables").get(0).getString());
322+
Assert.assertEquals("t2,t1", re1.getColumn("involvedTables").get(0).getString());
323323
Assert.assertEquals("", re1.getColumn("lastErrorMessage").get(0).getString());
324324

325325
BasicTable re2 = streamingSQLClient.getStreamingSQLStatus(id2);
@@ -328,7 +328,7 @@ public void test_StreamingSQLClient_registerStreamingSQL_queryId_null() throws I
328328
Assert.assertNotNull(re2.getColumn("registerTime").get(0).getString());
329329
Assert.assertEquals("SQL_REGISTERED", re2.getColumn("status").get(0).getString());
330330
Assert.assertEquals(sqlStr1, re2.getColumn("sqlQuery").get(0).getString());
331-
Assert.assertEquals("t1,t2", re2.getColumn("involvedTables").get(0).getString());
331+
Assert.assertEquals("t2,t1", re2.getColumn("involvedTables").get(0).getString());
332332
Assert.assertEquals("", re2.getColumn("lastErrorMessage").get(0).getString());
333333

334334
streamingSQLClient.revokeStreamingSQL(id1);

test/com/xxdb/streaming/client/streamingSQL/StreamingSQLResultUpdaterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public void clear() throws IOException {
4646
" try{revokeStreamingSQL(sqlStream.queryId)}catch(ex){print ex}\n" +
4747
" }\n" +
4848
" go;\n" +
49+
" try{undef(`t1,SHARED)}catch(ex){print ex}\n" +
50+
" try{undef(`t2,SHARED)}catch(ex){print ex}\n" +
4951
" try{revokeStreamingSQLTable(`t1)}catch(ex){print ex}\n" +
5052
" try{revokeStreamingSQLTable(`t2)}catch(ex){print ex}\n" +
5153
" try{undef(`t1,SHARED)}catch(ex){print ex}\n" +
@@ -1485,7 +1487,6 @@ public void onError(String queryId, Throwable mockError) {
14851487
BasicTable tableLog = (BasicTable)conn.run("select * from " + id1);
14861488
UpdateEvent event = eventRef.get();
14871489
Assert.assertNull(event);
1488-
Assert.assertEquals(id1, event.getQueryId());
14891490
}
14901491

14911492
//@Test//在代码中添加throw new RuntimeException("模拟 doEvent 抛异常"); 检查onError是否能够获取的到(检查日志)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ public void test_PollingClient_subscribe_StreamDeserializer_streamTable_arrayVec
18001800
pollingClient.unsubscribe(HOST, PORT, "outTables", "mutiSchema");
18011801
}
18021802

1803-
@Test
1803+
//@Test AJ-283
18041804
public void test_subscribe_msgAsTable_true() throws IOException {
18051805
TopicPoller poller1 = pollingClient.subscribe(HOST,PORT,"Trades1","subTread1",0,true,null,null,"","",true);
18061806
ArrayList<IMessage> msg1;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,7 +2233,7 @@ public void doEvent(IMessage msg) {
22332233
wait_data("Receive",10000, conn_leader);
22342234
BasicInt row_num = (BasicInt)conn_leader.run("(exec count(*) from Receive)[0]");
22352235
assertEquals(10000,row_num.getInt());
2236-
threadPooledClient.unsubscribe(HOST,PORT,"Trades");
2236+
threadPooledClient.unsubscribe(StreamLeaderHost, StreamLeaderPort,"Trades");
22372237
}
22382238

22392239
@Test(timeout = 120000)
@@ -2284,6 +2284,6 @@ public void doEvent(IMessage msg) {
22842284
wait_data("Receive",10000, conn_follower);
22852285
BasicInt row_num = (BasicInt)conn_follower.run("(exec count(*) from Receive)[0]");
22862286
assertEquals(10000,row_num.getInt());
2287-
threadPooledClient.unsubscribe(HOST,PORT,"Trades");
2287+
threadPooledClient.unsubscribe(StreamFollowerHost, StreamFollowerPort,"Trades");
22882288
}
22892289
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ public void test_subscribe_tableName_handler_offset_reconnect_success() throws I
474474
MyThread write_data = new MyThread ();
475475
write_data.start();
476476
sleep(2000);
477-
conn.run("stopPublishTable('"+HOST+"',9055,'Trades','javaStreamingApi')");
478-
sleep(1000);
477+
conn.run("stopPublishTable('"+HOST+"',8802,'Trades','javaStreamingApi')");
478+
sleep(3000);
479479
// conn.run("stopPublishTable('"+HOST+"',9055,'Trades')");
480480
// Thread.sleep(3000);
481481
BasicInt row_num = (BasicInt)conn.run("(exec count(*) from Receive)[0]");
@@ -3864,7 +3864,7 @@ public void doEvent(IMessage msg) {
38643864
wait_data("Receive",10000, conn_leader);
38653865
BasicInt row_num = (BasicInt)conn_leader.run("(exec count(*) from Receive)[0]");
38663866
assertEquals(10000,row_num.getInt());
3867-
threadedClient.unsubscribe(HOST,PORT,"Trades");
3867+
threadedClient.unsubscribe(StreamLeaderHost, StreamLeaderPort,"Trades");
38683868
}
38693869

38703870
@Test(timeout = 120000)
@@ -3915,6 +3915,6 @@ public void doEvent(IMessage msg) {
39153915
wait_data("Receive",10000, conn_follower);
39163916
BasicInt row_num = (BasicInt)conn_follower.run("(exec count(*) from Receive)[0]");
39173917
assertEquals(10000,row_num.getInt());
3918-
threadedClient.unsubscribe(HOST,PORT,"Trades");
3918+
threadedClient.unsubscribe(StreamFollowerHost, StreamFollowerPort,"Trades");
39193919
}
39203920
}

0 commit comments

Comments
 (0)