summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-23 15:04:46 -0400
committerJim Hahn <jrh3@att.com>2020-03-23 16:03:48 -0400
commit56bc6f68baeb376b99e0dbe4de4790f494dbe3c2 (patch)
tree70e5282b76cbe48aa63bcdd4a88f67c3a4919c44 /models-interactions/model-actors/actorServiceProvider/src
parentef5768de060c6cbf10b06569e00617b052dc7e61 (diff)
New Guard actor request structure is incorrect
Missing various fields within the request structure (e.g., ONAPName). Fixed. In the process, also modified makeGuardPayload() so that it only constructs the inner "guard" JSON object, making it easier for invoking code to modify it. Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7d34a279845bb98425caf66565eab7513d310815
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java11
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java12
2 files changed, 5 insertions, 18 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
index cdbdc2af5..a9d7f4e58 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
@@ -230,14 +230,7 @@ public abstract class OperationPartial implements Operation {
*/
protected CompletableFuture<OperationOutcome> startGuardAsync() {
// get the guard payload
- Map<String, Object> guardPayload = makeGuardPayload();
-
- // wrap it in a "resource"
- Map<String, Object> resource = new LinkedHashMap<>();
- resource.put("guard", guardPayload);
-
- Map<String, Object> payload = new LinkedHashMap<>();
- payload.put("resource", resource);
+ Map<String, Object> payload = makeGuardPayload();
/*
* Note: can't use constants from actor.guard, because that would create a
@@ -255,7 +248,7 @@ public abstract class OperationPartial implements Operation {
protected Map<String, Object> makeGuardPayload() {
Map<String, Object> guard = new LinkedHashMap<>();
guard.put("actor", params.getActor());
- guard.put("recipe", params.getOperation());
+ guard.put("operation", params.getOperation());
guard.put("target", params.getTargetEntity());
guard.put("requestId", params.getRequestId());
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
index b73a3a068..7b8eed59e 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
@@ -324,13 +324,7 @@ public class OperationPartialTest {
Map<String, Object> payload = params.getPayload();
assertNotNull(payload);
- @SuppressWarnings("unchecked")
- Map<String, Object> resource = (Map<String, Object>) payload.get("resource");
- assertNotNull(resource);
-
- @SuppressWarnings("unchecked")
- Map<String, Object> guard = (Map<String, Object>) resource.get("guard");
- assertEquals(oper.makeGuardPayload(), guard);
+ assertEquals(oper.makeGuardPayload(), payload);
}
@Test
@@ -341,13 +335,13 @@ public class OperationPartialTest {
// request id changes, so remove it
payload.remove("requestId");
- assertEquals("{actor=my-actor, recipe=my-operation, target=my-entity}", payload.toString());
+ assertEquals("{actor=my-actor, operation=my-operation, target=my-entity}", payload.toString());
// repeat, but with closed loop name
event.setClosedLoopControlName("my-loop");
payload = oper.makeGuardPayload();
payload.remove("requestId");
- assertEquals("{actor=my-actor, recipe=my-operation, target=my-entity, clname=my-loop}", payload.toString());
+ assertEquals("{actor=my-actor, operation=my-operation, target=my-entity, clname=my-loop}", payload.toString());
}
@Test