aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-node/src/main/java/org/onap
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2019-07-10 15:02:29 +0000
committerefiacor <fiachra.corcoran@est.tech>2019-07-10 15:02:29 +0000
commit98572b78fcce9ff28fa7429c9265812bd1e78bf2 (patch)
treee5f14bf7b083f543435634be6fee442882024827 /datarouter-node/src/main/java/org/onap
parentcec9a9227c805ff5415d6b9fd913fa64adafdd3a (diff)
Adding more DR-Node unit tests
Change-Id: I57b1c7aa678188136ecf84be53e0811908091f1a Issue-ID: DMAAP-1226 Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Diffstat (limited to 'datarouter-node/src/main/java/org/onap')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/PathFinder.java10
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java14
2 files changed, 12 insertions, 12 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/PathFinder.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/PathFinder.java
index d86b1e4d..fe3fdb6e 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/PathFinder.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/PathFinder.java
@@ -35,7 +35,7 @@ import org.onap.dmaap.datarouter.node.NodeConfig.ProvHop;
* get from this node to any other node.
*/
-public class PathFinder {
+class PathFinder {
private ArrayList<String> errors = new ArrayList<>();
private HashMap<String, String> routes = new HashMap<>();
@@ -47,7 +47,7 @@ public class PathFinder {
* @param nodes where we can go
* @param hops detours along the way
*/
- public PathFinder(String origin, String[] nodes, NodeConfig.ProvHop[] hops) {
+ PathFinder(String origin, String[] nodes, NodeConfig.ProvHop[] hops) {
HashSet<String> known = new HashSet<>();
HashMap<String, HashMap<String, Hop>> ht = new HashMap<>();
for (String n : nodes) {
@@ -77,8 +77,8 @@ public class PathFinder {
*
* @return array of error descriptions
*/
- public String[] getErrors() {
- return (errors.toArray(new String[errors.size()]));
+ String[] getErrors() {
+ return (errors.toArray(new String[0]));
}
/**
@@ -87,7 +87,7 @@ public class PathFinder {
* @param destination node
* @return list of node names separated by and ending with "/"
*/
- public String getPath(String destination) {
+ String getPath(String destination) {
String ret = routes.get(destination);
if (ret == null) {
return ("");
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java
index f501583a..b4a3f0a7 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java
@@ -37,10 +37,10 @@ import java.util.Timer;
/**
* Track redirections of subscriptions.
*/
-public class RedirManager {
+class RedirManager {
private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(RedirManager.class);
- RateLimitedOperation op;
+ private RateLimitedOperation op;
private HashMap<String, String> sid2primary = new HashMap<>();
private HashMap<String, String> sid2secondary = new HashMap<>();
private String redirfile;
@@ -52,7 +52,7 @@ public class RedirManager {
* @param mininterval The minimum number of milliseconds between writes to the redirection information file.
* @param timer The timer thread used to run delayed file writes.
*/
- public RedirManager(String redirfile, long mininterval, Timer timer) {
+ RedirManager(String redirfile, long mininterval, Timer timer) {
this.redirfile = redirfile;
op = new RateLimitedOperation(mininterval, timer) {
public void run() {
@@ -92,7 +92,7 @@ public class RedirManager {
* @param primary The URL associated with that subscription ID
* @param secondary The replacement URL to use instead
*/
- public synchronized void redirect(String sid, String primary, String secondary) {
+ synchronized void redirect(String sid, String primary, String secondary) {
sid2primary.put(sid, primary);
sid2secondary.put(sid, secondary);
op.request();
@@ -103,7 +103,7 @@ public class RedirManager {
*
* @param sid The subscription ID to remove from the table.
*/
- public synchronized void forget(String sid) {
+ synchronized void forget(String sid) {
sid2primary.remove(sid);
sid2secondary.remove(sid);
op.request();
@@ -117,7 +117,7 @@ public class RedirManager {
* @param primary The configured primary URL.
* @return The destination URL to really use.
*/
- public synchronized String lookup(String sid, String primary) {
+ synchronized String lookup(String sid, String primary) {
String oprim = sid2primary.get(sid);
if (primary.equals(oprim)) {
return (sid2secondary.get(sid));
@@ -130,7 +130,7 @@ public class RedirManager {
/**
* Is a subscription redirected.
*/
- public synchronized boolean isRedirected(String sid) {
+ synchronized boolean isRedirected(String sid) {
return (sid != null && sid2secondary.get(sid) != null);
}