summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-04 16:27:18 -0400
committerJim Hahn <jrh3@att.com>2020-08-06 19:19:46 -0400
commitdeed677c3dc8751209d50e7d35132c929fe6800d (patch)
tree01f3149d4a03206e134d889d50834ae8d141a0ce /models-interactions/model-actors/actor.sdnr/src/test
parent364ef26929f06637bca03dd7bfb5e8ac69b611f8 (diff)
Modify Actors to use properties when provided
Modified the Actors to use properties when the application provides them instead of going to the event context for the data. This sometimes entailed moving code out of the Operation subclass constructor that used or validated the context data. Combined some property names and renamed others. Changed VF Count from AtomicInteger to Integer. Issue-ID: POLICY-2746 Change-Id: Ib8730538309bb77d2f4f6161e9a20a49362d8972 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnr/src/test')
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
index 8ec1e4a20..abce2104e 100644
--- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
@@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
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 static org.mockito.Mockito.mock;
@@ -90,7 +91,7 @@ public class SdnrOperationTest extends BasicSdnrOperation {
@Test
public void testGetPropertyNames() {
- assertThat(operation.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK));
+ assertThat(operation.getPropertyNames()).isEqualTo(List.of(OperationProperties.EVENT_PAYLOAD));
}
@Test
@@ -235,6 +236,24 @@ public class SdnrOperationTest extends BasicSdnrOperation {
checkOutcome();
}
+ @Test
+ public void testGetEventPayload() {
+ // in neither property nor event
+ assertNull(operation.getEventPayload());
+
+ // only in event
+ event.setPayload("valueA2");
+ assertEquals("valueA2", operation.getEventPayload());
+
+ // both - should choose the property
+ operation.setProperty(OperationProperties.EVENT_PAYLOAD, "valueB");
+ assertEquals("valueB", operation.getEventPayload());
+
+ // both - should choose the property, even if it's null
+ operation.setProperty(OperationProperties.EVENT_PAYLOAD, null);
+ assertNull(operation.getEventPayload());
+ }
+
protected void checkOutcome() {
assertSame(outcome, operation.setOutcome(outcome, PolicyResult.SUCCESS, response));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());