diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-11-04 10:17:03 +0000 |
---|---|---|
committer | Adheli Tavares <adheli.tavares@est.tech> | 2024-11-07 10:17:37 +0000 |
commit | cd9cbc8d353e24bfff76049e187bd5f2216bf71d (patch) | |
tree | 854465a7f91612f05f863bcaa1fc2e80bb538f8e /models-interactions/model-actors/actor.xacml | |
parent | d8c2934b30d287011f95300bc5516f0df9dedfa9 (diff) |
Fix references and organize dependencies after splitting
policy-endpoints and message-bus
Issue-ID: POLICY-5131
Change-Id: I7542caaccc130bc6120cc105d31a1e1e951c8cff
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-interactions/model-actors/actor.xacml')
5 files changed, 53 insertions, 47 deletions
diff --git a/models-interactions/model-actors/actor.xacml/pom.xml b/models-interactions/model-actors/actor.xacml/pom.xml index cedbd958e..ff257c0ad 100644 --- a/models-interactions/model-actors/actor.xacml/pom.xml +++ b/models-interactions/model-actors/actor.xacml/pom.xml @@ -4,7 +4,7 @@ ONAP ================================================================================ Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2023 Nordix Foundation. + Modifications Copyright (C) 2023-2024 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -59,6 +59,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> diff --git a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java index a490def86..f43d892cb 100644 --- a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java +++ b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.CallbackManager; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java index 3dba20162..1ac60d22a 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java @@ -37,9 +37,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -47,7 +47,7 @@ import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; @ExtendWith(MockitoExtension.class) - class ConfigureOperationTest extends BasicHttpOperation { +class ConfigureOperationTest extends BasicHttpOperation { @Mock private Consumer<OperationOutcome> started; @@ -61,17 +61,17 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -80,7 +80,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); operConfig = mock(DecisionConfig.class); @@ -102,7 +102,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @@ -111,13 +111,13 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Tests "success" case with simulator. */ @Test - void testSuccess() throws Exception { + void testSuccess() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().payload(Map.of("policy-id", "test-policy")).retry(0).timeoutSec(5) - .executor(blockingExecutor).build(); + .executor(blockingExecutor).build(); oper = new ConfigureOperation(params, config); outcome = oper.start().get(); @@ -133,13 +133,13 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Tests "failure" case with simulator. */ @Test - void testFailure() throws Exception { + void testFailure() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().payload(Map.of("policy-id", "nonexistent")).retry(0).timeoutSec(5) - .executor(blockingExecutor).build(); + .executor(blockingExecutor).build(); oper = new ConfigureOperation(params, config); outcome = oper.start().get(); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java index fa81836f3..bba06c840 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java @@ -46,9 +46,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -60,7 +60,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.simulators.XacmlSimulatorJaxRs; @ExtendWith(MockitoExtension.class) - class DecisionOperationTest extends BasicHttpOperation { +class DecisionOperationTest extends BasicHttpOperation { private static final List<String> PROPERTY_NAMES = List.of("prop-A", "prop-B"); @Mock @@ -75,17 +75,17 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -94,7 +94,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); @@ -119,12 +119,12 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests with simulator. */ @Test - void testSimulator() throws Exception { + void testSimulator() throws Exception { DecisionParams opParams = DecisionParams.builder().clientName(MY_CLIENT).path("decision").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor) - .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); + .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); oper = new MyOper(params, config); outcome = oper.start().get(); @@ -133,18 +133,18 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @Test - void testGetPropertyNames() { + void testGetPropertyNames() { assertThat(oper.getPropertyNames()).isEqualTo(PROPERTY_NAMES); } @Test - void testStartOperationAsync() throws Exception { + void testStartOperationAsync() throws Exception { CompletableFuture<OperationOutcome> future2 = oper.start(); executor.runAll(100); assertFalse(future2.isDone()); @@ -171,7 +171,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests startOperationAsync() when the guard is disabled. */ @Test - void testStartOperationAsyncDisabled() throws Exception { + void testStartOperationAsyncDisabled() throws Exception { // indicate that it's disabled when(guardConfig.isDisabled()).thenReturn(true); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java index f8b53e8f8..f08c3b884 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java @@ -40,9 +40,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -52,7 +52,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.simulators.XacmlSimulatorJaxRs; @ExtendWith(MockitoExtension.class) - class GuardOperationTest extends BasicHttpOperation { +class GuardOperationTest extends BasicHttpOperation { @Mock private Consumer<OperationOutcome> started; @@ -66,17 +66,17 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -85,7 +85,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); @@ -110,9 +110,9 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests "success" case with simulator. */ @Test - void testSuccess() throws Exception { + void testSuccess() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); @@ -127,13 +127,13 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests "failure" case with simulator. */ @Test - void testFailure() throws Exception { + void testFailure() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor) - .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); + .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); oper = new GuardOperation(params, config); outcome = oper.start().get(); @@ -142,18 +142,18 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @Test - void testGetPropertyNames() { + void testGetPropertyNames() { assertThat(oper.getPropertyNames()).isEmpty(); } @Test - void testMakeRequest() throws CoderException { + void testMakeRequest() throws CoderException { oper.generateSubRequestId(2); verifyPayload("makeReqStd.json", makePayload()); @@ -182,7 +182,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testPostProcessResponse() { + void testPostProcessResponse() { DecisionResponse response = new DecisionResponse(); // null status |