From b527e4b2dba2d95231934180129d088e1c73c91c Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 25 Feb 2020 13:53:28 -0500 Subject: Remove ActorService singleton The ActorService singleton is not needed at this time, so it was removed. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn Change-Id: I9b4cbb72cedbeb77b39422e71650ab60c9aec7ec --- .../controlloop/actorserviceprovider/ActorService.java | 13 ------------- .../actorserviceprovider/ActorServiceProviderTest.java | 13 ++++--------- .../controlloop/actorserviceprovider/ActorServiceTest.java | 13 +++---------- 3 files changed, 7 insertions(+), 32 deletions(-) (limited to 'models-interactions/model-actors/actorServiceProvider') 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 22c7d3365..82f744421 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 @@ -47,10 +47,6 @@ public class ActorService extends StartConfigPartial name2actor; - private static class LazyHolder { - static final ActorService INSTANCE = new ActorService(); - } - /** * Constructs the object and loads the list of actors. */ @@ -84,15 +80,6 @@ public class ActorService extends StartConfigPartial= 1); - actorService = ActorService.getInstance(); - assertNotNull(actorService); - - Actor dummyActor = ActorService.getInstance().getActors().iterator().next(); - assertNotNull(dummyActor); + Actor dummyActor = actorService.getActor(DummyActor.class.getSimpleName()); assertEquals("DummyActor", dummyActor.actor()); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceTest.java index efc7bb830..989fc8d6e 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceTest.java @@ -214,14 +214,6 @@ public class ActorServiceTest { iter.next(); } - @Test - public void testGetInstance() { - service = ActorService.getInstance(); - assertNotNull(service); - - assertSame(service, ActorService.getInstance()); - } - @Test public void testGetActor() { assertSame(actor1, service.getActor(ACTOR1)); @@ -360,8 +352,9 @@ public class ActorServiceTest { @Test public void testLoadActors() { - assertFalse(ActorService.getInstance().getActors().isEmpty()); - assertNotNull(ActorService.getInstance().getActor("DummyActor")); + ActorService service = new ActorService(); + assertFalse(service.getActors().isEmpty()); + assertNotNull(service.getActor(DummyActor.class.getSimpleName())); } /** -- cgit 1.2.3-korg