diff options
author | Jim Hahn <jrh3@att.com> | 2020-02-26 17:14:34 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-02-26 17:14:34 -0500 |
commit | 51a885d5c7d61094c39c9c1942147bed5c9049a3 (patch) | |
tree | 690103c13bb486a5023d95e26c0d6a0223fd3730 /models-interactions/model-actors/actorServiceProvider/src | |
parent | 1bba8b33d25069f61d27bbd125cccccde9947f3d (diff) |
Change ActorService config to Map<String,Object>
It's a bit of a pain to pass Map<String, Map<String,Object>> to
the ActorService configure() method. Changed it to simply take
a Map<String,Object>, as it had been in a previous iteration.
Issue-ID: POLICY-1625
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ib6e703115027bc4919cc93762ca5b38d254f2b8f
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
2 files changed, 7 insertions, 5 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 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<Map<String, Map<String, Object>>> { +public class ActorService extends StartConfigPartial<Map<String, Object>> { private static final Logger logger = LoggerFactory.getLogger(ActorService.class); private final Map<String, Actor> name2actor; @@ -115,16 +115,18 @@ public class ActorService extends StartConfigPartial<Map<String, Map<String, Obj } @Override - protected void doConfigure(Map<String, Map<String, Object>> parameters) { + protected void doConfigure(Map<String, Object> parameters) { logger.info("configuring actors"); BeanValidationResult valres = new BeanValidationResult("ActorService", parameters); for (Actor actor : name2actor.values()) { String actorName = actor.getName(); - Map<String, Object> subparams = parameters.get(actorName); + Object paramValue = parameters.get(actorName); - if (subparams != null) { + if (paramValue instanceof Map) { + @SuppressWarnings("unchecked") + Map<String, Object> subparams = (Map<String, Object>) 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<String, Object> sub2; private Map<String, Object> sub3; private Map<String, Object> sub4; - private Map<String, Map<String, Object>> params; + private Map<String, Object> params; private ActorService service; |