summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-11-30 11:02:31 -0500
committerJim Hahn <jrh3@att.com>2020-11-30 11:04:55 -0500
commitf46e4ec3af461b4036b189fd8d6a18af37acc29d (patch)
tree3d1c033cc963cc0e2216d3d0960f812c921a0d42 /models-interactions/model-actors/actorServiceProvider
parent1dd41890f83702d47c5a957493046433989ef36c (diff)
Remove targetEntity from makeOutcome
The Actor Params class had two flavors of makeOutcome, the second of which took a "targetEntity" parameter. As the Params no longer deal directly with the targetEntity, the second flavor was removed. Issue-ID: POLICY-2804 Change-Id: Ic736dd1c809ce54f6bb7cd37d03bc84cf4a1410c Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider')
-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
7 files changed, 30 insertions, 50 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 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