diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2020-02-21 15:37:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-21 15:37:22 +0000 |
commit | 5e83ac6cd9c5276bfe861010b7879615da255fdb (patch) | |
tree | 3da47ae68758073782fc1ecd344bb158678cfe68 /models-interactions/model-actors/actor.sdnc/src | |
parent | 4d99fa993f76b9bc271dff7dbe336b281800403e (diff) | |
parent | 467247c7970f9ae83464d78929ed970bbf03c593 (diff) |
Merge "More actor clean-up"
Diffstat (limited to 'models-interactions/model-actors/actor.sdnc/src')
8 files changed, 26 insertions, 29 deletions
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java index 26cdfada3..ff1881302 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java @@ -23,8 +23,8 @@ package org.onap.policy.controlloop.actor.sdnc; import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; +import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.sdnc.SdncHealRequest; import org.onap.policy.sdnc.SdncHealRequestHeaderInfo; import org.onap.policy.sdnc.SdncHealRequestInfo; @@ -49,10 +49,10 @@ public class BandwidthOnDemandOperation extends SdncOperation { * Constructs the object. * * @param params operation parameters - * @param operator operator that created this operation + * @param config configuration for this operation */ - public BandwidthOnDemandOperation(ControlLoopOperationParams params, HttpOperator operator) { - super(params, operator); + public BandwidthOnDemandOperation(ControlLoopOperationParams params, HttpConfig config) { + super(params, config); } @Override diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java index f255f3e84..753da1bb1 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java @@ -23,8 +23,8 @@ package org.onap.policy.controlloop.actor.sdnc; import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; +import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.sdnc.SdncHealNetworkInfo; import org.onap.policy.sdnc.SdncHealRequest; import org.onap.policy.sdnc.SdncHealRequestHeaderInfo; @@ -45,10 +45,10 @@ public class RerouteOperation extends SdncOperation { * Constructs the object. * * @param params operation parameters - * @param operator operator that created this operation + * @param config configuration for this operation */ - public RerouteOperation(ControlLoopOperationParams params, HttpOperator operator) { - super(params, operator); + public RerouteOperation(ControlLoopOperationParams params, HttpConfig config) { + super(params, config); } @Override diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java index 99a4fdadd..cd9ad1ac2 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java @@ -31,6 +31,7 @@ import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpActor; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; +import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpActorParams; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.sdnc.SdncHealNetworkInfo; import org.onap.policy.sdnc.SdncHealRequest; @@ -46,7 +47,7 @@ import org.onap.policy.sdnc.SdncRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SdncActorServiceProvider extends HttpActor { +public class SdncActorServiceProvider extends HttpActor<HttpActorParams> { private static final Logger logger = LoggerFactory.getLogger(SdncActorServiceProvider.class); public static final String NAME = "SDNC"; @@ -75,13 +76,10 @@ public class SdncActorServiceProvider extends HttpActor { * Constructs the object. */ public SdncActorServiceProvider() { - super(NAME); + super(NAME, HttpActorParams.class); - addOperator(HttpOperator.makeOperator(NAME, RerouteOperation.NAME, - RerouteOperation::new)); - - addOperator(HttpOperator.makeOperator(NAME, BandwidthOnDemandOperation.NAME, - BandwidthOnDemandOperation::new)); + addOperator(new HttpOperator(NAME, RerouteOperation.NAME, RerouteOperation::new)); + addOperator(new HttpOperator(NAME, BandwidthOnDemandOperation.NAME, BandwidthOnDemandOperation::new)); } diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java index f6cacd97b..a83faa724 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java @@ -29,8 +29,8 @@ import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; +import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncResponse; @@ -43,10 +43,10 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> { * Constructs the object. * * @param params operation parameters - * @param operator operator that created this operation + * @param config configuration for this operation */ - public SdncOperation(ControlLoopOperationParams params, HttpOperator operator) { - super(params, operator, SdncResponse.class); + public SdncOperation(ControlLoopOperationParams params, HttpConfig config) { + super(params, config, SdncResponse.class); } /** @@ -73,7 +73,7 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> { // @formatter:off return handleResponse(outcome, url, - callback -> getOperator().getClient().post(callback, makePath(), entity, headers)); + callback -> getClient().post(callback, makePath(), entity, headers)); // @formatter:on } diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java index e8490627e..ade25133c 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java @@ -42,7 +42,7 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation { @Before public void setUp() throws Exception { super.setUp(); - oper = new BandwidthOnDemandOperation(params, operator); + oper = new BandwidthOnDemandOperation(params, config); } @Test diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index c1278f1b1..50e97496a 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -32,12 +32,11 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; -import java.util.function.BiFunction; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; -import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; +import org.onap.policy.controlloop.actorserviceprovider.impl.OperationMaker; +import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncResponse; @@ -76,7 +75,7 @@ public abstract class BasicSdncOperation extends BasicHttpOperation<SdncRequest> * Initializes mocks and sets up. */ public void setUp() throws Exception { - super.setUp(); + super.setUpBasic(); response = new SdncResponse(); @@ -119,12 +118,12 @@ public abstract class BasicSdncOperation extends BasicHttpOperation<SdncRequest> * @param expectedText text expected in the exception message */ protected void verifyMissing(String fieldName, String expectedText, - BiFunction<ControlLoopOperationParams, HttpOperator, SdncOperation> maker) { + OperationMaker<HttpConfig, SdncOperation> maker) { makeContext(); enrichment.remove(fieldName); - SdncOperation oper = maker.apply(params, operator); + SdncOperation oper = maker.apply(params, config); assertThatIllegalArgumentException().isThrownBy(() -> Whitebox.invokeMethod(oper, "makeRequest", 1)) .withMessageContaining("missing").withMessageContaining(expectedText); diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java index f0836b939..30ddd8781 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java @@ -42,7 +42,7 @@ public class RerouteOperationTest extends BasicSdncOperation { @Before public void setUp() throws Exception { super.setUp(); - oper = new RerouteOperation(params, operator); + oper = new RerouteOperation(params, config); } @Test diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java index e0825e13b..b87ed2c80 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java @@ -42,7 +42,7 @@ public class SdncOperationTest extends BasicSdncOperation { public void setUp() throws Exception { super.setUp(); - oper = new SdncOperation(params, operator) { + oper = new SdncOperation(params, config) { @Override protected SdncRequest makeRequest(int attempt) { return request; |