From 34299d910aa2a2bc423153bd2e91c9940efca21e Mon Sep 17 00:00:00 2001 From: Michael Dürre Date: Wed, 15 Jul 2020 12:33:56 +0200 Subject: cleanup apigateway code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed unused code and fixed warnings Issue-ID: CCSDK-2558 Signed-off-by: Michael Dürre Change-Id: I8827abe8932a8422dc27b166d742c46184109426 --- .../onap/ccsdk/features/sdnr/wt/apigateway/AaiServlet.java | 3 --- .../onap/ccsdk/features/sdnr/wt/apigateway/BaseServlet.java | 10 ---------- .../onap/ccsdk/features/sdnr/wt/apigateway/EsServlet.java | 7 ------- .../onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java | 12 +++++------- .../features/sdnr/wt/apigateway/test/TestAaiServlet.java | 2 -- .../sdnr/wt/apigateway/test/TestDatabaseServlet.java | 1 - .../features/sdnr/wt/apigateway/test/TestProperties.java | 2 -- .../sdnr/wt/apigateway/test/helper/HelpAaiServlet.java | 3 +-- .../sdnr/wt/apigateway/test/helper/HelpEsServlet.java | 4 ++-- .../features/sdnr/wt/apigateway/test/helper/HelpServlet.java | 5 +++-- .../sdnr/wt/apigateway/test/helper/HelpServletBase.java | 1 + .../sdnr/wt/apigateway/test/helper/IPublicServlet.java | 1 - 12 files changed, 12 insertions(+), 39 deletions(-) (limited to 'sdnr/wt') diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/AaiServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/AaiServlet.java index 0cdf79d43..219e75a78 100644 --- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/AaiServlet.java +++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/AaiServlet.java @@ -27,9 +27,6 @@ import javax.servlet.http.HttpServletResponse; public class AaiServlet extends BaseServlet { - /** - * - */ private static final long serialVersionUID = 5946205120796162644L; private static final String OFFLINE_RESPONSE_MESSAGE = "AAI interface is offline"; private static boolean trustAll = false; diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/BaseServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/BaseServlet.java index dab7ad776..7c8a9a1d9 100644 --- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/BaseServlet.java +++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/BaseServlet.java @@ -32,7 +32,6 @@ import java.security.NoSuchAlgorithmException; import java.util.Enumeration; import java.util.List; import java.util.Map; - import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; @@ -41,15 +40,11 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class BaseServlet extends HttpServlet { - /** - * - */ private static final long serialVersionUID = 7403047480257892794L; private static Logger LOG = LoggerFactory.getLogger(BaseServlet.class); private static SSLContext sc; @@ -66,11 +61,6 @@ public abstract class BaseServlet extends HttpServlet { protected abstract String getRemoteUrl(String uri); - /** - * - * @throws NoSuchAlgorithmException - * @throws KeyManagementException - */ private static void setupSslTrustAll(boolean trustall) throws NoSuchAlgorithmException, KeyManagementException { sc = SSLContext.getInstance("TLSv1.2"); diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/EsServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/EsServlet.java index 5db305ecb..f3871a5c4 100644 --- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/EsServlet.java +++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/EsServlet.java @@ -25,17 +25,10 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class EsServlet extends BaseServlet { - /** - * - */ private static final long serialVersionUID = -3996363343749995011L; private static final String OFFLINE_RESPONSE_MESSAGE = "Database interface is offline"; - private static Logger LOG = LoggerFactory.getLogger(EsServlet.class); private static boolean trustAll = false; diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java index d49b4dce2..d644c63a3 100644 --- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java +++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java @@ -28,7 +28,6 @@ import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; - import org.json.JSONArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,12 +42,6 @@ public class MyProperties { private static final String DEFAULT_ESDATABASE = "http://sdnrdb:9200"; private static final String DEFAULT_AAI = "off"; - @Override - public String toString() { - return "MyProperties [aaiBase=" + aaiBase + ", aaiHeaders=" + aaiHeaders + ", esBase=" + esBase - + ", trustInsecure=" + trustInsecure + ", corsEnabled=" + corsEnabled + "]"; - } - private static MyProperties mObj; private String aaiBase; @@ -168,4 +161,9 @@ public class MyProperties { return mObj; } + @Override + public String toString() { + return "MyProperties [aaiBase=" + aaiBase + ", aaiHeaders=" + aaiHeaders + ", esBase=" + esBase + + ", trustInsecure=" + trustInsecure + ", corsEnabled=" + corsEnabled + "]"; + } } diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java index 06bf2c17e..3436c36f2 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java @@ -23,9 +23,7 @@ package org.onap.ccsdk.features.sdnr.wt.apigateway.test; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; - import javax.servlet.ServletException; - import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java index bc6859ac1..45eac88cd 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java @@ -26,7 +26,6 @@ import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties; import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpEsServlet; import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpServletBase; - import java.io.*; import javax.servlet.ServletException; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java index 6fad884ff..761afe20e 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java @@ -21,12 +21,10 @@ package org.onap.ccsdk.features.sdnr.wt.apigateway.test; import static org.junit.Assert.*; - import java.io.ByteArrayInputStream; import java.io.File; import java.util.HashMap; import java.util.Map; - import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java index f6987b2fa..5d4c8f507 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java @@ -21,15 +21,14 @@ package org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.onap.ccsdk.features.sdnr.wt.apigateway.AaiServlet; public class HelpAaiServlet extends AaiServlet implements IPublicServlet { + private static final long serialVersionUID = 1L; public static final String RESPONSE_GET = "This is the response get"; public static final String RESPONSE_POST = "This is the response post"; public static final String RESPONSE_PUT = "This is the response put"; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java index 901dd5810..fe89c9fc4 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java @@ -21,15 +21,15 @@ package org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.onap.ccsdk.features.sdnr.wt.apigateway.EsServlet; public class HelpEsServlet extends EsServlet implements IPublicServlet { + private static final long serialVersionUID = 6502905928958752573L; + public static final String RESPONSE_GET = "This is the response get"; public static final String RESPONSE_POST = "This is the response post"; public static final String RESPONSE_PUT = "This is the response put"; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServlet.java index ddab06add..eeff762ac 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServlet.java @@ -25,12 +25,13 @@ import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.onap.ccsdk.features.sdnr.wt.apigateway.EsServlet; public class HelpServlet extends EsServlet { - @Override + private static final long serialVersionUID = 1L; + + @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); } diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java index 0bc42c342..b12281e32 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java @@ -49,6 +49,7 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +@SuppressWarnings("restriction") public class HelpServletBase { public static final String HTTPMETHOD_GET = "GET"; diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/IPublicServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/IPublicServlet.java index 86a9467ec..bf7fc56f4 100644 --- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/IPublicServlet.java +++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/IPublicServlet.java @@ -23,7 +23,6 @@ package org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -- cgit 1.2.3-korg