diff options
author | Fu Jinhua <fu.jinhua@zte.com.cn> | 2018-03-22 10:49:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-22 10:49:16 +0000 |
commit | 838f07437f7351149bd3f002f5f77cb5757d5650 (patch) | |
tree | 89c4d5f070a7195f10aa9461c16d64ddc0215423 | |
parent | fe1220f58c4068b92e467981a86ed28bb0b3064e (diff) | |
parent | 1b7527b26b653d95f53d7b033b58aca3444dde9e (diff) |
Merge "solve test code bug"
2 files changed, 10 insertions, 12 deletions
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java index 6b2b6c8..1031ff9 100644 --- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java +++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java @@ -27,15 +27,17 @@ public class AlarmTaskThreadTest { private AlarmTaskThread taskThread; private AlarmSocketServer server; + private Thread severThread; @Before public void setUp() throws IOException { - new Thread() { + severThread = new Thread(new Runnable(){ public void run() { server = new AlarmSocketServer(); server.socketServer(); } - }.start(); + }); + severThread.start(); CollectVo collectVo = new CollectVo(); collectVo.setIP("127.0.0.1"); collectVo.setPort("12345"); @@ -73,16 +75,12 @@ public class AlarmTaskThreadTest { @Test public void runAlarmTaskThread() { - try { - taskThread.run(); - Thread.sleep(10000); - taskThread.setStop(true); + taskThread.start(); + //Thread.sleep(3000); server.stop(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + severThread.stop(); + taskThread.setStop(true); + taskThread.close(); } } diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/HeartBeatTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/HeartBeatTest.java index 2ffb589..d93f51f 100644 --- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/HeartBeatTest.java +++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/HeartBeatTest.java @@ -43,7 +43,7 @@ public class HeartBeatTest { Socket socket = new Socket("127.0.0.1",12345); Msg msg = MessageUtil.putHeartBeatMsg(1); HeartBeat heartBeat = new HeartBeat(socket,msg); - heartBeat.run(); + heartBeat.start(); Thread.sleep(10); heartBeat.setStop(true); server.stop(); |