From 96b3a0059c5900f33d8c1b4f4295f6d84177e2bf Mon Sep 17 00:00:00 2001 From: "kris.jinka" Date: Thu, 15 Nov 2018 09:51:02 +0900 Subject: Modify event (en)coder to use param objs Use builder object to send params to event protocol coder and encoder methods to fix sonar issue Issue-ID: POLICY-1251 Change-Id: I6ca5823e1aa35d9aa3a05eb23ac159947efdde23 Signed-off-by: kris.jinka --- .../drools/protocol/coders/EventProtocolCoderTest.java | 9 ++++++--- .../java/org/onap/policy/drools/system/PolicyEngineTest.java | 12 +++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'policy-management/src/test') diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java index d6330cd5..ec1b9994 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java @@ -84,9 +84,12 @@ public class EventProtocolCoderTest { TopicEndpoint.manager.addTopicSinks(noopSinkProperties); - EventProtocolCoder.manager.addEncoder(ENCODER_GROUP, ENCODER_ARTIFACT, NOOP_TOPIC, - DroolsConfiguration.class.getCanonicalName(), new JsonProtocolFilter(), null, null, - DroolsConfiguration.class.getName().hashCode()); + EventProtocolCoder.manager.addEncoder( + EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT) + .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getCanonicalName()) + .protocolFilter(new JsonProtocolFilter()).customGsonCoder(null) + .customJacksonCoder(null) + .modelClassLoaderHash(DroolsConfiguration.class.getName().hashCode())); final String json = EventProtocolCoder.manager.encode(NOOP_TOPIC, new DroolsConfiguration(ENCODER_GROUP, ENCODER_ARTIFACT, ENCODER_VERSION)); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java index cd93d94c..4a2767a8 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java @@ -41,10 +41,9 @@ import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.persistence.SystemPersistence; import org.onap.policy.drools.properties.DroolsProperties; import org.onap.policy.drools.protocol.coders.EventProtocolCoder; +import org.onap.policy.drools.protocol.coders.EventProtocolParams; import org.onap.policy.drools.protocol.coders.JsonProtocolFilter; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; -import org.onap.policy.drools.system.PolicyController; -import org.onap.policy.drools.system.PolicyEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -205,9 +204,12 @@ public class PolicyEngineTest { TopicEndpoint.manager.addTopicSinks(noopSinkProperties).get(0).start(); - EventProtocolCoder.manager.addEncoder(ENCODER_GROUP, ENCODER_ARTIFACT, NOOP_TOPIC, - DroolsConfiguration.class.getCanonicalName(), new JsonProtocolFilter(), null, null, - DroolsConfiguration.class.getName().hashCode()); + EventProtocolCoder.manager.addEncoder( + EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT) + .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getCanonicalName()) + .protocolFilter(new JsonProtocolFilter()).customGsonCoder(null) + .customJacksonCoder(null) + .modelClassLoaderHash(DroolsConfiguration.class.getName().hashCode())); assertTrue(PolicyEngine.manager.deliver(NOOP_TOPIC, new DroolsConfiguration(ENCODER_GROUP, ENCODER_ARTIFACT, ENCODER_VERSION))); -- cgit 1.2.3-korg