Tests must specify serialization provider 91/108291/1
authorJim Hahn <jrh3@att.com>
Tue, 26 May 2020 21:44:44 +0000 (17:44 -0400)
committerJim Hahn <jrh3@att.com>
Tue, 26 May 2020 21:49:46 +0000 (17:49 -0400)
When GSON is made the default serialization provider, several
junits break.  Modified them to specify the GsonJackson provider,
which is what the REST classes use in production.

Issue-ID: POLICY-1526
Change-Id: If1bcb955d7411cf747a14a0bf1dc069b02e2f2ea
Signed-off-by: Jim Hahn <jrh3@att.com>
feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java

index d9e21b8..9049209 100644 (file)
@@ -45,7 +45,9 @@ import org.onap.policy.common.endpoints.http.client.HttpClient;
 import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
 import org.onap.policy.common.endpoints.http.server.HttpServletServer;
 import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
+import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler;
 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
+import org.onap.policy.common.gson.JacksonHandler;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.network.NetworkUtil;
@@ -110,7 +112,10 @@ public class RestLifecycleManagerTest {
                 .build());
 
         HttpServletServer server =
-            HttpServletServerFactoryInstance.getServerFactory().build("lifecycle", "localhost", 8765, "/", true, true);
+                        HttpServletServerFactoryInstance.getServerFactory().build("lifecycle", "localhost", 8765, "/",
+                                        true, true);
+        server.setSerializationProvider(
+                        String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName()));
         server.addServletClass("/*", RestLifecycleManager.class.getName());
         server.waitedStart(5000L);
 
index 1afac16..40af284 100644 (file)
@@ -46,7 +46,9 @@ import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
 import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
+import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler;
 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
+import org.onap.policy.common.gson.JacksonHandler;
 import org.onap.policy.common.utils.network.NetworkUtil;
 import org.onap.policy.drools.persistence.SystemPersistenceConstants;
 import org.onap.policy.drools.system.PolicyControllerConstants;
@@ -126,6 +128,10 @@ public class RestManagerTest {
                 + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
                 + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX,
                 TELEMETRY_PASSWORD);
+        engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+                + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
+                + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
+                String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName()));
 
         /* other properties */
         engineProps.put(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS, UEB_TOPIC);