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 --- .../common/endpoints/http/server/test/HttpServerTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java') 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 3d80793e..972fc666 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 @@ -39,6 +39,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.utils.gson.GsonTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -232,6 +233,16 @@ public class HttpServerTest { assertFalse(MyJacksonProvider.hasWrittenSome()); } + @Test + public void testSerialize() { + HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", port, "/", false, true); + server.addServletPackage("/*", this.getClass().getPackage().getName()); + server.addFilterClass("/*", TestFilter.class.getCanonicalName()); + + // ensure we can serialize the server + new GsonTestUtils().compareGson(server, HttpServerTest.class); + } + @Test public void testSingleServer() throws Exception { logger.info("-- testSingleServer() --"); -- cgit 1.2.3-korg