From 51a885d5c7d61094c39c9c1942147bed5c9049a3 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 26 Feb 2020 17:14:34 -0500 Subject: Change ActorService config to Map It's a bit of a pain to pass Map> to the ActorService configure() method. Changed it to simply take a Map, as it had been in a previous iteration. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn Change-Id: Ib6e703115027bc4919cc93762ca5b38d254f2b8f --- .../org/onap/policy/controlloop/actor/test/BasicActor.java | 2 +- .../policy/controlloop/actorserviceprovider/ActorService.java | 10 ++++++---- .../controlloop/actorserviceprovider/ActorServiceTest.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'models-interactions/model-actors') diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java index 1b11d0d32..304d4cd44 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java @@ -164,7 +164,7 @@ public class BasicActor { private TopicParameterGroup topics; @NotNull - private Map> actors; + private Map actors; /** * Validates the config. 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 e1b875dd0..b0d70fda0 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 @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; * {@link #start()} to start all of the actors. When finished using the actor service, * invoke {@link #stop()} or {@link #shutdown()}. */ -public class ActorService extends StartConfigPartial>> { +public class ActorService extends StartConfigPartial> { private static final Logger logger = LoggerFactory.getLogger(ActorService.class); private final Map name2actor; @@ -115,16 +115,18 @@ public class ActorService extends StartConfigPartial> parameters) { + protected void doConfigure(Map parameters) { logger.info("configuring actors"); BeanValidationResult valres = new BeanValidationResult("ActorService", parameters); for (Actor actor : name2actor.values()) { String actorName = actor.getName(); - Map subparams = parameters.get(actorName); + Object paramValue = parameters.get(actorName); - if (subparams != null) { + if (paramValue instanceof Map) { + @SuppressWarnings("unchecked") + Map subparams = (Map) paramValue; try { actor.configure(subparams); 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 989fc8d6e..401e0ca58 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 @@ -65,7 +65,7 @@ public class ActorServiceTest { private Map sub2; private Map sub3; private Map sub4; - private Map> params; + private Map params; private ActorService service; -- cgit 1.2.3-korg