From 5b593496b8f1b8e8be8d7d2dbcc223332e65a49b Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 29 Jul 2018 16:13:45 +0300 Subject: re base code Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando --- .../org/openecomp/sdc/webseal/simulator/Login.java | 11 +++--- .../simulator/MutableHttpServletRequest.java | 12 ++---- .../sdc/webseal/simulator/RequestsClient.java | 21 ++++------ .../SSL/DummySSLProtocolSocketFactory.java | 15 ++++--- .../simulator/SSL/DummyX509TrustManager.java | 7 ++-- .../openecomp/sdc/webseal/simulator/SdcProxy.java | 46 +++++++++------------- .../openecomp/sdc/webseal/simulator/conf/Conf.java | 9 ++--- 7 files changed, 48 insertions(+), 73 deletions(-) (limited to 'utils/webseal-simulator/src') diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java index 0f6cd8a5c4..a19b94094b 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java @@ -1,9 +1,6 @@ package org.openecomp.sdc.webseal.simulator; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Collection; -import java.util.Iterator; +import org.openecomp.sdc.webseal.simulator.conf.Conf; import javax.servlet.ServletConfig; import javax.servlet.ServletException; @@ -11,8 +8,10 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import org.openecomp.sdc.webseal.simulator.conf.Conf; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Collection; +import java.util.Iterator; public class Login extends HttpServlet { diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/MutableHttpServletRequest.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/MutableHttpServletRequest.java index 74c8a15c80..d5fd52204b 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/MutableHttpServletRequest.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/MutableHttpServletRequest.java @@ -1,15 +1,9 @@ package org.openecomp.sdc.webseal.simulator; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; +import java.util.*; public final class MutableHttpServletRequest extends HttpServletRequestWrapper { // holds custom header and value mapping @@ -17,7 +11,7 @@ public final class MutableHttpServletRequest extends HttpServletRequestWrapper { public MutableHttpServletRequest(HttpServletRequest request){ super(request); - this.customHeaders = new HashMap(); + this.customHeaders = new HashMap<>(); } public void putHeader(String name, String value){ @@ -37,7 +31,7 @@ public final class MutableHttpServletRequest extends HttpServletRequestWrapper { public Enumeration getHeaderNames() { // create a set of the custom header names - Set set = new HashSet(customHeaders.keySet()); + Set set = new HashSet<>(customHeaders.keySet()); // now add the headers from the wrapped request object @SuppressWarnings("unchecked") diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java index 4cfacecb12..17eaa1b945 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java @@ -1,23 +1,18 @@ package org.openecomp.sdc.webseal.simulator; -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; +import org.apache.commons.io.IOUtils; +import org.openecomp.sdc.webseal.simulator.conf.Conf; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.IOUtils; -import org.openecomp.sdc.webseal.simulator.conf.Conf; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; public class RequestsClient extends HttpServlet { diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummySSLProtocolSocketFactory.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummySSLProtocolSocketFactory.java index a11dec43b9..30d98146c2 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummySSLProtocolSocketFactory.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummySSLProtocolSocketFactory.java @@ -1,19 +1,18 @@ package org.openecomp.sdc.webseal.simulator.SSL; -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; - import org.apache.commons.httpclient.ConnectTimeoutException; import org.apache.commons.httpclient.HttpClientError; import org.apache.commons.httpclient.params.HttpConnectionParams; import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import java.io.IOException; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; public class DummySSLProtocolSocketFactory implements SecureProtocolSocketFactory { diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummyX509TrustManager.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummyX509TrustManager.java index dcfef828e0..df7a1d2b65 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummyX509TrustManager.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SSL/DummyX509TrustManager.java @@ -1,15 +1,14 @@ package org.openecomp.sdc.webseal.simulator.SSL; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; public class DummyX509TrustManager implements X509TrustManager { diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java index 724bf9ebc6..2580b439c2 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java @@ -1,11 +1,23 @@ package org.openecomp.sdc.webseal.simulator; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.methods.*; +import org.apache.commons.httpclient.protocol.Protocol; +import org.openecomp.sdc.webseal.simulator.SSL.DummySSLProtocolSocketFactory; +import org.openecomp.sdc.webseal.simulator.conf.Conf; + +import javax.net.ssl.X509TrustManager; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; @@ -17,28 +29,6 @@ import java.util.List; import java.util.Map; import java.util.zip.GZIPInputStream; -import javax.net.ssl.X509TrustManager; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.methods.DeleteMethod; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.InputStreamRequestEntity; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.PutMethod; -import org.apache.commons.httpclient.protocol.Protocol; -import org.openecomp.sdc.webseal.simulator.SSL.DummySSLProtocolSocketFactory; -import org.openecomp.sdc.webseal.simulator.conf.Conf; - public class SdcProxy extends HttpServlet { private static final long serialVersionUID = 1L; diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/conf/Conf.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/conf/Conf.java index ae2fa036ea..132a622b64 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/conf/Conf.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/conf/Conf.java @@ -1,15 +1,14 @@ package org.openecomp.sdc.webseal.simulator.conf; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import org.openecomp.sdc.webseal.simulator.User; + import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.webseal.simulator.User; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; - public class Conf { private static Conf conf= null; -- cgit 1.2.3-korg