Skip to content

Commit cbc7d80

Browse files
author
chengyitian
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 6a35d84 + d3fc985 commit cbc7d80

9 files changed

+92
-31
lines changed

test/com/xxdb/DBConnectionTest.java

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,7 @@ public void testMatrixUpload() throws IOException {
21892189
assertTrue(((BasicDateTimeMatrix) matrixDateTimeRes).get(1, 1).getString().equals("1925.10.18T23:32:09"));
21902190

21912191
Entity matrixTimeCross = conn.run("time(cross(add,13:31:10.008 12:30:10.008,1 2 3 -4))");
2192-
Entity matrixTime = conn.run("take(1900.06.13T13:30:10,8)$4:2");
2192+
Entity matrixTime = conn.run("take(2000.06.13T13:30:10,8)$4:2");
21932193
map.put("matrixTimeCross", matrixTimeCross);
21942194
map.put("matrixTime", matrixTime);
21952195
conn.upload(map);
@@ -5097,7 +5097,7 @@ public void test_exception_script() throws IOException {
50975097
}catch(Exception e){
50985098
re = e.getMessage();
50995099
}
5100-
assertEquals(true, re.contains("Duplicated column name name. "));
5100+
assertEquals(true, re.contains("Duplicated column name name "));
51015101
}
51025102

51035103
@Test
@@ -5112,7 +5112,7 @@ public void test_exception_Function() throws IOException {
51125112
}catch(Exception e){
51135113
re = e.getMessage();
51145114
}
5115-
assertEquals(true, re.contains("Can't recognize function name C. function: C"));
5115+
assertEquals(true, re.contains("Can't recognize function name C function: C"));
51165116
}
51175117
@Test
51185118
public void test_allDateType_combine() throws IOException {
@@ -5148,7 +5148,7 @@ public void test_allDateType_array_combine() throws IOException {
51485148
assertEquals(10000, data.rows());
51495149
}
51505150

5151-
@Test//api设置的parallelism小于server的setMaxJobParallelism
5151+
@Test//api设置的parallelism小于server的setMaxJobParallelism server默认管理员MaxJobParallelism为64,普通用户2
51525152
public void test_DBConnection_run_parallelism_1() throws IOException {
51535153
PrepareUser("parallelism_test","123456");
51545154
conn = new DBConnection();
@@ -5158,7 +5158,7 @@ public void test_DBConnection_run_parallelism_1() throws IOException {
51585158
DBConnection conn1 = new DBConnection();
51595159
conn1.connect(HOST,PORT,"parallelism_test","123456");
51605160
BasicTable re1 = (BasicTable)conn.run("getConsoleJobs();",3,5,false);
5161-
Assert.assertEquals("5",re1.getColumn(6).get(0).getString());
5161+
Assert.assertEquals("2",re1.getColumn(6).get(0).getString());
51625162
System.out.println(re1.getColumn(5).get(0).getString());
51635163
}
51645164
@Test//api设置的parallelism大于server的setMaxJobParallelism
@@ -5189,10 +5189,10 @@ public void test_DBConnection_run_parallelism_3() throws IOException, Interrupte
51895189
System.out.println(re1.getString());
51905190
Assert.assertEquals("22",re1.getColumn(6).get(0).getString());
51915191
}
5192-
@Test //isClientAuth开启
5192+
//@Test //isClientAuth开启
51935193
public void test_not_login_run_fuction() throws Exception {
51945194
DBConnection db = new DBConnection();
5195-
db.connect("192.168.0.69", 8868);
5195+
db.connect(HOST, PORT);
51965196
Entity version = db.run("version",new ArrayList<>());
51975197
System.out.println(version.getString());
51985198
assertNotNull(version.getString());
@@ -5263,7 +5263,7 @@ public void test_not_login_run_fuction_authenticateByTicket() throws Exception {
52635263
@Test
52645264
public void test_not_login_run_fuction_login() throws Exception {
52655265
DBConnection db = new DBConnection();
5266-
db.connect("192.168.0.69", 8868);
5266+
db.connect(HOST, PORT);
52675267
List<Entity> entity1 = new ArrayList<>();
52685268
entity1.add(new BasicString("admin"));
52695269
entity1.add(new BasicString("123456"));
@@ -5273,14 +5273,14 @@ public void test_not_login_run_fuction_login() throws Exception {
52735273
@Test
52745274
public void test_not_login_run_fuction_not_support() throws Exception {
52755275
DBConnection db = new DBConnection();
5276-
db.connect("192.168.0.69", 8868);
5276+
db.connect(HOST, PORT);
52775277
String re = null;
52785278
try{
52795279
db.run("getAllDBs",new ArrayList<>());
52805280
}catch(Exception e){
52815281
re = e.getMessage();
52825282
}
5283-
assertEquals(true, re.contains("Login is required for script execution with client authentication enabled. RefId: S04009. function: getAllDBs"));
5283+
assertEquals(true, re.contains("Login is required for script execution with client authentication enabled. RefId: S04009 function: getAllDBs"));
52845284
}
52855285
//@Test //isClientAuth开启
52865286
public void test_Connect_enableHighAvailability_true() throws IOException {
@@ -5419,7 +5419,14 @@ public void Test_DBConnection_enableSCRAM_true_compress_true() throws Exception
54195419
System.out.println(re.getString());
54205420
assertEquals("2", re.getString());
54215421
}
5422-
5422+
//@Test
5423+
public void Test_DBConnection_usePython_true() throws Exception {
5424+
DBConnection conn = new DBConnection(false, false,false,true);
5425+
conn.connect(HOST,PORT,"admin","123456");
5426+
BasicInt re = (BasicInt) conn.run("1+1");
5427+
System.out.println(re.getString());
5428+
assertEquals("2", re.getString());
5429+
}
54235430
@Test
54245431
public void Test_DBConnection_enableSCRAM_true_usePython_true() throws Exception {
54255432
PrepareUser_authMode("test1","123456","scram");
@@ -5465,6 +5472,57 @@ public void Test_DBConnection_enableSCRAM_true_login_function() throws Exception
54655472
System.out.println(re.getString());
54665473
assertEquals("2", re.getString());
54675474
}
5475+
5476+
@Test
5477+
public void Test_DBConnection_useKdb_false() throws Exception {
5478+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,false);
5479+
conn.connect(HOST,PORT);
5480+
BasicInt re = (BasicInt) conn.run("1+1");
5481+
System.out.println(re.getString());
5482+
assertEquals("2", re.getString());
5483+
}
5484+
@Test
5485+
public void Test_DBConnection_useKdb_false_1() throws Exception {
5486+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,false);
5487+
conn.connect(HOST,PORT);
5488+
String re = null;
5489+
try{
5490+
BasicLong re1 = (BasicLong) conn.run("a:1\n;a");
5491+
}catch(Exception e){
5492+
re = e.getMessage();
5493+
}
5494+
assertEquals(true, re.contains("Cannot recognize the token a script: a:1"));
5495+
}
5496+
5497+
//@Test
5498+
public void Test_DBConnection_useKdb_true() throws Exception {
5499+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,true);
5500+
conn.connect(HOST,8847);
5501+
BasicLong re = (BasicLong) conn.run("a:1\n;a");
5502+
System.out.println(re.getString());
5503+
assertEquals("1", re.getString());
5504+
}
5505+
5506+
//@Test
5507+
public void Test_DBConnection_useKdb_true_server_not_support() throws Exception {
5508+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,true);
5509+
conn.connect(HOST,18921);
5510+
BasicInt re = (BasicInt) conn.run("1+1");
5511+
System.out.println(re.getString());
5512+
assertEquals("2", re.getString());
5513+
}
5514+
5515+
@Test
5516+
public void Test_DBConnection_useKdb_true_usePython_true() throws Exception {
5517+
DBConnection conn = new DBConnection(false, false,false,true,false,null,false,true);
5518+
String re = null;
5519+
try{
5520+
conn.connect(HOST,PORT);
5521+
}catch(Exception e){
5522+
re = e.getMessage();
5523+
}
5524+
assertEquals("The param 'usePython' and 'useKdb' cannot be set simultaneously.", re);
5525+
}
54685526
@Test
54695527
public void Test_DBConnection_ConnectConfig() throws Exception {
54705528
DBConnection conn = new DBConnection();
@@ -5694,7 +5752,7 @@ public void Test_DBConnection_ConnectConfig_initialScript() throws Exception {
56945752
}
56955753

56965754
@Test
5697-
public void Test_DBConnection_ConnectConfig_reconnect_true_tryReconnectNums_10() throws Exception {
5755+
public void Test_DBConnection_ConnectConfig_reconnect_true_tryReconnectNums_5() throws Exception {
56985756
DBConnection conn = new DBConnection();
56995757
String re = null;
57005758
try{

test/com/xxdb/SimpleDBConnectionPoolTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public void test_SimpleDBConnectionPool_config_UseSSL_false() throws IOException
396396
assertEquals(false,config1.isUseSSL());
397397
}
398398

399-
@Test
399+
//@Test server有bug setUsePython 连接不上
400400
public void test_SimpleDBConnectionPool_config_UsePython_true() throws IOException, InterruptedException {
401401
SimpleDBConnectionPoolConfig config1 = new SimpleDBConnectionPoolConfig();
402402
config1.setHostName(HOST);
@@ -719,7 +719,7 @@ public void test_SimpleDBConnectionPool_closeIdleConnections_Auto() throws Inter
719719
assertEquals(10,pool.getTotalConnectionsCount());
720720
assertEquals(0,pool.getActiveConnectionsCount());
721721
assertEquals(10,pool.getIdleConnectionsCount());
722-
Thread.sleep(972);//972
722+
Thread.sleep(1000);//972
723723
assertEquals(6,pool.getTotalConnectionsCount());
724724
assertEquals(0,pool.getActiveConnectionsCount());
725725
assertEquals(6,pool.getIdleConnectionsCount());

test/com/xxdb/data/BasicIotAnyVectorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ public void test_iotAnyVector_allDateType_upload_null() throws IOException {
567567
Assert.assertEquals("IOTANY", entity33.getColumn(0).getString(0));
568568

569569
BasicTable entity4 = (BasicTable)conn.run("select * from loadTable( \"dfs://testIOT\", `pt) order by deviceId limit 9 ;");
570-
System.out.println(entity4.getColumn("value"));
570+
//System.out.println(entity4.getColumn("value"));
571571
BasicIotAnyVector entity44 = (BasicIotAnyVector)entity4.getColumn("value");
572572
Map<String, Entity> map2 = new HashMap<>();
573573
map2.put("iotAny3", entity44);

test/com/xxdb/data/BasicTableTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public void test_BasicTable_getSubTable() {
574574
public void test_BasicTable_GetSubTable_DFS() throws IOException {
575575
DBConnection conn = new DBConnection();
576576
conn.connect(HOST,PORT,"admin","123456");
577-
String script = "n=10000000;\n" +
577+
String script = "n=1000000;\n" +
578578
"bool = take(true false,n);\n" +
579579
"char = take('a'..'z',n);\n" +
580580
"short = take(1h..255h,n);\n" +
@@ -600,9 +600,10 @@ public void test_BasicTable_GetSubTable_DFS() throws IOException {
600600
"pt.append!(t)";
601601
conn.run(script);
602602
BasicTable bt = (BasicTable) conn.run("select * from pt;");
603-
assertEquals(10000000,bt.rows());
604-
Table gs = bt.getSubTable(0,9999999);
603+
assertEquals(1000000,bt.rows());
604+
Table gs = bt.getSubTable(0,1);
605605
System.out.println(gs.getString());
606+
assertEquals(2,gs.rows());
606607
}
607608
@Test
608609
public void test_BasicTable_getRowJson()throws Exception{

test/com/xxdb/restart/LoadBalanceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void doEvent(IMessage msg) {
151151
}
152152
};
153153

154-
@Test(timeout = 120000)
154+
//@Test(timeout = 120000)
155155
public void test_load_balance_ha_stream() throws IOException, InterruptedException {
156156
DBConnection controller_conn = new DBConnection();
157157
controller_conn.connect(controller_host,controller_port,"admin","123456");

test/com/xxdb/restart/SimpleDBConnectionPoolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void test_SimpleDBConnectionPool_config_HighAvailability_true_LoadBalance
8787
DBConnection controller_conn = new DBConnection();
8888
controller_conn.connect(controller_host, controller_port, "admin", "123456");
8989
controller_conn.run("try{stopDataNode('"+HOST+":"+PORT+"')}catch(ex){}");
90-
controller_conn.run("8000");
90+
controller_conn.run("10000");
9191
SimpleDBConnectionPoolConfig config1 = new SimpleDBConnectionPoolConfig();
9292
config1.setHostName(HOST);
9393
config1.setPort(PORT);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void test_EventClient_FieldNames_one_colume() throws IOException, Interr
210210
"timestamp = t\n"+
211211
"}\n"+
212212
"}\n"+
213-
"class MainMonitor{\n"+
213+
"class MainMonitor:CEPMonitor{\n"+
214214
"def MainMonitor(){}\n"+
215215
"def updateMarketData(event)\n"+
216216
"def onload(){addEventListener(updateMarketData,'MarketData',,'all')}\n"+
@@ -896,7 +896,7 @@ public void test_EventClient_unsubscribe_duplicated() throws IOException, Inter
896896
}catch(Exception ex){
897897
re = ex.getMessage();
898898
}
899-
Assert.assertEquals(true, re.contains("doesn't exist.. function: stopPublishTable"));
899+
Assert.assertEquals(true, re.contains("doesn't exist. function: stopPublishTable"));
900900
}
901901

902902
//@Test

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,13 @@ public void test_subscribe_ofst_negative2() throws IOException {
323323
PrepareStreamTable();
324324
int ofst = -2;
325325
String re = null;
326-
try {
327-
threadPooledClient.subscribe(HOST, PORT, "Trades", MessageHandler_handler, ofst);
328-
} catch (Exception ex) {
329-
re = ex.getMessage();
330-
}
331-
assertEquals(true, re.contains("Can't find the message with offset [-2]"));
326+
threadPooledClient.subscribe(HOST, PORT, "Trades", MessageHandler_handler, ofst);
327+
// try {
328+
// threadPooledClient.subscribe(HOST, PORT, "Trades", MessageHandler_handler, ofst);
329+
// } catch (Exception ex) {
330+
// re = ex.getMessage();
331+
// }
332+
// assertEquals(true, re.contains("Can't find the message with offset [-2]"));
332333
}
333334

334335
@Test

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ public void test_subscribe_other_user_unallow() throws IOException{
989989
threadedClient.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, true, filter1, true, 100, 5, "test1", "123456");
990990
fail("no exception thrown");
991991
}catch (Exception e){
992-
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]."));
992+
System.out.println(e.getMessage());
993+
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]"));
993994
}
994995
}
995996

@@ -1015,15 +1016,15 @@ public void test_subscribe_other_some_user() throws IOException, InterruptedExce
10151016
threadedClient.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, true, filter1, true, 100, 5, "test1", "123456");
10161017
fail("no exception thrown");
10171018
}catch (Exception e){
1018-
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]."));
10191019
System.out.println(e.getMessage());
1020+
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]"));
10201021
}
10211022

10221023
try {
10231024
threadedClient.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, true, filter1, true, 100, 5, "test3", "123456");
10241025
fail("no exception thrown");
10251026
}catch (Exception e){
1026-
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]."));
1027+
assertEquals(true,e.getMessage().contains("No access to shared table [Trades]"));
10271028
}
10281029
threadedClient.subscribe(HOST, PORT, "Trades", "subTread1", MessageHandler_handler, -1, false, filter1, true, 100, 5, "test2", "123456");
10291030
threadedClient.unsubscribe(HOST, PORT, "Trades", "subTread1");

0 commit comments

Comments
 (0)