diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-21 13:43:08 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-10-27 14:55:15 -0400 |
commit | 19ef8b24a98c09a349e6ae7309f535a0135463f6 (patch) | |
tree | d988e5a58865ae6f3a38dcb31e4f195f18e59946 /models-interactions/model-actors/actor.test/src/test | |
parent | 6b29d2c19e288148171db0c0e446e18dcd46effd (diff) |
Make Actors event-agnostic
Removed event and event-context code from the Actor code. Also removed
the preprocessing steps from the Actor code, giving the application
complete control over any preprocessing.
Also fixed a bug wherein the APPC actor was treating the
AAI_RESOURCE_VNF property as a String instead of as a GenericVnf.
Issue-ID: POLICY-2746-actor
Change-Id: Ibc05fe39ffedc0bc461abf10e6a960861ac70119
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.test/src/test')
3 files changed, 2 insertions, 35 deletions
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index 17ddb391a..6cccc5cb7 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java @@ -103,7 +103,6 @@ public class BasicBidirectionalTopicOperationTest { @Test public void testSetUp() { assertNotNull(oper.config); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java index 2327fec00..62c19b80a 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java @@ -64,7 +64,6 @@ public class BasicHttpOperationTest { assertEquals(200, oper.rawResponse.getStatus()); assertNotNull(oper.future); assertEquals(BasicHttpOperation.BASE_URI, oper.client.getBaseUrl()); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java index 60d3ddd31..fe06ad52f 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java @@ -24,19 +24,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; import java.util.Map; -import java.util.concurrent.CompletableFuture; import org.junit.Before; import org.junit.Test; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.resources.ResourceUtils; -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.actorserviceprovider.impl.OperationPartial; public class BasicOperationTest { private static final String ACTOR = "my-actor"; @@ -67,39 +61,24 @@ public class BasicOperationTest { @Test public void testSetUp() throws Exception { assertNotNull(oper.future); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); - assertNotNull(oper.guardOperation); - - CompletableFuture<OperationOutcome> future = oper.service.getActor(OperationPartial.GUARD_ACTOR_NAME) - .getOperator(OperationPartial.GUARD_OPERATION_NAME).buildOperation(null).start(); - assertTrue(future.isDone()); - assertEquals(OperationResult.SUCCESS, future.get().getResult()); } @Test public void testMakeContext() { oper.makeContext(); - assertTrue(oper.enrichment.isEmpty()); - - assertSame(BasicHttpOperation.REQ_ID, oper.event.getRequestId()); - assertSame(oper.enrichment, oper.event.getAai()); - - assertSame(oper.event, oper.context.getEvent()); - - assertSame(oper.context, oper.params.getContext()); assertSame(oper.service, oper.params.getActorService()); assertSame(oper.executor, oper.params.getExecutor()); assertEquals(ACTOR, oper.params.getActor()); assertEquals(OPERATION, oper.params.getOperation()); + assertSame(BasicHttpOperation.REQ_ID, oper.params.getRequestId()); assertEquals(BasicHttpOperation.TARGET_ENTITY, oper.params.getTargetEntity()); } @Test - public void testMakeEnrichment_testMakePayload() { - assertTrue(oper.makeEnrichment().isEmpty()); + public void testMakePayload() { assertNull(oper.makePayload()); } @@ -108,14 +87,4 @@ public class BasicOperationTest { Map<String, Object> map = Util.translateToMap("", ResourceUtils.getResourceAsString("actual.json")); oper.verifyRequest("expected.json", map, "svc-request-id", "vnf-id"); } - - @Test - public void testProvideCqResponse() throws Exception { - AaiCqResponse cq = new AaiCqResponse("{}"); - oper.provideCqResponse(cq); - - assertSame(cq, oper.context.getProperty(AaiCqResponse.CONTEXT_KEY)); - assertTrue(oper.cqFuture.isDone()); - assertEquals(OperationResult.SUCCESS, oper.cqFuture.get().getResult()); - } } |