summaryrefslogtreecommitdiffstats
path: root/datarouter-node/src/main
diff options
context:
space:
mode:
authoreconwar <conor.ward@est.tech>2019-06-24 11:03:58 +0000
committereconwar <conor.ward@est.tech>2019-06-24 11:03:58 +0000
commit5a55b790e8afa3131fd5f894e5d1b1e036dc4cd1 (patch)
tree950cfa7f24529c9b32cbb508fe22c5444e22db74 /datarouter-node/src/main
parentcf112f2d9ff43759a3aef38cb11dbbfc0a050e02 (diff)
Add test cases for 65% branch coverage
Format the Test classes to adhere to ONAP Java style Change-Id: I9efad3caa532c4db73bb20327d0356b3af5ed2b1 Issue-ID: DMAAP-1195 Signed-off-by: econwar <conor.ward@est.tech>
Diffstat (limited to 'datarouter-node/src/main')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java8
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java12
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java2
3 files changed, 14 insertions, 8 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
index df73c1e9..e4013240 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
@@ -28,7 +28,7 @@ import com.att.eelf.configuration.EELFManager;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Objects;
/**
@@ -50,7 +50,7 @@ public class Delivery {
private int threads;
private int curthreads;
private NodeConfigManager config;
- private Hashtable<String, DeliveryQueue> dqs = new Hashtable<>();
+ private HashMap<String, DeliveryQueue> dqs = new HashMap<>();
private DeliveryQueue[] queues = new DeliveryQueue[0];
private int qpos = 0;
private long nextcheck;
@@ -178,7 +178,7 @@ public class Delivery {
DestInfo[] alldis = config.getAllDests();
DeliveryQueue[] nqs = new DeliveryQueue[alldis.length];
qpos = 0;
- Hashtable<String, DeliveryQueue> ndqs = new Hashtable<>();
+ HashMap<String, DeliveryQueue> ndqs = new HashMap<>();
for (DestInfo di : alldis) {
String spl = di.getSpool();
DeliveryQueue dq = dqs.get(spl);
@@ -266,7 +266,7 @@ public class Delivery {
return false;
}
- private static class DelItem implements Comparable<DelItem> {
+ static class DelItem implements Comparable<DelItem> {
private String pubid;
private String spool;
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java
index 3277408c..903a0c5f 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java
@@ -56,6 +56,8 @@ public class LogManager extends TimerTask {
private String uploaddir;
private String logdir;
+ private static final String EXCEPTION = "Exception";
+
/**
* Construct a log manager
*
@@ -68,7 +70,7 @@ public class LogManager extends TimerTask {
isnodelog = Pattern.compile("node\\.log\\.\\d{8}").matcher("");
iseventlog = Pattern.compile("events-\\d{12}\\.log").matcher("");
} catch (Exception e) {
- logger.error("Exception", e);
+ logger.error(EXCEPTION, e);
}
logdir = config.getLogDir();
uploaddir = logdir + "/.spool";
@@ -87,9 +89,12 @@ public class LogManager extends TimerTask {
worker.poke();
}
- private class Uploader extends Thread implements DeliveryQueueHelper {
+ public Uploader getWorker() {
+ return worker;
+ }
+
+ class Uploader extends Thread implements DeliveryQueueHelper {
- private static final String EXCEPTION = "Exception";
private static final String META = "/.meta";
private EELFLogger logger = EELFManager.getInstance().getLogger(Uploader.class);
private DeliveryQueue dq;
@@ -166,6 +171,7 @@ public class LogManager extends TimerTask {
notify();
}
+ @Override
public void run() {
while (true) {
scan();
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java
index e6165588..2d02fa66 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java
@@ -53,7 +53,7 @@ public class StatusLog {
private long nexttime;
private OutputStream os;
private long intvl;
- private NodeConfigManager config = NodeConfigManager.getInstance();
+ private static NodeConfigManager config = NodeConfigManager.getInstance();
private StatusLog() {
}