diff options
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(); |