Skip to content

Commit 94f7ff6

Browse files
committed
AJ-691:fix broken case
1 parent 3afd20c commit 94f7ff6

File tree

4 files changed

+47
-7
lines changed

4 files changed

+47
-7
lines changed

test/com/xxdb/Prepare.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,35 @@ public static void clear_env() throws IOException {
4040
"clearShare()");
4141
conn.run("try{dropStreamEngine(\"serInput\");\n}catch(ex){\n}\n");
4242
}
43+
public static void clear_env_1() throws IOException {
44+
for (int i = 0; i < port_list.length; i++) {
45+
DBConnection conn = new DBConnection();
46+
conn.connect(HOST, port_list[i], "admin", "123456");
47+
conn.run("a = getStreamingStat().pubTables\n" +
48+
"for(i in a){\n" +
49+
"\ttry{stopPublishTable(i.subscriber.split(\":\")[0],int(i.subscriber.split(\":\")[1]),i.tableName,i.actions)}catch(ex){}\n" +
50+
"}");
51+
conn.run("def getAllShare(){\n" +
52+
"\treturn select name from objs(true) where shared=1\n" +
53+
"\t}\n" +
54+
"\n" +
55+
"def clearShare(){\n" +
56+
"\tlogin(`admin,`123456)\n" +
57+
"\tallShare=exec name from pnodeRun(getAllShare)\n" +
58+
"\tfor(i in allShare){\n" +
59+
"\t\ttry{\n" +
60+
"\t\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],clearTablePersistence,objByName(i))\n" +
61+
"\t\t\t}catch(ex1){}\n" +
62+
"\t\trpc((exec node from pnodeRun(getAllShare) where name =i)[0],undef,i,SHARED)\n" +
63+
"\t}\n" +
64+
"\ttry{\n" +
65+
"\t\tPST_DIR=rpc(getControllerAlias(),getDataNodeConfig{getNodeAlias()})['persistenceDir']\n" +
66+
"\t}catch(ex1){}\n" +
67+
"}\n" +
68+
"clearShare()");
69+
conn.run("try{dropStreamEngine(\"serInput\");\n}catch(ex){\n}\n");
70+
}
71+
}
4372

4473
public static void Preparedata(long count) throws IOException {
4574
String script = "login(`admin, `123456); \n" +

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ public class PollingClientReverseTest {
4949
public static PollingClient client;
5050
private StreamDeserializer deserializer_;
5151

52+
@BeforeClass
53+
public static void setUp() throws IOException {
54+
try {clear_env_1();}catch (Exception e){}
55+
}
5256
@Before
53-
public void setUp() throws IOException {
57+
public void clear() throws IOException {
5458
conn = new DBConnection();
5559
conn.connect(HOST, PORT, "admin", "123456");
5660
try {
@@ -92,12 +96,17 @@ public void after() throws IOException, InterruptedException {
9296
} catch (Exception e) {
9397
}
9498
try{conn.run("dropStreamTable(`Trades1)");}catch (Exception e){}
95-
// clear_env();
99+
try {clear_env();}catch (Exception e){}
96100
//client.close();
97101
conn.close();
98102
Thread.sleep(2000);
99103
}
100104

105+
@AfterClass
106+
public static void clear_conn() {
107+
try {clear_env_1();}catch (Exception e){}
108+
}
109+
101110
public void wait_data(String table_name,int data_row) throws IOException, InterruptedException {
102111
BasicInt row_num;
103112
while(true){

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ThreadPooledClientReverseTest {
3030

3131
@BeforeClass
3232
public static void setUp() throws IOException {
33-
33+
try {clear_env_1();}catch (Exception e){}
3434
}
3535
@Before
3636
public void clear() throws IOException {
@@ -50,7 +50,7 @@ public void clear() throws IOException {
5050
try{client.unsubscribe(HOST, PORT, "outTables", "mutiSchema");}catch (Exception ex){}
5151
try{client.unsubscribe(HOST, PORT, "outTables", "javaStreamingApi");}catch (Exception ex){}
5252
try{client.unsubscribe(HOST, PORT, "Trades1", "javaStreamingApi");}catch (Exception ex){}
53-
clear_env();
53+
try {clear_env();}catch (Exception e){}
5454
}
5555

5656
@After
@@ -83,6 +83,7 @@ public void after() throws IOException, InterruptedException {
8383

8484
@AfterClass
8585
public static void clear_conn() {
86+
try {clear_env_1();}catch (Exception e){}
8687
}
8788

8889
public static void PrepareStreamTable() throws IOException {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ThreadedClientsubscribeReverseTest {
3535

3636
@BeforeClass
3737
public static void setUp() throws IOException {
38-
38+
try {clear_env_1();}catch (Exception e){}
3939
}
4040
@Before
4141
public void clear() throws IOException {
@@ -54,7 +54,7 @@ public void clear() throws IOException {
5454
try{client.unsubscribe(HOST, PORT, "Trades", "subTrades");}catch (Exception ex){}
5555
try{client.unsubscribe(HOST, PORT, "outTables", "mutiSchema");}catch (Exception ex){}
5656
try{client.unsubscribe(HOST, PORT, "outTables", "javaStreamingApi");}catch (Exception ex){}
57-
clear_env();
57+
try {clear_env();}catch (Exception e){}
5858
}
5959

6060
@After
@@ -65,7 +65,7 @@ public void after() throws IOException, InterruptedException {
6565
try{client.unsubscribe(HOST, PORT, "Trades", "subTrades");}catch (Exception ex){}
6666
try{client.unsubscribe(HOST, PORT, "outTables", "mutiSchema");}catch (Exception ex){}
6767
try{client.unsubscribe(HOST, PORT, "outTables", "javaStreamingApi");}catch (Exception ex){}
68-
clear_env();
68+
try {clear_env();}catch (Exception e){}
6969
Thread.sleep(2000);
7070
client.close();
7171
conn.close();
@@ -74,6 +74,7 @@ public void after() throws IOException, InterruptedException {
7474

7575
@AfterClass
7676
public static void clear_conn() {
77+
try {clear_env_1();}catch (Exception e){}
7778
}
7879
public static MessageHandler MessageHandler_handler = new MessageHandler() {
7980
@Override

0 commit comments

Comments
 (0)