From c064f5e9ea7e385ae8c730bb9e9fc5fdd45e25d6 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 13 Feb 2019 10:53:12 -0500 Subject: Add gson handler and tests Added JacksonHandler which provides jackson behavior in gson. Also added classes to facilitate testing of gson serializations. Added compareGson(xxx, Class). Removed trailing spaces from some files. Updated license dates. Replaced incorrect constant with ${xxx} in json test file. Fixed typo in test method name. Change-Id: If05b654d76a4ffc88646f03334be82b32506f28f Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn --- .../policy/common/endpoints/event/comm/TopicEndpointProxy.java | 9 +++++++++ .../common/endpoints/event/comm/bus/internal/BusPublisher.java | 4 +++- .../common/endpoints/http/client/internal/JerseyClient.java | 2 ++ .../endpoints/http/server/internal/JettyServletServer.java | 4 +++- 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'policy-endpoints/src/main/java/org') 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 9912761f..ebed381d 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 @@ -31,6 +31,7 @@ import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSink; import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSource; import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSink; import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSource; +import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -229,35 +230,42 @@ class TopicEndpointProxy implements TopicEndpoint { } @JsonIgnore + @GsonJsonIgnore @Override public List getUebTopicSources() { return UebTopicSource.factory.inventory(); } @JsonIgnore + @GsonJsonIgnore @Override public List getDmaapTopicSources() { return DmaapTopicSource.factory.inventory(); } + @JsonIgnore + @GsonJsonIgnore @Override public List getNoopTopicSources() { return NoopTopicSource.factory.inventory(); } @JsonIgnore + @GsonJsonIgnore @Override public List getUebTopicSinks() { return UebTopicSink.factory.inventory(); } @JsonIgnore + @GsonJsonIgnore @Override public List getDmaapTopicSinks() { return DmaapTopicSink.factory.inventory(); } @JsonIgnore + @GsonJsonIgnore @Override public List getNoopTopicSinks() { return NoopTopicSink.factory.inventory(); @@ -325,6 +333,7 @@ class TopicEndpointProxy implements TopicEndpoint { * @return list of managed endpoints */ @JsonIgnore + @GsonJsonIgnore protected List getEndpoints() { final List 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 9b2e6f5c..1c2d6eeb 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-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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"); @@ -41,6 +41,7 @@ import org.onap.dmaap.mr.client.response.MRPublisherResponse; import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants; import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicSinkFactory; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,6 +73,7 @@ public interface BusPublisher { * The actual Cambria publisher. */ @JsonIgnore + @GsonJsonIgnore protected volatile 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 2287486e..01f9fbe3 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 @@ -41,6 +41,7 @@ import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; +import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -270,6 +271,7 @@ public class JerseyClient implements HttpClient { } @JsonIgnore + @GsonJsonIgnore @Override public String getPassword() { return password; 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 0c52aca8..76ad116f 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -44,6 +44,7 @@ import org.eclipse.jetty.util.security.Credential; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -486,6 +487,7 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable * @return the password */ @JsonIgnore + @GsonJsonIgnore public String getPassword() { return password; } -- cgit 1.2.3-korg