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 --- .../main/java/org/openecomp/sdc/dmaap/CliArgs.java | 2 +- .../org/openecomp/sdc/dmaap/DmaapPublishTool.java | 16 ++------ .../org/openecomp/sdc/dmaap/DmaapPublisher.java | 2 +- .../openecomp/sdc/dmaap/DmaapPublisherTest.java | 2 - utils/webseal-simulator/sdc-simulator/startup.sh | 0 .../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 ++--- 12 files changed, 54 insertions(+), 89 deletions(-) mode change 100755 => 100644 utils/webseal-simulator/sdc-simulator/startup.sh (limited to 'utils') diff --git a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/CliArgs.java b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/CliArgs.java index 38e53c824f..eec23abd47 100644 --- a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/CliArgs.java +++ b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/CliArgs.java @@ -1,7 +1,7 @@ package org.openecomp.sdc.dmaap; -import org.kohsuke.args4j.Option; import com.google.common.base.MoreObjects; +import org.kohsuke.args4j.Option; public class CliArgs { diff --git a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublishTool.java b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublishTool.java index 61e48fa50e..3b5d2c2360 100644 --- a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublishTool.java +++ b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublishTool.java @@ -1,22 +1,14 @@ package org.openecomp.sdc.dmaap; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; - +import com.att.nsa.mr.client.MRBatchingPublisher; +import com.att.nsa.mr.client.MRClientFactory; +import com.att.nsa.mr.client.MRPublisher.message; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; -import com.att.nsa.mr.client.MRBatchingPublisher; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.MRPublisher.message; +import java.util.concurrent.TimeUnit; public class DmaapPublishTool { diff --git a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublisher.java b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublisher.java index fd558356ed..e239220a41 100644 --- a/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublisher.java +++ b/utils/DmaapPublisher/src/main/java/org/openecomp/sdc/dmaap/DmaapPublisher.java @@ -7,6 +7,7 @@ import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.OptionHandlerFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -16,7 +17,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Consumer; import java.util.stream.IntStream; - import static org.openecomp.sdc.dmaap.Util.*; public class DmaapPublisher { diff --git a/utils/DmaapPublisher/src/test/java/org/openecomp/sdc/dmaap/DmaapPublisherTest.java b/utils/DmaapPublisher/src/test/java/org/openecomp/sdc/dmaap/DmaapPublisherTest.java index 19dbdeaed4..83d7aa9a12 100644 --- a/utils/DmaapPublisher/src/test/java/org/openecomp/sdc/dmaap/DmaapPublisherTest.java +++ b/utils/DmaapPublisher/src/test/java/org/openecomp/sdc/dmaap/DmaapPublisherTest.java @@ -3,8 +3,6 @@ package org.openecomp.sdc.dmaap; import org.junit.Test; import java.io.File; -import java.net.URL; -import java.nio.file.Paths; import static org.junit.Assert.*; diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh old mode 100755 new mode 100644 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