summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.guard/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-08-27 08:44:12 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-08-27 14:29:09 -0400
commitf456cc5c8e1efd15edb6da718e1428d8fd7c66c5 (patch)
treeb7b4ba3fc6255b056e00f6e203d7ec8fd6a7c194 /models-interactions/model-actors/actor.guard/src
parent68a60a45f27287a4a523c82ef466cbeec655f641 (diff)
Remove Target and TargetType
The dependency should have been removed in the last review to remove SDC and policy-yaml legacy code. It was revealed that usage of TargetType and Type were spread out over the actor code. Those fields are represented differently in the new TOSCA Operational Policy Type, so fields were created to capture those values to be used by actor code. Issue-ID: POLICY-2428 Change-Id: Ib783526a518ca7942ae9e38019bd343639f4dd98 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.guard/src')
-rw-r--r--models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java8
-rw-r--r--models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java22
2 files changed, 15 insertions, 15 deletions
diff --git a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
index 032a0c179..d9ec3ab2c 100644
--- a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
+++ b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
@@ -31,11 +31,11 @@ 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.CallbackManager;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.impl.OperationPartial;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
-import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.slf4j.Logger;
@@ -150,15 +150,15 @@ public class DecisionOperation extends HttpOperation<DecisionResponse> {
// determine the result
String status = response.getStatus();
if (status == null) {
- outcome.setResult(PolicyResult.FAILURE);
+ outcome.setResult(OperationResult.FAILURE);
outcome.setMessage("response contains no status");
return CompletableFuture.completedFuture(outcome);
}
if (PERMIT.equalsIgnoreCase(status) || INDETERMINATE.equalsIgnoreCase(status)) {
- outcome.setResult(PolicyResult.SUCCESS);
+ outcome.setResult(OperationResult.SUCCESS);
} else {
- outcome.setResult(PolicyResult.FAILURE);
+ outcome.setResult(OperationResult.FAILURE);
}
// set the message
diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
index ac6d6c8e3..5502ec6aa 100644
--- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
+++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
@@ -49,8 +49,8 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInst
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.Util;
-import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.simulators.GuardSimulatorJaxRs;
@@ -121,7 +121,7 @@ public class DecisionOperationTest extends BasicHttpOperation {
oper = new DecisionOperation(params, config);
outcome = oper.start().get();
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertTrue(outcome.getResponse() instanceof DecisionResponse);
}
@@ -138,7 +138,7 @@ public class DecisionOperationTest extends BasicHttpOperation {
oper = new DecisionOperation(params, config);
outcome = oper.start().get();
- assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertEquals(OperationResult.FAILURE, outcome.getResult());
assertTrue(outcome.getResponse() instanceof DecisionResponse);
}
@@ -170,7 +170,7 @@ public class DecisionOperationTest extends BasicHttpOperation {
assertTrue(future2.isDone());
outcome = future2.get();
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertEquals(resp, outcome.getResponse());
assertNotNull(oper.getSubRequestId());
@@ -194,7 +194,7 @@ public class DecisionOperationTest extends BasicHttpOperation {
assertTrue(future2.isDone());
outcome = future2.get();
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertNull(outcome.getResponse());
// ensure callbacks were invoked
@@ -237,26 +237,26 @@ public class DecisionOperationTest extends BasicHttpOperation {
// null status
response.setStatus(null);
- verifyOutcome(response, PolicyResult.FAILURE, "response contains no status");
+ verifyOutcome(response, OperationResult.FAILURE, "response contains no status");
// permit, mixed case
response.setStatus("peRmit");
- verifyOutcome(response, PolicyResult.SUCCESS, "peRmit");
+ verifyOutcome(response, OperationResult.SUCCESS, "peRmit");
// indeterminate, mixed case
response.setStatus("inDETerminate");
- verifyOutcome(response, PolicyResult.SUCCESS, "inDETerminate");
+ verifyOutcome(response, OperationResult.SUCCESS, "inDETerminate");
// deny, mixed case
response.setStatus("deNY");
- verifyOutcome(response, PolicyResult.FAILURE, "deNY");
+ verifyOutcome(response, OperationResult.FAILURE, "deNY");
// unknown status
response.setStatus("unknown");
- verifyOutcome(response, PolicyResult.FAILURE, "unknown");
+ verifyOutcome(response, OperationResult.FAILURE, "unknown");
}
- private void verifyOutcome(DecisionResponse response, PolicyResult expectedResult, String expectedMessage) {
+ private void verifyOutcome(DecisionResponse response, OperationResult expectedResult, String expectedMessage) {
oper.postProcessResponse(outcome, BASE_URI, rawResponse, response);
assertEquals(expectedResult, outcome.getResult());
assertEquals(expectedMessage, outcome.getMessage());