aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdatarouter-node/pom.xml48
-rw-r--r--datarouter-node/src/main/resources/docker/Dockerfile11
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilterTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java3
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTaskTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/LogManagerTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServerTest.java3
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java78
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeUtilsTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/ProvDataTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/RedirManagerTest.java2
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/StatusLogTest.java2
-rwxr-xr-xdatarouter-prov/pom.xml48
-rw-r--r--datarouter-prov/src/main/resources/docker/Dockerfile11
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthTest.java3
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java2
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java39
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java43
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java72
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/InternalServletTest.java42
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/LogServletTest.java32
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProxyServletTest.java2
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/PublishServletTest.java16
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java69
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java15
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java35
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java70
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTaskTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/BaseLogRecordTest.java4
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRouteTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/GroupTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRouteTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRouteTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecordTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/SubscriptionTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java44
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLITest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DbTest.java2
-rwxr-xr-xdatarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObjectTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoaderTest.java2
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTaskTest.java2
-rwxr-xr-xdatarouter-subscriber/pom.xml64
-rw-r--r--datarouter-subscriber/src/main/resources/docker/Dockerfile11
-rwxr-xr-xdatarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java2
-rwxr-xr-xpom.xml97
49 files changed, 593 insertions, 317 deletions
diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml
index fd859bef..3f0bd546 100755
--- a/datarouter-node/pom.xml
+++ b/datarouter-node/pom.xml
@@ -64,6 +64,12 @@
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
@@ -103,7 +109,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
+ <artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -115,6 +121,24 @@
<groupId>org.sonatype.http-testing-harness</groupId>
<artifactId>junit-runner</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>powermock-reflect</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-security</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jsr305</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
@@ -128,7 +152,7 @@
</dependency>
<dependency>
<groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
+ <artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -142,6 +166,26 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>3.1.6</version>
diff --git a/datarouter-node/src/main/resources/docker/Dockerfile b/datarouter-node/src/main/resources/docker/Dockerfile
index 0d2331fd..7357d931 100644
--- a/datarouter-node/src/main/resources/docker/Dockerfile
+++ b/datarouter-node/src/main/resources/docker/Dockerfile
@@ -18,14 +18,17 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM openjdk:8-jre-alpine
+FROM openjdk:11.0.6-jre-slim
MAINTAINER DMAAP Team
COPY /opt /opt
# curl used for healthcheck
-RUN apk update && apk add curl && apk add vim
+RUN apt-get update && \
+ apt-get install -y \
+ curl \
+ vim
EXPOSE 8080 8443
@@ -33,8 +36,8 @@ WORKDIR /opt
RUN chmod 0700 startup.sh
ENTRYPOINT ["sh", "startup.sh"]
-RUN addgroup -S -g 1001 onap \
- && adduser -S -u 1000 dradmin -G onap \
+RUN groupadd -g 1001 onap \
+ && useradd -u 1000 dradmin -g onap \
&& chown -R dradmin:onap /opt/ /var/
USER dradmin
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilterTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilterTest.java
index bb367186..0796aa56 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilterTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilterTest.java
@@ -39,6 +39,7 @@ import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.filter.CadiFilter;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -46,6 +47,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
@PrepareForTest({CadiFilter.class})
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
public class DRNodeCadiFilterTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java
index 5b2b9ea1..fa4966c9 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java
@@ -36,7 +36,6 @@ import static org.mockito.Mockito.when;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
import org.apache.commons.lang3.reflect.FieldUtils;
@@ -46,11 +45,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class DeliveryQueueTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTaskTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTaskTest.java
index 596d56a7..0f019161 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTaskTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTaskTest.java
@@ -34,12 +34,14 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest({URL.class})
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class DeliveryTaskTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java
index 18d9d56c..25830cdd 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java
@@ -39,11 +39,13 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.onap.dmaap.datarouter.node.Delivery.DelItem;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class DeliveryTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/LogManagerTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/LogManagerTest.java
index da690206..7eacd838 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/LogManagerTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/LogManagerTest.java
@@ -38,11 +38,13 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.onap.dmaap.datarouter.node.LogManager.Uploader;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.node.NodeConfigManager"})
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class LogManagerTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java
index 9c945725..88e6e48d 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java
@@ -30,6 +30,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URL;
+import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import java.nio.file.Files;
@@ -46,7 +47,6 @@ import org.junit.Test;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
-import sun.net.www.URLConnection;
@PowerMockIgnore({"javax.net.ssl.*", "javax.security.auth.x500.X500Principal", "javax.crypto.*"})
@PrepareForTest({InetAddress.class})
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java
index b03407bf..05cd0dce 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java
@@ -31,11 +31,13 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.node.ProvData"})
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class NodeConfigTest {
private static NodeConfig nodeConfig;
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServerTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServerTest.java
index f72e581d..153753e9 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServerTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServerTest.java
@@ -34,11 +34,13 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class NodeServerTest {
private NodeConfigManager config = mock(NodeConfigManager.class);
@@ -47,7 +49,6 @@ public class NodeServerTest {
setUpConfig();
setUpNodeMainDelivery();
createFilesAndDirectories();
- mock(Delivery.class);
}
@AfterClass
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java
index 136e21d4..4340b018 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java
@@ -22,32 +22,43 @@
******************************************************************************/
package org.onap.dmaap.datarouter.node;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
-import ch.qos.logback.classic.Logger;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.reflect.FieldUtils;
-import org.junit.*;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
import org.slf4j.LoggerFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class NodeServletTest {
private NodeServlet nodeServlet;
@@ -128,7 +139,7 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_PUT_And_Endpoint_Is_Incorrect_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/incorrect/");
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -136,7 +147,7 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_PUT_And_Request_Is_Not_Secure_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -144,7 +155,7 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_PUT_And_File_Id_Is_Null_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -152,7 +163,7 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_PUT_And_Authorization_Is_Null_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.getHeader("Authorization")).thenReturn(null);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -160,16 +171,17 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_PUT_And_Publish_Does_Not_Include_File_Id_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/publish/");
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Publish_Not_Permitted_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
+ when(request.getRemoteAddr()).thenReturn("1.2.3.4");
setNodeConfigManagerIsPublishPermittedToReturnAReason();
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -184,16 +196,19 @@ public class NodeServletTest {
@Test
public void Given_Request_Is_HTTP_PUT_And_Internal_Publish_But_Invalid_File_Id_Then_Not_Found_Response_Is_Generated() throws Exception {
- when(request.getPathInfo()).thenReturn("/internal/publish/1/");
+ when(request.getPathInfo()).thenReturn("/internal/publish/1/blah");
+ when(request.getRemoteAddr()).thenReturn("1.2.3.4");
+ when(config.isAnotherNode(anyString(), anyString())).thenReturn(true);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@Test
public void Given_Request_Is_HTTP_PUT_On_Publish_And_Ingress_Node_Is_Provided_Then_Request_Is_Redirected() throws Exception {
- when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setNodeConfigManagerToAllowRedirectOnIngressNode();
+ when(request.getPathInfo()).thenReturn("/publish/1/fileName");
+ when(request.getRemoteAddr()).thenReturn("1.2.3.4");
nodeServlet.doPut(request, response);
verify(response).sendRedirect(anyString());
verifyEnteringExitCalled(listAppender);
@@ -204,7 +219,7 @@ public class NodeServletTest {
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setHeadersForValidRequest(true);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -212,7 +227,7 @@ public class NodeServletTest {
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setHeadersForValidRequest(false);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -222,7 +237,7 @@ public class NodeServletTest {
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setHeadersForValidRequest(true);
nodeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -231,14 +246,14 @@ public class NodeServletTest {
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setHeadersForValidRequest(false);
nodeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_File_With_Invalid_Endpoint_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/delete/1");
nodeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -273,7 +288,7 @@ public class NodeServletTest {
public void Given_Request_Is_HTTP_DELETE_File_And_File_Does_Not_Exist_Then_Not_Found_Response_Is_Generated() throws IOException {
when(request.getPathInfo()).thenReturn("/delete/1/nonExistingFile");
nodeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -302,7 +317,7 @@ public class NodeServletTest {
when(config.getSpoolBase()).thenReturn("spool");
when(config.getLogDir()).thenReturn("log/dir");
when(config.getPublishId()).thenReturn("User1");
- when(config.isAnotherNode(anyString(), anyString())).thenReturn(true);
+ when(config.isAnotherNode(anyString(), anyString())).thenReturn(false);
when(config.getEventLogInterval()).thenReturn("40");
when(config.isDeletePermitted("1")).thenReturn(true);
when(config.getAllDests()).thenReturn(new DestInfo[0]);
@@ -348,10 +363,11 @@ public class NodeServletTest {
private void setNodeConfigManagerIsPublishPermittedToReturnAReason() throws IllegalAccessException{
NodeConfigManager config = mock(NodeConfigManager.class);
when(config.isShutdown()).thenReturn(false);
+ when(config.getMyName()).thenReturn("dmaap-dr-node");
when(config.isConfigured()).thenReturn(true);
when(config.getSpoolDir()).thenReturn("spool/dir");
when(config.getLogDir()).thenReturn("log/dir");
- when(config.isPublishPermitted(anyString(), anyString(), anyString())).thenReturn("Not Permitted");
+ when(config.isPublishPermitted(anyString(), anyString(), anyString())).thenReturn("Publisher not permitted for this feed");
when(config.isAnotherNode(anyString(), anyString())).thenReturn(false);
FieldUtils.writeDeclaredStaticField(NodeServlet.class, "config", config, true);
}
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeUtilsTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeUtilsTest.java
index 9832785e..d139d0e3 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeUtilsTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeUtilsTest.java
@@ -34,7 +34,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import org.slf4j.MDC;
@RunWith(PowerMockRunner.class)
-@PowerMockIgnore({"java.net.ssl", "javax.security.auth.x500.X500Principal"})
+@PowerMockIgnore({"java.net.ssl", "javax.security.auth.x500.X500Principal", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
public class NodeUtilsTest {
@Mock
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/ProvDataTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/ProvDataTest.java
index 1fd79d9a..1a4564ab 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/ProvDataTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/ProvDataTest.java
@@ -29,9 +29,11 @@ import java.io.Reader;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class ProvDataTest {
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/RedirManagerTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/RedirManagerTest.java
index 2c8a0e52..87abe84e 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/RedirManagerTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/RedirManagerTest.java
@@ -33,9 +33,11 @@ import org.hamcrest.core.Is;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class RedirManagerTest {
private RedirManager redirManager;
diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/StatusLogTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/StatusLogTest.java
index d3793069..28dcba9a 100644
--- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/StatusLogTest.java
+++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/StatusLogTest.java
@@ -30,6 +30,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -37,6 +38,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
@PrepareForTest(StatusLog.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class StatusLogTest {
@Before
diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml
index 334a57fb..54f6d85b 100755
--- a/datarouter-prov/pom.xml
+++ b/datarouter-prov/pom.xml
@@ -93,6 +93,12 @@
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.onap.aaf.authz</groupId>
@@ -143,6 +149,24 @@
<groupId>org.sonatype.http-testing-harness</groupId>
<artifactId>junit-runner</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>powermock-reflect</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-security</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jsr305</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -161,7 +185,7 @@
</dependency>
<dependency>
<groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
+ <artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -175,6 +199,26 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
@@ -194,7 +238,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
+ <artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/datarouter-prov/src/main/resources/docker/Dockerfile b/datarouter-prov/src/main/resources/docker/Dockerfile
index b99ab42b..51841fd5 100644
--- a/datarouter-prov/src/main/resources/docker/Dockerfile
+++ b/datarouter-prov/src/main/resources/docker/Dockerfile
@@ -18,13 +18,16 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM openjdk:8-jre-alpine
+FROM openjdk:11.0.6-jre-slim
MAINTAINER DMAAP Team
COPY /opt /opt
-RUN apk update && apk add curl && apk add vim
+RUN apt-get update && \
+ apt-get install -y \
+ curl \
+ vim
EXPOSE 8080 8443
@@ -33,8 +36,8 @@ RUN chmod 0700 startup.sh
ENTRYPOINT ["sh", "startup.sh"]
-RUN addgroup -S -g 1001 onap \
- && adduser -S -u 1000 dradmin -G onap \
+RUN groupadd -g 1001 onap \
+ && useradd -u 1000 dradmin -g onap \
&& chown -R dradmin:onap /opt/ /var/
USER dradmin \ No newline at end of file
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthTest.java
index 172df821..d335ffa1 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthTest.java
@@ -36,9 +36,12 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.dmaap.datarouter.authz.AuthorizationResponse;
import org.onap.dmaap.datarouter.provisioning.StatisticsServlet;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({ "javax.management.*", "com.sun.org.apache.xerces.*", "javax.xml.*",
+ "org.xml.*", "org.w3c.dom.*", "com.sun.org.apache.xalan.*", "javax.activation.*" })
public class ProvAuthTest {
@Mock
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
index bfd33f80..149943ea 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
@@ -61,7 +61,7 @@ import org.slf4j.MDC;
@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.Feed",
"org.onap.dmaap.datarouter.provisioning.beans.Subscription",
"org.onap.dmaap.datarouter.provisioning.beans.Group"})
-@PowerMockIgnore({"javax.crypto.*"})
+@PowerMockIgnore({"javax.crypto.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
@PrepareForTest({UUID.class, SecretKeyFactory.class})
public class BaseServletTest extends DrServletTestBase {
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java
index 06f488c0..af1d7145 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java
@@ -22,8 +22,7 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Mockito.argThat;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.contains;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
@@ -55,10 +54,12 @@ import org.onap.dmaap.datarouter.authz.AuthorizationResponse;
import org.onap.dmaap.datarouter.authz.Authorizer;
import org.onap.dmaap.datarouter.provisioning.beans.Insertable;
import org.onap.dmaap.datarouter.provisioning.utils.Poker;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class DRFeedsServletTest extends DrServletTestBase {
private static DRFeedsServlet drfeedsServlet;
@@ -102,7 +103,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
@Test
public void Given_Request_Is_HTTP_DELETE_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
drfeedsServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -112,7 +113,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
when(request.isSecure()).thenReturn(false);
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
drfeedsServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -121,7 +122,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
throws Exception {
setBehalfHeader(null);
drfeedsServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -130,7 +131,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
throws Exception {
when(request.getRequestURI()).thenReturn("/123");
drfeedsServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -139,7 +140,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
throws Exception {
setAuthoriserToReturnRequestNotAuthorized();
drfeedsServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -147,7 +148,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
when(request.getParameter("name")).thenReturn("stub_name");
when(request.getParameter("version")).thenReturn("stub_version");
drfeedsServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -175,7 +176,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
@Test
public void Given_Request_Is_HTTP_PUT_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
drfeedsServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -186,7 +187,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
when(request.isSecure()).thenReturn(false);
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -195,7 +196,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
throws Exception {
setBehalfHeader(null);
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -204,7 +205,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
throws Exception {
when(request.getRequestURI()).thenReturn("/123");
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -215,7 +216,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
when(request.getContentType()).thenReturn("stub_contentType");
drfeedsServlet.doPost(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -236,7 +237,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
}
};
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -257,7 +258,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
}
};
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -330,7 +331,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated()
throws Exception {
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -343,7 +344,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
}
};
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_CONFLICT), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_CONFLICT), anyString());
}
@Test
@@ -356,7 +357,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
};
drfeedsServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -402,7 +403,7 @@ public class DRFeedsServletTest extends DrServletTestBase {
};
drfeedsServlet.doPost(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@NotNull
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
index c5e3e150..00bc2aa2 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
@@ -22,8 +22,7 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Mockito.argThat;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.contains;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
@@ -59,10 +58,12 @@ import org.onap.dmaap.datarouter.authz.Authorizer;
import org.onap.dmaap.datarouter.provisioning.beans.Feed;
import org.onap.dmaap.datarouter.provisioning.beans.Updateable;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*", "com.sun.org.apache.xalan.*"})
public class FeedServletTest extends DrServletTestBase {
private static FeedServlet feedServlet;
@@ -108,7 +109,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.isSecure()).thenReturn(false);
feedServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -117,28 +118,28 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
setBehalfHeader(null);
feedServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
feedServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
feedServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
setAuthoriserToReturnRequestNotAuthorized();
feedServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -167,7 +168,7 @@ public class FeedServletTest extends DrServletTestBase {
};
feedServlet.doDelete(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -183,7 +184,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.isSecure()).thenReturn(false);
feedServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -192,7 +193,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
setBehalfHeader(null);
feedServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -200,7 +201,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn(null);
feedServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -208,7 +209,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn("/123");
feedServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -217,7 +218,7 @@ public class FeedServletTest extends DrServletTestBase {
setAuthoriserToReturnRequestNotAuthorized();
when(request.getPathInfo()).thenReturn("/2");
feedServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -235,7 +236,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.isSecure()).thenReturn(false);
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -244,7 +245,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
setBehalfHeader(null);
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -252,7 +253,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn(null);
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -260,7 +261,7 @@ public class FeedServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn("/123");
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -270,7 +271,7 @@ public class FeedServletTest extends DrServletTestBase {
when(request.getContentType()).thenReturn("stub_contentType");
when(request.getPathInfo()).thenReturn("/2");
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -297,7 +298,7 @@ public class FeedServletTest extends DrServletTestBase {
}
};
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -436,7 +437,7 @@ public class FeedServletTest extends DrServletTestBase {
}
};
feedServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -467,7 +468,7 @@ public class FeedServletTest extends DrServletTestBase {
@Test
public void Given_Request_Is_HTTP_POST_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
feedServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java
index 67687d08..d84e66d4 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java
@@ -22,6 +22,22 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.json.JSONObject;
import org.junit.AfterClass;
@@ -35,25 +51,11 @@ import org.onap.dmaap.datarouter.authz.Authorizer;
import org.onap.dmaap.datarouter.provisioning.beans.Insertable;
import org.onap.dmaap.datarouter.provisioning.beans.Updateable;
import org.onap.dmaap.datarouter.provisioning.utils.Poker;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
-
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*", "com.sun.org.apache.xalan.*"})
public class GroupServletTest {
private static EntityManagerFactory emf;
private static EntityManager em;
@@ -93,21 +95,21 @@ public class GroupServletTest {
public void Given_Request_Is_HTTP_GET_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
groupServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
groupServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
groupServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -122,35 +124,35 @@ public class GroupServletTest {
public void Given_Request_Is_HTTP_PUT_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Group_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/3");
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
when(request.getContentType()).thenReturn("stub_contentType");
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -159,7 +161,7 @@ public class GroupServletTest {
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -167,7 +169,7 @@ public class GroupServletTest {
when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(true);
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -175,7 +177,7 @@ public class GroupServletTest {
when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail();
groupServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -192,21 +194,21 @@ public class GroupServletTest {
public void Given_Request_Is_HTTP_POST_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
when(request.getContentType()).thenReturn("stub_contentType");
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -215,7 +217,7 @@ public class GroupServletTest {
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -223,7 +225,7 @@ public class GroupServletTest {
when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(false);
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -231,7 +233,7 @@ public class GroupServletTest {
when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnGroupInDb();
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -239,7 +241,7 @@ public class GroupServletTest {
when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail();
groupServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -255,7 +257,7 @@ public class GroupServletTest {
@Test
public void Given_Request_Is_HTTP_DELETE_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
groupServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
}
private void setAuthoriserToReturnRequestIsAuthorized() throws IllegalAccessException {
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/InternalServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/InternalServletTest.java
index 51531669..1601e63d 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/InternalServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/InternalServletTest.java
@@ -22,15 +22,15 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
import java.io.File;
import java.net.InetAddress;
import javax.persistence.EntityManager;
@@ -40,18 +40,14 @@ import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
import org.apache.commons.lang3.reflect.FieldUtils;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.BeforeClass;
-import org.junit.AfterClass;
import org.mockito.Mock;
-
import org.onap.dmaap.datarouter.provisioning.beans.Deleteable;
import org.onap.dmaap.datarouter.provisioning.beans.Insertable;
import org.onap.dmaap.datarouter.provisioning.beans.LogRecord;
@@ -59,11 +55,13 @@ import org.onap.dmaap.datarouter.provisioning.beans.Parameters;
import org.onap.dmaap.datarouter.provisioning.beans.Updateable;
import org.onap.dmaap.datarouter.provisioning.utils.Poker;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest(LogRecord.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class InternalServletTest extends DrServletTestBase {
private static EntityManagerFactory emf;
private static EntityManager em;
@@ -106,7 +104,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getRemoteAddr()).thenReturn("127.100.0.3");
internalServlet.doGet(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -165,7 +163,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/logs/TestFile");
internalServlet.doGet(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_NO_CONTENT), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_NO_CONTENT), anyString());
}
@Test
@@ -208,7 +206,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/incorrect/");
internalServlet.doGet(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -218,7 +216,7 @@ public class InternalServletTest extends DrServletTestBase {
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
internalServlet.doPut(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -243,7 +241,7 @@ public class InternalServletTest extends DrServletTestBase {
internalServlet = internalServerFailure();
internalServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -252,7 +250,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/incorrect");
internalServlet.doPut(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -262,7 +260,7 @@ public class InternalServletTest extends DrServletTestBase {
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
internalServlet.doDelete(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -298,7 +296,7 @@ public class InternalServletTest extends DrServletTestBase {
internalServlet = internalServerFailure();
internalServlet.doDelete(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -307,7 +305,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/incorrect");
internalServlet.doDelete(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -316,7 +314,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getRemoteAddr()).thenReturn("127.100.0.3");
internalServlet.doPost(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -341,7 +339,7 @@ public class InternalServletTest extends DrServletTestBase {
internalServlet = internalServerFailure();
internalServlet.doPost(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -406,7 +404,7 @@ public class InternalServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/incorrect/");
internalServlet.doPost(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
private void setUpValidAuthorisedRequest() throws Exception {
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/LogServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/LogServletTest.java
index a52f1a0b..1f6e3a59 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/LogServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/LogServletTest.java
@@ -31,6 +31,7 @@ import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.servlet.ServletOutputStream;
@@ -40,14 +41,17 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.matches;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import static org.powermock.api.mockito.PowerMockito.when;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class LogServletTest extends DrServletTestBase {
private static EntityManagerFactory emf;
@@ -91,7 +95,7 @@ public class LogServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_DELETE_And_Is_Not_Allowed_Then_Forbidden_Response_Is_Generated()
throws Exception {
logServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -100,7 +104,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn(null);
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -109,7 +113,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("type")).thenReturn("bad_type");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -117,7 +121,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("publishId")).thenReturn("bad_PublishID'");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -125,7 +129,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("statusCode")).thenReturn("1'");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -133,7 +137,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("expiryReason")).thenReturn("bad_ExpiryReason");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -141,7 +145,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("start")).thenReturn("bad_startTime");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -149,7 +153,7 @@ public class LogServletTest extends DrServletTestBase {
throws Exception {
when(request.getParameter("end")).thenReturn("bad_endTime");
logServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -163,7 +167,7 @@ public class LogServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_PUT_And_Is_Not_Allowed_Then_Forbidden_Response_Is_Generated()
throws Exception {
logServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -171,7 +175,7 @@ public class LogServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_Is_Not_Allowed_Then_Forbidden_Response_Is_Generated()
throws Exception {
logServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProxyServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProxyServletTest.java
index 80fcb0e7..8a676878 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProxyServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProxyServletTest.java
@@ -61,8 +61,8 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("javax.net.ssl.*")
@PrepareForTest({URLUtilities.class, BaseServlet.class, Scheme.class})
+@PowerMockIgnore({"javax.net.ssl.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class ProxyServletTest {
private static ProxyServlet proxyServlet;
private static EntityManagerFactory emf;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/PublishServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/PublishServletTest.java
index e1a11f3e..49e93bf1 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/PublishServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/PublishServletTest.java
@@ -30,6 +30,7 @@ import org.junit.*;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -43,9 +44,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.net.InetAddress;
-import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.*;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
@@ -56,6 +57,7 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic;
@RunWith(PowerMockRunner.class)
@PrepareForTest({InetAddress.class })
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class PublishServletTest extends DrServletTestBase {
private PublishServlet publishServlet;
@@ -99,7 +101,7 @@ public class PublishServletTest extends DrServletTestBase {
throws Exception {
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "nodes", new String[0], true);
publishServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_SERVICE_UNAVAILABLE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_SERVICE_UNAVAILABLE), anyString());
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "nodes", new String[1], true);
verifyEnteringExitCalled(listAppender);
}
@@ -108,7 +110,7 @@ public class PublishServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_DELETE_And_Path_Is_Null_Then_Not_Found_Error_Is_Returned()
throws Exception {
publishServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -117,7 +119,7 @@ public class PublishServletTest extends DrServletTestBase {
when(request.getPathInfo()).thenReturn("/1/");
publishServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -125,7 +127,7 @@ public class PublishServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn("/122/fileName.txt");
publishServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -133,7 +135,7 @@ public class PublishServletTest extends DrServletTestBase {
throws Exception {
when(request.getPathInfo()).thenReturn("/abc/fileName.txt");
publishServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
index 226dae04..0c5f63fc 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
@@ -23,28 +23,31 @@
package org.onap.dmaap.datarouter.provisioning;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.onap.dmaap.datarouter.provisioning.beans.*;
+import org.onap.dmaap.datarouter.provisioning.beans.Deleteable;
+import org.onap.dmaap.datarouter.provisioning.beans.Insertable;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class RouteServletTest {
private static EntityManagerFactory emf;
@@ -83,7 +86,7 @@ public class RouteServletTest {
throws Exception {
when(request.getRemoteAddr()).thenReturn("stub_addr");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -91,7 +94,7 @@ public class RouteServletTest {
throws Exception {
when(request.getPathInfo()).thenReturn("/ingress/3/internal/route/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -99,7 +102,7 @@ public class RouteServletTest {
throws Exception {
when(request.getPathInfo()).thenReturn("/ingress/feedID/internal/route/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -107,49 +110,49 @@ public class RouteServletTest {
throws Exception {
when(request.getPathInfo()).thenReturn("/ingress/feedID/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
when(request.getPathInfo()).thenReturn("/ingress/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Egress_Route_Does_Not_Exist_In_Path() throws Exception {
when(request.getPathInfo()).thenReturn("/egress/3");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Egress_Path_Contains_Invalid_SubID() throws Exception {
when(request.getPathInfo()).thenReturn("/egress/subID");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Egress_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
when(request.getPathInfo()).thenReturn("/egress/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Network_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
when(request.getPathInfo()).thenReturn("/network/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Deletable_Is_Null_Then_Bad_Url_Is_Returned() throws Exception {
when(request.getPathInfo()).thenReturn("/route/");
routeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -167,21 +170,21 @@ public class RouteServletTest {
};
routeServlet.doDelete(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Is_Not_Authorized() throws Exception {
when(request.getRemoteAddr()).thenReturn("stub_addr");
routeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Path_Does_Not_Start_With_Valid_Route() throws Exception {
when(request.getPathInfo()).thenReturn("/route/");
routeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -216,13 +219,13 @@ public class RouteServletTest {
public void Given_Request_Is_HTTP_PUT_And_Is_Not_Authorized() throws Exception {
when(request.getRemoteAddr()).thenReturn("stub_addr");
routeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Contains_Bad_URL() throws Exception {
routeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -230,7 +233,7 @@ public class RouteServletTest {
public void Given_Request_Is_HTTP_POST_And_Is_Not_Authorized() throws Exception {
when(request.getRemoteAddr()).thenReturn("stub_addr");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -243,7 +246,7 @@ public class RouteServletTest {
when(request.getParameter("nodepatt")).thenReturn(null);
when(request.getParameter("seq")).thenReturn(null);
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -252,7 +255,7 @@ public class RouteServletTest {
when(request.getPathInfo()).thenReturn("/egress/");
when(request.getParameter("sub")).thenReturn("1");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -261,14 +264,14 @@ public class RouteServletTest {
when(request.getPathInfo()).thenReturn("/egress/");
when(request.getParameter("sub")).thenReturn("3");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Network_And_Is_Missing_Arguments() throws Exception {
when(request.getPathInfo()).thenReturn("/network/");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -278,7 +281,7 @@ public class RouteServletTest {
when(request.getParameter("to")).thenReturn("stub_to");
when(request.getParameter("via")).thenReturn("stub_via");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -288,7 +291,7 @@ public class RouteServletTest {
when(request.getParameter("to")).thenReturn("stub_to");
when(request.getParameter("via")).thenReturn("stub_via");
routeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -310,6 +313,6 @@ public class RouteServletTest {
routeServlet.doPost(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java
index f9fcd687..1fe8d9b1 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java
@@ -22,9 +22,8 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -41,9 +40,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class StatisticsServletTest {
private StatisticsServlet statisticsServlet;
@@ -84,7 +85,7 @@ public class StatisticsServletTest {
throws Exception {
statisticsServlet.doDelete(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -92,7 +93,7 @@ public class StatisticsServletTest {
throws Exception {
statisticsServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -100,7 +101,7 @@ public class StatisticsServletTest {
throws Exception {
statisticsServlet.doPost(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED),
- argThat(notNullValue(String.class)));
+ anyString());
}
@Test
@@ -109,7 +110,7 @@ public class StatisticsServletTest {
when(request.getParameter("type")).thenReturn("get");
statisticsServlet.doGet(request, response);
verify(response)
- .sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ .sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java
index 979c2c4a..48a39925 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java
@@ -22,8 +22,7 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Mockito.argThat;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.contains;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
@@ -55,10 +54,12 @@ import org.onap.dmaap.datarouter.authz.Authorizer;
import org.onap.dmaap.datarouter.provisioning.beans.Insertable;
import org.onap.dmaap.datarouter.provisioning.utils.Poker;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class SubscribeServletTest extends DrServletTestBase {
private static SubscribeServlet subscribeServlet;
private static EntityManagerFactory emf;
@@ -102,7 +103,7 @@ public class SubscribeServletTest extends DrServletTestBase {
@Test
public void Given_Request_Is_HTTP_DELETE_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
subscribeServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -111,7 +112,7 @@ public class SubscribeServletTest extends DrServletTestBase {
when(request.isSecure()).thenReturn(false);
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
subscribeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -119,7 +120,7 @@ public class SubscribeServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_GET_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscribeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -127,14 +128,14 @@ public class SubscribeServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_GET_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscribeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscribeServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -151,7 +152,7 @@ public class SubscribeServletTest extends DrServletTestBase {
@Test
public void Given_Request_Is_HTTP_PUT_SC_METHOD_NOT_ALLOWED_Response_Is_Generated() throws Exception {
subscribeServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED), anyString());
verifyEnteringExitCalled(listAppender);
}
@Test
@@ -159,7 +160,7 @@ public class SubscribeServletTest extends DrServletTestBase {
when(request.isSecure()).thenReturn(false);
FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -167,7 +168,7 @@ public class SubscribeServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -175,7 +176,7 @@ public class SubscribeServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -183,7 +184,7 @@ public class SubscribeServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -208,7 +209,7 @@ public class SubscribeServletTest extends DrServletTestBase {
}
};
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -319,14 +320,14 @@ public class SubscribeServletTest extends DrServletTestBase {
when(request.getContentType()).thenReturn("stub_contentType");
when(request.getPathInfo()).thenReturn("/1");
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/1");
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -339,7 +340,7 @@ public class SubscribeServletTest extends DrServletTestBase {
}
};
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_CONFLICT), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_CONFLICT), anyString());
}
@Test
@@ -366,7 +367,7 @@ public class SubscribeServletTest extends DrServletTestBase {
}
};
subscribeServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@NotNull
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java
index a7b42976..d644df9a 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java
@@ -42,8 +42,7 @@ import org.onap.dmaap.datarouter.provisioning.beans.Subscription;
import org.onap.dmaap.datarouter.provisioning.beans.Updateable;
import org.onap.dmaap.datarouter.provisioning.utils.Poker;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.persistence.EntityManager;
@@ -57,12 +56,17 @@ import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Mockito.*;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.contains;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class SubscriptionServletTest extends DrServletTestBase {
private static EntityManagerFactory emf;
private static EntityManager em;
@@ -109,7 +113,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_DELETE_SC_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -117,28 +121,28 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_DELETE_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Subscription_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
setAuthoriserToReturnRequestNotAuthorized();
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -149,7 +153,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doDelete(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -175,7 +179,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_GET_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
subscriptionServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -183,28 +187,28 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_GET_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscriptionServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscriptionServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Subscription_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscriptionServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
public void Given_Request_Is_HTTP_GET_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
setAuthoriserToReturnRequestNotAuthorized();
subscriptionServlet.doGet(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -220,7 +224,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_PUT_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -228,21 +232,21 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_PUT_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_PUT_And_Subscription_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -267,7 +271,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -328,7 +332,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
when(request.getContentType()).thenReturn("stub_ContentType");
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -337,7 +341,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -350,7 +354,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -376,7 +380,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -406,7 +410,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doPut(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
}
@Test
@@ -443,7 +447,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
when(request.isSecure()).thenReturn(false);
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
verifyEnteringExitCalled(listAppender);
}
@@ -451,28 +455,28 @@ public class SubscriptionServletTest extends DrServletTestBase {
public void Given_Request_Is_HTTP_POST_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
setBehalfHeader(null);
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn(null);
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Subscription_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
when(request.getPathInfo()).thenReturn("/123");
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
public void Given_Request_Is_HTTP_POST_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
when(request.getContentType()).thenReturn("stub_ContentType");
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
}
@Test
@@ -480,7 +484,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
when(request.getHeader(anyString())).thenReturn("application/vnd.dmaap-dr.subscription-control");
setAuthoriserToReturnRequestNotAuthorized();
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
}
@Test
@@ -489,7 +493,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
@@ -509,7 +513,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
}
};
subscriptionServlet.doPost(request, response);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@Test
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTaskTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTaskTest.java
index 7ebe45d9..24adde97 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTaskTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTaskTest.java
@@ -62,7 +62,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("javax.net.ssl.*")
+@PowerMockIgnore({"javax.net.ssl.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
@PrepareForTest({BaseServlet.class, URLUtilities.class})
public class SynchronizerTaskTest {
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/BaseLogRecordTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/BaseLogRecordTest.java
index 69016f24..76b92627 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/BaseLogRecordTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/BaseLogRecordTest.java
@@ -22,13 +22,11 @@
******************************************************************************/
package org.onap.dmaap.datarouter.provisioning.beans;
-import org.jetbrains.annotations.NotNull;
+import java.text.ParseException;
import org.junit.Assert;
import org.junit.Test;
import org.onap.dmaap.datarouter.provisioning.utils.LOGJSONObject;
-import java.text.ParseException;
-
public class BaseLogRecordTest {
private BaseLogRecord baseLogRecord;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRouteTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRouteTest.java
index 40d2d61d..b006b531 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRouteTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRouteTest.java
@@ -32,9 +32,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class EgressRouteTest {
private EgressRoute egressRoute;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java
index ec401075..5e87d3a7 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java
@@ -41,9 +41,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class FeedTest {
private static EntityManagerFactory emf;
private static EntityManager em;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/GroupTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/GroupTest.java
index 82ee0837..68b28dea 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/GroupTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/GroupTest.java
@@ -36,9 +36,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class GroupTest {
private static EntityManagerFactory emf;
private static EntityManager em;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRouteTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRouteTest.java
index b26b0000..d2bd02fd 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRouteTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRouteTest.java
@@ -30,6 +30,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -42,6 +43,7 @@ import static org.mockito.Mockito.mock;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.provisioning.beans.Feed")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class IngressRouteTest {
private IngressRoute ingressRoute;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRouteTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRouteTest.java
index d02f39d4..c7c3f6e6 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRouteTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRouteTest.java
@@ -32,9 +32,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class NetworkRouteTest {
private NetworkRoute networkRoute = new NetworkRoute("node01.","node03.","node02.");
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecordTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecordTest.java
index dd798ab6..9f97ba87 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecordTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecordTest.java
@@ -25,11 +25,13 @@ package org.onap.dmaap.datarouter.provisioning.beans;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import java.text.ParseException;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class PubFailRecordTest {
private PubFailRecord pubFailRecord;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/SubscriptionTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/SubscriptionTest.java
index 7f049e5d..9d0535e3 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/SubscriptionTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/SubscriptionTest.java
@@ -32,9 +32,11 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class SubscriptionTest {
private Subscription subscription;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java
index 5e24c5a8..25df548e 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java
@@ -20,6 +20,19 @@
package org.onap.dmaap.datarouter.provisioning.utils;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -30,24 +43,13 @@ import org.onap.aaf.cadi.filter.CadiFilter;
import org.onap.dmaap.datarouter.provisioning.BaseServlet;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.servlet.FilterChain;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER;
-
@RunWith(PowerMockRunner.class)
@PrepareForTest({CadiFilter.class})
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class DRProvCadiFilterTest {
@Mock
@@ -88,7 +90,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("PUT", "subs");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -114,7 +116,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("PUT", "feeds");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@Test
@@ -150,7 +152,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("POST", "subscribe");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -159,7 +161,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("POST", "subscribe");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -169,7 +171,7 @@ public class DRProvCadiFilterTest {
when(request.getPathInfo()).thenReturn("/2");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -213,7 +215,7 @@ public class DRProvCadiFilterTest {
when(request.getPathInfo()).thenReturn("/5");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
}
@@ -245,7 +247,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("PUT", "subs");
when(request.getPathInfo()).thenReturn("5/");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
@@ -254,7 +256,7 @@ public class DRProvCadiFilterTest {
setRequestMocking("PUT", "feeds");
when(request.getPathInfo()).thenReturn("//5");
cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
+ verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
}
private void setRequestMocking(String method, String servletPath)
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLITest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLITest.java
index dc8d4c79..a21bd9fb 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLITest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLITest.java
@@ -34,6 +34,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.ByteArrayInputStream;
@@ -46,6 +47,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class DRRouteCLITest {
@Mock
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DbTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DbTest.java
index d1bedabb..6f5ab294 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DbTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DbTest.java
@@ -28,9 +28,11 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class DbTest {
private static EntityManagerFactory emf;
private static EntityManager em;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObjectTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObjectTest.java
index ae81f15d..98fd6b7a 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObjectTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObjectTest.java
@@ -31,6 +31,7 @@ import org.json.JSONTokener;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.HashMap;
import java.util.Map;
@@ -39,6 +40,7 @@ import static org.junit.Assert.assertThat;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class LOGJSONObjectTest {
private static LOGJSONObject logJO;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoaderTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoaderTest.java
index a15509b4..d68bad4d 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoaderTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoaderTest.java
@@ -40,11 +40,13 @@ import org.junit.runner.RunWith;
import org.onap.dmaap.datarouter.provisioning.InternalServlet;
import org.onap.dmaap.datarouter.provisioning.beans.Parameters;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.provisioning.beans.Parameters")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class LogfileLoaderTest {
private static EntityManagerFactory emf;
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTaskTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTaskTest.java
index 604b4c0a..de2be442 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTaskTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTaskTest.java
@@ -33,10 +33,12 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class PurgeLogDirTaskTest {
private static EntityManagerFactory emf;
diff --git a/datarouter-subscriber/pom.xml b/datarouter-subscriber/pom.xml
index a2e99366..9390050f 100755
--- a/datarouter-subscriber/pom.xml
+++ b/datarouter-subscriber/pom.xml
@@ -67,18 +67,74 @@
<dependency>
<groupId>org.sonatype.http-testing-harness</groupId>
<artifactId>junit-runner</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>powermock-reflect</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.powermock</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-security</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jsr305</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
diff --git a/datarouter-subscriber/src/main/resources/docker/Dockerfile b/datarouter-subscriber/src/main/resources/docker/Dockerfile
index 6c3536c2..20a2ca2b 100644
--- a/datarouter-subscriber/src/main/resources/docker/Dockerfile
+++ b/datarouter-subscriber/src/main/resources/docker/Dockerfile
@@ -18,20 +18,25 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM openjdk:8-jre-alpine
+FROM openjdk:11.0.6-jre-slim
MAINTAINER DMAAP Team
COPY /opt /opt
+RUN apt-get update && \
+ apt-get install -y \
+ curl \
+ vim
+
EXPOSE 8080 8443
WORKDIR /opt
RUN chmod 0700 startup.sh
ENTRYPOINT ["sh", "startup.sh"]
-RUN addgroup -S -g 1001 onap \
- && adduser -S -u 1000 datarouter -G onap \
+RUN groupadd -g 1001 onap \
+ && useradd -u 1000 datarouter -g onap \
&& chown -R datarouter:onap /opt/
USER datarouter \ No newline at end of file
diff --git a/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java b/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java
index 109c63a9..006dee76 100755
--- a/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java
+++ b/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java
@@ -28,6 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.servlet.ServletInputStream;
@@ -40,6 +41,7 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*", "com.sun.org.apache.xalan.*"})
public class SampleSubscriberServletTest {
private SampleSubscriberServlet sampleSubServlet;
diff --git a/pom.xml b/pom.xml
index 0d793996..0f2ebfbd 100755
--- a/pom.xml
+++ b/pom.xml
@@ -32,14 +32,14 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>2.1.0</version>
+ <version>3.0.0</version>
</parent>
<properties>
<!--revision must also be set in the version.properties file at project root-->
<revision>2.1.6-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
@@ -74,9 +74,9 @@
<httpclient.version>4.5.3</httpclient.version>
<junit-runner.version>0.11</junit-runner.version>
<junit.version>4.12</junit.version>
- <mockito-core.version>1.10.19</mockito-core.version>
- <powermock.version>1.7.4</powermock.version>
- <powermock-api-mockito.version>1.7.4</powermock-api-mockito.version>
+ <mockito-core.version>3.3.3</mockito-core.version>
+ <byte-buddy-version>1.10.9</byte-buddy-version>
+ <powermock.version>2.0.7</powermock.version>
<commons-lang3.version>3.0</commons-lang3.version>
<eelf-core.version>1.0.0</eelf-core.version>
<json.version>20160810</json.version>
@@ -93,10 +93,19 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>${hamcrest-lib.version}</version>
- <scope>test</scope>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>${commons-lang3.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf-core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>${json.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -215,18 +224,47 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>${hamcrest-lib.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock-api-mockito.version}</version>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <version>${byte-buddy-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <version>${byte-buddy-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ <version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.27.0-GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>${powermock.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
@@ -245,19 +283,10 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf-core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>${json.version}</version>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
@@ -270,6 +299,18 @@
<excludes>
<exclude>IntegrationSuite.java</exclude>
</excludes>
+ <argLine>
+ --illegal-access=permit
+ </argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <argLine>
+ --illegal-access=permit
+ </argLine>
</configuration>
</plugin>
<plugin>
@@ -308,8 +349,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>