diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-06-01 15:14:24 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-06-08 10:27:43 +0100 |
commit | 8a269b8f73838e46323502e671ec88ba09707f8e (patch) | |
tree | 75f1f840ba1884b04bbb1130d0059395845fce7b /participant/participant-impl/participant-impl-policy/src/test/java | |
parent | 20c7487f77d0728d270b2bed34c2c798d17cc12d (diff) |
Convert Policy Participant to SpringBoot Application
Issue-ID: POLICY-3245
Change-Id: Iadacaba3b2a30c67adbe77b8b17debce2f2abb39
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src/test/java')
5 files changed, 60 insertions, 358 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java index abc3e71b8..2a6f4b005 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java @@ -18,117 +18,112 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.handler; +package org.onap.policy.clamp.controlloop.participant.policy.endtoend; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.clamp.controlloop.common.ControlLoopConstants; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData; -import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.Main; -import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyActivator; import org.onap.policy.clamp.controlloop.participant.policy.main.utils.TestListenerUtils; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.utils.services.Registry; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit.jupiter.SpringExtension; -public class TestPolicyHandler { +@ExtendWith(SpringExtension.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@TestPropertySource(properties = "participant.file=src/test/resources/parameters/TestParameters.json") +class ParticipantPolicyTest { - private static ControlLoopUpdateListener clUpdateListener; - private ControlLoopStateChangeListener clStateChangeListener; - private static ParticipantControlLoopUpdate participantControlLoopUpdateMsg; - private ParticipantControlLoopStateChange participantControlLoopStateChangeMsg; - private static final String PARTICIPANTS_ENDPOINT = "participants"; - private static final String ELEMENTS_ENDPOINT = "elements"; + private static final Object lockit = new Object(); private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; - private static final Object lockit = new Object(); - static CommonTestData commonTestData = new CommonTestData(); - - /** - * Setup before class, instantiate Main. - * - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - Registry.newRegistry(); - final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"}; - Main main = new Main(configParameters); - assertTrue(main.isRunning()); - TestListenerUtils.initParticipantHandler(); - - clUpdateListener = new ControlLoopUpdateListener( - PolicyHandler.getInstance() - .getPolicyProvider() - .getIntermediaryApi() - .getParticipantHandler()); - participantControlLoopUpdateMsg = - TestListenerUtils.createControlLoopUpdateMsg(); - participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); - } + + @Autowired + private ParticipantIntermediaryApi participantIntermediaryApi; @Test - public void testUpdatePolicyTypes() throws Exception { + void testUpdatePolicyTypes() { + ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); + // Verify that the ToscaServicetemplate has policy_types assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition().getPolicyTypes()); synchronized (lockit) { + ControlLoopUpdateListener clUpdateListener = + new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored assertEquals("org.onap.PM_Policy", - TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); } @Test - public void testUpdatePolicies() throws Exception { + void testUpdatePolicies() throws Exception { + ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); + // Add policies to the toscaServiceTemplate TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition()); // Verify that the ToscaServicetemplate has policies - assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition() - .getToscaTopologyTemplate().getPolicies()); + assertNotNull( + participantControlLoopUpdateMsg.getControlLoopDefinition().getToscaTopologyTemplate().getPolicies()); synchronized (lockit) { + ControlLoopUpdateListener clUpdateListener = + new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored assertEquals("org.onap.PM_Policy", - TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); } @Test - public void testDeletePoliciesAndPolicyTypes() throws Exception { + void testDeletePoliciesAndPolicyTypes() throws Exception { + ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); + // Add policies to the toscaServiceTemplate TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition()); // Verify that the ToscaServicetemplate has policies - assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition() - .getToscaTopologyTemplate().getPolicies()); + assertNotNull( + participantControlLoopUpdateMsg.getControlLoopDefinition().getToscaTopologyTemplate().getPolicies()); synchronized (lockit) { + ControlLoopUpdateListener clUpdateListener = + new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored assertEquals("org.onap.PM_Policy", - TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); - clStateChangeListener = new ControlLoopStateChangeListener(TestListenerUtils.getParticipantHandler()); - participantControlLoopStateChangeMsg = + ControlLoopStateChangeListener clStateChangeListener = + new ControlLoopStateChangeListener(participantIntermediaryApi.getParticipantHandler()); + ParticipantControlLoopStateChange participantControlLoopStateChangeMsg = TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED); participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED); clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg); // Verify the result of GET participants with what is stored assertEquals("org.onap.PM_Policy", - TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java index dd62dbfc4..8c12a4038 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java @@ -20,79 +20,39 @@ package org.onap.policy.clamp.controlloop.participant.policy.main.parameters; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.io.FileNotFoundException; -import org.apache.commons.io.DirectoryWalker.CancelException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; -import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyCommandLineArguments; import org.onap.policy.common.utils.coder.CoderException; -public class TestParticipantPolicyParameterHandler { +class TestParticipantPolicyParameterHandler { @Test - public void testParameterHandlerNoParameterFile() throws ControlLoopException { - final String[] emptyArgumentString = { "-c", "src/test/resources/parameters/NoParametersFile.json" }; + void testParameterHandlerNoParameterFile() throws ControlLoopException { + final String path = "src/test/resources/parameters/NoParametersFile.json"; - final ParticipantPolicyCommandLineArguments emptyArguments = new ParticipantPolicyCommandLineArguments(); - emptyArguments.parse(emptyArgumentString); - - assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().getParameters(emptyArguments)) + assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().toParticipantDcaeParameters(path)) .hasCauseInstanceOf(CoderException.class) .hasRootCauseInstanceOf(FileNotFoundException.class); } @Test - public void testParameterHandlerInvalidParameters() throws ControlLoopException { - final String[] invalidArgumentString = { "-c", "src/test/resources/parameters/InvalidParameters.json" }; - - final ParticipantPolicyCommandLineArguments invalidArguments = - new ParticipantPolicyCommandLineArguments(); - invalidArguments.parse(invalidArgumentString); + void testParameterHandlerInvalidParameters() throws ControlLoopException { + final String path = "src/test/resources/parameters/InvalidParameters.json"; - assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().getParameters(invalidArguments)) + assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().toParticipantDcaeParameters(path)) .hasMessageStartingWith("error reading parameters from") .hasCauseInstanceOf(CoderException.class); } @Test - public void testParticipantPolicyParameters() throws ControlLoopException { - final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json" }; - - final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments(); - arguments.parse(participantConfigParameters); - + void testParticipantParameterGroup() throws ControlLoopException { + final String path = "src/test/resources/parameters/TestParameters.json"; final ParticipantPolicyParameters parGroup = new ParticipantPolicyParameterHandler() - .getParameters(arguments); - assertTrue(arguments.checkSetConfigurationFilePath()); + .toParticipantDcaeParameters(path); assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName()); } - - @Test - public void testParticipantVersion() throws ControlLoopException { - final String[] participantConfigParameters = { "-v" }; - final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments(); - final String version = arguments.parse(participantConfigParameters); - assertThat(arguments.parse(participantConfigParameters)).startsWith( - "ONAP Tosca defined control loop Participant"); - } - - @Test - public void testParticipantHelp() throws ControlLoopException { - final String[] participantConfigParameters = { "-h" }; - final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments(); - assertThat(arguments.parse(participantConfigParameters)).startsWith("usage:"); - } - - @Test - public void testParticipantInvalidOption() throws ControlLoopException { - final String[] participantConfigParameters = { "-d" }; - final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments(); - assertThatThrownBy(() -> arguments.parse(participantConfigParameters)) - .hasMessageStartingWith("invalid command line arguments specified"); - } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java deleted file mode 100644 index f77b678c0..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.clamp.controlloop.participant.policy.main.startstop; - -import static org.assertj.core.api.Assertions.assertThatCode; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.clamp.controlloop.common.ControlLoopConstants; -import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; -import org.onap.policy.common.utils.resources.MessageConstants; -import org.onap.policy.common.utils.services.Registry; - -public class TestMain { - - /** - * Set up. - */ - @BeforeClass - public static void setUp() { - Registry.newRegistry(); - } - - /** - * Shuts "main" down. - * - * @throws Exception if an error occurs - */ - @AfterClass - public static void tearDown() throws Exception { - // shut down activator - final ParticipantPolicyActivator activator = - Registry.getOrDefault(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, - ParticipantPolicyActivator.class, null); - if (activator != null && activator.isAlive()) { - activator.shutdown(); - } - } - - @Test - public void testMain_Help() { - final String[] configParameters = {"-h"}; - Main main = new Main(configParameters); - assertFalse(main.isRunning()); - } - - @Test - public void testMain_Version() { - final String[] configParameters = {"-v"}; - Main main = new Main(configParameters); - assertFalse(main.isRunning()); - } - - @Test - public void testMain_Valid() { - final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"}; - Main main = new Main(configParameters); - assertTrue(main.isRunning()); - - assertThatCode(() -> main.shutdown()).doesNotThrowAnyException(); - - assertFalse(main.isRunning()); - } - - @Test - public void testMain_NoParameter() { - assertThatConfigParameterThrownException(new String[] {}); - } - - @Test - public void testMain_FilePathNotDefined() { - assertThatConfigParameterThrownException(new String[] {"-c"}); - } - - @Test - public void testMain_TooManyCommand() { - assertThatConfigParameterThrownException(new String[] {"-h", "d"}); - } - - @Test - public void testMain_WrongParameter() { - assertThatConfigParameterThrownException(new String[] {"-d"}); - } - - private void assertThatConfigParameterThrownException(final String[] configParameters) { - assertThatThrownBy(() -> Main.main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class) - .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP)); - } - - @Test - public void testParticipant_NoFileWithThisName() { - assertThatConfigFileThrownException("src/test/resources/parameters/NoFileWithThisName.json"); - } - - @Test - public void testParticipant_NotValidFile() { - assertThatConfigFileThrownException("src/test/resources/parameters"); - } - - @Test - public void testParticipant_NoParameters() { - assertThatConfigFileThrownException("src/test/resources/parameters/NoParameters.json"); - } - - @Test - public void testParticipant_InvalidParameters() { - assertThatConfigFileThrownException("src/test/resources/parameters/InvalidParameters.json"); - } - - @Test - public void testParticipant_WrongJsonFormat() { - assertThatConfigFileThrownException("src/test/resources/parameters/Unreadable.json"); - } - - private void assertThatConfigFileThrownException(final String configFilePath) { - final String[] configParameters = new String[] {"-c", configFilePath}; - assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class) - .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP)); - } -} diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java deleted file mode 100644 index afb0f6cb4..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.clamp.controlloop.participant.policy.main.startstop; - -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameterHandler; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters; -import org.onap.policy.common.utils.services.Registry; - -public class TestParticipantPolicyActivator { - - private static ParticipantPolicyActivator activator; - - /** - * Initializes an activator. - * - * @throws Exception if an error occurs - */ - @BeforeClass - public static void setUp() throws Exception { - Registry.newRegistry(); - final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"}; - final ParticipantPolicyCommandLineArguments arguments = - new ParticipantPolicyCommandLineArguments(participantConfigParameters); - final ParticipantPolicyParameters parGroup = - new ParticipantPolicyParameterHandler().getParameters(arguments); - activator = new ParticipantPolicyActivator(parGroup); - } - - /** - * Method for cleanup after each test. - * - * @throws Exception if an error occurs - */ - @AfterClass - public static void teardown() throws Exception { - // shut down activator - if (activator != null && activator.isAlive()) { - activator.shutdown(); - } - } - - @Test - public void testParticipantActivator() { - activator.start(); - assertTrue(activator.isAlive()); - assertTrue(activator.getParameters().isValid()); - assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, activator.getParameters().getName()); - - // repeat - should throw an exception - assertThatIllegalStateException().isThrownBy(() -> activator.start()); - assertTrue(activator.isAlive()); - assertTrue(activator.getParameters().isValid()); - - activator.shutdown(); - assertFalse(activator.isAlive()); - - // repeat - should throw an exception - assertThatIllegalStateException().isThrownBy(() -> activator.shutdown()); - assertFalse(activator.isAlive()); - } -} diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java index 4f3d6d62c..794b9ff69 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java @@ -29,7 +29,6 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.UUID; -import lombok.Getter; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; @@ -39,10 +38,7 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; -import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; -import org.onap.policy.clamp.controlloop.participant.policy.main.handler.PolicyProvider; import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -61,27 +57,9 @@ public class TestListenerUtils { static CommonTestData commonTestData = new CommonTestData(); private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class); - @Getter - private static ParticipantHandler participantHandler; - private TestListenerUtils() {} /** - * Method to initialize participantHandler. - */ - public static void initParticipantHandler() { - - final ParticipantPolicyParameters participantParameters = commonTestData.toObject( - commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME), - ParticipantPolicyParameters.class); - - PolicyProvider policyProvider = - new PolicyProvider(participantParameters.getIntermediaryParameters()); - - participantHandler = policyProvider.getIntermediaryApi().getParticipantHandler(); - } - - /** * Method to create a controlLoop from a yaml file. * * @return ControlLoop controlloop |