From 7e547eaa55920dfbc9691eab33bb728395b50cf2 Mon Sep 17 00:00:00 2001 From: Ravindra Bakkamanthala Date: Mon, 15 May 2017 12:53:18 -0400 Subject: Policy TestSuite Enabled Change-Id: I9f98c7dcdcf98713d73544956d873a84fc82adf7 Signed-off-by: Ravindra Bakkamanthala --- .../policy/std/test/AutoClientEndTest.java | 92 +--------------------- .../org/openecomp/policy/std/test/Handler.java | 12 ++- .../policy/std/test/ManualClientEndTest.java | 78 ++---------------- .../policy/std/test/ManualClientEndUEBTest.java | 43 ---------- 4 files changed, 17 insertions(+), 208 deletions(-) (limited to 'PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test') diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java index 97ff4bde6..86f15992a 100644 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java @@ -20,17 +20,16 @@ package org.openecomp.policy.std.test; -import javax.websocket.Session; +import static org.junit.Assert.assertNotNull; -import org.junit.*; -import org.mockito.Mockito; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openecomp.policy.api.NotificationHandler; import org.openecomp.policy.api.NotificationScheme; import org.openecomp.policy.std.AutoClientEnd; import org.openecomp.policy.std.StdPolicyEngine; -import static org.junit.Assert.*; - /** * The class AutoClientEndTest contains tests for the class {@link AutoClientEnd}. * @@ -86,89 +85,6 @@ public class AutoClientEndTest { assertNotNull(result); } - /** - * Run the void onClose(Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testOnClose() - throws Exception { - AutoClientEnd fixture = new AutoClientEnd(); - Session mockSession = Mockito.mock(Session.class); - fixture.onClose(mockSession); - - // 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.openecomp.policy.std.AutoClientEnd - } - - - /** - * Run the void onError(Session,Throwable) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testOnError() - throws Exception { - AutoClientEnd fixture = new AutoClientEnd(); - Session mockSession = Mockito.mock(Session.class); - Throwable e = new Throwable(); - - fixture.onError(mockSession, e); - - // 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.openecomp.policy.std.AutoClientEnd - } - - /** - * Run the void onMessage(String,Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testOnMessage() - throws Exception { - AutoClientEnd fixture = new AutoClientEnd(); - Session mockSession = Mockito.mock(Session.class); - String message = ""; - //Session session = null; - - fixture.onMessage(message, mockSession); - - // 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.openecomp.policy.std.AutoClientEnd - } - - - /** - * Run the void onOpen(Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testOnOpen() - throws Exception { - AutoClientEnd fixture = new AutoClientEnd(); - Session mockSession = Mockito.mock(Session.class); - - fixture.onOpen(mockSession); - - // 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.openecomp.policy.std.AutoClientEnd - } /** * Run the void setAuto(NotificationScheme,NotificationHandler) method test. diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java index 460fb8883..9879174cb 100644 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java @@ -32,9 +32,13 @@ import org.openecomp.policy.api.PolicyConfigStatus; import org.openecomp.policy.api.PolicyEngine; import org.openecomp.policy.api.PolicyEngineException; import org.openecomp.policy.api.RemovedPolicy; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; public class Handler implements NotificationHandler{ + private static final Logger LOGGER = FlexLogger.getLogger(Handler.class); + @Override public void notificationReceived(PDPNotification notification) { System.out.println("Notification Received..."); @@ -72,9 +76,9 @@ public class Handler implements NotificationHandler{ } } } catch (PolicyEngineException e) { - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); } catch (PolicyConfigException e) { - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); } } } @@ -110,9 +114,9 @@ public class Handler implements NotificationHandler{ } } } catch (PolicyEngineException e) { - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); } catch (PolicyConfigException e) { - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); } } } diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java index d8aecb28c..c44dac606 100644 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java @@ -20,16 +20,16 @@ package org.openecomp.policy.std.test; -import javax.websocket.Session; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; -import org.junit.*; -import org.mockito.Mockito; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openecomp.policy.api.NotificationScheme; import org.openecomp.policy.api.PDPNotification; import org.openecomp.policy.std.ManualClientEnd; -import static org.junit.Assert.*; - /** * The class ManualClientEndTest contains tests for the class {@link ManualClientEnd}. * @@ -50,74 +50,6 @@ public class ManualClientEndTest { // add additional test code here } - /** - * Run the void onClose(Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testOnClose() - throws Exception { - ManualClientEnd fixture = Mockito.mock(ManualClientEnd.class); - Session mockSession = Mockito.mock(Session.class); - - fixture.onClose(mockSession); - - } - - /** - * Run the void onError(Session,Throwable) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testOnError() - throws Exception { - ManualClientEnd fixture = Mockito.mock(ManualClientEnd.class); - Session mockSession = Mockito.mock(Session.class); - Throwable e = new Throwable(); - - fixture.onError(mockSession, e); - } - - /** - * Run the void onMessage(String,Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testOnMessage() - throws Exception { - ManualClientEnd mockclient = Mockito.mock(ManualClientEnd.class); - String message = ""; - Session mockSession = Mockito.mock(Session.class); - - Mockito.doNothing().when(mockclient).onMessage(message,mockSession); - mockclient.onMessage(message,mockSession); - } - - /** - * Run the void onOpen(Session) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testOnOpen() - throws Exception { - ManualClientEnd fixture = Mockito.mock(ManualClientEnd.class); - Session mockSession = Mockito.mock(Session.class); - - fixture.onOpen(mockSession); - - } /** * Run the PDPNotification result(NotificationScheme) method test. diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java index c0c9316e7..f19697597 100644 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java @@ -75,25 +75,6 @@ public class ManualClientEndUEBTest { // add additional test code here } - /** - * Run the void createTopic(String,String,List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testCreateTopic_1() - throws Exception { - String url = "http://test.com"; - String uniqueID = "test"; - List uebURLList = new LinkedList(); - uebURLList.add(url); - - ManualClientEndUEB.createTopic(url, uniqueID, uebURLList); - - } - /** * Run the PDPNotification result(NotificationScheme) method test. * @@ -111,30 +92,6 @@ public class ManualClientEndUEBTest { assertNull(result); } - - /** - * Run the void start(String,List,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testStart_1() - throws Exception { - String url = "http://test.com"; - List uebURLList = new LinkedList(); - String uniqueID = "test"; - uebURLList.add(url); - - ManualClientEndUEB.start(url, uebURLList, uniqueID); - - // 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.openecomp.policy.std.ManualClientEndUEB - } - - /** * Perform post-test clean-up. * -- cgit 1.2.3-korg