summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/data/aaa.txt0
-rw-r--r--ems/boco/data/bbb.txt1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java1
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtilTest.java59
4 files changed, 57 insertions, 4 deletions
diff --git a/ems/boco/data/aaa.txt b/ems/boco/data/aaa.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ems/boco/data/aaa.txt
diff --git a/ems/boco/data/bbb.txt b/ems/boco/data/bbb.txt
index e69de29..458aab0 100644
--- a/ems/boco/data/bbb.txt
+++ b/ems/boco/data/bbb.txt
@@ -0,0 +1 @@
+test abc \ No newline at end of file
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
index d3ced48..89cf34b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
@@ -35,7 +35,6 @@ public class CollectMsgReceiverThread extends DriverThread {
@Override
public void dispose() {
collectChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_CHANNEL_KEY);
-
taskService = TaskThreadService.getInstance(threadMaxNum);
taskService.start();
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtilTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtilTest.java
index 2f3d637..171c041 100644
--- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtilTest.java
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtilTest.java
@@ -15,10 +15,17 @@
*/
package org.onap.vfc.nfvo.emsdriver.collector.alarm;
-import org.junit.Test;
-
import static org.junit.Assert.assertNotNull;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.junit.Test;
+
public class MessageUtilTest {
@Test
@@ -62,6 +69,52 @@ public class MessageUtilTest {
assertNotNull(msg);
}
+
+ @Test
+ public void putloginMsg() {
+ String user = "test";
+ String passwd = "test";
+ Msg msg = MessageUtil.putLoginMsg(user, passwd);
+ assertNotNull(msg);
+ }
-
+ @Test
+ public void putHeartBeatMsg() {
+ Msg msg = MessageUtil.putHeartBeatMsg(1);
+ assertNotNull(msg);
+ }
+
+ @Test
+ public void readOneMsg(){
+ try {
+ String fileName = System.getProperty("user.dir") + "/data/" + "bbb.txt";
+ FileInputStream fis = new FileInputStream(fileName);
+ BufferedInputStream bis=new BufferedInputStream(fis);
+ Msg msg = MessageUtil.readOneMsg(bis);
+ assertNotNull(msg);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ System.out.println("File is not found");
+ } catch (IOException e){
+ System.out.println("There is IOException");
+ }
+ }
+
+
+
+ @Test
+ public void writeMsg(){
+ try {
+ String msgBody = "Heartbeat";
+ Msg msg = new Msg(msgBody,MsgType.ACK_HEARTBEAT);
+ String fileName = System.getProperty("user.dir") + "/data/" + "aaa.txt";
+ FileOutputStream fos=new FileOutputStream(fileName);
+ BufferedOutputStream bos=new BufferedOutputStream(fos);
+ MessageUtil.writeMsg(msg, bos);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ System.out.println("There is IOException");
+ }
+
+ }
}