summaryrefslogtreecommitdiffstats
path: root/models-interactions
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-26 13:37:21 -0500
committerJim Hahn <jrh3@att.com>2020-02-26 13:37:21 -0500
commit7cf4ed6d9a5701be62f50facb4661461a5b15f09 (patch)
tree05f87a0a71fcbd9f6b607907ed900859c1a27c7f /models-interactions
parentaa2e18733fbaa2a0910091eca9677c076c53f454 (diff)
ActorService constructor should be public
Now that ActorService is no longer a singleton, the constructor should be public so other classes can create an instance. Also added a test to verify that each ActorService instance gets its own instances of the actors. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I78cabecc0ca6b355696a5d27489a4e59b6e7c012
Diffstat (limited to 'models-interactions')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java7
2 files changed, 8 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
index 82f744421..e1b875dd0 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
@@ -50,7 +50,7 @@ public class ActorService extends StartConfigPartial<Map<String, Map<String, Obj
/**
* Constructs the object and loads the list of actors.
*/
- protected ActorService() {
+ public ActorService() {
super("actors");
Map<String, Actor> map = new HashMap<>();
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java
index cca0694d7..abf156b58 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java
@@ -23,6 +23,8 @@
package org.onap.policy.controlloop.actorserviceprovider;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -50,5 +52,10 @@ public class ActorServiceProviderTest {
assertEquals(2, dummyActor.recipeTargets(DOROTHY).size());
assertEquals(2, dummyActor.recipePayloads(DOROTHY).size());
+
+ // verify that we get a new actor object if we create a new service
+ Actor dummyActor2 = new ActorService().getActor(DummyActor.class.getSimpleName());
+ assertNotNull(dummyActor2);
+ assertNotSame(dummyActor, dummyActor2);
}
}