diff options
author | Jim Hahn <jrh3@att.com> | 2019-07-08 10:21:36 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-07-08 15:51:01 -0400 |
commit | a593d0931f9a5785572bb52c5dfae32faa5d8116 (patch) | |
tree | 5b8aac486241678b83afd744868e1bb01d7670a2 /policy-management/src/test | |
parent | f1d4f751519980c7683538b3530f9c3661093c6c (diff) |
Fix drools-pdp due to sonar changes in common
Fixed breakages due to changes made in policy/common to satisfy
sonar.
Change-Id: I26a38340707b2903e089350c31c5dfdb5c019ee0
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management/src/test')
4 files changed, 22 insertions, 24 deletions
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 40646b11..db90bea7 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 @@ -24,9 +24,8 @@ package org.onap.policy.drools.protocol.coders; import static org.junit.Assert.assertTrue; import java.util.Properties; - import org.junit.Test; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; +import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; @@ -82,7 +81,7 @@ public class EventProtocolCoderTest { final Properties noopSinkProperties = new Properties(); noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); - TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder( EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT) diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java index c6209a52..64661845 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java @@ -31,7 +31,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.kie.api.builder.ReleaseId; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; +import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.controller.DroolsController; @@ -231,7 +231,7 @@ public class ProtocolCoderToolsetTest { Properties sinkConfig = new Properties(); sinkConfig.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, JUNIT_PROTOCOL_CODER_TOPIC); - final List<? extends TopicSink> noopTopics = TopicEndpoint.manager.addTopicSinks(sinkConfig); + final List<? extends TopicSink> noopTopics = TopicEndpointManager.getManager().addTopicSinks(sinkConfig); Properties droolsControllerConfig = new Properties(); droolsControllerConfig.put(DroolsProperties.RULES_GROUPID, releaseId.getGroupId()); diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java index 3df9fac2..88712a3b 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java @@ -27,7 +27,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; - import org.apache.http.HttpEntity; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; @@ -46,7 +45,7 @@ import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; +import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.persistence.SystemPersistence; @@ -101,7 +100,7 @@ public class RestManagerTest { /** * Set up. - * + * * @throws IOException throws an IO exception */ @BeforeClass @@ -116,15 +115,15 @@ public class RestManagerTest { + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." - + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_FILTER_CLASSES_SUFFIX, TestAafTelemetryAuthFilter.class.getName()); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." - + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, TELEMETRY_USER); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." - + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEngine.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, TELEMETRY_PASSWORD); @@ -162,12 +161,12 @@ public class RestManagerTest { Properties noopProperties = new Properties(); noopProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, NOOP_TOPIC); noopProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); - TopicEndpoint.manager.addTopics(noopProperties); + TopicEndpointManager.getManager().addTopics(noopProperties); } /** * Tear down. - * + * * @throws IOException IO exception * @throws InterruptedException Interrupted exception */ @@ -175,7 +174,7 @@ public class RestManagerTest { public static void tearDown() throws IOException, InterruptedException { /* Shutdown managed resources */ PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); PolicyEngine.manager.stop(); Thread.sleep(10000L); client.close(); @@ -190,7 +189,7 @@ public class RestManagerTest { /* * DELETE: /engine/controllers/controllerName/drools/facts/session/factType - * + * */ httpDelete = new HttpDelete(HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts/session/factType"); @@ -306,7 +305,7 @@ public class RestManagerTest { httpPut.setEntity(new StringEntity("FOOOO")); response = client.execute(httpPut); logger.info(httpPut.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - + assertEquals(406, response.getStatusLine().getStatusCode()); httpPut.releaseConnection(); @@ -471,7 +470,7 @@ public class RestManagerTest { * GET: /engine/controllers/inventory /engine/controllers/features * /engine/controllers/features/inventory /engine/controllers/features/featureName * /engine/controllers/controllerName - * + * */ httpGet = new HttpGet(HOST_URL + "/engine/controllers/inventory"); response = client.execute(httpGet); @@ -558,7 +557,7 @@ public class RestManagerTest { * /engine/controllers/controllerName/drools/facts/session * /engine/controllers/controllerName/drools/facts/session/factType * /engine/controllers/controllerName/drools/facts/session/query/queriedEntity - * + * */ httpGet = new HttpGet(HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts"); response = client.execute(httpGet); @@ -944,7 +943,7 @@ public class RestManagerTest { /** * Get response body. - * + * * @param response incoming response * @return the body or null */ 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 a586e774..d47c2183 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 @@ -34,9 +34,9 @@ import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; +import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSink; +import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.utils.gson.GsonTestUtils; import org.onap.policy.drools.persistence.SystemPersistence; @@ -209,7 +209,7 @@ public class PolicyEngineTest { final Properties noopSinkProperties = new Properties(); noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); - TopicEndpoint.manager.addTopicSinks(noopSinkProperties).get(0).start(); + TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties).get(0).start(); EventProtocolCoder.manager.addEncoder( EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT) @@ -220,7 +220,7 @@ public class PolicyEngineTest { assertTrue(PolicyEngine.manager.deliver(NOOP_TOPIC, new DroolsConfiguration(ENCODER_GROUP, ENCODER_ARTIFACT, ENCODER_VERSION))); - final TopicSink sink = NoopTopicSink.factory.get(NOOP_TOPIC); + final TopicSink sink = NoopTopicFactories.getSinkFactory().get(NOOP_TOPIC); assertTrue(sink.getRecentEvents()[0].contains(ENCODER_GROUP)); assertTrue(sink.getRecentEvents()[0].contains(ENCODER_ARTIFACT)); @@ -295,7 +295,7 @@ public class PolicyEngineTest { /* Shutdown managed resources */ PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); PolicyEngine.manager.stop(); Thread.sleep(10000L); |