aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appc
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-29 13:20:06 -0500
committerJim Hahn <jrh3@att.com>2020-02-29 13:22:48 -0500
commitf583aa9031e4f73ae0004bf972ac7a6c3afa4b71 (patch)
treefd4a02ba054118ef79c589a263376b13fe441a0c /models-interactions/model-actors/actor.appc
parentda47a120294d931bde38d821df8979813564e05c (diff)
Add sequence number to Actors
When actors with duplicate names are loaded, a way is needed to determine which should take precedence. Added a sequence number to Actor to facilitate this. Unfortunately, couldn't use OrderedServiceImpl, because it only creates the Actors once, which would break a number of junit tests. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I1ade92f4fe516cfc54bb92d0a3624c67e8981075
Diffstat (limited to 'models-interactions/model-actors/actor.appc')
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java8
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java1
2 files changed, 9 insertions, 0 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java
index 76aa828c1..117bd5c86 100644
--- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java
@@ -81,6 +81,14 @@ public class AppcActorServiceProvider extends BidirectionalTopicActor<Bidirectio
ModifyConfigOperation::new));
}
+ /**
+ * This actor should take precedence over APPC-LCM.
+ */
+ @Override
+ public int getSequenceNumber() {
+ return -1;
+ }
+
// TODO old code: remove lines down to **HERE**
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 99e9d824a..a2bf018b3 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -133,6 +133,7 @@ public class AppcServiceProviderTest extends BasicActor {
@Test
public void testConstructor() {
AppcActorServiceProvider prov = new AppcActorServiceProvider();
+ assertEquals(-1, prov.getSequenceNumber());
// verify that it has the operators we expect
var expected = Arrays.asList(ModifyConfigOperation.NAME).stream().sorted().collect(Collectors.toList());