@@ -229,7 +229,7 @@ public void test_subscribe_ofst0() throws Exception {
229
229
int ofst = 0 ;
230
230
client .subscribe (HOST , PORT , "Trades" , MessageHandler_handler , ofst );
231
231
conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "Trades.append!(t)" );
232
- Thread .sleep (20000 );
232
+ Thread .sleep (30000 );
233
233
BasicTable re = (BasicTable ) conn .run ("select * from Receive order by tag" );
234
234
BasicTable tra = (BasicTable ) conn .run ("select * from Trades order by tag" );
235
235
client .unsubscribe (HOST , PORT , "Trades" , "javaStreamingApi" );
@@ -478,7 +478,7 @@ public void test_subscribe_other_some_user() throws IOException, InterruptedExce
478
478
479
479
@ Test
480
480
public void test_subscribe_one_user_some_table () throws IOException , InterruptedException {
481
- conn .run ("def create_user(){try{deleteUser(`test1)}catch(ex){};createUser(`test1, '123456');};" +
481
+ conn .run ("login('admin','123456'); def create_user(){try{deleteUser(`test1)}catch(ex){};createUser(`test1, '123456');};" +
482
482
"rpc(getControllerAlias(),create_user);" +
483
483
"share streamTable(1000000:0,`tag`ts`data,[INT,TIMESTAMP,DOUBLE]) as tmp_st1;" +
484
484
"share streamTable(1000000:0,`tag`ts`data,[INT,TIMESTAMP,DOUBLE]) as tmp_st2;" +
@@ -489,7 +489,7 @@ public void test_subscribe_one_user_some_table() throws IOException, Interrupted
489
489
client .subscribe (HOST , PORT , "tmp_st3" , "subTread1" , MessageHandler_handler , -1 , true , null , true , "test1" , "123456_error" );
490
490
fail ("no exception thrown" );
491
491
}catch (Exception e ){
492
- System .out .println (e .getMessage ());
492
+ System .out .println (e .getMessage ()+ "12345666" );
493
493
}
494
494
conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "tmp_st1.append!(t)" );
495
495
conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "tmp_st2.append!(t)" );
@@ -577,11 +577,11 @@ public void test_ThreadPooledClient_null() throws Exception {
577
577
client1 .subscribe (HOST , PORT , "Trades" , "subTrades" ,MessageHandler_handler ,true );
578
578
conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "Trades.append!(t)" );
579
579
conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "Trades.append!(t)" );
580
- Thread .sleep (10000 );
580
+ Thread .sleep (15000 );
581
581
BasicTable re = (BasicTable ) conn .run ("select * from Receive order by tag" );
582
582
BasicTable tra = (BasicTable ) conn .run ("select * from Trades order by tag" );
583
583
client1 .unsubscribe (HOST , PORT , "Trades" , "subTrades" );
584
- // assertEquals(20000, re.rows());
584
+ assertEquals (20000 , re .rows ());
585
585
for (int i = 0 ; i < 1000 ; i ++) {
586
586
assertEquals (re .getColumn (0 ).get (i ), tra .getColumn (0 ).get (i ));
587
587
assertEquals (re .getColumn (1 ).get (i ), tra .getColumn (1 ).get (i ));
@@ -684,4 +684,25 @@ public void test_StreamDeserializer_dataType_filters_subscribe_haStreamTable() t
684
684
Assert .assertEquals (table2 .rows (), msg2 .size ());
685
685
client .unsubscribe (StreamLeaderHost , StreamLeaderPort , "outTables" , "mutiSchema" );
686
686
}
687
+ @ Test
688
+ public void test_ThreadPooledClient_threadCount () throws Exception {
689
+ client = new ThreadPooledClient (10 );
690
+ Vector filter1 = (Vector ) conn .run ("1..1000" );
691
+ client .subscribe (HOST , PORT , "Trades" , "subTrades" , MessageHandler_handler , -1 , true , filter1 , true );
692
+ conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "Trades.append!(t)" );
693
+ conn .run ("n=10000;t=table(1..n as tag,now()+1..n as ts,rand(100.0,n) as data);" + "Trades.append!(t)" );
694
+ Thread .sleep (10000 );
695
+ BasicTable re = (BasicTable ) conn .run ("select * from Receive order by tag" );
696
+ BasicTable tra = (BasicTable ) conn .run ("select * from Trades order by tag" );
697
+ client .unsubscribe (HOST , PORT , "Trades" , "subTrades" );
698
+ assertEquals (2000 , re .rows ());
699
+ for (int i = 0 ; i < 1000 ; i ++) {
700
+ assertEquals (re .getColumn (0 ).get (i ), tra .getColumn (0 ).get (i ));
701
+ assertEquals (re .getColumn (1 ).get (i ), tra .getColumn (1 ).get (i ));
702
+ assertEquals (((Scalar )re .getColumn (2 ).get (i )).getNumber ().doubleValue (), ((Scalar )tra .getColumn (2 ).get (i )).getNumber ().doubleValue (), 4 );
703
+ assertEquals (re .getColumn (0 ).get (i + 1000 ), tra .getColumn (0 ).get (i + 1000 ));
704
+ assertEquals (re .getColumn (1 ).get (i + 1000 ), tra .getColumn (1 ).get (i + 1000 ));
705
+ assertEquals (((Scalar )re .getColumn (2 ).get (i + 1000 )).getNumber ().doubleValue (), ((Scalar )tra .getColumn (2 ).get (i + 1000 )).getNumber ().doubleValue (), 4 );
706
+ }
707
+ }
687
708
}
0 commit comments