summaryrefslogtreecommitdiffstats
path: root/datarouter-node/src
diff options
context:
space:
mode:
Diffstat (limited to 'datarouter-node/src')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java58
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java5
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/TaskList.java10
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/AuditFilter.java2
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java1
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java1
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/TaskListTest.java44
7 files changed, 56 insertions, 65 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
index 90aaf0a1..be77d244 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
@@ -497,13 +497,6 @@ public class NodeConfigManager implements DeliveryQueueHelper {
}
/**
- * Is a destination redirected.
- */
- public boolean isDestRedirected(DestInfo destinfo) {
- return (followredirects && rdmgr.isRedirected(destinfo.getSubId()));
- }
-
- /**
* Set up redirection on receipt of a 3XX from a target URL.
*/
public boolean handleRedirection(DestInfo destinationInfo, String redirto, String fileid) {
@@ -521,23 +514,6 @@ public class NodeConfigManager implements DeliveryQueueHelper {
}
/**
- * Set up redirection on receipt of a 3XX from a target URL.
- */
- public boolean handleRedirectionSubLevel(DeliveryTask task, DestInfo destinfo, String redirto, String fileid) {
- fileid = "/" + fileid;
- String subid = destinfo.getSubId();
- String purl = destinfo.getURL();
- if (task.getFollowRedirects() && subid != null && redirto.endsWith(fileid)) {
- redirto = redirto.substring(0, redirto.length() - fileid.length());
- if (!redirto.equals(purl)) {
- rdmgr.redirect(subid, purl, redirto);
- return true;
- }
- }
- return false;
- }
-
- /**
* Handle unreachable target URL.
*/
public void handleUnreachable(DestInfo destinationInfo) {
@@ -607,16 +583,6 @@ public class NodeConfigManager implements DeliveryQueueHelper {
}
/**
- * Get the creation date for a feed.
- *
- * @param feedid The feed ID
- * @return the timestamp of creation date of feed id passed
- */
- public String getCreatedDate(String feedid) {
- return (config.getCreatedDate(feedid));
- }
-
- /**
* Get the spool directory for temporary files.
*/
public String getSpoolDir() {
@@ -811,30 +777,14 @@ public class NodeConfigManager implements DeliveryQueueHelper {
return enabledprotocols;
}
- public void setEnabledprotocols(String[] enabledprotocols) {
- this.enabledprotocols = enabledprotocols.clone();
- }
-
public String getAafType() {
return aafType;
}
- public void setAafType(String aafType) {
- this.aafType = aafType;
- }
-
- public void setAafInstance(String aafInstance) {
- this.aafInstance = aafInstance;
- }
-
public String getAafAction() {
return aafAction;
}
- public void setAafAction(String aafAction) {
- this.aafAction = aafAction;
- }
-
/*
* Get aafURL from SWM variable
* */
@@ -842,18 +792,10 @@ public class NodeConfigManager implements DeliveryQueueHelper {
return aafURL;
}
- public void setAafURL(String aafURL) {
- this.aafURL = aafURL;
- }
-
public boolean getCadiEnabled() {
return cadiEnabled;
}
- public void setCadiEnabled(boolean cadiEnabled) {
- this.cadiEnabled = cadiEnabled;
- }
-
/**
* Builds the permissions string to be verified.
*
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
index c436076f..03e952c1 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
@@ -152,7 +152,7 @@ public class ProvData {
}
/**
- * Get the raw node configuration entries
+ * Get the raw node configuration entries.
*/
public NodeConfig.ProvNode[] getNodes() {
return (pn);
@@ -333,6 +333,9 @@ public class ProvData {
if (jnodes != null) {
for (int nx = 0; nx < jnodes.length(); nx++) {
String nn = gvas(jnodes, nx);
+ if (nn == null) {
+ continue;
+ }
if (nn.indexOf('.') == -1) {
nn = nn + "." + sfx;
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/TaskList.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/TaskList.java
index 7fa0dc4d..a77277f2 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/TaskList.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/TaskList.java
@@ -38,7 +38,7 @@ import java.util.Iterator;
* called.
* </ul>
*/
-public class TaskList {
+class TaskList {
private Iterator<Runnable> runlist;
private HashSet<Runnable> tasks = new HashSet<>();
@@ -50,7 +50,7 @@ public class TaskList {
/**
* Start executing the sequence of tasks.
*/
- public synchronized void startRun() {
+ synchronized void startRun() {
sofar = new HashSet<>();
added = new HashSet<>();
removed = new HashSet<>();
@@ -61,7 +61,7 @@ public class TaskList {
/**
* Get the next task to execute.
*/
- public synchronized Runnable next() {
+ synchronized Runnable next() {
while (runlist != null) {
if (runlist.hasNext()) {
Runnable task = runlist.next();
@@ -88,7 +88,7 @@ public class TaskList {
/**
* Add a task to the list of tasks to run whenever the event occurs.
*/
- public synchronized void addTask(Runnable task) {
+ synchronized void addTask(Runnable task) {
if (runlist != null) {
added.add(task);
removed.remove(task);
@@ -99,7 +99,7 @@ public class TaskList {
/**
* Remove a task from the list of tasks to run whenever the event occurs.
*/
- public synchronized void removeTask(Runnable task) {
+ synchronized void removeTask(Runnable task) {
if (runlist != null) {
removed.add(task);
added.remove(task);
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/AuditFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/AuditFilter.java
index 33103db5..a278c2e3 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/AuditFilter.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/AuditFilter.java
@@ -17,9 +17,9 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+
package org.onap.dmaap.datarouter.node.eelf;
-import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java
index 8b5f2a6f..d5e520ea 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java
@@ -17,6 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+
package org.onap.dmaap.datarouter.node.eelf;
import ch.qos.logback.classic.spi.ILoggingEvent;
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java
index 890d56be..f3e27fee 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java
@@ -17,6 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+
package org.onap.dmaap.datarouter.node.eelf;
import ch.qos.logback.classic.Level;
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/TaskListTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/TaskListTest.java
new file mode 100644
index 00000000..311165c6
--- /dev/null
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/TaskListTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.datarouter.node;
+
+import org.junit.Test;
+
+public class TaskListTest {
+
+ @Test
+ public void Given_New_Task_List_Verify_Add_And_Run() {
+ TaskList taskList = new TaskList();
+ taskList.startRun();
+ taskList.addTask(() -> {
+ });
+ taskList.next();
+ taskList.removeTask(() -> {
+ });
+ }
+
+ @Test
+ public void Given_Empty_Task_List_Verify_Next() {
+ TaskList taskList = new TaskList();
+ taskList.startRun();
+ taskList.next();
+ }
+}