diff options
author | efiacor <fiachra.corcoran@est.tech> | 2022-12-07 10:56:27 +0000 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2022-12-07 15:59:59 +0000 |
commit | bda6aeaa60607ab4fe5af508156019d7bd5c0ce4 (patch) | |
tree | 24bae3847c1139ba9aed95ce286277202aae9a93 /datarouter-prov/src/test | |
parent | b37d32a39c7096e39fc389f15d150e8c2b8c54c2 (diff) |
[DMAAP-DR] Remove AAF/TLS phase 1
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: Ifeae01dd8e7f0a737d8b74594a8061ae3d4ea647
Issue-ID: DMAAP-1642
Diffstat (limited to 'datarouter-prov/src/test')
28 files changed, 85 insertions, 350 deletions
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java index 47a3071f..7ebdf223 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java index 70be1f22..2cc5feba 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java index dfe7f787..9f604fe9 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.Header; import org.apache.http.HttpEntity; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java index 4220ef17..15e7c70a 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java index f451f5a3..25e6e43a 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java index 7a02931e..d77bc98d 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.Header; import org.apache.http.HttpEntity; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java index bc724079..9c30cd3f 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java index ba28da11..0da0f41d 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.text.SimpleDateFormat; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java index 833380a6..5c84a670 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.Header; import org.apache.http.HttpResponse; diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java index 1f21c1f6..dfcdeff4 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; 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 d335ffa1..9d0d3c80 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 @@ -25,7 +25,7 @@ import static org.mockito.Mockito.when; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; 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 149943ea..84244dc3 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 @@ -38,7 +38,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; import javax.crypto.SecretKeyFactory; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.reflect.FieldUtils; import org.json.JSONObject; import org.junit.Assert; 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 af1d7145..9993334e 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 @@ -32,14 +32,14 @@ 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 jakarta.servlet.ServletOutputStream; import java.util.HashSet; import java.util.Set; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.NotNull; import org.json.JSONArray; 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 00bc2aa2..066b51fc 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 @@ -32,6 +32,8 @@ 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 jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletOutputStream; import java.sql.Connection; import java.sql.SQLException; import java.util.HashSet; @@ -39,10 +41,8 @@ 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.NotNull; import org.json.JSONArray; 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 d84e66d4..5b9be757 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 @@ -29,15 +29,15 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.onap.dmaap.datarouter.provisioning.BaseServlet.BEHALF_HEADER; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletOutputStream; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.json.JSONObject; import org.junit.AfterClass; 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 1601e63d..1016b06d 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 @@ -31,15 +31,15 @@ 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 jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletOutputStream; import java.io.File; import java.net.InetAddress; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.junit.AfterClass; import org.junit.Assert; 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 1f6e3a59..931c00a2 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 @@ -25,6 +25,7 @@ package org.onap.dmaap.datarouter.provisioning; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.read.ListAppender; +import jakarta.servlet.ServletOutputStream; import org.junit.Before; import org.junit.BeforeClass; import org.junit.AfterClass; @@ -34,9 +35,8 @@ import org.mockito.Mock; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java index 78d2eaa7..a915fa84 100644 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java @@ -46,7 +46,7 @@ public class ProvServerTest { public static void init() { System.setProperty( "org.onap.dmaap.datarouter.provserver.properties", - "src/test/resources/h2Database.properties"); + "src/test/resources/h2DatabaseTlsDisabled.properties"); } @Test 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 8a676878..3c8d84e6 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 @@ -24,6 +24,7 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.powermock.api.mockito.PowerMockito.when; +import jakarta.servlet.ServletConfig; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; @@ -33,9 +34,8 @@ import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.http.Header; import org.apache.http.HttpEntity; 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 49e93bf1..f0d18b30 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 @@ -37,8 +37,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.FileNotFoundException; 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 0c5f63fc..dea98e0a 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 @@ -29,12 +29,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import jakarta.servlet.ServletOutputStream; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; 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 b6686b0e..9512ff19 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 @@ -28,12 +28,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import jakarta.servlet.ServletOutputStream; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; 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 48a39925..bf2371f8 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 @@ -32,14 +32,14 @@ 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 jakarta.servlet.ServletOutputStream; import java.util.HashSet; import java.util.Set; 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.NotNull; import org.json.JSONObject; 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 1f4fd535..d5badd34 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 @@ -32,6 +32,8 @@ 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 jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletOutputStream; import java.sql.Connection; import java.sql.SQLException; import java.util.HashSet; @@ -39,10 +41,8 @@ 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 jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.NotNull; import org.json.JSONObject; 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 deleted file mode 100644 index 25df548e..00000000 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilterTest.java +++ /dev/null @@ -1,271 +0,0 @@ -/**-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dmaap.datarouter.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;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.onap.aaf.cadi.PropAccess;
-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;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({CadiFilter.class})
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
-public class DRProvCadiFilterTest {
-
- @Mock
- private PropAccess access;
-
- @Mock
- private HttpServletRequest request;
-
- @Mock
- private HttpServletResponse response;
-
- @Mock
- private FilterChain chain;
-
- private DRProvCadiFilter cadiFilter;
-
-
- private static EntityManagerFactory emf;
- private static EntityManager em;
-
-
- @BeforeClass
- public static void init() {
- emf = Persistence.createEntityManagerFactory("dr-unit-tests");
- em = emf.createEntityManager();
- System.setProperty(
- "org.onap.dmaap.datarouter.provserver.properties",
- "src/test/resources/h2Database.properties");
- }
-
- @Before
- public void setUp() throws Exception {
- cadiFilter = new DRProvCadiFilter(false, access);
- }
-
- @Test
- public void Given_doFilter_Called_And_Path_Contains_subs_And_SubId_Is_Incorrectly_Set_Then_Not_Found_Response_Returned() throws Exception{
- setRequestMocking("PUT", "subs");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
- }
-
- @Test
- public void Given_doFilter_called_And_Path_Contains_subs_And_Is_AAF_Subscriber_then_call_Super_doFilter() throws Exception{
- setRequestMocking("PUT", "subs");
- when(request.getPathInfo()).thenReturn("/2");
- PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(CadiFilter.class));
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(0)).doFilter(request, response);
- }
-
- @Test
- public void Given_doFilter_called_And_Path_Contains_subs_And_Is_Not_AAF_Subscriber_then_call_chain_doFilter() throws Exception{
- setRequestMocking("PUT", "subs");
- when(request.getPathInfo()).thenReturn("/5");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
- }
-
- @Test
- public void Given_doFilter_called_And_FeedId_Is_Incorrectly_Set_Then_Not_Found_Response_Returned () throws Exception{
- setRequestMocking("PUT", "feeds");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
- }
-
- @Test
- public void Given_doFilter_called_And_FeedId_Is_Correctly_Set_And_Is_AAF_Feed_Then_Call_Super_doFilter() throws Exception{
- setRequestMocking("PUT", "feeds");
- when(request.getPathInfo()).thenReturn("/2");
- PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(CadiFilter.class));
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(0)).doFilter(request, response);
- }
-
- @Test
- public void Given_doFilter_called_And_FeedId_Is_Correctly_Set_And_Is_Not_AAF_Feed_then_call_chain_doFilter() throws Exception{
- setRequestMocking("PUT", "feeds");
- when(request.getPathInfo()).thenReturn("/1");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
- }
-
- @Test
- public void Given_doFilter_called_With_Get_Then_call_chain_doFilter() throws Exception{
- setRequestMocking("GET", "feeds");
- when(request.getPathInfo()).thenReturn("/5");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
- }
-
-
- @Test
- public void Given_doFilter_called_With_POST_Then_call_chain_doFilter() throws Exception{
- setRequestMocking("POST", "subscribe");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_FeedId_Is_Incorrectly_Set_Then_Not_Found_Response_Returned() throws Exception{
- setRequestMocking("POST", "subscribe");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Exclude_AAF_Is_NULL_Then_Bad_Request_Response_Returned() throws Exception{
- setRequestMocking("POST", "subscribe");
- when(request.getPathInfo()).thenReturn("/2");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Exclude_AAF_Equals_True_Then_Call_Chain_doFilter() throws Exception{
- setRequestMocking("POST", "subscribe");
- when(request.getPathInfo()).thenReturn("/2");
- when(request.getHeader("X-EXCLUDE-AAF")).thenReturn("true");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Exclude_AAF_Equals_False_Then_Call_Super_doFilter() throws Exception{
- setRequestMocking("POST", "subscribe");
- when(request.getPathInfo()).thenReturn("/2");
- when(request.getHeader("X-EXCLUDE-AAF")).thenReturn("false");
- PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(CadiFilter.class));
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(0)).doFilter(request, response);
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Is_Not_AAF_Exclude_AAF_Equals_Then_Call_Chain_doFilter() throws Exception{
- setRequestMocking("POST", "subscribe");
- when(request.getPathInfo()).thenReturn("/5");
- when(request.getHeader("X-EXCLUDE-AAF")).thenReturn("false");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Path_Not_Includes_subscribe_And_Exclude_AAF_Is_NULL_Then_Bad_Request_Response_Returned() throws Exception{
- setRequestMocking("POST", "other");
- when(request.getPathInfo()).thenReturn("/5");
-
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Path_Not_Includes_subscribe_And_Exclude_AAF_Equals_True_Then_Call_Chain_doFilter() throws Exception{
- setRequestMocking("POST", "other");
- when(request.getPathInfo()).thenReturn("/5");
- when(request.getHeader("X-EXCLUDE-AAF")).thenReturn("true");
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(1)).doFilter(request, response);
-
- }
-
- @Test
- public void Given_doFilter_called_With_POST_And_Path_Not_Includes_subscribe_And_Exclude_AAF_Equals_False_Then_Call_Super_doFilter() throws Exception{
- setRequestMocking("POST", "other");
- when(request.getPathInfo()).thenReturn("/5");
- when(request.getHeader("X-EXCLUDE-AAF")).thenReturn("false");
- PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(CadiFilter.class));
-
- cadiFilter.doFilter(request, response, chain);
- verify(chain, times(0)).doFilter(request, response);
-
- }
-
- @Test
- public void Given_doFilter_Called_And_Path_Contains_subs_And_getSubId_Throws_NumberFormatException_then_Not_Found_response_returned() throws Exception{
- setRequestMocking("PUT", "subs");
- when(request.getPathInfo()).thenReturn("5/");
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
-
- }
-
- @Test
- public void Given_doFilter_called_And_FeedId_Throws_Set_Then_Not_Found_Response_Returned () throws Exception{
- setRequestMocking("PUT", "feeds");
- when(request.getPathInfo()).thenReturn("//5");
- cadiFilter.doFilter(request, response, chain);
- verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
- }
-
- private void setRequestMocking(String method, String servletPath)
- {
- when(request.getRemoteAddr()).thenReturn(null);
- when(request.getHeader(BEHALF_HEADER)).thenReturn(null);
- when(request.getAttribute(BaseServlet.CERT_ATTRIBUTE)).thenReturn(null);
- when(request.getMethod()).thenReturn(method);
- when(request.getServletPath()).thenReturn(servletPath);
- }
-
- }
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilterTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilterTest.java index 94ef3b72..bb0077ab 100644 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilterTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilterTest.java @@ -23,6 +23,25 @@ package org.onap.dmaap.datarouter.provisioning.utils; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.reflect.FieldUtils; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationSupport; @@ -31,33 +50,20 @@ import org.eclipse.jetty.server.HttpChannel; import org.eclipse.jetty.server.HttpConnection; import org.eclipse.jetty.server.Request; import org.junit.Test; - import org.junit.runner.RunWith; -import static org.junit.Assert.*; -import static org.hamcrest.core.Is.is; import org.mockito.Mock; - -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - 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; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.*; - @RunWith(PowerMockRunner.class) @SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.Parameters", "org.eclipse.jetty.server.Request", "org.eclipse.jetty.continuation.ContinuationSupport", "org.eclipse.jetty.server.HttpConnection"}) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) public class ThrottleFilterTest { @Mock @@ -132,7 +138,7 @@ public class ThrottleFilterTest { public void Given_Do_Filter_Run_and_enabled_and_action_is_true_and_rate_is_greater_than_0_and_getFeedId_returns_id_then_continuation_will_call_suspend_and_dispatch_once() throws Exception { mockParametersWithValues("0,5,thing"); PowerMockito.mockStatic(ContinuationSupport.class); - PowerMockito.when(continuationsupport.getContinuation(any())).thenReturn(continuation); + PowerMockito.when(ContinuationSupport.getContinuation(any())).thenReturn(continuation); ThrottleFilter.configure(); mockServletInputStream(); FieldUtils.writeDeclaredStaticField(ThrottleFilter.class, "action", 1, true); @@ -175,7 +181,7 @@ public class ThrottleFilterTest { FilterConfig filterconfig = mock(FilterConfig.class); mockParametersWithValues("0,5,thing"); PowerMockito.mockStatic(ContinuationSupport.class); - PowerMockito.when(continuationsupport.getContinuation(any())).thenReturn(continuation); + PowerMockito.when(ContinuationSupport.getContinuation(any())).thenReturn(continuation); throttleFilter.init(filterconfig); throttleFilter.destroy(); @@ -199,17 +205,17 @@ public class ThrottleFilterTest { private void mockContinuationSupport() { PowerMockito.mockStatic(ContinuationSupport.class); - PowerMockito.when(continuationsupport.getContinuation(any())).thenReturn(continuation); + PowerMockito.when(ContinuationSupport.getContinuation(any())).thenReturn(continuation); } private void mockHttpConnectionHttpChannelAndRequest(ServletInputStream serverinputstream) throws IOException { PowerMockito.mockStatic(ContinuationSupport.class); - PowerMockito.when(continuationsupport.getContinuation(any())).thenReturn(continuation); + PowerMockito.when(ContinuationSupport.getContinuation(any())).thenReturn(continuation); when(serverinputstream.read(any())).thenReturn(2).thenReturn(1).thenReturn(0); when(request.getInputStream()).thenReturn(serverinputstream); PowerMockito.mockStatic(HttpConnection.class); EndPoint endpoint = mock(EndPoint.class); - PowerMockito.when(httpconnection.getCurrentConnection()).thenReturn(httpconnection); + PowerMockito.when(HttpConnection.getCurrentConnection()).thenReturn(httpconnection); PowerMockito.when(httpconnection.getHttpChannel()).thenReturn(httpchannel); when(httpchannel.getRequest()).thenReturn(req); when(req.getHttpChannel()).thenReturn(httpchannel); diff --git a/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties b/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties index 05ab3a47..b7f5aa9d 100644 --- a/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties +++ b/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties @@ -25,8 +25,8 @@ org.onap.dmaap.datarouter.db.driver = org.h2.Driver org.onap.dmaap.datarouter.db.url = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 org.onap.dmaap.datarouter.provserver.isaddressauthenabled = true -org.onap.dmaap.datarouter.provserver.cadi.enabled = true -org.onap.dmaap.datarouter.provserver.https.relaxation = false +org.onap.dmaap.datarouter.provserver.cadi.enabled = false +org.onap.dmaap.datarouter.provserver.https.relaxation = true org.onap.dmaap.datarouter.provserver.accesslog.dir = unit-test-logs org.onap.dmaap.datarouter.provserver.spooldir = src/test/resources org.onap.dmaap.datarouter.provserver.dbscripts = src/test/resources diff --git a/datarouter-prov/src/test/resources/prov_data.json b/datarouter-prov/src/test/resources/prov_data.json index cf455c71..80ff6fab 100644 --- a/datarouter-prov/src/test/resources/prov_data.json +++ b/datarouter-prov/src/test/resources/prov_data.json @@ -25,10 +25,10 @@ "aaf_instance": "legacy", "publisher": "dradmin", "links": { - "subscribe": "https://dmaap-dr-prov/subscribe/1", - "log": "https://dmaap-dr-prov/feedlog/1", - "publish": "https://dmaap-dr-prov/publish/1", - "self": "https://dmaap-dr-prov/feed/1" + "subscribe": "http://dmaap-dr-prov/subscribe/1", + "log": "http://dmaap-dr-prov/feedlog/1", + "publish": "http://dmaap-dr-prov/publish/1", + "self": "http://dmaap-dr-prov/feed/1" }, "created_date": 1560871903000 } @@ -49,7 +49,7 @@ "use100": true, "password": "PASSWORD", "user": "LOGIN", - "url": "https://dcae-pm-mapper:8443/delivery" + "url": "http://dcae-pm-mapper:8080/delivery" }, "subscriber": "dradmin", "groupid": 0, @@ -62,9 +62,9 @@ "decompress": true, "aaf_instance": "legacy", "links": { - "feed": "https://dmaap-dr-prov/feed/1", - "log": "https://dmaap-dr-prov/sublog/1", - "self": "https://dmaap-dr-prov/subs/1" + "feed": "http://dmaap-dr-prov/feed/1", + "log": "http://dmaap-dr-prov/sublog/1", + "self": "http://dmaap-dr-prov/subs/1" }, "created_date": 1560872889000 } |