From 80f072f60509ef3a35369a60857fe05f6c2a993a Mon Sep 17 00:00:00 2001 From: "Tej, Tarun" Date: Mon, 21 Aug 2017 20:00:50 -0400 Subject: Fixes for sonar critical issues Fixes for critical and blocker issues reported in sonar. Issue-Id: POLICY-113 Change-Id: I50969fe93a94b0497f3fb30864a6c45e63208fe6 Signed-off-by: Tej, Tarun --- .../onap/policy/std/test/AutoClientUEBTest.java | 388 +-------------------- .../org/onap/policy/test/ActionPolicyApiTest.java | 4 +- .../org/onap/policy/test/ConfigBasePolicyTest.java | 4 +- .../onap/policy/test/ConfigFirewallPolicyTest.java | 4 +- .../onap/policy/test/DecisionPolicyApiTest.java | 4 +- .../policy/test/PolicyEngineInterfaceTest.java | 4 +- 6 files changed, 13 insertions(+), 395 deletions(-) (limited to 'PolicyEngineAPI/src/test/java/org/onap') diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java index 94c2ac781..eef76bdd7 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java @@ -119,369 +119,6 @@ public class AutoClientUEBTest { assertNotNull(result); } - /** - * Run the boolean isRunning() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testIsRunning_1() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); - fixture.isRunning = true; - - boolean result = fixture.isRunning(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - assertTrue(result); - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_1() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_2() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_3() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_4() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_5() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_6() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_7() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_8() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_9() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_10() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_11() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_12() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_13() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_14() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_15() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void run() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testRun_16() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.run(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - - /** - * Run the void setAuto(NotificationScheme,NotificationHandler) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetAuto_1() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; - NotificationHandler handler = null; - - fixture.setAuto(scheme, handler); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - /** * Run the void setScheme(NotificationScheme) method test. * @@ -501,26 +138,6 @@ public class AutoClientUEBTest { // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB } - /** - * Run the void terminate() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testTerminate_1() - throws Exception { - AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); - fixture.isRunning = true; - - fixture.terminate(); - - // add additional test code here - // An unexpected exception was thrown in user code while executing this test: - // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB - } - /** * Perform pre-test initialization. * @@ -535,9 +152,10 @@ public class AutoClientUEBTest { // add set up code here List urlList = new LinkedList(); urlList.add("test2.com"); - AutoClientUEB client = new AutoClientUEB("test.com", urlList, "testKey", "testSecret"); + @SuppressWarnings("unused") + AutoClientUEB client = new AutoClientUEB("test.com", urlList, "testKey", "testSecret"); NotificationHandler handler = null; - client.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + AutoClientUEB.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); } /** diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java index a66256432..ae971b405 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java @@ -51,7 +51,7 @@ public class ActionPolicyApiTest extends TestCase { PolicyParameters policyParameters = new PolicyParameters(); @Before - protected void setUp() throws Exception { + public void setUp() throws Exception { try { policyEngine = new PolicyEngine("Test/config_pass.properties"); } catch (PolicyEngineException e) { @@ -80,7 +80,7 @@ public class ActionPolicyApiTest extends TestCase { policyParameters.setRequestID(UUID.randomUUID()); } - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); } diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java index 5d5a076ae..b5fb75c42 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java @@ -64,7 +64,7 @@ public class ConfigBasePolicyTest extends TestCase { * * @see TestCase#setUp() */ - protected void setUp() throws Exception { + public void setUp() throws Exception { try { policyEngine = new PolicyEngine("Test/config_pass.properties"); } catch (PolicyEngineException e) { @@ -102,7 +102,7 @@ public class ConfigBasePolicyTest extends TestCase { * * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); // Add additional tear down code here } diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java index 78ae2493b..c50b3de47 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java @@ -59,7 +59,7 @@ public class ConfigFirewallPolicyTest extends TestCase { * * @see TestCase#setUp() */ - protected void setUp() throws Exception { + public void setUp() throws Exception { try { policyEngine = new PolicyEngine("Test/config_pass.properties"); } catch (PolicyEngineException e) { @@ -101,7 +101,7 @@ public class ConfigFirewallPolicyTest extends TestCase { * * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); // Add additional tear down code here } diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java index a80093470..7c9eb3e10 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java @@ -63,7 +63,7 @@ public class DecisionPolicyApiTest extends TestCase { * * @see TestCase#setUp() */ - protected void setUp() throws Exception { + public void setUp() throws Exception { try { policyEngine = new PolicyEngine("Test/config_pass.properties"); } catch (PolicyEngineException e) { @@ -106,7 +106,7 @@ public class DecisionPolicyApiTest extends TestCase { * * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); // Add additional tear down code here } diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java index be9e0e7e8..2adf3b0bf 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java @@ -104,7 +104,7 @@ public class PolicyEngineInterfaceTest extends TestCase { * * @see TestCase#setUp() */ - protected void setUp() throws Exception { + public void setUp() throws Exception { try { policyEngine = new PolicyEngine("Test/config_pass.properties"); } catch (PolicyEngineException e) { @@ -126,7 +126,7 @@ public class PolicyEngineInterfaceTest extends TestCase { * * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); // Add additional tear down code here } -- cgit 1.2.3-korg