aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors')
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java15
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java30
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java25
10 files changed, 35 insertions, 55 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index b5ba5d2ab..3cec9b602 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -167,10 +167,10 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation {
@Test
public void testSetOutcome() {
- outcome = oper.setOutcome(params.makeOutcome(null), OperationResult.SUCCESS, null, null);
+ outcome = oper.setOutcome(params.makeOutcome(), OperationResult.SUCCESS, null, null);
assertNull(outcome.getResponse());
- outcome = oper.setOutcome(params.makeOutcome(null), OperationResult.SUCCESS, null, "{}");
+ outcome = oper.setOutcome(params.makeOutcome(), OperationResult.SUCCESS, null, "{}");
assertTrue(outcome.getResponse() instanceof AaiCqResponse);
}
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
index f83f782d9..9291a3adb 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
@@ -219,7 +219,7 @@ public class GrpcOperationTest {
public void testStartOperationAsyncError() throws Exception {
operation = new GrpcOperation(params, config);
assertThatIllegalArgumentException()
- .isThrownBy(() -> operation.startOperationAsync(1, params.makeOutcome(null)));
+ .isThrownBy(() -> operation.startOperationAsync(1, params.makeOutcome()));
}
private void verifyOperation(TargetType targetType, Runnable loader) {
@@ -240,7 +240,7 @@ public class GrpcOperationTest {
operation.generateSubRequestId(1);
loader.run();
- CompletableFuture<OperationOutcome> future3 = operation.startOperationAsync(1, params.makeOutcome(null));
+ CompletableFuture<OperationOutcome> future3 = operation.startOperationAsync(1, params.makeOutcome());
assertNotNull(future3);
}
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
index 4bfbe40f2..539202c4a 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
@@ -102,7 +102,7 @@ public class BasicOperation {
makeContext();
// get a fresh outcome
- outcome = params.makeOutcome(TARGET_ENTITY);
+ outcome = params.makeOutcome();
}
/**
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 c3d3f6663..6874c5edd 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
@@ -899,7 +899,9 @@ public abstract class OperationPartial implements Operation {
* @return a new operation outcome
*/
protected OperationOutcome makeOutcome() {
- return params.makeOutcome(getProperty(OperationProperties.AAI_TARGET_ENTITY));
+ OperationOutcome outcome = params.makeOutcome();
+ outcome.setTarget(getProperty(OperationProperties.AAI_TARGET_ENTITY));
+ return outcome;
}
/**
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
index 2769697cf..f28777097 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
@@ -52,6 +52,9 @@ import org.slf4j.LoggerFactory;
public class ControlLoopOperationParams {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopOperationParams.class);
+ /*
+ * Optional keys within the "targetEntityIds" map.
+ */
public static final String PARAMS_ENTITY_RESOURCEID = "resourceID";
public static final String PARAMS_ENTITY_MODEL_INVARIANT_ID = "modelInvariantId";
public static final String PARAMS_ENTITY_MODEL_VERSION_ID = "modelVersionId";
@@ -185,21 +188,9 @@ public class ControlLoopOperationParams {
* @return a new operation outcome
*/
public OperationOutcome makeOutcome() {
- return makeOutcome(null);
- }
-
- /**
- * Makes an operation outcome, populating it from the parameters.
- *
- * @param targetEntity the target entity
- *
- * @return a new operation outcome
- */
- public OperationOutcome makeOutcome(String targetEntity) {
OperationOutcome outcome = new OperationOutcome();
outcome.setActor(getActor());
outcome.setOperation(getOperation());
- outcome.setTarget(targetEntity);
return outcome;
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
index 14b1daf49..08d4adfd2 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
@@ -110,7 +110,7 @@ public class BidirectionalTopicOperationTest {
executor = new PseudoExecutor();
params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).executor(executor).build();
- outcome = params.makeOutcome(null);
+ outcome = params.makeOutcome();
response = new MyResponse();
response.setRequestId(REQ_ID);
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
index 587313a46..82aa091c1 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
@@ -182,7 +182,7 @@ public class HttpOperationTest {
params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).requestId(REQ_ID).build();
- outcome = params.makeOutcome(null);
+ outcome = params.makeOutcome();
callback = new AtomicReference<>();
future = new CompletableFuture<>();
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
index 845758a48..45ef29321 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
@@ -100,7 +100,7 @@ public class HttpPollingOperationTest {
when(rawResponse.readEntity(String.class)).thenReturn(response);
params = ControlLoopOperationParams.builder().actor(MY_ACTOR).operation(MY_OPERATION).build();
- outcome = params.makeOutcome(null);
+ outcome = params.makeOutcome();
oper = new MyOper(params, config);
}
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 72a7338d5..f6dbcd85f 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
@@ -283,7 +283,7 @@ public class OperationPartialTest {
public void testIsActorFailed() {
assertFalse(oper.isActorFailed(null));
- OperationOutcome outcome = params.makeOutcome(null);
+ OperationOutcome outcome = params.makeOutcome();
// incorrect outcome
outcome.setResult(OperationResult.SUCCESS);
@@ -343,7 +343,7 @@ public class OperationPartialTest {
@Override
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
- OperationOutcome outcome2 = params.makeOutcome(null);
+ OperationOutcome outcome2 = params.makeOutcome();
outcome2.setResult(OperationResult.SUCCESS);
/*
@@ -480,7 +480,7 @@ public class OperationPartialTest {
public void testIsSameOperation() {
assertFalse(oper.isSameOperation(null));
- OperationOutcome outcome = params.makeOutcome(null);
+ OperationOutcome outcome = params.makeOutcome();
// wrong actor - should be false
outcome.setActor(null);
@@ -523,7 +523,7 @@ public class OperationPartialTest {
// first task completes, others do not
List<Supplier<CompletableFuture<OperationOutcome>>> tasks = new LinkedList<>();
- final OperationOutcome outcome = params.makeOutcome(null);
+ final OperationOutcome outcome = params.makeOutcome();
tasks.add(() -> CompletableFuture.completedFuture(outcome));
tasks.add(() -> new CompletableFuture<>());
@@ -588,7 +588,7 @@ public class OperationPartialTest {
@Test
public void testAllOfArray() throws Exception {
- final OperationOutcome outcome = params.makeOutcome(null);
+ final OperationOutcome outcome = params.makeOutcome();
CompletableFuture<OperationOutcome> future1 = new CompletableFuture<>();
CompletableFuture<OperationOutcome> future2 = new CompletableFuture<>();
@@ -619,7 +619,7 @@ public class OperationPartialTest {
@Test
public void testAllOfList() throws Exception {
- final OperationOutcome outcome = params.makeOutcome(null);
+ final OperationOutcome outcome = params.makeOutcome();
CompletableFuture<OperationOutcome> future1 = new CompletableFuture<>();
CompletableFuture<OperationOutcome> future2 = new CompletableFuture<>();
@@ -708,9 +708,9 @@ public class OperationPartialTest {
// null outcome - takes precedence over a success
List<Supplier<CompletableFuture<OperationOutcome>>> tasks = new LinkedList<>();
- tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome(null)));
+ tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome()));
tasks.add(() -> CompletableFuture.completedFuture(null));
- tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome(null)));
+ tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome()));
CompletableFuture<OperationOutcome> result = oper.allOf(tasks);
assertTrue(executor.runAll(MAX_REQUESTS));
@@ -721,9 +721,9 @@ public class OperationPartialTest {
IllegalStateException except = new IllegalStateException(EXPECTED_EXCEPTION);
tasks.clear();
- tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome(null)));
+ tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome()));
tasks.add(() -> CompletableFuture.failedFuture(except));
- tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome(null)));
+ tasks.add(() -> CompletableFuture.completedFuture(params.makeOutcome()));
result = oper.allOf(tasks);
assertTrue(executor.runAll(MAX_REQUESTS));
@@ -736,7 +736,7 @@ public class OperationPartialTest {
*/
@Test
public void testSequence() throws Exception {
- final OperationOutcome outcome = params.makeOutcome(null);
+ final OperationOutcome outcome = params.makeOutcome();
List<Supplier<CompletableFuture<OperationOutcome>>> tasks = new LinkedList<>();
tasks.add(() -> CompletableFuture.completedFuture(outcome));
@@ -758,7 +758,7 @@ public class OperationPartialTest {
assertSame(outcome, result.get());
// second task fails, third should not run
- OperationOutcome failure = params.makeOutcome(null);
+ OperationOutcome failure = params.makeOutcome();
failure.setResult(OperationResult.FAILURE);
tasks.clear();
tasks.add(() -> CompletableFuture.completedFuture(outcome));
@@ -797,7 +797,7 @@ public class OperationPartialTest {
OperationOutcome expectedOutcome = null;
for (int count = 0; count < results.length; ++count) {
- OperationOutcome outcome = params.makeOutcome(null);
+ OperationOutcome outcome = params.makeOutcome();
outcome.setResult(results[count]);
tasks.add(() -> CompletableFuture.completedFuture(outcome));
@@ -817,7 +817,7 @@ public class OperationPartialTest {
public void testDetmPriority() throws CoderException {
assertEquals(1, oper.detmPriority(null));
- OperationOutcome outcome = params.makeOutcome(null);
+ OperationOutcome outcome = params.makeOutcome();
Map<OperationResult, Integer> map = Map.of(OperationResult.SUCCESS, 0, OperationResult.FAILURE_GUARD, 2,
OperationResult.FAILURE_RETRIES, 3, OperationResult.FAILURE, 4, OperationResult.FAILURE_TIMEOUT, 5,
@@ -1049,7 +1049,7 @@ public class OperationPartialTest {
}
private OperationOutcome makeSuccess() {
- OperationOutcome outcome = params.makeOutcome(null);
+ OperationOutcome outcome = params.makeOutcome();
outcome.setResult(OperationResult.SUCCESS);
return outcome;
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
index fc36c12ba..33904517b 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
@@ -61,7 +61,6 @@ public class ControlLoopOperationParamsTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
- private static final String TARGET_ENTITY = "my-target";
private static final Integer RETRY = 3;
private static final Integer TIMEOUT = 100;
private static final UUID REQ_ID = UUID.randomUUID();
@@ -115,7 +114,7 @@ public class ControlLoopOperationParamsTest {
.retry(RETRY).timeoutSec(TIMEOUT)
.startCallback(starter).build();
- outcome = params.makeOutcome(TARGET_ENTITY);
+ outcome = params.makeOutcome();
}
@Test
@@ -139,25 +138,13 @@ public class ControlLoopOperationParamsTest {
@Test
public void testMakeOutcome() {
- outcome = params.makeOutcome();
- assertNull(outcome.getTarget());
- checkRemainingFields("with actor");
- }
-
- @Test
- public void testMakeOutcomeString() {
- assertEquals(TARGET_ENTITY, outcome.getTarget());
- checkRemainingFields("with actor");
- }
-
- protected void checkRemainingFields(String testName) {
assertEquals(ACTOR, outcome.getActor());
assertEquals(OPERATION, outcome.getOperation());
- assertNull(testName, outcome.getStart());
- assertNull(testName, outcome.getEnd());
- assertNull(testName, outcome.getSubRequestId());
- assertNotNull(testName, outcome.getResult());
- assertNull(testName, outcome.getMessage());
+ assertNull(outcome.getStart());
+ assertNull(outcome.getEnd());
+ assertNull(outcome.getSubRequestId());
+ assertNotNull(outcome.getResult());
+ assertNull(outcome.getMessage());
}
@Test