summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java9
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadService.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/Msg.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DateUtil.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java3
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtil.java2
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java9
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/VarExprParser.java9
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/XmlUtil.java1
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java12
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadTest.java11
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/AlarmManagerTest.java52
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/CollectManagerTest.java6
15 files changed, 77 insertions, 42 deletions
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 55d8d72..da48829 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
@@ -43,7 +43,7 @@ import java.util.regex.Pattern;
public class TaskThread implements Runnable {
private static final Log log = LogFactory.getLog(TaskThread.class);
- public MessageChannel pmResultChannel; //This should also be private. Need to change in TastThreadTest
+ private MessageChannel pmResultChannel; //This should also be private. Need to change in TastThreadTest
private MessageChannel cmResultChannel;
private CollectMsg data;
@@ -924,5 +924,12 @@ public class TaskThread implements Runnable {
}
return regularList;
}
+
+ public MessageChannel getPmResultChannel() {
+ return pmResultChannel;
+ }
+ public void setPmResultChannel(MessageChannel pmResultChannel) {
+ this.pmResultChannel = pmResultChannel;
+ }
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadService.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadService.java
index b0dca40..2a7bac4 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadService.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThreadService.java
@@ -25,7 +25,6 @@ import java.util.concurrent.*;
public class TaskThreadService extends Thread {
-
private final ExecutorService pool;
private static final Log log = LogFactory.getLog(TaskThreadService.class);
private BlockingQueue<CollectMsg> queue = new LinkedBlockingQueue<>();
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
index 8672bca..eede19b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.vfc.nfvo.emsdriver.collector.alarm;
import java.io.*;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/Msg.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/Msg.java
index 5cfd0cb..3245625 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/Msg.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/Msg.java
@@ -21,7 +21,6 @@ import java.io.UnsupportedEncodingException;
public class Msg {
-
public final static String reqLoginAlarm = "reqLoginAlarm;user=%s;key=%s;type=%s";
public final static String reqHeartBeat = "reqHeartBeat;reqId=%s";
public final static String disconnectMsg = "closeConnAlarm";
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DateUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DateUtil.java
index 2613759..6b4037a 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DateUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DateUtil.java
@@ -22,7 +22,6 @@ import java.util.Date;
public class DateUtil {
-
public static long[] getScanScope(Date fireTime, long collectPeriod) {
Calendar fire = Calendar.getInstance();
long start = 0L;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
index d17bccb..64b518b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
@@ -60,7 +60,6 @@ public abstract class DriverThread implements Runnable {
}
public boolean stop() {
-
this.setRun(false);
while (!isEnd()) {
try {
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
index 89aa731..e6ed9d5 100644
--- 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
@@ -20,9 +20,6 @@ import java.util.zip.GZIPInputStream;
public class Gunzip {
- /**
- *
- */
public void unCompress(String gzFileName, String toFile) throws IOException {
try ( FileInputStream gzInput = new FileInputStream(gzFileName);
GZIPInputStream gzIn = new GZIPInputStream(gzInput)){
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtil.java
index 1b9606b..e09ff8d 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/StringUtil.java
@@ -21,7 +21,6 @@ import java.io.StringWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
public class StringUtil {
private static final Log log = LogFactory.getLog(StringUtil.class);
@@ -47,7 +46,6 @@ public class StringUtil {
}
public static boolean isBank(String str) {
-
if (str == null || str.trim().length() == 0) {
return true;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
index bc70907..504a47b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
@@ -29,9 +29,6 @@ public class UnZip {
protected String deCompressPath = null;
protected String zipFilePath = null;
- /**
- *
- */
public UnZip(String zipFilePath, String toPath) throws IOException {
File zipFile = new File(
new File(zipFilePath).getAbsolutePath());
@@ -48,9 +45,6 @@ public class UnZip {
deCompressPath = deCompressPath + File.separator;
}
- /**
- *
- */
public void deCompress() throws IOException {
try(ZipFile zipFile = new ZipFile(zipFilePath)){
Enumeration<ZipEntry> e = zipFile.getEntries();
@@ -68,9 +62,6 @@ public class UnZip {
}
}
- /**
- *
- */
protected void deCompressFile(InputStream input, String toPath)
throws IOException {
byte byteBuf[] = new byte[2048];
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/VarExprParser.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/VarExprParser.java
index 354a344..0e3f27c 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/VarExprParser.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/VarExprParser.java
@@ -34,7 +34,7 @@ final public class VarExprParser {
if (str.indexOf("${") == -1)
return str;
- // 支持原系统变量
+ // support original system variable
str = str.replace("${s_year}", "${SCAN_START_TIME,yyyy}");
str = str.replace("${s_mon}", "${SCAN_START_TIME,MM}");
str = str.replace("${s_day}", "${SCAN_START_TIME,dd}");
@@ -109,16 +109,13 @@ final public class VarExprParser {
}
/**
- * 仅支持该两个变量替换 省得正则匹配慢
- *
+ * Support two variable substitutions
* @param result
* @param scan_start_time
* @param scan_stop_time
* @return
*/
- public static String replaceTimeVar(String result,
- String scan_start_time, String scan_stop_time) {
-
+ public static String replaceTimeVar(String result,String scan_start_time, String scan_stop_time) {
boolean isReplace = false;
if (result.indexOf("${SCAN_ST") != -1) {
isReplace = true;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/XmlUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/XmlUtil.java
index 92345bf..19483ca 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/XmlUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/XmlUtil.java
@@ -27,7 +27,6 @@ import java.io.InputStream;
public class XmlUtil {
public static Document getDocument(InputStream is) throws XMLStreamException, JDOMException, IOException {
-
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(is);
return doc;
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
index 1d757a3..d79e89d 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
@@ -26,22 +26,16 @@ import java.util.zip.ZipOutputStream;
public class Zip {
protected int compressDirectoryCount = 0;
protected int compressFileCount = 0;
-
protected int relativeAddrIdx = 0;
protected int compressLevel = 6;
protected String zipFilePath = null;
protected String compressPath = null;
-
protected ZipOutputStream zipOutput = null;
- /**
- *
- */
public Zip(String compressPath, String zipFilePath) throws IOException {
File compressFile = new File(compressPath);
if (!compressFile.exists())
throw new IOException("the file or directory '" + compressPath + "' not found!");
-
this.zipFilePath = zipFilePath;
this.compressPath = compressFile.getAbsolutePath();
@@ -55,12 +49,8 @@ public class Zip {
relativeAddrIdx = this.compressPath.lastIndexOf(File.separator) + 1;
}
- /**
- *
- */
public void compress() throws IOException {
File theFile = new File(zipFilePath);
-
if (!theFile.exists()) {
String parentPath = theFile.getParent();
if (parentPath != null)
@@ -87,8 +77,6 @@ public class Zip {
compressDirectory(listFiles[i]);
}
}
-
-
}
protected void compressFile(String absolutePath) throws IOException {
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
index d6365b6..767aac3 100644
--- 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
@@ -21,6 +21,7 @@ import org.junit.Test;
import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
import org.onap.vfc.nfvo.emsdriver.commons.utils.Gzip;
+import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannelFactory;
import java.io.File;
@@ -39,7 +40,8 @@ public class TaskThreadTest {
@Before
public void setUp() throws IOException {
taskThread = new TaskThread();
- taskThread.pmResultChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_RESULT_PM_CHANNEL_KEY);
+ MessageChannel pmResultChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_RESULT_PM_CHANNEL_KEY);
+ taskThread.setPmResultChannel(pmResultChannel);
Gzip gzip = new Gzip();
gzip.compress(csvPath, gzPath);
}
@@ -65,7 +67,12 @@ public class TaskThreadTest {
File file = new File(xmlPath);
boolean re = taskThread.processPMXml(file);
assertTrue(re);
- System.out.println(taskThread.pmResultChannel.size());
+ MessageChannel pmResultChannel = taskThread.getPmResultChannel();
+ if(null!=pmResultChannel){
+ System.out.println(pmResultChannel.size());
+ }else{
+ System.out.println("pmResultChannel is null");
+ }
}
@Test
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/AlarmManagerTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/AlarmManagerTest.java
new file mode 100644
index 0000000..60ddc82
--- /dev/null
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/AlarmManagerTest.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.taskscheduler;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vfc.nfvo.emsdriver.collector.alarm.AlarmManager;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationImp;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationInterface;
+
+public class AlarmManagerTest {
+
+ private AlarmManager alarmManager;
+ private ConfigurationInterface configurationInterface;
+
+
+ @Before
+ public void setUp() throws Exception {
+ configurationInterface = new ConfigurationImp();
+
+ alarmManager = new AlarmManager();
+ alarmManager.setConfigurationInterface(configurationInterface);
+ alarmManager.dispose();
+ }
+
+ @Test
+ public void test() {
+ Thread t = new Thread(alarmManager);
+ t.start();
+ }
+
+ @Test
+ public void testGetConfigurationInteface(){
+ ConfigurationInterface confInteface = alarmManager.getConfigurationInterface();
+ assertEquals(configurationInterface,confInteface);
+ }
+}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/CollectManagerTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/CollectManagerTest.java
index 1ebacc2..fb420ca 100644
--- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/CollectManagerTest.java
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/taskscheduler/CollectManagerTest.java
@@ -31,7 +31,6 @@ public class CollectManagerTest {
@Before
public void setUp() throws Exception {
configurationInterface = new ConfigurationImp();
-
collectManager = new CollectManager();
collectManager.setConfigurationInterface(configurationInterface);
collectManager.dispose();
@@ -43,4 +42,9 @@ public class CollectManagerTest {
t.start();
}
+ @Test
+ public void testGetConfigurationInteface(){
+ ConfigurationInterface confInteface = collectManager.getConfigurationInterface();
+ assertEquals(configurationInterface,confInteface);
+ }
}