aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy-endpoints/src')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java8
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java4
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java2
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java2
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java95
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java49
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java83
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoReqResp.java5
8 files changed, 2 insertions, 246 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
index 6f3094ff..b86532fc 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
@@ -20,7 +20,6 @@
package org.onap.policy.common.endpoints.event.comm;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -313,42 +312,36 @@ class TopicEndpointProxy implements TopicEndpoint {
return sinks;
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<UebTopicSource> getUebTopicSources() {
return UebTopicFactories.getSourceFactory().inventory();
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<DmaapTopicSource> getDmaapTopicSources() {
return DmaapTopicFactories.getSourceFactory().inventory();
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<NoopTopicSource> getNoopTopicSources() {
return NoopTopicFactories.getSourceFactory().inventory();
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<UebTopicSink> getUebTopicSinks() {
return UebTopicFactories.getSinkFactory().inventory();
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<DmaapTopicSink> getDmaapTopicSinks() {
return DmaapTopicFactories.getSinkFactory().inventory();
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public List<NoopTopicSink> getNoopTopicSinks() {
@@ -416,7 +409,6 @@ class TopicEndpointProxy implements TopicEndpoint {
*
* @return list of managed endpoints
*/
- @JsonIgnore
@GsonJsonIgnore
protected List<Startable> getEndpoints() {
final List<Startable> endpoints = new ArrayList<>();
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
index c2b590a0..09d52946 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +25,6 @@ import com.att.nsa.apiClient.http.HttpClient.ConnectionType;
import com.att.nsa.cambria.client.CambriaBatchingPublisher;
import com.att.nsa.cambria.client.CambriaClientBuilders;
import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import java.net.MalformedURLException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
@@ -69,7 +68,6 @@ public interface BusPublisher {
/**
* The actual Cambria publisher.
*/
- @JsonIgnore
@GsonJsonIgnore
protected CambriaBatchingPublisher publisher;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java
index ab19b7ef..f4f0705c 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java
@@ -22,7 +22,6 @@
package org.onap.policy.common.endpoints.http.client.internal;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@@ -298,7 +297,6 @@ public class JerseyClient implements HttpClient {
return userName;
}
- @JsonIgnore
@GsonJsonIgnore
@Override
public String getPassword() {
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
index 6825f07c..699d5d43 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
@@ -21,7 +21,6 @@
package org.onap.policy.common.endpoints.http.server.internal;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
import org.eclipse.jetty.security.ConstraintMapping;
@@ -492,7 +491,6 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
*
* @return the password
*/
- @JsonIgnore
@GsonJsonIgnore
public String getPassword() {
return password;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
index 5d609a65..7e03b1f6 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
@@ -63,8 +63,6 @@ public class HttpClientTest {
private static final String FALSE_STRING = "false";
private static final String ALPHA123 = "alpha123";
private static final String PUT_HELLO = "PUT:hello:{myParameter=myValue}";
- private static final String DOT_GSON = "." + "GSON";
- private static final String DOT_JACKSON = "." + "JACKSON";
private static final String DOT_PDP = "." + "PDP";
private static final String DOT_PAP = "." + "PAP";
@@ -143,7 +141,6 @@ public class HttpClientTest {
HttpClientFactoryInstance.getClientFactory().destroy();
MyGsonProvider.resetSome();
- MyJacksonProvider.resetSome();
}
/**
@@ -351,26 +348,6 @@ public class HttpClientTest {
}
@Test
- public void testHttpPutAuthClient_JacksonProvider() throws Exception {
- final HttpClient client = HttpClientFactoryInstance.getClientFactory()
- .build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT).useHttps(true)
- .allowSelfSignedCerts(true).hostname(LOCALHOST).port(6667).basePath(JUNIT_ECHO)
- .userName("x").password("y").managed(true)
- .serializationProvider(MyJacksonProvider.class.getName()).build());
-
- Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
- final Response response = client.put(HELLO, entity, Collections.emptyMap());
- final String body = HttpClient.getBody(response, String.class);
-
- assertEquals(200, response.getStatus());
- assertEquals(PUT_HELLO, body);
-
- assertTrue(MyJacksonProvider.hasWrittenSome());
-
- assertFalse(MyGsonProvider.hasWrittenSome());
- }
-
- @Test
public void testHttpPutAuthClient_GsonProvider() throws Exception {
final HttpClient client = HttpClientFactoryInstance.getClientFactory()
.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT).useHttps(true)
@@ -386,8 +363,6 @@ public class HttpClientTest {
assertEquals(PUT_HELLO, body);
assertTrue(MyGsonProvider.hasWrittenSome());
-
- assertFalse(MyJacksonProvider.hasWrittenSome());
}
@Test
@@ -488,7 +463,6 @@ public class HttpClientTest {
response = clientPdp.get("test");
assertEquals(500, response.getStatus());
- assertFalse(MyJacksonProvider.hasWrittenSome());
assertFalse(MyGsonProvider.hasWrittenSome());
// try with empty path
@@ -508,75 +482,6 @@ public class HttpClientTest {
assertEquals(200, response.getStatus());
}
- @Test
- public void testHttpAuthClientProps_MixedProviders() throws Exception {
- final Properties httpProperties = new Properties();
-
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES, "GSON,JACKSON");
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, LOCALHOST);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "6666");
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_HTTP_URL_SUFFIX, JUNIT_ECHO);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX, FALSE_STRING);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true");
- httpProperties.setProperty(
- PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
- + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- MyGsonProvider.class.getName());
-
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, LOCALHOST);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "6666");
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_HTTP_URL_SUFFIX, JUNIT_ECHO);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX, FALSE_STRING);
- httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true");
- httpProperties.setProperty(
- PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
- + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- MyJacksonProvider.class.getName());
-
- final List<HttpClient> clients = HttpClientFactoryInstance.getClientFactory().build(httpProperties);
- assertEquals(2, clients.size());
-
- Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
-
- // use gson client
- MyGsonProvider.resetSome();
- MyJacksonProvider.resetSome();
- HttpClient client = HttpClientFactoryInstance.getClientFactory().get("GSON");
-
- Response response = client.put(HELLO, entity, Collections.emptyMap());
- String body = HttpClient.getBody(response, String.class);
-
- assertEquals(200, response.getStatus());
- assertEquals(PUT_HELLO, body);
-
- assertTrue(MyGsonProvider.hasWrittenSome());
- assertFalse(MyJacksonProvider.hasWrittenSome());
-
- // use jackson client
- MyGsonProvider.resetSome();
- MyJacksonProvider.resetSome();
- client = HttpClientFactoryInstance.getClientFactory().get("JACKSON");
-
- response = client.put(HELLO, entity, Collections.emptyMap());
- body = HttpClient.getBody(response, String.class);
-
- assertEquals(200, response.getStatus());
- assertEquals(PUT_HELLO, body);
-
- assertTrue(MyJacksonProvider.hasWrittenSome());
- assertFalse(MyGsonProvider.hasWrittenSome());
- }
-
private HttpClient getAuthHttpClient() throws HttpClientConfigException {
return HttpClientFactoryInstance.getClientFactory()
.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT).useHttps(true)
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
index c367d133..68c9dc8a 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
@@ -91,7 +91,6 @@ public class HttpServerTest {
HttpServletServerFactoryInstance.getServerFactory().destroy();
- MyJacksonProvider.resetSome();
MyGsonProvider.resetSome();
MyYamlProvider.resetSome();
}
@@ -132,38 +131,6 @@ public class HttpServerTest {
}
@Test
- public void testJacksonPackageServer() throws Exception {
- logger.info("-- testJacksonPackageServer() --");
-
- HttpServletServer server = HttpServletServerFactoryInstance.getServerFactory()
- .build("echo", LOCALHOST, port, "/", false, true);
-
- server.setSerializationProvider(MyJacksonProvider.class.getName());
- server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getName());
- server.waitedStart(5000);
-
- assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAlive());
-
- RestEchoReqResp request = new RestEchoReqResp();
- request.setRequestId(100);
- request.setText(SOME_TEXT);
- String reqText = gson.toJson(request);
-
- String response = http(portUrl + JUNIT_ECHO_FULL_REQUEST, JSON_MEDIA, reqText);
- assertEquals(reqText, response);
-
- assertTrue(MyJacksonProvider.hasReadSome());
- assertTrue(MyJacksonProvider.hasWrittenSome());
-
- assertFalse(MyGsonProvider.hasReadSome());
- assertFalse(MyGsonProvider.hasWrittenSome());
-
- assertFalse(MyYamlProvider.hasReadSome());
- assertFalse(MyYamlProvider.hasWrittenSome());
- }
-
- @Test
public void testGsonPackageServer() throws Exception {
logger.info("-- testGsonPackageServer() --");
@@ -188,9 +155,6 @@ public class HttpServerTest {
assertTrue(MyGsonProvider.hasReadSome());
assertTrue(MyGsonProvider.hasWrittenSome());
- assertFalse(MyJacksonProvider.hasReadSome());
- assertFalse(MyJacksonProvider.hasWrittenSome());
-
assertFalse(MyYamlProvider.hasReadSome());
assertFalse(MyYamlProvider.hasWrittenSome());
}
@@ -224,9 +188,6 @@ public class HttpServerTest {
assertFalse(MyGsonProvider.hasReadSome());
assertFalse(MyGsonProvider.hasWrittenSome());
-
- assertFalse(MyJacksonProvider.hasReadSome());
- assertFalse(MyJacksonProvider.hasWrittenSome());
}
@Test
@@ -256,7 +217,6 @@ public class HttpServerTest {
HttpServletServer server = HttpServletServerFactoryInstance.getServerFactory()
.build("echo", LOCALHOST, port, "/", false, true);
- server.setSerializationProvider(MyJacksonProvider.class.getName());
server.addServletClass("/*", RestEchoService.class.getName());
server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
@@ -271,9 +231,6 @@ public class HttpServerTest {
String response = http(portUrl + JUNIT_ECHO_FULL_REQUEST, JSON_MEDIA, reqText);
assertEquals(reqText, response);
- assertTrue(MyJacksonProvider.hasReadSome());
- assertTrue(MyJacksonProvider.hasWrittenSome());
-
assertFalse(MyGsonProvider.hasReadSome());
assertFalse(MyGsonProvider.hasWrittenSome());
@@ -305,9 +262,6 @@ public class HttpServerTest {
assertTrue(MyGsonProvider.hasReadSome());
assertTrue(MyGsonProvider.hasWrittenSome());
- assertFalse(MyJacksonProvider.hasReadSome());
- assertFalse(MyJacksonProvider.hasWrittenSome());
-
assertFalse(MyYamlProvider.hasReadSome());
assertFalse(MyYamlProvider.hasWrittenSome());
}
@@ -340,9 +294,6 @@ public class HttpServerTest {
assertFalse(MyGsonProvider.hasReadSome());
assertFalse(MyGsonProvider.hasWrittenSome());
-
- assertFalse(MyJacksonProvider.hasReadSome());
- assertFalse(MyJacksonProvider.hasWrittenSome());
}
@Test
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java
deleted file mode 100644
index cd922eba..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.common.endpoints.http.server.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import lombok.AccessLevel;
-import lombok.Setter;
-import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider;
-
-/**
- * JacksonJsonProvider that tracks activities.
- */
-public class MyJacksonProvider extends JacksonJsonProvider {
-
- @Setter(AccessLevel.PRIVATE)
- private static boolean readSome = false;
-
- @Setter(AccessLevel.PRIVATE)
- private static boolean wroteSome = false;
-
- /**
- * Constructs the object and resets the variables to indicate that no activity has
- * occurred yet.
- */
- public MyJacksonProvider() {
- super();
- }
-
- @Override
- public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
- MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException {
-
- setReadSome(true);
- return super.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream);
- }
-
- @Override
- public void writeTo(Object object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
- MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException {
-
- setWroteSome(true);
- super.writeTo(object, type, genericType, annotations, mediaType, httpHeaders, entityStream);
- }
-
- public static boolean hasReadSome() {
- return readSome;
- }
-
- public static boolean hasWrittenSome() {
- return wroteSome;
- }
-
- public static void resetSome() {
- MyJacksonProvider.readSome = false;
- MyJacksonProvider.wroteSome = false;
- }
-
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoReqResp.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoReqResp.java
index c211881f..2a3e244d 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoReqResp.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoReqResp.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
package org.onap.policy.common.endpoints.http.server.test;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
@@ -29,12 +28,10 @@ import org.onap.policy.common.gson.annotation.GsonJsonProperty;
* both jackson and gson.
*/
public class RestEchoReqResp {
- @JsonProperty("reqId")
@GsonJsonProperty("reqId")
@SerializedName("reqId")
private int requestId;
- @JsonProperty("textValue")
@GsonJsonProperty("textValue")
@SerializedName("textValue")
private String text;