summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appclcm
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-06 18:22:28 -0500
committerJim Hahn <jrh3@att.com>2020-03-06 19:04:13 -0500
commit2440b81428fa4bfa28a51f87c58e12c78ced744b (patch)
tree61ca5668446ed47301ee3b2cca520cc7a83d46aa /models-interactions/model-actors/actor.appclcm
parent3c1fb89886d7ebf2efe1183e92b4ed8191f506b4 (diff)
Add subrequest ID to OperationOutcome
Rule notifications need the subrequest ID to be populated in the OperationOutcome object, where possible. Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ic44320f67ad8df7bcb3000cfa667f95427818e71
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm')
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java5
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java19
2 files changed, 16 insertions, 8 deletions
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
index 749622714..87ff357e9 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
@@ -80,7 +81,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
}
@Override
- protected AppcLcmDmaapWrapper makeRequest(int attempt) {
+ protected Pair<String, AppcLcmDmaapWrapper> makeRequest(int attempt) {
VirtualControlLoopEvent onset = params.getContext().getEvent();
String subRequestId = UUID.randomUUID().toString();
@@ -125,7 +126,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
body.setInput(inputRequest);
dmaapRequest.setBody(body);
- return dmaapRequest;
+ return Pair.of(subRequestId, dmaapRequest);
}
/**
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
index e94eaecd2..8e6a603eb 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.appclcm.AppcLcmBody;
@@ -118,20 +119,26 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
@Test
public void testMakeRequest() {
- AppcLcmDmaapWrapper request = oper.makeRequest(2);
+ Pair<String, AppcLcmDmaapWrapper> result = oper.makeRequest(2);
+ String subreq = result.getLeft();
+ assertNotNull(subreq);
+
+ AppcLcmDmaapWrapper request = result.getRight();
assertEquals("DefaultOperation", request.getBody().getInput().getAction());
AppcLcmCommonHeader header = request.getBody().getInput().getCommonHeader();
assertNotNull(header);
assertEquals(params.getRequestId(), header.getRequestId());
- String subreq = header.getSubRequestId();
- assertNotNull(subreq);
+ assertEquals(subreq, header.getSubRequestId());
assertEquals("{vnf-id=my-target}", request.getBody().getInput().getActionIdentifiers().toString());
// a subsequent request should have a different sub-request id
- assertNotEquals(subreq, oper.makeRequest(2).getBody().getInput().getCommonHeader().getSubRequestId());
+ result = oper.makeRequest(2);
+ assertNotEquals(subreq, result.getLeft());
+ assertNotNull(result.getLeft());
+ assertEquals(result.getLeft(), result.getRight().getBody().getInput().getCommonHeader().getSubRequestId());
}
@Test
@@ -140,7 +147,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
params = params.toBuilder().operation(AppcLcmConstants.OPERATION_CONFIG_MODIFY).build();
oper = new AppcLcmOperation(params, config);
- AppcLcmDmaapWrapper req = oper.makeRequest(2);
+ AppcLcmDmaapWrapper req = oper.makeRequest(2).getRight();
assertEquals("{\"key-A\":\"value-A\"}", req.getBody().getInput().getPayload());
// coder exception
@@ -162,7 +169,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
@Test
public void testGetExpectedKeyValues() {
- AppcLcmDmaapWrapper request = oper.makeRequest(2);
+ AppcLcmDmaapWrapper request = oper.makeRequest(2).getRight();
assertEquals(Arrays.asList(request.getBody().getInput().getCommonHeader().getSubRequestId()),
oper.getExpectedKeyValues(50, request));
}