aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/common
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-01-29 12:46:06 -0500
committerDan Timoney <dtimoney@att.com>2021-01-29 12:47:35 -0500
commit4e69f3358d31173a222b275e2a82da692846aa1a (patch)
tree7355744a66614a0811113ee6a43a423e68257fe3 /sdnr/wt/common
parent123b423cddbe01bdaba0bea50d986ff1b18a25bc (diff)
Revert "update common and data-provider"
This reverts commit a3e70a1a48d13193d9f28a2d91089d5b253d3e91. Change was incomplete - many modules still reference version 2.1.0 (Sodium-based) of CCSDK parent poms, causing version conflicts in odlsli docker. Issue-ID: CCSDK-3076 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: I447371239a1bfe102b705e7ecbd964f368780657
Diffstat (limited to 'sdnr/wt/common')
-rw-r--r--sdnr/wt/common/pom.xml13
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/database/SearchResult.java11
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPClient.java41
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPResponse.java10
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseServlet.java8
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletInputStreamFromByteArrayInputStream.java15
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToByteArrayOutputStream.java18
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToStringWriter.java20
-rw-r--r--sdnr/wt/common/src/test/resources/testpom.xml4
9 files changed, 30 insertions, 110 deletions
diff --git a/sdnr/wt/common/pom.xml b/sdnr/wt/common/pom.xml
index 83b07536f..54ffc01c3 100644
--- a/sdnr/wt/common/pom.xml
+++ b/sdnr/wt/common/pom.xml
@@ -29,14 +29,14 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-common</artifactId>
<version>1.1.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ <packaging>jar</packaging>
<name>ccsdk-features :: ${project.artifactId}</name>
<licenses>
@@ -47,6 +47,7 @@
</licenses>
<properties>
+ <checkstyle.skip>true</checkstyle.skip> <!-- POM configuration -->
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<buildtime>${maven.build.timestamp} UTC</buildtime>
@@ -62,7 +63,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
+ <artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -76,6 +77,7 @@
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
+ <version>${elasticsearch-rest-client.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -90,8 +92,8 @@
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
</dependency>
</dependencies>
@@ -112,6 +114,7 @@
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
+ <version>6.16</version>
<configuration>
<skip>${skipTests}</skip>
<clusterName>testCluster</clusterName>
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/database/SearchResult.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/database/SearchResult.java
index 529853e08..5a011eec9 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/database/SearchResult.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/database/SearchResult.java
@@ -45,6 +45,10 @@ public class SearchResult<T> {
this.total = total;
}
+ // public SearchResult(List<T> hits,long total) {
+ // this.hits = hits;
+ // this.total = total;
+ // }
public SearchResult() {
this.hits = new ArrayList<>();
this.total = 0;
@@ -65,11 +69,4 @@ public class SearchResult<T> {
public void add(T object) {
this.hits.add(object);
}
-
- @Override
- public String toString() {
- return "SearchResult [hits=" + hits + ", total=" + total + "]";
- }
-
-
}
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPClient.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPClient.java
index 198fb920c..155e51609 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPClient.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPClient.java
@@ -48,11 +48,7 @@ import java.security.interfaces.RSAPrivateKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import javax.annotation.Nonnull;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
@@ -60,7 +56,7 @@ import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
-import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.DatatypeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,29 +111,6 @@ public class BaseHTTPClient {
throws IOException {
return this.sendRequest(uri, method, body != null ? body.getBytes(CHARSET) : null, headers);
}
- public BaseHTTPResponse sendRequest(HttpServletRequest req) throws IOException {
- final String method = req.getMethod();
- byte[] buffer=null;
-
- if(!"GET".equals(method)) {
- InputStream is = req.getInputStream();
- buffer=is.readAllBytes();
- is.close();
-
- }
- return this.sendRequest(req.getRequestURI(), method, buffer,mapHeaders(req));
- }
-
- private Map<String, String> mapHeaders(HttpServletRequest req) {
- Map<String,String> headers = new HashMap<>();
- Enumeration<String> keys = req.getHeaderNames();
- String key;
- while(keys.hasMoreElements()) {
- key=keys.nextElement();
- headers.put(key,req.getHeader(key));
- }
- return headers;
- }
protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, byte[] body, Map<String, String> headers)
throws IOException {
@@ -191,16 +164,10 @@ public class BaseHTTPClient {
// Receive answer
int responseCode = ((HttpURLConnection) http).getResponseCode();
String sresponse = "";
- Map<String,String> responseHeaders = null;
InputStream response = null;
try {
if (responseCode >= 200 && responseCode < 300) {
response = http.getInputStream();
- responseHeaders = new HashMap<>();
- for(Entry<String,List<String>> entry:http.getHeaderFields().entrySet()) {
- responseHeaders.put(entry.getKey(), String.join(";", entry.getValue()));
- }
-
} else {
response = ((HttpURLConnection) http).getErrorStream();
if (response == null) {
@@ -228,7 +195,7 @@ public class BaseHTTPClient {
}
LOG.debug("ResponseCode: " + responseCode);
LOG.trace("Response (len:{}): {}", String.valueOf(lensum), sresponse);
- return new BaseHTTPResponse(responseCode, sresponse,responseHeaders);
+ return new BaseHTTPResponse(responseCode, sresponse);
}
public static SSLContext setupSsl(boolean trustall)
@@ -332,7 +299,7 @@ public class BaseHTTPClient {
String data = new String(pem);
String[] tokens = data.split(beginDelimiter);
tokens = tokens[1].split(endDelimiter);
- return Base64.getDecoder().decode(tokens[0]);
+ return DatatypeConverter.parseBase64Binary(tokens[0]);
}
protected static RSAPrivateKey generatePrivateKeyFromDER(byte[] keyBytes)
@@ -370,6 +337,4 @@ public class BaseHTTPClient {
return SSLCERT_PEM;
}
-
-
}
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPResponse.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPResponse.java
index a0fd7220e..91a2cc27c 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPResponse.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseHTTPResponse.java
@@ -21,8 +21,6 @@
*/
package org.onap.ccsdk.features.sdnr.wt.common.http;
-import java.util.Map;
-
public class BaseHTTPResponse {
public static final int CODE404 = 404;
@@ -30,14 +28,10 @@ public class BaseHTTPResponse {
public static final BaseHTTPResponse UNKNOWN = new BaseHTTPResponse(-1, "");
public final int code;
public final String body;
- public final Map<String,String> headers;
+
public BaseHTTPResponse(int code, String body) {
- this(code, body, null);
- }
- public BaseHTTPResponse(int code, String body, Map<String,String> rawData) {
this.code = code;
this.body = body;
- this.headers = rawData;
}
@Override
@@ -46,6 +40,6 @@ public class BaseHTTPResponse {
}
public boolean isSuccess() {
- return this.code >= CODE200 && this.code<300;
+ return this.code == CODE200;
}
}
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseServlet.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseServlet.java
index f66070200..59e4e7705 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseServlet.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/http/BaseServlet.java
@@ -32,6 +32,7 @@ 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;
@@ -40,6 +41,7 @@ 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;
@@ -326,9 +328,9 @@ public abstract class BaseServlet extends HttpServlet {
response = http.getInputStream();
} else {
response = http.getErrorStream();
-// if (response == null) {
-// response = http.getInputStream();
-// }
+ if (response == null) {
+ http.getInputStream();
+ }
}
LOG.debug("ResponseCode: {}", responseCode);
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletInputStreamFromByteArrayInputStream.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletInputStreamFromByteArrayInputStream.java
index 6475ac3c9..b926ff65c 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletInputStreamFromByteArrayInputStream.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletInputStreamFromByteArrayInputStream.java
@@ -23,7 +23,6 @@ package org.onap.ccsdk.features.sdnr.wt.common.test;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
public class ServletInputStreamFromByteArrayInputStream extends ServletInputStream {
@@ -43,18 +42,4 @@ public class ServletInputStreamFromByteArrayInputStream extends ServletInputStre
return bis.read();
}
- @Override
- public boolean isFinished() {
- return false;
- }
-
- @Override
- public boolean isReady() {
- return false;
- }
-
- @Override
- public void setReadListener(ReadListener readListener) {
- }
-
}
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToByteArrayOutputStream.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToByteArrayOutputStream.java
index 3ea607cc0..1914d9b67 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToByteArrayOutputStream.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToByteArrayOutputStream.java
@@ -24,7 +24,6 @@ package org.onap.ccsdk.features.sdnr.wt.common.test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.servlet.ServletOutputStream;
-import javax.servlet.WriteListener;
public class ServletOutputStreamToByteArrayOutputStream extends ServletOutputStream {
@@ -33,21 +32,12 @@ public class ServletOutputStreamToByteArrayOutputStream extends ServletOutputStr
// end of variables
- public ByteArrayOutputStream getByteArrayOutputStream() {
- return out;
- }
-
- @Override
- public void setWriteListener(WriteListener writeListener) {
- }
-
@Override
- public void write(int b) throws IOException {
- out.write(b);
+ public void write(int arg0) throws IOException {
+ out.write(arg0);
}
- @Override
- public boolean isReady() {
- return false;
+ public ByteArrayOutputStream getByteArrayOutputStream() {
+ return out;
}
}
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToStringWriter.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToStringWriter.java
index 48d9f940f..57ed596ae 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToStringWriter.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/ServletOutputStreamToStringWriter.java
@@ -24,7 +24,6 @@ package org.onap.ccsdk.features.sdnr.wt.common.test;
import java.io.IOException;
import java.io.StringWriter;
import javax.servlet.ServletOutputStream;
-import javax.servlet.WriteListener;
public class ServletOutputStreamToStringWriter extends ServletOutputStream {
@@ -32,28 +31,13 @@ public class ServletOutputStreamToStringWriter extends ServletOutputStream {
private StringWriter out = new StringWriter();
// end of variables
- public StringWriter getStringWriter() {
- return out;
- }
-
@Override
public void write(int arg0) throws IOException {
out.write(arg0);
}
- @Override
- public String toString() {
- return out.toString();
- }
-
- @Override
- public boolean isReady() {
- return false;
- }
-
- @Override
- public void setWriteListener(WriteListener writeListener) {
+ public StringWriter getStringWriter() {
+ return out;
}
-
}
diff --git a/sdnr/wt/common/src/test/resources/testpom.xml b/sdnr/wt/common/src/test/resources/testpom.xml
index 6fba87af9..1adf713c1 100644
--- a/sdnr/wt/common/src/test/resources/testpom.xml
+++ b/sdnr/wt/common/src/test/resources/testpom.xml
@@ -29,13 +29,13 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.1.0</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-common</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ccsdk-features :: ${project.artifactId}</name>