Skip to content

Commit 6a06f7b

Browse files
committed
AJ-843:add test case about kdb parser
1 parent 6c84b3c commit 6a06f7b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

test/com/xxdb/DBConnectionTest.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5465,6 +5465,57 @@ public void Test_DBConnection_enableSCRAM_true_login_function() throws Exception
54655465
System.out.println(re.getString());
54665466
assertEquals("2", re.getString());
54675467
}
5468+
5469+
@Test
5470+
public void Test_DBConnection_useKdb_false() throws Exception {
5471+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,false);
5472+
conn.connect(HOST,PORT);
5473+
BasicInt re = (BasicInt) conn.run("1+1");
5474+
System.out.println(re.getString());
5475+
assertEquals("2", re.getString());
5476+
}
5477+
@Test
5478+
public void Test_DBConnection_useKdb_false_1() throws Exception {
5479+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,false);
5480+
conn.connect(HOST,PORT);
5481+
String re = null;
5482+
try{
5483+
BasicLong re1 = (BasicLong) conn.run("a:1\n;a");
5484+
}catch(Exception e){
5485+
re = e.getMessage();
5486+
}
5487+
assertEquals(true, re.contains("Cannot recognize the token a script: a:1"));
5488+
}
5489+
5490+
//@Test
5491+
public void Test_DBConnection_useKdb_true() throws Exception {
5492+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,true);
5493+
conn.connect(HOST,8847);
5494+
BasicLong re = (BasicLong) conn.run("a:1\n;a");
5495+
System.out.println(re.getString());
5496+
assertEquals("1", re.getString());
5497+
}
5498+
5499+
//@Test
5500+
public void Test_DBConnection_useKdb_true_server_not_support() throws Exception {
5501+
DBConnection conn = new DBConnection(false, false,false,false,false,null,false,true);
5502+
conn.connect(HOST,18921);
5503+
BasicInt re = (BasicInt) conn.run("1+1");
5504+
System.out.println(re.getString());
5505+
assertEquals("2", re.getString());
5506+
}
5507+
5508+
@Test
5509+
public void Test_DBConnection_useKdb_true_usePython_true() throws Exception {
5510+
DBConnection conn = new DBConnection(false, false,false,true,false,null,false,true);
5511+
String re = null;
5512+
try{
5513+
conn.connect(HOST,PORT);
5514+
}catch(Exception e){
5515+
re = e.getMessage();
5516+
}
5517+
assertEquals("The param 'usePython' and 'useKdb' cannot be set simultaneously.", re);
5518+
}
54685519
@Test
54695520
public void Test_DBConnection_ConnectConfig() throws Exception {
54705521
DBConnection conn = new DBConnection();

0 commit comments

Comments
 (0)