diff options
author | mmis <michael.morris@ericsson.com> | 2018-03-21 15:22:10 +0000 |
---|---|---|
committer | mmis <michael.morris@ericsson.com> | 2018-03-22 13:58:39 +0000 |
commit | af861a9d8e28d49d357ead4a4acad82554510b6f (patch) | |
tree | 8f21c330990242ed4a2b40b13bae811a9affc7fb /controlloop/common/actors/actorServiceProvider | |
parent | 512a8f5b4dc9afaf382dd76531dcbc0667551c58 (diff) |
Removed checkstyle warnings
Removed checkstyle warnings in:
policy/drools-applications/controlloop/common/actors
policy/drools-applications/controlloop/common/eventmanager
policy/drools-applications/controlloop/common/feature-controlloop-utils
Issue-ID: POLICY-705
Change-Id: Iccf99b291bc62bc3ba2082ccdb4c1f9e12107896
Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'controlloop/common/actors/actorServiceProvider')
4 files changed, 104 insertions, 94 deletions
diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java index 45bb9f265..b0b7eb566 100644 --- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java +++ b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ActorService * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,42 +20,53 @@ package org.onap.policy.controlloop.actorserviceprovider; +import com.google.common.collect.ImmutableList; + import java.util.Iterator; import java.util.ServiceLoader; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.collect.ImmutableList; public class ActorService { - private static final Logger logger = LoggerFactory.getLogger(ActorService.class); - private static ActorService service; - - // USed to load actors - private ServiceLoader<Actor> loader; - - private ActorService() { - loader = ServiceLoader.load(Actor.class); - } - - public static synchronized ActorService getInstance() { - if (service == null) { - service = new ActorService(); - } - return service; - } - - public ImmutableList<Actor> actors() { - Iterator<Actor> iter = loader.iterator(); - logger.debug("returning actors"); - while (iter.hasNext()) { - if (logger.isDebugEnabled()) { - logger.debug("Got {}", iter.next().actor()); - } - } - - return ImmutableList.copyOf(loader.iterator()); - } + private static final Logger logger = LoggerFactory.getLogger(ActorService.class); + private static ActorService service; + + // USed to load actors + private ServiceLoader<Actor> loader; + + private ActorService() { + loader = ServiceLoader.load(Actor.class); + } + + /** + * Get the single instance. + * + * @return the instance + */ + public static synchronized ActorService getInstance() { + if (service == null) { + service = new ActorService(); + } + return service; + } + + /** + * Get the actors. + * + * @return the actors + */ + public ImmutableList<Actor> actors() { + Iterator<Actor> iter = loader.iterator(); + logger.debug("returning actors"); + while (iter.hasNext()) { + if (logger.isDebugEnabled()) { + logger.debug("Got {}", iter.next().actor()); + } + } + + return ImmutableList.copyOf(loader.iterator()); + } } diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java index b8e310d61..46cc6f643 100644 --- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java +++ b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Actor * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +23,13 @@ package org.onap.policy.controlloop.actorserviceprovider.spi; import java.util.List; public interface Actor { - - public String actor(); - - public List<String> recipes(); - - public List<String> recipeTargets(String recipe); - - public List<String> recipePayloads(String recipe); + + public String actor(); + + public List<String> recipes(); + + public List<String> recipeTargets(String recipe); + + public List<String> recipePayloads(String recipe); } diff --git a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java index 5bf66bc21..0fd00e12a 100644 --- a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java +++ b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java @@ -26,35 +26,35 @@ import java.util.List; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; public class TestActor implements Actor { - @Override - public String actor() { - return this.getClass().getSimpleName(); - } - - @Override - public List<String> recipes() { - List<String> recipieList = new ArrayList<>(); - recipieList.add("Dorothy"); - recipieList.add("Wizard"); - - return recipieList; - } - - @Override - public List<String> recipeTargets(String recipe) { - List<String> recipieTargetList = new ArrayList<>(); - recipieTargetList.add("Wicked Witch"); - recipieTargetList.add("Wizard of Oz"); - - return recipieTargetList; - } - - @Override - public List<String> recipePayloads(String recipe) { - List<String> recipiePayloadList = new ArrayList<>(); - recipiePayloadList.add("Dorothy"); - recipiePayloadList.add("Toto"); - - return recipiePayloadList; - } + @Override + public String actor() { + return this.getClass().getSimpleName(); + } + + @Override + public List<String> recipes() { + List<String> recipieList = new ArrayList<>(); + recipieList.add("Dorothy"); + recipieList.add("Wizard"); + + return recipieList; + } + + @Override + public List<String> recipeTargets(String recipe) { + List<String> recipieTargetList = new ArrayList<>(); + recipieTargetList.add("Wicked Witch"); + recipieTargetList.add("Wizard of Oz"); + + return recipieTargetList; + } + + @Override + public List<String> recipePayloads(String recipe) { + List<String> recipiePayloadList = new ArrayList<>(); + recipiePayloadList.add("Dorothy"); + recipiePayloadList.add("Toto"); + + return recipiePayloadList; + } } diff --git a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActorServiceProvider.java b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActorServiceProvider.java index 14c2d8297..1544e1ab4 100644 --- a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActorServiceProvider.java +++ b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActorServiceProvider.java @@ -24,31 +24,30 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; public class TestActorServiceProvider { - - @Test - public void testActorServiceProvider() { - ActorService actorService = ActorService.getInstance(); - assertNotNull(actorService); - - assertEquals(1, actorService.actors().size()); - - actorService = ActorService.getInstance(); - assertNotNull(actorService); - - Actor testActor = ActorService.getInstance().actors().get(0); - assertNotNull(testActor); - - assertEquals("TestActor", testActor.actor()); - - assertEquals(2, testActor.recipes().size()); - assertEquals("Dorothy", testActor.recipes().get(0)); - assertEquals("Wizard", testActor.recipes().get(1)); - - assertEquals(2, testActor.recipeTargets("Dorothy").size()); - assertEquals(2, testActor.recipePayloads("Dorothy").size()); - } + + @Test + public void testActorServiceProvider() { + ActorService actorService = ActorService.getInstance(); + assertNotNull(actorService); + + assertEquals(1, actorService.actors().size()); + + actorService = ActorService.getInstance(); + assertNotNull(actorService); + + Actor testActor = ActorService.getInstance().actors().get(0); + assertNotNull(testActor); + + assertEquals("TestActor", testActor.actor()); + + assertEquals(2, testActor.recipes().size()); + assertEquals("Dorothy", testActor.recipes().get(0)); + assertEquals("Wizard", testActor.recipes().get(1)); + + assertEquals(2, testActor.recipeTargets("Dorothy").size()); + assertEquals(2, testActor.recipePayloads("Dorothy").size()); + } } |