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/actor.so/src/test | |
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/actor.so/src/test')
-rw-r--r-- | controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java | 149 |
1 files changed, 79 insertions, 70 deletions
diff --git a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java index 5d2134ec1..108962c22 100644 --- a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java @@ -20,7 +20,10 @@ package org.onap.policy.controlloop.actor.so; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; import java.util.UUID; @@ -36,73 +39,79 @@ import org.onap.policy.simulators.Util; import org.onap.policy.so.SORequest; public class TestSOActorServiceProvider { - @BeforeClass - public static void setUpSimulator() { - try { - Util.buildAaiSim(); - } catch (Exception e) { - fail(e.getMessage()); - } - } - - @AfterClass - public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); - } - - @Test - public void testConstructRequest() { - VirtualControlLoopEvent onset = new VirtualControlLoopEvent(); - ControlLoopOperation operation = new ControlLoopOperation(); - - UUID requestID = UUID.randomUUID(); - onset.setRequestID(requestID); - - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - - Policy policy = new Policy(); - policy.setActor("Dorothy"); - policy.setRecipe("GoToOz"); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); - - policy.setActor("SO"); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); - - policy.setRecipe("VF Module Create"); - assertNotNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); - - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:999999"); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); - - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - assertNotNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); - - SORequest request = new SOActorServiceProvider().constructRequest(onset, operation, policy); - - assertEquals(requestID, request.getRequestId()); - assertEquals("policy", request.getRequestDetails().getRequestInfo().getRequestorId()); - assertEquals("RegionOne", request.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId()); - } - - @Test - public void testSendRequest() { - try { - SOActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); - } - catch (Exception e) { - fail("Test should not throw an exception"); - } - } - - @Test - public void testMethods() { - SOActorServiceProvider sp = new SOActorServiceProvider(); - - assertEquals("SO", sp.actor()); - assertEquals(1, sp.recipes().size()); - assertEquals("VF Module Create", sp.recipes().get(0)); - assertEquals(0, sp.recipePayloads("VF Module Create").size()); - } + + /** + * Set up for test class. + */ + @BeforeClass + public static void setUpSimulator() { + try { + Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + /** + * Tear down after test class. + */ + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + @Test + public void testConstructRequest() { + VirtualControlLoopEvent onset = new VirtualControlLoopEvent(); + final ControlLoopOperation operation = new ControlLoopOperation(); + + final UUID requestId = UUID.randomUUID(); + onset.setRequestID(requestId); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + + Policy policy = new Policy(); + policy.setActor("Dorothy"); + policy.setRecipe("GoToOz"); + assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); + + policy.setActor("SO"); + assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); + + policy.setRecipe("VF Module Create"); + assertNotNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:999999"); + assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + assertNotNull(new SOActorServiceProvider().constructRequest(onset, operation, policy)); + + SORequest request = new SOActorServiceProvider().constructRequest(onset, operation, policy); + + assertEquals(requestId, request.getRequestId()); + assertEquals("policy", request.getRequestDetails().getRequestInfo().getRequestorId()); + assertEquals("RegionOne", request.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId()); + } + + @Test + public void testSendRequest() { + try { + SOActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); + } catch (Exception e) { + fail("Test should not throw an exception"); + } + } + + @Test + public void testMethods() { + SOActorServiceProvider sp = new SOActorServiceProvider(); + + assertEquals("SO", sp.actor()); + assertEquals(1, sp.recipes().size()); + assertEquals("VF Module Create", sp.recipes().get(0)); + assertEquals(0, sp.recipePayloads("VF Module Create").size()); + } } |