From 2a1a7893b445ebca44ec8e1b90f84bb66fbca92f Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 8 Jul 2019 10:56:34 -0400 Subject: Fix drools-applications due to sonar changes in common Fixed breakages due to changes made in policy/common to satisfy sonar. Repointed op.pom to correct parent, which allowed the other version to be dropped and properties used in the rest of the pom. Change-Id: Ib19c228c38b7f27fb9e9f508e5cf2566a8939cdd Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn --- .../coordination/CoordinationDirectiveTest.java | 2 -- .../org/onap/policy/coordination/UtilTest.java | 2 -- .../eventmanager/ControlLoopEventManagerTest.java | 4 +-- .../ControlLoopOperationManagerTest.java | 4 +-- .../server/restful/RestControlLoopManagerTest.java | 28 ++++++++-------- .../src/test/resources/op.pom | 9 +++--- .../feature/utils/ControlLoopUtilsFeatureTest.java | 14 ++++---- .../policy/guard/PolicyGuardXacmlHelperTest.java | 6 ++-- .../template/demo/CcvpnBwControlLoopTest.java | 11 +++---- .../policy/template/demo/CcvpnControlLoopTest.java | 11 +++---- .../template/demo/ControlLoopEventCleanupTest.java | 14 ++++---- .../template/demo/ControlLoopFailureTest.java | 27 ++++++++-------- .../policy/template/demo/VcpeControlLoopTest.java | 29 ++++++++--------- .../policy/template/demo/VdnsControlLoopTest.java | 33 ++++++++++--------- .../policy/template/demo/VfcControlLoopTest.java | 25 +++++++-------- .../policy/template/demo/VfwControlLoopTest.java | 37 +++++++++++----------- .../policy/template/demo/VpciControlLoopTest.java | 27 ++++++++-------- .../policy/template/demo/VsonhControlLoopTest.java | 28 ++++++++-------- 18 files changed, 149 insertions(+), 162 deletions(-) (limited to 'controlloop') diff --git a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java index 30606d1fd..47d11dd62 100644 --- a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java +++ b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java @@ -21,12 +21,10 @@ package org.onap.policy.coordination; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.util.Arrays; -import org.assertj.core.api.Assertions; import org.junit.Test; public class CoordinationDirectiveTest { diff --git a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java index 76ae3b41c..21998a7b4 100644 --- a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java +++ b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java @@ -21,11 +21,9 @@ package org.onap.policy.coordination; import static org.assertj.core.api.Assertions.assertThatNullPointerException; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; import org.junit.Test; diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java index 3a4b27770..b7dc1f0d9 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java @@ -54,7 +54,7 @@ import org.onap.policy.aai.Relationship; import org.onap.policy.aai.RelationshipData; import org.onap.policy.aai.RelationshipList; import org.onap.policy.aai.util.AaiException; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.utils.io.Serializer; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopException; @@ -122,7 +122,7 @@ public class ControlLoopEventManagerTest { @AfterClass public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); } /** diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java index 835b4ac82..13fe72517 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java @@ -53,7 +53,7 @@ import org.onap.policy.appclcm.LcmRequest; import org.onap.policy.appclcm.LcmRequestWrapper; import org.onap.policy.appclcm.LcmResponse; import org.onap.policy.appclcm.LcmResponseWrapper; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.utils.io.Serializer; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopException; @@ -155,7 +155,7 @@ public class ControlLoopOperationManagerTest { public static void tearDown() { em.close(); emf.close(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); } @Test diff --git a/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java b/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java index 3d89e5a1e..849b4189b 100644 --- a/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java +++ b/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java @@ -38,7 +38,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.builder.ReleaseId; -import org.onap.policy.common.endpoints.http.client.HttpClient; +import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.persistence.SystemPersistence; import org.onap.policy.drools.properties.DroolsProperties; @@ -100,7 +100,7 @@ public class RestControlLoopManagerTest { PolicyEngine.manager.createPolicyController(CONTROLLER, controllerProperties); PolicyEngine.manager.start(); - HttpClient.factory.build(SystemPersistence.manager.getProperties(CLIENT_CONFIG)); + HttpClientFactoryInstance.getClientFactory().build(SystemPersistence.manager.getProperties(CLIENT_CONFIG)); if (!NetworkUtil.isTcpPortOpen("localhost", 9696, 6, 10000L)) { throw new IllegalStateException("cannot connect to port 9696"); @@ -143,30 +143,30 @@ public class RestControlLoopManagerTest { */ @Test public void testOperationalPolicy() throws IOException { - assertEquals(Status.OK.getStatusCode(), - HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOPS).getStatus()); + assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER) + .get(URL_CONTEXT_PATH_CONTROLLOOPS).getStatus()); - assertEquals(Status.OK.getStatusCode(), - HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP).getStatus()); + assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER) + .get(URL_CONTEXT_PATH_CONTROLLOOP).getStatus()); - assertEquals(Status.NOT_FOUND.getStatusCode(), - HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus()); + assertEquals(Status.NOT_FOUND.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER) + .get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus()); String policyFromFile = new String(Files.readAllBytes(Paths.get(POLICY))); - HttpClient.factory.get(CONTROLLER) - .put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY, Entity.text(policyFromFile), Collections.emptyMap()); + HttpClientFactoryInstance.getClientFactory().get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY, + Entity.text(policyFromFile), Collections.emptyMap()); - assertEquals(Status.OK.getStatusCode(), - HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus()); + assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER) + .get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus()); - String policyFromPdpD = HttpClient.factory.get(CONTROLLER) + String policyFromPdpD = HttpClientFactoryInstance.getClientFactory().get(CONTROLLER) .get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY) .readEntity(String.class); assertEquals(policyFromFile, policyFromPdpD); assertEquals(Status.CONFLICT.getStatusCode(), - HttpClient.factory.get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY, + HttpClientFactoryInstance.getClientFactory().get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY, Entity.text(policyFromFile), Collections.emptyMap()).getStatus()); } diff --git a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom index 91b651cbb..517410d66 100644 --- a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom +++ b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP ================================================================================ - Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,14 +26,13 @@ 4.0.0 - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 2.1.0-SNAPSHOT + org.onap.policy.drools-applications.controlloop.common + common + 1.5.1-SNAPSHOT org.onap.policy.drools.apps.test op - 1.5.0-SNAPSHOT diff --git a/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java b/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java index fd73b6293..899b7ce8e 100644 --- a/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java +++ b/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.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. @@ -23,7 +23,7 @@ package org.onap.policy.drools.apps.controlloop.feature.utils; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.drools.utils.logging.LoggerUtil; import org.onap.policy.simulators.Util; @@ -39,11 +39,11 @@ public class ControlLoopUtilsFeatureTest { LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); final ControlLoopUtilsFeature feature = new ControlLoopUtilsFeature(); feature.afterStart(PolicyEngine.manager); - assertNotNull(HttpServletServer.factory.get(Util.AAISIM_SERVER_PORT)); - assertNotNull(HttpServletServer.factory.get(Util.SOSIM_SERVER_PORT)); - assertNotNull(HttpServletServer.factory.get(Util.SOSIM_SERVER_PORT)); - assertNotNull(HttpServletServer.factory.get(Util.GUARDSIM_SERVER_PORT)); - assertNotNull(HttpServletServer.factory.get(Util.SDNCSIM_SERVER_PORT)); + assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.AAISIM_SERVER_PORT)); + assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SOSIM_SERVER_PORT)); + assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SOSIM_SERVER_PORT)); + assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.GUARDSIM_SERVER_PORT)); + assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SDNCSIM_SERVER_PORT)); } } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java index 19fed30a0..9d252b9f1 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java @@ -27,7 +27,7 @@ import java.util.Properties; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.drools.utils.logging.LoggerUtil; @@ -48,7 +48,7 @@ public class PolicyGuardXacmlHelperTest { LoggerUtil.setLevel("ROOT", "INFO"); LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); org.onap.policy.simulators.Util.buildGuardSim(); // @@ -62,7 +62,7 @@ public class PolicyGuardXacmlHelperTest { */ @AfterClass public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); // Null/ Bad Connection Case PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes( diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnBwControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnBwControlLoopTest.java index 0ac9c48df..42742b261 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnBwControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnBwControlLoopTest.java @@ -32,17 +32,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -90,7 +89,7 @@ public class CcvpnBwControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -137,9 +136,9 @@ public class CcvpnBwControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnControlLoopTest.java index c546248f2..2c2b5d8fb 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/CcvpnControlLoopTest.java @@ -31,17 +31,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -89,7 +88,7 @@ public class CcvpnControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -136,9 +135,9 @@ public class CcvpnControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopEventCleanupTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopEventCleanupTest.java index 37e139074..928bcb80c 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopEventCleanupTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopEventCleanupTest.java @@ -38,9 +38,9 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; -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.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.VirtualControlLoopEvent; @@ -123,7 +123,7 @@ public class ControlLoopEventCleanupTest { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - final List noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + final List noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -177,9 +177,9 @@ public class ControlLoopEventCleanupTest { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); if (saveGuardFlag == null) { PolicyEngine.manager.getEnvironment().remove(GUARD_DISABLED); @@ -202,7 +202,7 @@ public class ControlLoopEventCleanupTest { kieSession.fireAllRules(); List facts = getSessionObjects(); - + // should have events for both control loops assertEquals(2 * CL_OBJECTS, facts.size()); assertTrue(hasEvent(facts, CONTROL_LOOP_NAME)); @@ -362,7 +362,7 @@ public class ControlLoopEventCleanupTest { /** * Determines if the facts contain an event for the given control loop. - * + * * @param facts session facts to be checked * @param controlLoopName name of the control loop of interest * @return {@code true} if the facts contain an event for the given control loop, diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java index 47bbc63ab..6dbe17ee2 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,6 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -43,10 +42,10 @@ import org.onap.policy.appclcm.LcmRequestWrapper; import org.onap.policy.appclcm.LcmResponse; import org.onap.policy.appclcm.LcmResponseWrapper; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -97,7 +96,7 @@ public class ControlLoopFailureTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -148,9 +147,9 @@ public class ControlLoopFailureTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } /** @@ -205,7 +204,7 @@ public class ControlLoopFailureTest implements TopicListener { * a lock for a different */ kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -223,7 +222,7 @@ public class ControlLoopFailureTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate the DRL rules file * @param yamlFile the yaml file containing the policies * @param policyScope scope for policy @@ -248,7 +247,7 @@ public class ControlLoopFailureTest implements TopicListener { /* * Construct a kie session */ - final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, + final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8")); @@ -265,7 +264,7 @@ public class ControlLoopFailureTest implements TopicListener { /* * (non-Javadoc) - * + * * @see org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang.String) */ @Override @@ -371,7 +370,7 @@ public class ControlLoopFailureTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -391,7 +390,7 @@ public class ControlLoopFailureTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession the session containing the facts */ public void dumpFacts(KieSession kieSession) { diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java index d9988b0e4..28706fd66 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,6 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -43,10 +42,10 @@ import org.onap.policy.appclcm.LcmRequestWrapper; import org.onap.policy.appclcm.LcmResponse; import org.onap.policy.appclcm.LcmResponseWrapper; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -97,7 +96,7 @@ public class VcpeControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -147,9 +146,9 @@ public class VcpeControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -176,7 +175,7 @@ public class VcpeControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "vCPEInfraVNF13", true); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -216,7 +215,7 @@ public class VcpeControlLoopTest implements TopicListener { kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -234,7 +233,7 @@ public class VcpeControlLoopTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate the DRL rules file * @param yamlFile the yaml file containing the policies * @param policyScope scope for policy @@ -259,7 +258,7 @@ public class VcpeControlLoopTest implements TopicListener { /* * Construct a kie session */ - final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, + final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8")); @@ -276,7 +275,7 @@ public class VcpeControlLoopTest implements TopicListener { /* * (non-Javadoc) - * + * * @see org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang.String) */ @Override @@ -367,7 +366,7 @@ public class VcpeControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -410,7 +409,7 @@ public class VcpeControlLoopTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession the session containing the facts */ public void dumpFacts(KieSession kieSession) { diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java index 3694423c0..3e5825bc1 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,17 +32,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -91,7 +90,7 @@ public class VdnsControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -136,9 +135,9 @@ public class VdnsControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -165,7 +164,7 @@ public class VdnsControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -204,7 +203,7 @@ public class VdnsControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "error"); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -244,10 +243,10 @@ public class VdnsControlLoopTest implements TopicListener { try { kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); - + } catch (Exception e) { e.printStackTrace(); logger.warn(e.toString()); @@ -268,7 +267,7 @@ public class VdnsControlLoopTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate the DRL rules file * @param yamlFile the yaml file containing the policies * @param policyScope scope for policy @@ -293,7 +292,7 @@ public class VdnsControlLoopTest implements TopicListener { /* * Construct a kie session */ - final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, + final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8")); @@ -310,7 +309,7 @@ public class VdnsControlLoopTest implements TopicListener { /* * (non-Javadoc) - * + * * @see org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang.String) */ @Override @@ -380,7 +379,7 @@ public class VdnsControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -414,7 +413,7 @@ public class VdnsControlLoopTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession the session containing the facts */ public void dumpFacts(KieSession kieSession) { diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java index 4c0d4f37f..fdf27490c 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java @@ -33,17 +33,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -94,7 +93,7 @@ public class VfcControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -112,7 +111,7 @@ public class VfcControlLoopTest implements TopicListener { fail(e.getMessage()); } /* - * + * * Start the kie session */ try { @@ -139,9 +138,9 @@ public class VfcControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -168,7 +167,7 @@ public class VfcControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -219,7 +218,7 @@ public class VfcControlLoopTest implements TopicListener { kieSession.insert(event); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -261,7 +260,7 @@ public class VfcControlLoopTest implements TopicListener { /* * Construct a kie session */ - final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, + final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8")); @@ -278,7 +277,7 @@ public class VfcControlLoopTest implements TopicListener { /* * (non-Javadoc) - * + * * @see org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang.String) */ @Override @@ -346,7 +345,7 @@ public class VfcControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -373,7 +372,7 @@ public class VfcControlLoopTest implements TopicListener { /** * Dumps the kie session facts. - * + * * @param kieSession input session */ public static void dumpFacts(KieSession kieSession) { diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java index d29eabd2a..327a1b4dc 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,6 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -42,10 +41,10 @@ import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -95,7 +94,7 @@ public class VfwControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -147,9 +146,9 @@ public class VfwControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -177,10 +176,10 @@ public class VfwControlLoopTest implements TopicListener { try { kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); - + } catch (Exception e) { e.printStackTrace(); logger.warn(e.toString()); @@ -223,10 +222,10 @@ public class VfwControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "error"); try { kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); - + } catch (Exception e) { e.printStackTrace(); logger.warn(e.toString()); @@ -257,10 +256,10 @@ public class VfwControlLoopTest implements TopicListener { try { kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); - + } catch (Exception e) { e.printStackTrace(); logger.warn(e.toString()); @@ -280,7 +279,7 @@ public class VfwControlLoopTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate the DRL rules file * @param yamlFile the yaml file containing the policies * @param policyScope scope for policy @@ -305,7 +304,7 @@ public class VfwControlLoopTest implements TopicListener { /* * Construct a kie session */ - final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, + final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate, pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8")); @@ -406,7 +405,7 @@ public class VfwControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -426,7 +425,7 @@ public class VfwControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the control loop (onset * message) or end the control loop (abatement message). - * + * * @param policy the controlLoopName comes from the policy * @param requestId the requestId for this event * @param status could be onset or abated @@ -445,7 +444,7 @@ public class VfwControlLoopTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession the session containing the facts */ public void dumpFacts(KieSession kieSession) { diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java index 3247aa58d..3278d4396 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,17 +33,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -98,7 +97,7 @@ public class VpciControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -146,9 +145,9 @@ public class VpciControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -175,7 +174,7 @@ public class VpciControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, true); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -215,7 +214,7 @@ public class VpciControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, false); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -233,7 +232,7 @@ public class VpciControlLoopTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate * the DRL rules file * @param yamlFile @@ -283,7 +282,7 @@ public class VpciControlLoopTest implements TopicListener { /* * (non-Javadoc) - * + * * @see * org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang. * String) @@ -384,7 +383,7 @@ public class VpciControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the * control loop (onset message). - * + * * @param policy * the controlLoopName comes from the policy * @param requestId @@ -423,7 +422,7 @@ public class VpciControlLoopTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession * the session containing the facts */ diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java index 871755db9..3859b7405 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java @@ -3,13 +3,14 @@ * demo * ================================================================================ * Copyright (C) 2019 Wipro Limited Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,17 +33,16 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.UUID; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -97,7 +97,7 @@ public class VsonhControlLoopTest implements TopicListener { "org.onap.policy.controlloop.VirtualControlLoopNotification"); noopSinkProperties.put("noop.sink.topics.POLICY-CL-MGT.events.custom.gson", "org.onap.policy.controlloop.util.Serialization,gsonPretty"); - noopTopics = TopicEndpoint.manager.addTopicSinks(noopSinkProperties); + noopTopics = TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(EventProtocolParams.builder() .groupId("junit.groupId") @@ -145,9 +145,9 @@ public class VsonhControlLoopTest implements TopicListener { kieSession.dispose(); PolicyEngine.manager.stop(); - HttpServletServer.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); PolicyController.factory.shutdown(); - TopicEndpoint.manager.shutdown(); + TopicEndpointManager.getManager().shutdown(); } @Test @@ -174,7 +174,7 @@ public class VsonhControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, true); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -214,7 +214,7 @@ public class VsonhControlLoopTest implements TopicListener { sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, false); kieSession.fireUntilHalt(); - + // allow object clean-up kieSession.fireAllRules(); @@ -232,7 +232,7 @@ public class VsonhControlLoopTest implements TopicListener { /** * This method will start a kie session and instantiate the Policy Engine. - * + * * @param droolsTemplate * the DRL rules file * @param yamlFile @@ -282,7 +282,7 @@ public class VsonhControlLoopTest implements TopicListener { /* * (non-Javadoc) - * + * * @see * org.onap.policy.drools.PolicyEngineListener#newEventNotification(java.lang. * String) @@ -387,7 +387,7 @@ public class VsonhControlLoopTest implements TopicListener { /** * This method is used to simulate event messages from DCAE that start the * control loop (onset message). - * + * * @param policy * the controlLoopName comes from the policy * @param requestId @@ -429,7 +429,7 @@ public class VsonhControlLoopTest implements TopicListener { /** * This method will dump all the facts in the working memory. - * + * * @param kieSession * the session containing the facts */ -- cgit 1.2.3-korg