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.vfc/src/test/java/org/onap | |
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.vfc/src/test/java/org/onap')
-rw-r--r-- | controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java | 132 |
1 files changed, 70 insertions, 62 deletions
diff --git a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java index 7919af446..39be472ae 100644 --- a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java +++ b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java @@ -20,7 +20,10 @@ package org.onap.policy.controlloop.actor.vfc; -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; @@ -37,72 +40,77 @@ import org.onap.policy.simulators.Util; import org.onap.policy.vfc.VFCRequest; public class TestVFCActorServiceProvider { - @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(); - - Policy policy = new Policy(); - policy.setRecipe("GoToOz"); - - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - onset.getAAI().put("generic-vnf.vnf-id", "dorothy.gale.1939"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + + /** + * Set up for test class. + */ + @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(); + + Policy policy = new Policy(); + policy.setRecipe("GoToOz"); + + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAAI().put("generic-vnf.vnf-id", "dorothy.gale.1939"); + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - UUID requestID = UUID.randomUUID(); - onset.setRequestID(requestID); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - onset.getAAI().put("generic-vnf.vnf-name", "Dorothy"); + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + UUID requestId = UUID.randomUUID(); + onset.setRequestID(requestId); + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAAI().put("generic-vnf.vnf-name", "Dorothy"); PolicyEngine.manager.getEnvironment().remove("aai.password"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - onset.getAAI().put("service-instance.service-instance-id", ""); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); - - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse())); - - policy.setRecipe("Restart"); - assertNotNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse())); - - VFCRequest request = VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse()); - - assertEquals(requestID, request.getRequestId()); - assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId()); - assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction()); + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAAI().put("service-instance.service-instance-id", ""); + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + + assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse())); + + policy.setRecipe("Restart"); + assertNotNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse())); + + VFCRequest request = + VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse()); + + assertEquals(requestId, request.getRequestId()); + assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId()); + assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction()); } - @Test - public void testMethods() { - VFCActorServiceProvider sp = new VFCActorServiceProvider(); + @Test + public void testMethods() { + VFCActorServiceProvider sp = new VFCActorServiceProvider(); - assertEquals("VFC", sp.actor()); - assertEquals(1, sp.recipes().size()); - assertEquals("Restart", sp.recipes().get(0)); - assertEquals("VM", sp.recipeTargets("Restart").get(0)); - assertEquals(0, sp.recipePayloads("Restart").size()); - } + assertEquals("VFC", sp.actor()); + assertEquals(1, sp.recipes().size()); + assertEquals("Restart", sp.recipes().get(0)); + assertEquals("VM", sp.recipeTargets("Restart").get(0)); + assertEquals(0, sp.recipePayloads("Restart").size()); + } } |