summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/conf/EMSInfo.xml52
-rw-r--r--ems/boco/conf/emsdriver.yml58
-rw-r--r--ems/boco/conf/ftpconfig.properties28
-rw-r--r--ems/boco/conf/log4j.properties40
-rw-r--r--ems/boco/conf/spring.xml50
-rw-r--r--ems/boco/data/License.txt14
-rw-r--r--ems/boco/data/PM-ENB-EUTRANCELLNB-test.csv.gzbin0 -> 1058 bytes
-rw-r--r--ems/boco/pom.xml12
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java86
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java11
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java4
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/AFtpRemoteFile.java2
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsg.java7
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java36
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java9
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java79
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannel.java5
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadServiceTest.java48
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadTest.java52
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java42
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsgTest.java41
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVoTest.java40
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java48
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/GunzipTest.java54
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtilTest.java58
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZipTest.java46
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/ZipTest.java54
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java68
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManagerTest.java64
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelFactoryTest.java52
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelTest.java72
-rw-r--r--ems/microservice-standalone/src/main/assembly/run.sh1
33 files changed, 1151 insertions, 83 deletions
diff --git a/ems/boco/conf/EMSInfo.xml b/ems/boco/conf/EMSInfo.xml
new file mode 100644
index 0000000..bdfe945
--- /dev/null
+++ b/ems/boco/conf/EMSInfo.xml
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='GBK'?>
+<!--
+
+ Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+-->
+<collectSources>
+ <ems name="1234">
+ <collect type ="cm" crontab="0 0/1 * * * ?">
+ <ip>192.168.6.48</ip>
+ <port>21</port>
+ <user>gcp</user>
+ <password>gcp</password>
+ <remotepath>/opt/Gcp/data/</remotepath>
+ <match>*</match>
+ <passive>true</passive>
+ <ftptype>ftp</ftptype>
+ <granularity>15</granularity>
+ </collect>
+ <collect type ="pm" crontab="">
+ <ip>192.168.1.16</ip>
+ <port>21</port>
+ <user>gcp</user>
+ <password>gcp</password>
+ <remotepath>/var/vsftp/gcp/ftproot/GD/WX/HW/JS_OMC2/</remotepath>
+ <match>*</match>
+ <passive>true</passive>
+ <ftptype>ftp</ftptype>
+ <granularity>15</granularity>
+ </collect>
+ <collect type ="alarm" iscollect = "false">
+ <ip>127.0.0.1</ip>
+ <port>9997</port>
+ <user>yiyang</user>
+ <password>123456</password>
+ <readtimeout>6</readtimeout>;
+ </collect>
+ </ems>
+</collectSources> \ No newline at end of file
diff --git a/ems/boco/conf/emsdriver.yml b/ems/boco/conf/emsdriver.yml
new file mode 100644
index 0000000..d88e3a1
--- /dev/null
+++ b/ems/boco/conf/emsdriver.yml
@@ -0,0 +1,58 @@
+
+# Copyright 2017 CMCC Technologies Co., Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+defaultName: EmsDriver-Stranger
+
+#microservice Bus address
+msbAddress: 10.74.205.123:80
+
+server:
+ type: simple
+ rootPath: '/api/emsdriver/v1/*'
+ applicationContextPath: /
+ adminContextPath: /admin
+ connector:
+ type: http
+ port: 8206
+
+# Logging settings.
+logging:
+
+ # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
+ level: INFO
+
+ # Logger-specific levels.
+ loggers:
+
+ # Sets the level for 'org.openo.nfvo.monitor.dac' to INFO.
+ org.onap.vfc.nfvo.emsdriver.northbound.service.EmsDriverApplication: INFO
+
+ appenders:
+ - type: console
+ threshold: WARN
+ timeZone: PRC
+ logFormat: "%-4level [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %logger{5} - %X{code} %msg %n"
+ - type: file
+ threshold: INFO
+ logFormat: "%-4level [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %logger{5} - %X{code} %msg %n"
+ currentLogFilename: ./logs/dac.log
+ archivedLogFilenamePattern: ./logs/dac-%d{yyyyMMdd}-%d{HHmm}-%d{ssSSS}.log.gz
+ archivedFileCount: 7
+ timeZone: PRC
+
+
+
diff --git a/ems/boco/conf/ftpconfig.properties b/ems/boco/conf/ftpconfig.properties
new file mode 100644
index 0000000..8d79bbd
--- /dev/null
+++ b/ems/boco/conf/ftpconfig.properties
@@ -0,0 +1,28 @@
+
+# Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ftp_ip = 192.168.6.48
+ftp_port = 21
+ftp_user = gcp
+ftp_password = gcp
+ftp_remote_path = /opt/Gcp/
+ftp_passive = true
+ftp_type = ftp
+
+#
+msbAddress: 10.74.205.123:80
+dataNotifyUrl:/dataNotify
+alarmUrl:/alarm \ No newline at end of file
diff --git a/ems/boco/conf/log4j.properties b/ems/boco/conf/log4j.properties
new file mode 100644
index 0000000..f9edd80
--- /dev/null
+++ b/ems/boco/conf/log4j.properties
@@ -0,0 +1,40 @@
+# Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+log4j.rootCategory=debug,R,E,stdout
+
+#### \u7b2c\u4e00\u4e2a appender\u5c06log\u5199\u5230\u5c4f\u5e55
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%p] [%d] [%c] - [%m]%n
+log4j.appender.stdout.Threshold=INFO
+
+#### \u7b2c\u4e8c\u4e2a appender \u5c06\u5168\u90e8log\u5199\u5230\u6587\u4ef6
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=../log/monitor.log
+log4j.appender.R.MaxFileSize=20MB
+log4j.appender.R.MaxBackupIndex=50
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=[%p] [%d] [%t] [%c] - [%m]%n
+log4j.appender.R.Threshold=INFO
+
+#### \u7b2c\u4e09\u4e2a appender \u5c06\u9519\u8beflog\u5199\u5230\u6587\u4ef6
+log4j.appender.E=org.apache.log4j.RollingFileAppender
+log4j.appender.E.File=../log/error.log
+log4j.appender.E.MaxFileSize=20MB
+log4j.appender.E.MaxBackupIndex=10
+log4j.appender.E.layout=org.apache.log4j.PatternLayout
+log4j.appender.E.layout.ConversionPattern=[%p] [%d] [%t] [%c] - [%m]%n
+log4j.appender.E.Threshold=ERROR
diff --git a/ems/boco/conf/spring.xml b/ems/boco/conf/spring.xml
new file mode 100644
index 0000000..c047c88
--- /dev/null
+++ b/ems/boco/conf/spring.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="GBK"?>
+<!--
+
+ Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
+ default-lazy-init="true">
+
+ <bean id="configurationManager" class="org.onap.nfvo.emsdriver.configmgr.ConfigurationManager">
+ <property name="run" value="true" />
+
+ </bean>
+ <bean id="collectMsgReceiverThread" class="org.onap.nfvo.emsdriver.collector.CollectMsgReceiverThread">
+ <property name="run" value="true" />
+ <property name="thread_max_num" value="100" />
+ </bean>
+
+ <bean id="configurationImp" class="org.onap.nfvo.emsdriver.configmgr.ConfigurationImp">
+ </bean>
+ <bean id="alarmManager" class="org.onap.nfvo.emsdriver.collector.alarm.AlarmManager">
+ <property name="run" value="true" />
+ <property name="configurationInterface" ref="configurationImp" />
+ </bean>
+ <bean id="collectManager" class="org.onap.nfvo.emsdriver.taskscheduler.CollectManager">
+ <property name="run" value="true" />
+ <property name="configurationInterface" ref="configurationImp" />
+ </bean>
+ <bean id="northMessageMgr" class="org.onap.nfvo.emsdriver.northbound.client.NorthMessageMgr">
+ <property name="run" value="true" />
+ <property name="configurationInterface" ref="configurationImp" />
+ </bean>
+
+
+</beans>
diff --git a/ems/boco/data/License.txt b/ems/boco/data/License.txt
new file mode 100644
index 0000000..a98c7aa
--- /dev/null
+++ b/ems/boco/data/License.txt
@@ -0,0 +1,14 @@
+
+ Copyright 2017 BOCO Corporation. CMCC?Technologies?Co.,?Ltd
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/ems/boco/data/PM-ENB-EUTRANCELLNB-test.csv.gz b/ems/boco/data/PM-ENB-EUTRANCELLNB-test.csv.gz
new file mode 100644
index 0000000..8c4a4d0
--- /dev/null
+++ b/ems/boco/data/PM-ENB-EUTRANCELLNB-test.csv.gz
Binary files differ
diff --git a/ems/boco/pom.xml b/ems/boco/pom.xml
index 6a54ed6..6090461 100644
--- a/ems/boco/pom.xml
+++ b/ems/boco/pom.xml
@@ -163,11 +163,11 @@
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
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 a73fc37..ae15248 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
@@ -51,6 +51,7 @@ public class CollectMsgReceiverThread extends DriverThread{
Object obj = collectChannel.poll();
if(obj == null){
+ Thread.sleep(10);
continue;
}
if(obj != null && obj instanceof CollectMsg){
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
index dac8df2..e2fcf7d 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
@@ -48,6 +48,7 @@ import org.onap.vfc.nfvo.emsdriver.commons.ftp.FTPSrv;
import org.onap.vfc.nfvo.emsdriver.commons.ftp.SFTPSrv;
import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
+import org.onap.vfc.nfvo.emsdriver.commons.utils.Gunzip;
import org.onap.vfc.nfvo.emsdriver.commons.utils.StringUtil;
import org.onap.vfc.nfvo.emsdriver.commons.utils.UnZip;
import org.onap.vfc.nfvo.emsdriver.commons.utils.Zip;
@@ -74,10 +75,17 @@ public class TaskThread implements Runnable{
private SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private String csvpathAndFileName;
+ private String xmlPathAndFileName;
+ private int countNum = 0 ;
+
public TaskThread(CollectMsg data) {
this.data = data;
}
-
+ public TaskThread() {
+ super();
+ }
+
@Override
public void run(){
@@ -121,6 +129,25 @@ public class TaskThread implements Runnable{
parseResult = processCMXml(tempfile, nename,"CM");
}else{
parseResult = processPMCsv(tempfile, nename,"PM");
+
+ //createzipFile
+ String[] fileKeys = this.createZipFile(csvpathAndFileName,xmlPathAndFileName,nename);
+ //ftp store
+ Properties ftpPro = configurationInterface.getProperties();
+ String ip = ftpPro.getProperty("ftp_ip");
+ String port = ftpPro.getProperty("ftp_port");
+ String ftp_user = ftpPro.getProperty("ftp_user");
+ String ftp_password = ftpPro.getProperty("ftp_password");
+
+ String ftp_passive = ftpPro.getProperty("ftp_passive");
+ String ftp_type = ftpPro.getProperty("ftp_type");
+ String remoteFile = ftpPro.getProperty("ftp_remote_path");
+ this.ftpStore(fileKeys,ip,port,ftp_user,ftp_password,ftp_passive,ftp_type,remoteFile);
+ //create Message
+ String message = this.createMessage(fileKeys[1], ftp_user, ftp_password, ip, port, countNum,nename);
+
+ //set message
+ this.setMessage(message);
}
if (parseResult){
@@ -132,7 +159,7 @@ public class TaskThread implements Runnable{
}
}
- private boolean processPMCsv(File tempfile, String nename,String type) {
+ public boolean processPMCsv(File tempfile, String nename,String type) {
String csvpath = localPath+nename+"/"+type+"/";
File csvpathfile = new File(csvpath);
@@ -140,7 +167,7 @@ public class TaskThread implements Runnable{
csvpathfile.mkdirs();
}
String csvFileName = nename +dateFormat.format(new Date())+ System.nanoTime();
- String csvpathAndFileName = csvpath+csvFileName;
+ csvpathAndFileName = csvpath+csvFileName+".csv";
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
@@ -163,7 +190,7 @@ public class TaskThread implements Runnable{
br = new BufferedReader(isr);
//common field
String commonField = br.readLine();
- String[] fields = commonField.split("|",-1);
+ String[] fields = commonField.split("\\|",-1);
for(String com : fields){
String[] comNameAndValue = com.split("=",2);
columnNames.add(comNameAndValue[0].trim());
@@ -171,23 +198,22 @@ public class TaskThread implements Runnable{
}
//column names
String columnName = br.readLine();
- String[] names = columnName.split("|",-1);
+ String[] names = columnName.split("\\|",-1);
for(String name : names){
columnNames.add(name);
}
- String xmlPathAndFileName = this.setColumnNames(nename, columnNames,type);
+ xmlPathAndFileName = this.setColumnNames(nename, columnNames,type);
String valueLine = "";
List<String> valuelist = new ArrayList<String>();
- int countNum = 0 ;
+
while (br.readLine() != null) {
-
if (valueLine.trim().equals("")) {
continue;
}
countNum ++;
- String [] values = valueLine.split("|",-1);
+ String [] values = valueLine.split("\\|",-1);
valuelist.addAll(commonValues);
for(String value : values){
@@ -197,33 +223,6 @@ public class TaskThread implements Runnable{
valuelist.clear();
}
-
- if(bos != null){
- bos.close();
- bos = null;
- }
- if(fos != null){
- fos.close();
- fos = null;
- }
-
- String[] fileKeys = this.createZipFile(csvpathAndFileName,xmlPathAndFileName,nename);
- //ftp store
- Properties ftpPro = configurationInterface.getProperties();
- String ip = ftpPro.getProperty("ftp_ip");
- String port = ftpPro.getProperty("ftp_port");
- String ftp_user = ftpPro.getProperty("ftp_user");
- String ftp_password = ftpPro.getProperty("ftp_password");
-
- String ftp_passive = ftpPro.getProperty("ftp_passive");
- String ftp_type = ftpPro.getProperty("ftp_type");
- String remoteFile = ftpPro.getProperty("ftp_remote_path");
- this.ftpStore(fileKeys,ip,port,ftp_user,ftp_password,ftp_passive,ftp_type,remoteFile);
- //create Message
- String message = this.createMessage(fileKeys[1], ftp_user, ftp_password, ip, port, countNum,nename);
-
- //set message
- this.setMessage(message);
} catch (IOException e) {
log.error("processPMCsv is fail ",e);
return false;
@@ -238,7 +237,6 @@ public class TaskThread implements Runnable{
if(bos != null){
bos.close();
}
-
if(fos != null){
fos.close();
}
@@ -622,7 +620,12 @@ public class TaskThread implements Runnable{
if (fileName.indexOf(".gz") > 1)
{
-// decompressFile = deGz(file);
+ try {
+ File decompressFile = deGz(fileName);
+ filelist.add(decompressFile);
+ } catch (IOException e) {
+ log.error("decompressed is fail "+StringUtil.getStackTrace(e));
+ }
} else if (fileName.indexOf(".zip") > 1)
{
try {
@@ -641,6 +644,13 @@ public class TaskThread implements Runnable{
return filelist;
}
+ private File deGz(String gzFileName) throws IOException {
+ Gunzip gunzip = new Gunzip();
+ String orgFile = gzFileName.replace(".gz", "");
+ gunzip.unCompress(gzFileName, orgFile);
+ return new File(orgFile);
+ }
+
public File[] deZip(File file) throws Exception{
String regx = "(.*).zip";
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java
index c665463..d03fd4b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java
@@ -50,6 +50,11 @@ public class AlarmTaskThread extends Thread{
private MessageChannel alarmChannel;
+
+ public AlarmTaskThread() {
+ super();
+ }
+
public AlarmTaskThread(CollectVo collectVo) {
this.collectVo = collectVo;
@@ -84,7 +89,7 @@ public class AlarmTaskThread extends Thread{
}
}
- private String build120Alarm(String body) {
+ public String build120Alarm(String body) {
StringBuilder content = new StringBuilder(
"<?xml version='1.0' encoding='iso-8859-1'?>\n")
.append("<WholeMsg MsgMark='120' Priority='2' FieldNum='5'><FM_ALARM_MSG>\n");
@@ -96,7 +101,7 @@ public class AlarmTaskThread extends Thread{
for (String key : keys) {
- String value = (String)reagobj.get(key);
+ String value = reagobj.get(key).toString();
content.append("<").append(key).append(">");
content.append(value);
content.append("</").append(key).append(">\n");
@@ -135,7 +140,7 @@ public class AlarmTaskThread extends Thread{
}
if("ackHeartBeat".equalsIgnoreCase(msg.getMsgType().name)){
- log.debug("received heartBeat��"+msg.getBody());
+ log.debug("received heartBeat message:"+msg.getBody());
retString = null;
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
index f099abd..c6edaf1 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
@@ -19,9 +19,9 @@ import java.io.File;
public class Constant {
- public static String SYS_HOME = System.getenv("EMSDRIVER_HOME")==null?"E:/workspace/ems-driver/":System.getenv("EMSDRIVER_HOME");
+ public static String SYS_HOME = System.getenv("RUNHOME")==null?System.getProperty("user.dir"):System.getenv("RUNHOME");
- public static String SYS_CFG = SYS_HOME + File.separator + "cfg" + File.separator;
+ public static String SYS_CFG = SYS_HOME + File.separator + "conf" + File.separator;
public static String SYS_DATA = SYS_HOME + "data" + File.separator;
public static String SYS_DATA_TEMP = SYS_DATA + File.separator + "temp" + File.separator;
public static String SYS_DATA_RESULT = SYS_DATA + File.separator + "RESULT" + File.separator;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/AFtpRemoteFile.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/AFtpRemoteFile.java
index bea4fc0..336c5a3 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/AFtpRemoteFile.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/AFtpRemoteFile.java
@@ -78,4 +78,4 @@ public class AFtpRemoteFile implements RemoteFile{
ftpFile = null;
currDir = null;
}
-}
+} \ No newline at end of file
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsg.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsg.java
index c644faa..fed0294 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsg.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsg.java
@@ -64,6 +64,13 @@ public class CollectMsg {
public void setType(String type) {
this.type = type;
}
+
+ @Override
+ public String toString() {
+ return "CollectMsg [id=" + id + ", emsName=" + emsName + ", type="
+ + type + "]";
+ }
+
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java
index a49b19a..75aaa59 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java
@@ -220,33 +220,15 @@ public class CollectVo {
}
- public String toString(){
- StringBuffer sb = new StringBuffer();
- sb.append("CollectVo:").append("\n");
- if("alarm".equalsIgnoreCase(type)){
- sb.append("type = ").append(type).append("\n");
- sb.append("ip = ").append(IP).append("\n");
- sb.append("port = ").append(port).append("\n");
- sb.append("user = ").append(user).append("\n");
- sb.append("password = ").append(password).append("\n");
- sb.append("iscollect = ").append(iscollect).append("\n");
- }else{
- sb.append("type = ").append(type).append("\n");
- sb.append("ip = ").append(IP).append("\n");
- sb.append("port = ").append(port).append("\n");
- sb.append("user = ").append(user).append("\n");
-
- sb.append("password = ").append(password).append("\n");
- sb.append("remotepath = ").append(remotepath).append("\n");
- sb.append("match = ").append(match).append("\n");
- sb.append("passive = ").append(passive).append("\n");
- sb.append("ftptype = ").append(ftptype).append("\n");
- sb.append("granularity = ").append(type).append("\n");
- }
-
-
- return sb.toString();
-
+ @Override
+ public String toString() {
+ return "CollectVo [emsName=" + emsName + ", type=" + type
+ + ", crontab=" + crontab + ", IP=" + IP + ", port=" + port
+ + ", user=" + user + ", password=" + password + ", remotepath="
+ + remotepath + ", match=" + match + ", passive=" + passive
+ + ", ftptype=" + ftptype + ", granularity=" + granularity
+ + ", iscollect=" + iscollect + ", read_timeout=" + read_timeout
+ + "]";
}
/**
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java
index ec61bb0..c0a4618 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java
@@ -49,11 +49,8 @@ public class EMSInfo {
this.collectMap.put(type, collectVo);
}
- public String toString(){
- StringBuffer sb = new StringBuffer();
- sb.append("name = ").append(name).append("\n");
- sb.append("CollectMap = ").append(collectMap);
-
- return sb.toString();
+ @Override
+ public String toString() {
+ return "EMSInfo [name=" + name + ", collectMap=" + collectMap + "]";
}
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
new file mode 100644
index 0000000..84bed63
--- /dev/null
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
@@ -0,0 +1,79 @@
+package org.onap.vfc.nfvo.emsdriver.commons.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.GZIPInputStream;
+
+
+public class Gunzip {
+
+ /**
+ *
+ */
+ public void unCompress(String gzFileName, String toFile)
+ throws IOException {
+ GZIPInputStream gzIn = null;
+ FileOutputStream fileOutput = null;
+ FileInputStream gzInput = new FileInputStream(gzFileName);
+ try {
+ gzIn = new GZIPInputStream(gzInput);
+ File tofile = new File(toFile);
+ enable(tofile);
+ fileOutput = new FileOutputStream(tofile, false);
+
+ moveBytes(gzIn, fileOutput, -1, -1, 1024);
+ } finally{
+ if(gzIn != null){
+ gzIn.close();
+ }
+ if(fileOutput != null){
+ fileOutput.close();
+ }
+
+ }
+
+
+ }
+
+ private void enable(File tofile) throws IOException {
+ if (!tofile.exists()) {
+ String parentPath = tofile.getParent();
+ if (parentPath != null)
+ new File(parentPath).mkdirs();
+ tofile.createNewFile();
+ }
+ }
+
+
+ public long moveBytes(InputStream input, OutputStream output, long off, long len, int bufsize)
+ throws IOException {
+ if (off > 0)
+ input.skip(off);
+
+ long totalNum = 0;
+ byte[] buf = new byte[bufsize];
+
+ while (true) {
+ if (len>0 && (len-totalNum)<=0)
+ break;
+
+ else if (len>0 && bufsize>(len-totalNum))
+ bufsize = (int)(len-totalNum);
+
+ int readNum = input.read(buf, 0, bufsize);
+ if (readNum <= 0)
+ break;
+
+ output.write(buf, 0, readNum);
+ totalNum += readNum;
+ }
+ buf = null;
+ return totalNum;
+ }
+
+
+} \ No newline at end of file
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannel.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannel.java
index 20b1e7f..50304c3 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannel.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannel.java
@@ -56,5 +56,10 @@ public class MessageChannel {
public void clear(){
queue.clear();
}
+
+ public BlockingQueue<Object> getQueue() {
+ return queue;
+ }
+
}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadServiceTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadServiceTest.java
new file mode 100644
index 0000000..76569ff
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadServiceTest.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.collector;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.collector.TaskThreadService;
+import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
+
+public class TaskThreadServiceTest {
+
+ private TaskThreadService taskThreadService;
+ private CollectMsg collectMsg;
+
+ @Before
+ public void setUp() {
+ collectMsg = new CollectMsg();
+ taskThreadService = TaskThreadService.getInstance(1);
+ }
+
+ @Test
+ public void add() {
+ taskThreadService.add(collectMsg);
+ }
+
+ @Test
+ public void receive() {
+ taskThreadService.add(collectMsg);
+ CollectMsg collectMsg = taskThreadService.receive();
+ assertNotNull(collectMsg);
+ }
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadTest.java
new file mode 100644
index 0000000..59dd737
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadTest.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.collector;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.collector.TaskThread;
+
+public class TaskThreadTest {
+
+ private String gzPath = System.getProperty("user.dir")+"/data/" +"PM-ENB-EUTRANCELLNB-test.csv.gz";
+ private TaskThread taskThread;
+ private List<File> list = null;
+ @Before
+ public void setUp() throws IOException {
+ taskThread = new TaskThread();
+ }
+
+ @Test
+ public void decompressed(){
+ list = taskThread.decompressed(gzPath);
+ assertTrue(list.size() > 0);
+ }
+
+ @Test
+ public void processPMCsv(){
+ list = taskThread.decompressed(gzPath);
+ for(File file : list){
+ boolean re = taskThread.processPMCsv(file,"nename","PM");
+ assertTrue(re);
+ }
+ }
+}
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
new file mode 100644
index 0000000..fe8a28b
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThreadTest.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.collector.alarm;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.collector.alarm.AlarmTaskThread;
+
+public class AlarmTaskThreadTest {
+
+ private AlarmTaskThread taskThread;
+
+ @Before
+ public void setUp() throws IOException {
+ taskThread = new AlarmTaskThread();
+ }
+
+ @Test
+ public void build120Alarm(){
+ String alarm = "{\"alarmSeq\":495,\"alarmTitle\":\"LTE cell outage\",\"alarmStatus\":1,\"alarmType\":\"processingErrorAlarm\"}";
+ String al = taskThread.build120Alarm(alarm);
+ assertNotNull(al);
+ }
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsgTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsgTest.java
new file mode 100644
index 0000000..e53f7b3
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectMsgTest.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.model;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
+
+public class CollectMsgTest {
+
+ private CollectMsg collectMsg;
+
+ @Before
+ public void setUp() {
+ collectMsg = new CollectMsg();
+ }
+
+ @Test
+ public void testCollectMsg() {
+ collectMsg.setEmsName("emsName");
+ collectMsg.setId(100L);
+ collectMsg.setType("PM");
+ assertNotNull(collectMsg.toString());
+ }
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVoTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVoTest.java
new file mode 100644
index 0000000..bff3482
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVoTest.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.model;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
+
+public class CollectVoTest {
+
+ private CollectVo collectVo;
+
+ @Before
+ public void setUp() {
+ collectVo = new CollectVo();
+ }
+
+ @Test
+ public void testCollectVo() {
+ collectVo.setEmsName("emsName");
+ collectVo.setFtptype("ftp");
+ assertNotNull(collectVo.toString());
+ }
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java
new file mode 100644
index 0000000..00490f7
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.model;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
+import org.onap.vfc.nfvo.emsdriver.commons.model.EMSInfo;
+
+public class EMSInfoTest {
+
+ private EMSInfo EMSInfo;
+
+ @Before
+ public void setUp() {
+ EMSInfo = new EMSInfo();
+ }
+
+ @Test
+ public void testEMSInfo() {
+ EMSInfo.setName("emsName");
+ Map<String,CollectVo> collectMap = new HashMap<String,CollectVo>();
+ CollectVo collectVo = new CollectVo();
+ collectVo.setEmsName("emsName");
+ collectMap.put("pm", collectVo);
+ EMSInfo.putCollectMap("pm", collectVo);
+
+ assertNotNull(EMSInfo.toString());
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/GunzipTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/GunzipTest.java
new file mode 100644
index 0000000..6a31ab2
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/GunzipTest.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.utils;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.utils.Gunzip;
+
+public class GunzipTest {
+
+ private String gzPath = System.getProperty("user.dir")+"/data/" +"PM-ENB-EUTRANCELLNB-test.csv.gz";
+ private Gunzip gunzip = null;
+ private String gunzipfile;
+
+
+ @Before
+ public void setUp() throws IOException {
+ gunzip = new Gunzip();
+
+ }
+
+ @Test
+ public void deCompress() throws IOException{
+ gunzipfile = gzPath.replace(".gz", "");
+ gunzip.unCompress(gzPath, gunzipfile);
+ assertTrue(new File(gunzipfile).length() > 0);
+
+ }
+
+ @After
+ public void setDown() throws IOException {
+ new File(gunzipfile).delete();
+
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtilTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtilTest.java
new file mode 100644
index 0000000..a243032
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtilTest.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.utils;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.utils.StringUtil;
+
+public class StringUtilTest {
+
+ private Throwable throwable;
+
+ @Before
+ public void setUp() {
+ throwable = new Exception("test");
+ }
+
+ @Test
+ public void testGetStackTrace() {
+ String str = StringUtil.getStackTrace(throwable);
+
+ assertNotNull(str);
+ }
+
+ @Test
+ public void testAddSlash(){
+ String str = StringUtil.addSlash("aa/bb");
+
+ assertTrue(str.endsWith(File.separator));
+ }
+
+ @Test
+ public void testIsBank(){
+ boolean str = StringUtil.isBank("aa/bb");
+ boolean str1 = StringUtil.isBank("");
+ boolean str2 = StringUtil.isBank(null);
+ assertFalse(str);
+ assertTrue(str1);
+ assertTrue(str2);
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZipTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZipTest.java
new file mode 100644
index 0000000..c89a756
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZipTest.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.utils;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Before;
+import org.onap.vfc.nfvo.emsdriver.commons.utils.UnZip;
+
+public class UnZipTest {
+
+ private String zipPath = System.getProperty("user.dir")+"/data/" +"PM-ENB-EUTRANCELLNB-test.csv.gz";
+ private String toPath = System.getProperty("user.dir")+"/data/";
+ private UnZip unZip = null;
+
+ @Before
+ public void setUp() throws IOException {
+ unZip = new UnZip(zipPath,toPath);
+ }
+
+ public void deCompress() throws IOException{
+ unZip.deCompress();
+
+ assertTrue(new File(toPath).listFiles().length > 0);
+ }
+
+ public static void main(String[] str){
+ System.out.println(System.getProperty("user.dir"));
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/ZipTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/ZipTest.java
new file mode 100644
index 0000000..5274c7d
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/utils/ZipTest.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.commons.utils;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.utils.Zip;
+
+public class ZipTest {
+
+ private String file = "./test.txt";
+ private String tofile1 = "./test.zip";
+ private Zip zip = null;
+ @Before
+ public void setUp() throws IOException {
+ new File(file).createNewFile();
+ zip = new Zip(file,tofile1);
+ }
+
+ @Test
+ public void compress() throws IOException{
+ zip.compress();
+
+ assertTrue(tofile1.endsWith(".zip"));
+
+ }
+
+
+ @After
+ public void setDown() throws IOException {
+ new File(file).delete();
+ new File(tofile1).delete();
+
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java
new file mode 100644
index 0000000..35911cb
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.configmgr;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
+import org.onap.vfc.nfvo.emsdriver.commons.model.EMSInfo;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationImp;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationManager;
+
+public class ConfigurationImpTest {
+
+
+ private ConfigurationManager configurationManager;
+ private ConfigurationImp configurationImp;
+ @Before
+ public void setUp() throws IOException {
+ configurationImp = new ConfigurationImp();
+ configurationManager = new ConfigurationManager();
+ configurationManager.dispose();
+ }
+
+ @Test
+ public void getAllEMSInfo() {
+
+ List<EMSInfo> list = configurationImp.getAllEMSInfo();
+
+ assertTrue(list.size() >0);
+ }
+
+ @Test
+ public void getCollectVoByEmsNameAndType() {
+
+ CollectVo collectVo = configurationImp.getCollectVoByEmsNameAndType("1234","cm");
+
+ assertNotNull(collectVo);
+ }
+
+ @Test
+ public void getProperties() {
+
+ Properties properties = configurationImp.getProperties();
+
+ assertNotNull(properties);
+ }
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManagerTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManagerTest.java
new file mode 100644
index 0000000..e2e5df6
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManagerTest.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.configmgr;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.commons.model.EMSInfo;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationManager;
+
+public class ConfigurationManagerTest {
+
+ private ConfigurationManager configurationManager;
+ @Before
+ public void setUp() throws IOException {
+ configurationManager = new ConfigurationManager();
+ configurationManager.dispose();
+ }
+
+ @Test
+ public void getAllEMSInfos() {
+
+ List<EMSInfo> list = ConfigurationManager.getAllEMSInfos();
+
+ assertTrue(list.size() >0);
+ }
+
+ @Test
+ public void getEMSInfoByName() {
+
+ EMSInfo eMSInfo = ConfigurationManager.getEMSInfoByName("1234");
+
+ assertNotNull(eMSInfo);
+ }
+
+ @Test
+ public void getProperties() {
+
+ Properties properties = ConfigurationManager.getProperties();
+
+ assertNotNull(properties);
+ }
+
+
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelFactoryTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelFactoryTest.java
new file mode 100644
index 0000000..da8cb25
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelFactoryTest.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.messagemgr;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
+import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannelFactory;
+
+public class MessageChannelFactoryTest {
+
+ @Test
+ public void getMessageChannel(){
+ MessageChannel messageChannel = MessageChannelFactory.getMessageChannel("aaa", 100);
+
+ assertNotNull(messageChannel);
+ }
+
+ @Test
+ public void getMessageChannelTest(){
+ MessageChannel messageChannel = MessageChannelFactory.getMessageChannel("aaa");
+
+ assertNotNull(messageChannel);
+ }
+
+ @Test
+ public void destroyMessageChannel(){
+ boolean result = MessageChannelFactory.destroyMessageChannel("aaa");
+
+ assertNotNull(result);
+ }
+
+ @Test
+ public void clean(){
+ MessageChannelFactory.clean();
+
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelTest.java
new file mode 100644
index 0000000..25c68d1
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/messagemgr/MessageChannelTest.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.emsdriver.messagemgr;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
+
+public class MessageChannelTest {
+
+ private MessageChannel messageChannel;
+ @Before
+ public void setUp() {
+ messageChannel = new MessageChannel();
+ }
+
+ @Test
+ public void MessageChannel(){
+ MessageChannel messageChannel = new MessageChannel(10);
+ assertNotNull(messageChannel.getQueue());
+ MessageChannel messageChannel1 = new MessageChannel(0);
+ assertNotNull(messageChannel1.getQueue());
+ }
+
+ @Test
+ public void put() throws Exception{
+ Object obj = new Object();
+ messageChannel.put(obj);
+
+ assertEquals(1, messageChannel.size());
+ }
+
+ @Test
+ public void get() throws Exception{
+ Object obj = new Object();
+ messageChannel.put(obj);
+ Object objr = messageChannel.get();
+ assertNotNull(objr);
+ }
+
+ @Test
+ public void poll() throws Exception{
+ Object obj = new Object();
+ messageChannel.put(obj);
+ Object objr = messageChannel.poll();
+ assertNotNull(objr);
+ }
+
+ @Test
+ public void clear() throws Exception{
+ Object obj = new Object();
+ messageChannel.put(obj);
+ messageChannel.clear();
+ assertEquals(0, messageChannel.size());
+ }
+
+}
diff --git a/ems/microservice-standalone/src/main/assembly/run.sh b/ems/microservice-standalone/src/main/assembly/run.sh
index b1fa1cd..8f3681f 100644
--- a/ems/microservice-standalone/src/main/assembly/run.sh
+++ b/ems/microservice-standalone/src/main/assembly/run.sh
@@ -17,6 +17,7 @@
DIRNAME=`dirname $0`
RUNHOME=`cd $DIRNAME/; pwd`
+export RUNHOME
echo @RUNHOME@ $RUNHOME
cd $RUNHOME
# JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")