From 91d04c64771832a0b8815ffbe1f0f9920320d94d Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 14 Feb 2017 19:41:00 -0500 Subject: Initial OpenECOMP policy/engine commit Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e Signed-off-by: Pamela Dragosh --- .../policy/std/test/AutoClientEndTest.java | 312 +++++ .../policy/std/test/AutoClientUEBTest.java | 569 ++++++++ .../org/openecomp/policy/std/test/Handler.java | 120 ++ .../policy/std/test/ManualClientEndTest.java | 195 +++ .../policy/std/test/ManualClientEndUEBTest.java | 164 +++ .../openecomp/policy/std/test/MatchStoreTest.java | 774 +++++++++++ .../org/openecomp/policy/std/test/MatchesTest.java | 216 +++ .../policy/std/test/NotificationStoreTest.java | 359 +++++ .../policy/std/test/NotificationUnMarshalTest.java | 256 ++++ .../policy/std/test/StdLoadedPolicyTest.java | 314 +++++ .../policy/std/test/StdPDPNotificationTest.java | 311 +++++ .../std/test/StdPolicyChangeResponseTest.java | 166 +++ .../policy/std/test/StdPolicyConfigTest.java | 821 +++++++++++ .../policy/std/test/StdPolicyEngineTest.java | 1002 ++++++++++++++ .../policy/std/test/StdPolicyResponseTest.java | 348 +++++ .../policy/std/test/StdRemovedPolicyTest.java | 206 +++ .../openecomp/policy/std/test/StdStatusTest.java | 1433 ++++++++++++++++++++ .../openecomp/policy/std/test/package-info.java | 27 + 18 files changed, 7593 insertions(+) create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyEngineTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java (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 new file mode 100644 index 000000000..af36d6d71 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java @@ -0,0 +1,312 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import javax.websocket.Session; + +import org.junit.*; +import org.mockito.Mockito; +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}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class AutoClientEndTest { + /** + * Run the AutoClientEnd() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testAutoClientEnd_1() + throws Exception { + AutoClientEnd result = new AutoClientEnd(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the boolean getStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetStatus_1() + throws Exception { + + boolean result = AutoClientEnd.getStatus(); + + assertNotNull(result); + } + + /** + * Run the String getURL() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetURL_1() + throws Exception { + + String result = AutoClientEnd.getURL(); + + // 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 + 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. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetAuto() + throws Exception { + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + NotificationHandler handler = null; + + AutoClientEnd.setAuto(scheme, handler); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.ExceptionInInitializerError + // at org.apache.log4j.Logger.getLogger(Logger.java:104) + // at org.openecomp.policy.std.AutoClientEnd.(AutoClientEnd.java:39) + } + + /** + * Run the void setScheme(NotificationScheme) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetScheme() + throws Exception { + + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + AutoClientEnd.setScheme(scheme); + + } + + /** + * Run the void start(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStart() + throws Exception { + String url = "http://test.com"; + + AutoClientEnd.start(url); + + // 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 start(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStart_2() + throws Exception { + String url = null; + + AutoClientEnd.start(url); + + // 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 stop() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStop_1() + throws Exception { + + AutoClientEnd.stop(); + + // 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 + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add set up code here + StdPolicyEngine policyEngine = new StdPolicyEngine("Test/config_pass.properties"); + + NotificationHandler handler = policyEngine.getNotificationHandler(); + AutoClientEnd.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + AutoClientEnd.start("http://testurl.com"); + + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(AutoClientEndTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java new file mode 100644 index 000000000..f6760056f --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java @@ -0,0 +1,569 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.*; +import org.openecomp.policy.api.NotificationHandler; +import org.openecomp.policy.api.NotificationScheme; +import org.openecomp.policy.std.AutoClientEnd; +import org.openecomp.policy.std.AutoClientUEB; +import org.openecomp.policy.std.StdPolicyEngine; + +import static org.junit.Assert.*; + +/** + * The class AutoClientUEBTest contains tests for the class {@link AutoClientUEB}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class AutoClientUEBTest { + /** + * Run the AutoClientUEB(String,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testAutoClientUEB_1() + throws Exception { + String url = ""; + List uebURLList = new LinkedList(); + + AutoClientUEB result = new AutoClientUEB(url, uebURLList); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.ExceptionInInitializerError + // at org.apache.log4j.Logger.getLogger(Logger.java:104) + // at org.openecomp.policy.std.AutoClientUEB.(AutoClientUEB.java:39) + assertNotNull(result); + } + + /** + * Run the String getNotficationType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetNotficationType_1() + throws Exception { + + String result = AutoClientUEB.getNotficationType(); + + // 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.AutoClientUEB + assertNull(result); + } + + /** + * Run the boolean getStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetStatus_1() + throws Exception { + + boolean result = AutoClientUEB.getStatus(); + + // 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.AutoClientUEB + assertFalse(result); + } + + /** + * Run the String getURL() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetURL_1() + throws Exception { + + String result = AutoClientUEB.getURL(); + + // 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.AutoClientUEB + 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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.policy.std.AutoClientUEB + } + + /** + * Run the void setScheme(NotificationScheme) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetScheme_1() + throws Exception { + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + AutoClientUEB.setScheme(scheme); + + // 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.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.openecomp.policy.std.AutoClientUEB + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add set up code here + StdPolicyEngine policyEngine = new StdPolicyEngine("Test/config_pass.properties"); + List urlList = new LinkedList(); + urlList.add("test2.com"); + AutoClientUEB client = new AutoClientUEB("test.com", urlList); + NotificationHandler handler = null; + //AutoClientEnd.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + client.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(AutoClientUEBTest.class); + } +} 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 new file mode 100644 index 000000000..e1e398e1a --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java @@ -0,0 +1,120 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Collection; + +import org.openecomp.policy.api.LoadedPolicy; +import org.openecomp.policy.api.NotificationHandler; +import org.openecomp.policy.api.NotificationType; +import org.openecomp.policy.api.PDPNotification; +import org.openecomp.policy.api.PolicyConfig; +import org.openecomp.policy.api.PolicyConfigException; +import org.openecomp.policy.api.PolicyConfigStatus; +import org.openecomp.policy.api.PolicyEngine; +import org.openecomp.policy.api.PolicyEngineException; +import org.openecomp.policy.api.RemovedPolicy; + +public class Handler implements NotificationHandler{ + + @Override + public void notificationReceived(PDPNotification notification) { + System.out.println("Notification Received..."); + System.out.println(notification.getNotificationType()); + if(notification.getNotificationType().equals(NotificationType.REMOVE)){ + System.out.println("Removed Policies: \n"); + for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){ + System.out.println(removedPolicy.getPolicyName()); + System.out.println(removedPolicy.getVersionNo()); + } + }else if(notification.getNotificationType().equals(NotificationType.UPDATE)){ + System.out.println("Updated Policies: \n"); + for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){ + System.out.println("policyName : " + updatedPolicy.getPolicyName()); + System.out.println("policyVersion :" + updatedPolicy.getVersionNo()); + if(updatedPolicy.getPolicyName().contains(".Config_")){ + System.out.println("Matches: " + updatedPolicy.getMatches()); + System.out.println("UpdateType: "+ updatedPolicy.getUpdateType()); + // Checking the Name is correct or not. + try { + PolicyEngine policyEngine = new PolicyEngine("config.properties"); + Collection policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName()); + for(PolicyConfig policyConfig: policyConfigs){ + if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){ + System.out.println("Policy Retrieved with this Name notified. "); + }else{ + System.err.println("\n\n Fail to retrieve policy !!!!\n\n"); + } + // Also Test this case. + if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){ + System.out.println("Policy Name is good. "); + }else{ + System.err.println("\n\n Fail to check Name \n\n"); + } + } + } catch (PolicyEngineException e) { + e.printStackTrace(); + } catch (PolicyConfigException e) { + e.printStackTrace(); + } + } + } + }else if(notification.getNotificationType().equals(NotificationType.BOTH)){ + System.out.println("Both updated and Removed Notification: \n"); + System.out.println("Removed Policies: \n"); + for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){ + System.out.println(removedPolicy.getPolicyName()); + System.out.println(removedPolicy.getVersionNo()); + } + System.out.println("Updated Policies: \n"); + for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){ + System.out.println("policyName : " + updatedPolicy.getPolicyName()); + System.out.println("policyVersion :" + updatedPolicy.getVersionNo()); + System.out.println("Matches: " + updatedPolicy.getMatches()); + System.out.println("UpdateType: "+ updatedPolicy.getUpdateType()); + // Checking the Name is correct or not. + try { + PolicyEngine policyEngine = new PolicyEngine("config.properties"); + Collection policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName()); + for(PolicyConfig policyConfig: policyConfigs){ + if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){ + System.out.println("Policy Retrieved with this Name notified. "); + }else{ + System.err.println("\n\n Fail to retrieve policy !!!!\n\n"); + } + // Also Test this case. + if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){ + System.out.println("Policy Name is good. "); + }else{ + System.err.println("\n\n Fail to check Name \n\n"); + } + } + } catch (PolicyEngineException e) { + e.printStackTrace(); + } catch (PolicyConfigException e) { + e.printStackTrace(); + } + } + } + } + + +} 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 new file mode 100644 index 000000000..21cb14f6a --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java @@ -0,0 +1,195 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import javax.websocket.Session; + +import org.junit.*; +import org.mockito.Mockito; +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}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class ManualClientEndTest { + /** + * Run the ManualClientEnd() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testManualClientEnd_1() + throws Exception { + ManualClientEnd result = new ManualClientEnd(); + assertNotNull(result); + // 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 fixture = new ManualClientEnd(); + 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. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testResult_1() + throws Exception { + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + PDPNotification result = ManualClientEnd.result(scheme); + + assertNull(result); + } + + + /** + * Run the void start(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStart_1() + throws Exception { + String url = ""; + + ManualClientEnd.start(url); + + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(ManualClientEndTest.class); + } +} 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 new file mode 100644 index 000000000..fedcc9992 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.*; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.openecomp.policy.api.NotificationScheme; +import org.openecomp.policy.api.PDPNotification; +import org.openecomp.policy.std.ManualClientEndUEB; +import org.openecomp.policy.std.NotificationUnMarshal; +import org.openecomp.policy.std.StdPDPNotification; + +import static org.junit.Assert.*; + +/** + * The class ManualClientEndUEBTest contains tests for the class {@link ManualClientEndUEB}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class ManualClientEndUEBTest { + + String resultJson = "{'test':'testing'}"; + String json = "{\"test\":\"testing\"}"; + StdPDPNotification notification = new StdPDPNotification(); + ManualClientEndUEB mockManualClient = null; + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + String url = "http://test.com"; + String uniqueID = "test"; + List uebURLList = new LinkedList(); + uebURLList.add(url); + + } + /** + * Run the ManualClientEndUEB() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testManualClientEndUEB_1() + throws Exception { + ManualClientEndUEB result = new ManualClientEndUEB(); + assertNotNull(result); + // 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. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testResult_1() + throws Exception { + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + PDPNotification result = ManualClientEndUEB.result(scheme); + + 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. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(ManualClientEndUEBTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java new file mode 100644 index 000000000..917e9d5e6 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java @@ -0,0 +1,774 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.openecomp.policy.api.PDPNotification; +import org.openecomp.policy.std.MatchStore; +import org.openecomp.policy.std.Matches; +import org.openecomp.policy.std.StdPDPNotification; + +import static org.junit.Assert.*; + +/** + * The class MatchStoreTest contains tests for the class {@link MatchStore}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class MatchStoreTest { + /** + * Run the MatchStore() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testMatchStore_1() + throws Exception { + MatchStore result = new MatchStore(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_1() + throws Exception { + PDPNotification oldNotification = null; + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_2() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_3() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_4() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_5() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_6() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_7() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_8() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_9() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_10() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_11() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_12() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_13() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_14() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_15() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the PDPNotification checkMatch(PDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testCheckMatch_16() + throws Exception { + PDPNotification oldNotification = new StdPDPNotification(); + + PDPNotification result = MatchStore.checkMatch(oldNotification); + + // 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.MatchStore + assertNotNull(result); + } + + /** + * Run the HashSet getMatchStore() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetMatchStore_1() + throws Exception { + + HashSet result = MatchStore.getMatchStore(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.ExceptionInInitializerError + // at org.apache.log4j.Logger.getLogger(Logger.java:104) + // at org.openecomp.policy.std.MatchStore.(MatchStore.java:15) + assertNotNull(result); + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_1() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_2() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_3() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_4() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_5() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_6() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_7() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_8() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_9() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_10() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_11() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_12() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_13() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_14() + throws Exception { + Matches newMatch = new Matches(); + newMatch.setConfigAttributes(new Hashtable()); + newMatch.setConfigName(""); + newMatch.setEcompName(""); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_15() + throws Exception { + Matches newMatch = new Matches(); + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Run the void storeMatch(Matches) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStoreMatch_16() + throws Exception { + Matches newMatch = null; + + MatchStore.storeMatch(newMatch); + + // 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.MatchStore + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(MatchStoreTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java new file mode 100644 index 000000000..735d12561 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java @@ -0,0 +1,216 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.openecomp.policy.std.Matches; + +import static org.junit.Assert.*; + +/** + * The class MatchesTest contains tests for the class {@link Matches}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class MatchesTest { + /** + * Run the Matches() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testMatches_1() + throws Exception { + Matches result = new Matches(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the Map getConfigAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetConfigAttributes_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + + Map result = fixture.getConfigAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getConfigName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetConfigName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + + String result = fixture.getConfigName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getEcompName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetEcompName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + + String result = fixture.getEcompName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the void setConfigAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigAttributes_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + Map configAttributes = new Hashtable(); + + fixture.setConfigAttributes(configAttributes); + + // add additional test code here + } + + /** + * Run the void setConfigName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + String configName = ""; + + fixture.setConfigName(configName); + + // add additional test code here + } + + /** + * Run the void setEcompName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetEcompName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setEcompName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + String ecompName = ""; + + fixture.setEcompName(ecompName); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(MatchesTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java new file mode 100644 index 000000000..d54c4f4cb --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java @@ -0,0 +1,359 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import org.junit.*; +import org.openecomp.policy.std.NotificationStore; +import org.openecomp.policy.std.StdPDPNotification; + +import static org.junit.Assert.*; + +/** + * The class NotificationStoreTest contains tests for the class {@link NotificationStore}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class NotificationStoreTest { + /** + * Run the NotificationStore() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testNotificationStore_1() + throws Exception { + NotificationStore result = new NotificationStore(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_1() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_2() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_3() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_4() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_5() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_6() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_7() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_8() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_9() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_10() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_11() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_12() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_13() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_14() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_15() + throws Exception { + StdPDPNotification notification = new StdPDPNotification(); + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Run the void recordNotification(StdPDPNotification) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRecordNotification_16() + throws Exception { + StdPDPNotification notification = null; + + NotificationStore.recordNotification(notification); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(NotificationStoreTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java new file mode 100644 index 000000000..7a93a7b49 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java @@ -0,0 +1,256 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import org.junit.*; +import org.openecomp.policy.std.NotificationUnMarshal; +import org.openecomp.policy.std.StdPDPNotification; + +import static org.junit.Assert.*; + +import com.fasterxml.jackson.databind.JsonMappingException; + +/** + * The class NotificationUnMarshalTest contains tests for the class {@link NotificationUnMarshal}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class NotificationUnMarshalTest { + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_1() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_2() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_3() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_4() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_5() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_6() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_7() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_8() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_9() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the StdPDPNotification notificationJSON(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class) + public void testNotificationJSON_10() + throws Exception { + String json = ""; + + StdPDPNotification result = NotificationUnMarshal.notificationJSON(json); + + // add additional test code here + assertNotNull(result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(NotificationUnMarshalTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java new file mode 100644 index 000000000..ce6d361df --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java @@ -0,0 +1,314 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.openecomp.policy.api.UpdateType; +import org.openecomp.policy.std.StdLoadedPolicy; + +import static org.junit.Assert.*; + +/** + * The class StdLoadedPolicyTest contains tests for the class {@link StdLoadedPolicy}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class StdLoadedPolicyTest { + /** + * Run the StdLoadedPolicy() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStdLoadedPolicy_1() + throws Exception { + StdLoadedPolicy result = new StdLoadedPolicy(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the Map getMatches() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetMatches_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + Map result = fixture.getMatches(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_2() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName((String) null); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_3() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UpdateType getUpdateType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetUpdateType_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + UpdateType result = fixture.getUpdateType(); + + // add additional test code here + assertNotNull(result); + assertEquals("new", result.toString()); + assertEquals("NEW", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getVersionNo() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetVersionNo_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + + String result = fixture.getVersionNo(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the void setMatches(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetMatches_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + Map matches = new Hashtable(); + + fixture.setMatches(matches); + + // add additional test code here + } + + /** + * Run the void setPolicyName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyName_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setUpdateType(UpdateType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetUpdateType_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + UpdateType updateType = UpdateType.NEW; + + fixture.setUpdateType(updateType); + + // add additional test code here + } + + /** + * Run the void setVersionNo(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetVersionNo_1() + throws Exception { + StdLoadedPolicy fixture = new StdLoadedPolicy(); + fixture.setPolicyName(""); + fixture.setVersionNo(""); + fixture.setUpdateType(UpdateType.NEW); + fixture.setMatches(new Hashtable()); + String versionNo = ""; + + fixture.setVersionNo(versionNo); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdLoadedPolicyTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java new file mode 100644 index 000000000..490120fb9 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java @@ -0,0 +1,311 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Collection; +import java.util.LinkedList; + +import org.junit.*; +import org.openecomp.policy.api.LoadedPolicy; +import org.openecomp.policy.api.NotificationType; +import org.openecomp.policy.api.RemovedPolicy; +import org.openecomp.policy.std.StdLoadedPolicy; +import org.openecomp.policy.std.StdPDPNotification; +import org.openecomp.policy.std.StdRemovedPolicy; + +import static org.junit.Assert.*; + +/** + * The class StdPDPNotificationTest contains tests for the class {@link StdPDPNotification}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class StdPDPNotificationTest { + /** + * Run the StdPDPNotification() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testStdPDPNotification_1() + throws Exception { + StdPDPNotification result = new StdPDPNotification(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the Collection getLoadedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetLoadedPolicies_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + Collection result = fixture.getLoadedPolicies(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Collection getLoadedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetLoadedPolicies_2() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + Collection result = fixture.getLoadedPolicies(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Collection getLoadedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetLoadedPolicies_3() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(null); + + Collection result = fixture.getLoadedPolicies(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the NotificationType getNotificationType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetNotificationType_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + NotificationType result = fixture.getNotificationType(); + + // add additional test code here + assertNotNull(result); + assertEquals("both", result.toString()); + assertEquals("BOTH", result.name()); + assertEquals(2, result.ordinal()); + } + + /** + * Run the Collection getRemovedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRemovedPolicies_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + Collection result = fixture.getRemovedPolicies(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Collection getRemovedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRemovedPolicies_2() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + Collection result = fixture.getRemovedPolicies(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Collection getRemovedPolicies() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRemovedPolicies_3() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(null); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + + Collection result = fixture.getRemovedPolicies(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the void setNotificationType(NotificationType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetNotificationType_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + NotificationType notificationType = NotificationType.BOTH; + + fixture.setNotificationType(notificationType); + + // add additional test code here + } + + /** + * Run the void setRemovedPolicies(Collection) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetRemovedPolicies_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + Collection removedPolicies = new LinkedList(); + + fixture.setRemovedPolicies(removedPolicies); + + // add additional test code here + } + + /** + * Run the void setUpdatedPolicies(Collection) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetUpdatedPolicies_1() + throws Exception { + StdPDPNotification fixture = new StdPDPNotification(); + fixture.setRemovedPolicies(new LinkedList()); + fixture.setNotificationType(NotificationType.BOTH); + fixture.setLoadedPolicies(new LinkedList()); + Collection updatedPolicies = new LinkedList(); + + fixture.setLoadedPolicies(updatedPolicies); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdPDPNotificationTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java new file mode 100644 index 000000000..45c70187d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import org.junit.*; +import org.openecomp.policy.std.StdPolicyChangeResponse; + +import static org.junit.Assert.*; + +/** + * The class StdPolicyChangeResponseTest contains tests for the class {@link StdPolicyChangeResponse}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class StdPolicyChangeResponseTest { + /** + * Run the StdPolicyChangeResponse() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStdPolicyChangeResponse_1() + throws Exception { + StdPolicyChangeResponse result = new StdPolicyChangeResponse(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the int getResponseCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetResponseCode_1() + throws Exception { + StdPolicyChangeResponse fixture = new StdPolicyChangeResponse(); + fixture.setResponseMessage(""); + fixture.setResponseCode(1); + + int result = fixture.getResponseCode(); + + // add additional test code here + assertEquals(1, result); + } + + /** + * Run the String getResponseMessage() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetResponseMessage_1() + throws Exception { + StdPolicyChangeResponse fixture = new StdPolicyChangeResponse(); + fixture.setResponseMessage(""); + fixture.setResponseCode(1); + + String result = fixture.getResponseMessage(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the void setResponseCode(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetResponseCode_1() + throws Exception { + StdPolicyChangeResponse fixture = new StdPolicyChangeResponse(); + fixture.setResponseMessage(""); + fixture.setResponseCode(1); + int responseCode = 1; + + fixture.setResponseCode(responseCode); + + // add additional test code here + } + + /** + * Run the void setResponseMessage(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetResponseMessage_1() + throws Exception { + StdPolicyChangeResponse fixture = new StdPolicyChangeResponse(); + fixture.setResponseMessage(""); + fixture.setResponseCode(1); + String responseMessage = ""; + + fixture.setResponseMessage(responseMessage); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdPolicyChangeResponseTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java new file mode 100644 index 000000000..88a22c300 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java @@ -0,0 +1,821 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; + +import javax.json.JsonObject; + +import org.junit.*; +import org.openecomp.policy.api.PolicyConfigStatus; +import org.openecomp.policy.api.PolicyType; +import org.openecomp.policy.std.StdPolicyConfig; + +import static org.junit.Assert.*; + +import org.w3c.dom.Document; + +/** + * The class StdPolicyConfigTest contains tests for the class {@link StdPolicyConfig}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class StdPolicyConfigTest { + /** + * Run the Map getMatchingConditions() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetMatchingConditions_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + Map result = fixture.getMatchingConditions(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getPolicyConfigMessage() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyConfigMessage_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.getPolicyConfigMessage(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyConfigStatus getPolicyConfigStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyConfigStatus_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + PolicyConfigStatus result = fixture.getPolicyConfigStatus(); + + // add additional test code here + assertNotNull(result); + assertEquals("not_found", result.toString()); + assertEquals("CONFIG_NOT_FOUND", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyName_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyName_2() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName((String) null); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyName_3() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyVersion() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyVersion_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.getPolicyVersion(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the Map getResponseAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetResponseAttributes_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + Map result = fixture.getResponseAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the PolicyType getType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetType_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + PolicyType result = fixture.getType(); + + // add additional test code here + assertNotNull(result); + assertEquals("json", result.toString()); + assertEquals("JSON", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the void setConfigStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigStatus_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + String configStatus = ""; + + fixture.setConfigStatus(configStatus); + + // add additional test code here + } + + /** + * Run the void setConfigStatus(String,PolicyConfigStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigStatus_2() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + String configStatus = ""; + PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + + fixture.setConfigStatus(configStatus, policyConfigStatus); + + // add additional test code here + } + + /** + * Run the void setDocument(Document) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDocument_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + Document document = null; + + fixture.setDocument(document); + + // add additional test code here + } + + /** + * Run the void setJsonObject(JsonObject) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetJsonObject_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + JsonObject jsonObject = null; + + fixture.setJsonObject(jsonObject); + + // add additional test code here + } + + /** + * Run the void setMatchingConditions(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetMatchingConditions_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + Map matchingConditions = new Hashtable(); + + fixture.setMatchingConditions(matchingConditions); + + // add additional test code here + } + + /** + * Run the void setOther(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetOther_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + String other = ""; + + fixture.setOther(other); + + // add additional test code here + } + + /** + * Run the void setPolicyConfigStatus(PolicyConfigStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyConfigStatus_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + + fixture.setPolicyConfigStatus(policyConfigStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyName_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setPolicyType(PolicyType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyType_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + PolicyType policyType = PolicyType.JSON; + + fixture.setPolicyType(policyType); + + // add additional test code here + } + + /** + * Run the void setPolicyVersion(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyVersion_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + String policyVersion = ""; + + fixture.setPolicyVersion(policyVersion); + + // add additional test code here + } + + /** + * Run the void setProperties(Properties) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetProperties_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + Properties properties = new Properties(); + + fixture.setProperties(properties); + + // add additional test code here + } + + /** + * Run the void setResponseAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetResponseAttributes_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + Map responseAttributes = new Hashtable(); + + fixture.setResponseAttributes(responseAttributes); + + // add additional test code here + } + + /** + * Run the JsonObject toJSON() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToJSON_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + JsonObject result = fixture.toJSON(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String toOther() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToOther_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.toOther(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the Properties toProperties() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToProperties_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + Properties result = fixture.toProperties(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName("test"); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("PolicyConfig [ policyConfigStatus=not_found, policyConfigMessage=, policyName=test]", result); + } + + /** + * Run the Document toXML() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToXML_1() + throws Exception { + StdPolicyConfig fixture = new StdPolicyConfig(); + fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setDocument((Document) null); + fixture.setResponseAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setOther(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setPolicyName(""); + fixture.setProperties(new Properties()); + fixture.setJsonObject((JsonObject) null); + fixture.setMatchingConditions(new Hashtable()); + + Document result = fixture.toXML(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdPolicyConfigTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyEngineTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyEngineTest.java new file mode 100644 index 000000000..c2fee2f0e --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyEngineTest.java @@ -0,0 +1,1002 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.StringReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.UUID; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.policy.api.AttributeType; +import org.openecomp.policy.api.ConfigRequestParameters; +import org.openecomp.policy.api.DecisionRequestParameters; +import org.openecomp.policy.api.DecisionResponse; +import org.openecomp.policy.api.DeletePolicyCondition; +import org.openecomp.policy.api.DeletePolicyParameters; +import org.openecomp.policy.api.DictionaryParameters; +import org.openecomp.policy.api.DictionaryType; +import org.openecomp.policy.api.EventRequestParameters; +import org.openecomp.policy.api.ImportParameters; +import org.openecomp.policy.api.NotificationHandler; +import org.openecomp.policy.api.NotificationScheme; +import org.openecomp.policy.api.PolicyChangeResponse; +import org.openecomp.policy.api.PolicyClass; +import org.openecomp.policy.api.PolicyConfig; +import org.openecomp.policy.api.PolicyConfigStatus; +import org.openecomp.policy.api.PolicyConfigType; +import org.openecomp.policy.api.PolicyDecision; +import org.openecomp.policy.api.PolicyParameters; +import org.openecomp.policy.api.PolicyResponse; +import org.openecomp.policy.api.PolicyType; +import org.openecomp.policy.api.PushPolicyParameters; +import org.openecomp.policy.api.ImportParameters.IMPORT_TYPE; +import org.openecomp.policy.std.StdDecisionResponse; +import org.openecomp.policy.std.StdPolicyChangeResponse; +import org.openecomp.policy.std.StdPolicyConfig; +import org.openecomp.policy.std.StdPolicyEngine; +import org.openecomp.policy.std.StdPolicyResponse; + +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; + +/** + * The class StdPolicyEngineTest contains tests for the class {@link StdPolicyEngine}. + * + * @generatedBy CodePro at 6/3/16 2:03 PM + * @version $Revision: 1.0 $ + */ +public class StdPolicyEngineTest { + + private static final Logger logger = FlexLogger.getLogger(StdPolicyEngine.class); + + private StdPolicyEngine fixture = null; + private StdPolicyEngine mockEngine = null; + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + PolicyParameters policyParameters = new PolicyParameters(); + String json = null; + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Before + public void setUp() + throws Exception { + fixture = new StdPolicyEngine("Test/config_pass.properties"); + + //Mocks + mockEngine = Mockito.mock(StdPolicyEngine.class); + } + + private static JsonObject buildJSON(String jsonString) { + JsonObject json = null;; + if (jsonString != null) { + StringReader in = null; + + in = new StringReader(jsonString); + + JsonReader jsonReader = Json.createReader(in); + json = jsonReader.readObject(); + } + + return json; + } + + //Reads a File and converts into a String. + private static String readFile( String file ) throws IOException { + BufferedReader reader = new BufferedReader( new FileReader (file)); + String line = null; + StringBuilder stringBuilder = new StringBuilder(); + String ls = System.getProperty("line.separator"); + + try { + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + stringBuilder.append( ls ); + } + + return stringBuilder.toString(); + } finally { + reader.close(); + } + } + + /** + * Run the StdPolicyEngine(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testStdPolicyEngine() + throws Exception { + String propertyFilePath = "Test/config_pass.properties"; + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath); + + assertNotNull(result); + } + + /** + * Run the StdPolicyEngine(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStdPolicyEngine_2() + throws Exception { + String propertyFilePath = "http"; + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath); + + assertNull(result); + } +*/ + /** + * Run the StdPolicyEngine(String,NotificationScheme) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testStdPolicyEngine_3() + throws Exception { + String propertyFilePath = "Test/config_pass.properties"; + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath, scheme); + + assertNotNull(result); + } + + /** + * Run the StdPolicyEngine(String,NotificationScheme) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStdPolicyEngine_4() + throws Exception { + String propertyFilePath = "http"; + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath, scheme); + + // 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.StdPolicyEngine + assertNull(result); + }*/ + + /** + * Run the StdPolicyEngine(String,NotificationScheme,NotificationHandler) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStdPolicyEngine_5() + throws Exception { + String propertyFilePath = "Test/config_pass.properties"; + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + NotificationHandler handler = new Handler(); + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath, scheme, handler); + + assertNull(result); + }*/ + + /** + * Run the StdPolicyEngine(String,NotificationScheme,NotificationHandler) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStdPolicyEngine_6() + throws Exception { + String propertyFilePath = "http"; + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + NotificationHandler handler = new Handler(); + + StdPolicyEngine result = new StdPolicyEngine(propertyFilePath, scheme, handler); + + assertNull(result); + } +*/ + /** + * Run the StdPolicyEngine(List,List,List,List,NotificationScheme,NotificationHandler,String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStdPolicyEngine_8() + throws Exception { + List configURL = new LinkedList(); + List configPapURL = new LinkedList(); + List encodingPAP = new LinkedList(); + List encoding = new LinkedList(); + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + NotificationHandler handler = new Handler(); + String clientAuth = "TEST"; + + StdPolicyEngine result = new StdPolicyEngine(configURL, configPapURL, encodingPAP, encoding, scheme, handler, clientAuth); + + // 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.StdPolicyEngine + assertNull(result); + } +*/ + /** + * Run the Collection config(ConfigRequestParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testConfig() + throws Exception { + String configMessage = "Error in Calling the Configuration URL java.lang.Exception: PE500 - Process Flow Issue: Cannot open a connection to the configURL"; + PolicyConfigStatus configStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + String policyName = "JunitTest.Config_testing"; + String policyVersion = "1"; + + ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); + configRequestParameters.setPolicyName(".*"); + Collection result = fixture.config(configRequestParameters); + + //assertEquals(response, result); + for(PolicyConfig policyConfig: result){ + assertEquals(policyName, policyConfig.getPolicyName()); + assertEquals(policyVersion, policyConfig.getPolicyVersion()); + assertEquals(configStatus, policyConfig.getPolicyConfigStatus()); + assertEquals(configMessage, policyConfig.getPolicyConfigMessage()); + } + } + + + /** + * Run the Collection listConfig(ConfigRequestParameters) method test. + * + * @throws Exception + * + */ + @Test + public void testListConfig() + throws Exception { + + Collection response = new ArrayList(); + response.add("Policy Name: listConfigTest"); + + ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); + configRequestParameters.setPolicyName(".*"); + Collection result = fixture.listConfig(configRequestParameters); + + assertEquals(result, response); + } + + /** + * Run the String copyFile(String,String,StdPAPPolicy,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testCopyFile() + throws Exception { + String policyId = "test.testing"; + String group = "default"; + URI selectedURI = null; + StdPDPPolicy policy = new StdPDPPolicy("testing", true, "test", selectedURI, true, "test", "testing", "1"); + StdPAPPolicy location = new StdPAPPolicy(policy.getLocation()); + String clientScope = "Config"; + UUID requestID = UUID.randomUUID(); + + String result = fixture.copyFile(policyId, group, location, clientScope, requestID); + + assertNotNull(result); + }*/ + + /** + * Run the String copyPolicy(PDPPolicy,String,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testCopyPolicy() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + URI selectedURI = null; + + StdPDPPolicy policy = new StdPDPPolicy("testing", true, "test", selectedURI, true, "test", "testing", "1"); + String group = "default"; + String policyType = "Base"; + UUID requestID = UUID.randomUUID(); + + String result = fixture.copyPolicy(policy, group, policyType, requestID); + + assertNotNull(result); + } +*/ + /** + * Run the String createConfigFirewallPolicy(String,JsonObject,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateConfigFirewallPolicy() + throws Exception { + + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyConfigType(PolicyConfigType.Firewall); + + String json= "{\"serviceTypeId\": \"/v0/firewall/pan\",\"configName\": \"rule1607\",\"deploymentOption\":{\"deployNow\": false},\"securityZoneId\": \"/v0/firewall/pan\",\"serviceGroups\": [{\"name\": \"1607Group\",\"description\": null,\"members\": [{\"type\": \"REFERENCE\",\"name\": \"SList\"},{\"type\": \"REFERENCE\",\"name\": \"Syslog\"}]}, {\"name\": \"Syslog\",\"description\": \"NA\",\"type\": \"SERVICE\",\"transportProtocol\": \"udp\",\"appProtocol\": null,\"ports\": \"514\"}, {\"name\": \"SList\",\"description\": \"Service List\",\"type\": \"SERVICE\",\"transportProtocol\": \"tcp\",\"appProtocol\": null,\"ports\": \"8080\"}],\"addressGroups\": [{\"name\": \"1607Group\",\"description\": null,\"members\": [{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"},{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"}]},{\"name\": \"PL_CCE3\",\"description\": \"CCE Routers\",\"members\":[{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"}]}],\"firewallRuleList\": [{\"position\": \"1\",\"ruleName\": \"1607Rule\",\"fromZones\": [\"Trusted\"],\"toZones\": [\"Untrusted\"],\"negateSource\": false,\"negateDestination\": false,\"sourceList\": [{\"type\": \"REFERENCE\",\"name\": \"PL_CCE3\"}, {\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"destinationList\": [{\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"sourceServices\": [],\"destServices\": [{\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"action\": \"accept\",\"description\": \"Rule for 1607 templates\",\"enabled\": true,\"log\": true}]}"; + policyParameters.setConfigBody(json); + policyParameters.setPolicyName("test.testing"); + + PolicyChangeResponse result = fixture.createPolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + /** + * Run the String createConfigPolicy(String,String,String,String,Map,String,String,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateConfigPolicy() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyConfigType(PolicyConfigType.Base); + policyParameters.setPolicyName("test.junittest"); + policyParameters.setPolicyDescription("testing junit"); + policyParameters.setEcompName("test"); + policyParameters.setConfigName("testname"); + Map configAttributes = new HashMap(); + configAttributes.put("Template", "SampleTemplate"); + configAttributes.put("controller", "default"); + configAttributes.put("SamPoll", "30"); + configAttributes.put("value", "abcd"); + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + policyParameters.setRequestID(UUID.randomUUID()); + policyParameters.setConfigBodyType(PolicyType.OTHER); + policyParameters.setConfigBody("test"); + + PolicyChangeResponse result = fixture.createPolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + + /** + * Run the String createUpdateActionPolicy(String,String,Map,List,List,List,List,String,String,String,Boolean,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateUpdateActionPolicy_Create() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyClass(PolicyClass.Action); + policyParameters.setPolicyName("test.junittest"); + policyParameters.setPolicyDescription("testing"); + Map configAttributes = new HashMap(); + configAttributes.put("Template", "UpdateTemplate"); + configAttributes.put("controller", "default"); + configAttributes.put("SamPoll", "30"); + configAttributes.put("value", "abcd"); + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + policyParameters.setActionPerformer("PDP"); + policyParameters.setActionAttribute("test"); + + PolicyChangeResponse result = fixture.createPolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + /** + * Run the String createUpdateActionPolicy(String,String,Map,List,List,List,List,String,String,String,Boolean,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateUpdateActionPolicy_Update() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyClass(PolicyClass.Action); + policyParameters.setPolicyName("test.junittest"); + policyParameters.setPolicyDescription("testing"); + Map configAttributes = new HashMap(); + configAttributes.put("Template", "UpdateTemplate"); + configAttributes.put("controller", "default"); + configAttributes.put("SamPoll", "30"); + configAttributes.put("value", "abcd"); + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + policyParameters.setActionPerformer("PDP"); + policyParameters.setActionAttribute("test"); + + PolicyChangeResponse result = fixture.updatePolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + + /** + * Run the String createUpdateBRMSParamPolicy(String,String,Map>,String,String,Boolean,UUID,Map>) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateUpdateBRMSParamPolicy_Create() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + policyParameters.setPolicyName("test.testing"); + policyParameters.setPolicyDescription("testing"); + Map ruleAttributes = new HashMap(); + ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary. + ruleAttributes.put("controller", "default"); // Set Rule to a PDP Controller, default is the controller name. + ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us. + ruleAttributes.put("value", "abcd"); // Template specific key and value set by us. + Map> attributes = new HashMap>(); + attributes.put(AttributeType.RULE, ruleAttributes); + policyParameters.setAttributes(attributes); + + PolicyChangeResponse result = fixture.createPolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + /** + * Run the String createUpdateBRMSParamPolicy(String,String,Map>,String,String,Boolean,UUID,Map>) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateUpdateBRMSParamPolicy_Update() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + policyParameters.setPolicyName("test.testing"); + policyParameters.setPolicyDescription("testing"); + Map ruleAttributes = new HashMap(); + ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary. + ruleAttributes.put("controller", "default"); // Set Rule to a PDP Controller, default is the controller name. + ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us. + ruleAttributes.put("value", "abcd"); // Template specific key and value set by us. + Map> attributes = new HashMap>(); + attributes.put(AttributeType.RULE, ruleAttributes); + policyParameters.setAttributes(attributes); + + PolicyChangeResponse result = fixture.updatePolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + /** + * Run the String createUpdateBRMSRawPolicy(String,String,Map>,String,String,Boolean,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testCreateUpdateBRMSRawPolicy_Create() + throws Exception { + response.setResponseMessage("success"); + PolicyParameters policyParameters = new PolicyParameters(); + policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + policyParameters.setPolicyName("test.testing"); + policyParameters.setPolicyDescription("testing"); + Map attrib= new HashMap(); + attrib.put("cpu","80"); + attrib.put("memory", "50"); + Map> attributes = new HashMap>(); + attributes.put(AttributeType.RULE, attrib); + + policyParameters.setAttributes(attributes); + + File rawBodyFile = null; + Path file = Paths.get("Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt"); + rawBodyFile = file.toFile(); + + policyParameters.setConfigBody(readFile(rawBodyFile.toString())); + + PolicyChangeResponse result = fixture.updatePolicy(policyParameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + /** + * Run the PolicyChangeResponse createDictionaryItem(DictionaryParameters) method test. + * + * @throws Exception + * + */ + @Test + public void testCreateDictionaryItem() throws Exception { + response.setResponseMessage("success"); + DictionaryParameters parameters = new DictionaryParameters(); + + parameters.setDictionaryType(DictionaryType.Common); + parameters.setDictionary("Attribute"); + + Map fields = new HashMap(); + fields.put("ATTRIBUTEID", "A5:"); + fields.put("DATATYPE", "user"); + fields.put("DESCRIPTION", "testing something"); + fields.put("ATTRIBUTEVALUE", "1,2,A,B"); + fields.put("PRIORITY", "High"); + Map> dictionaryFields = new HashMap>(); + dictionaryFields.put(AttributeType.DICTIONARY, fields); + + parameters.setDictionaryFields(dictionaryFields); + + PolicyChangeResponse result = fixture.createDictionaryItem(parameters); + + assertEquals(response.getResponseMessage(), result.getResponseMessage()); + } + + + /** + * Run the PolicyDecision decide(DecisionRequestParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testDecide() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + StdDecisionResponse response = new StdDecisionResponse(); + response.setDecision(PolicyDecision.PERMIT); + + DecisionRequestParameters decisionRequestParameters = new DecisionRequestParameters(); + decisionRequestParameters.setECOMPComponentName("testEcompName"); + Map decisionAttributes = new HashMap(); + decisionAttributes.put("key", "value"); + decisionRequestParameters.setDecisionAttributes(decisionAttributes); + decisionRequestParameters.setRequestID(UUID.randomUUID()); + + Mockito.when(mockEngine.decide(decisionRequestParameters)).thenReturn(response); + DecisionResponse result = mockEngine.decide(decisionRequestParameters); + + assertNotNull(result); + } + + /** + * Run the PolicyChangeResponse deletePolicy(DeletePolicyParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testDeletePolicy() + throws Exception { + response.setResponseMessage("success"); + DeletePolicyParameters parameters = new DeletePolicyParameters(); + parameters.setDeleteCondition(DeletePolicyCondition.ALL); + parameters.setPolicyComponent("PAP"); + parameters.setPolicyName("testing.Config_junittest.1.xml"); + + PolicyChangeResponse result = fixture.deletePolicy(parameters); + + assertNotNull(result); + } + + /** + * Run the Collection event(EventRequestParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testEvent() + throws Exception { + + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + StdPolicyResponse response = new StdPolicyResponse(); + response.setPolicyResponseMessage("tested"); + Collection mockResult = new HashSet(); + mockResult.add(response); + StdPolicyEngine mockEngine = Mockito.mock(StdPolicyEngine.class); + + Map eventAttributes = new HashMap(); + eventAttributes.put("key", "test"); + EventRequestParameters eventRequestParameters = new EventRequestParameters(eventAttributes, UUID.randomUUID()); + Mockito.when(mockEngine.event(eventRequestParameters)).thenReturn(mockResult); + + Collection result = mockEngine.event(eventRequestParameters); + + assertEquals(result, mockResult); + } + + /** + * Run the PDPNotification getNotification() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testGetNotification() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + + PDPNotification result = fixture.getNotification(); + + assertNull(result); + }*/ + + /** + * Run the NotificationHandler getNotificationHandler() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testGetNotificationHandler() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + + NotificationHandler result = fixture.getNotificationHandler(); + + assertNull(result); + } + + /** + * Run the String getPAPURL() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testGetPAPURL() + throws Exception { + + String result = StdPolicyEngine.getPAPURL(); + + assertNotNull(result); + } + + /** + * Run the String getPDPURL() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testGetPDPURL() + throws Exception { + + String result = StdPolicyEngine.getPDPURL(); + + assertNotNull(result); + } + + /** + * Run the NotificationScheme getScheme() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testGetScheme() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + + NotificationScheme result = fixture.getScheme(); + + assertNull(result); + } + + /** + * Run the boolean isJSONValid(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testIsJSONValid() + throws Exception { + String data = "{\"test\": \"testing\"}"; + + boolean result = StdPolicyEngine.isJSONValid(data); + + assertTrue(result); + } + + /** + * Run the void notification(NotificationScheme,NotificationHandler) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testNotification() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + Handler handler = new Handler(); + + fixture.notification(scheme, handler); + + } +*/ + /** + * Run the PolicyChangeResponse policyEngineImport(ImportParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testPolicyEngineImport() + throws Exception { + response.setResponseMessage("success"); + ImportParameters importParameters = new ImportParameters(); + importParameters.setServiceName("ControllerServiceSampleSdnlServiceInstance"); + importParameters.setVersion("1607-2"); + importParameters.setFilePath("C:\\Workspaces\\models\\TestingModel\\ControllerServiceSampleSdnlServiceInstance-v0.1.0-SNAPSHOT.zip"); + importParameters.setServiceType(IMPORT_TYPE.MICROSERVICE); + + PolicyChangeResponse result = fixture.policyEngineImport(importParameters); + + assertNotNull(result); + + } + + /** + * Run the Collection policyName(String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testPolicyName() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + StdPolicyConfig config = new StdPolicyConfig(); + config.setPolicyName("testing"); + Collection response = new HashSet(); + response.add(config); + String policyName = "test.testing"; + UUID requestID = UUID.randomUUID(); + + Mockito.when(mockEngine.policyName(policyName, requestID)).thenReturn(response); + Collection result = mockEngine.policyName(policyName, requestID); + + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse pushPolicy(PushPolicyParameters) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testPushPolicy() + throws Exception { + response.setResponseMessage("success"); + + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + + PushPolicyParameters pushPolicyParameters = new PushPolicyParameters(); + pushPolicyParameters.setPolicyName("test.testPolicy"); + pushPolicyParameters.setPdpGroup("default"); + pushPolicyParameters.setPolicyType("Base"); + + try { + + Mockito.when(mockEngine.pushPolicy(pushPolicyParameters)).thenReturn(response); + result = mockEngine.pushPolicy(pushPolicyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the void rotateList() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testRotateList() + throws Exception { + + StdPolicyEngine.rotateList(); + + } + + /** + * Run the void setScheme(NotificationScheme) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testSetScheme() + throws Exception { + //StdPolicyEngine fixture = new StdPolicyEngine("http", NotificationScheme.AUTO_ALL_NOTIFICATIONS, (NotificationHandler) null); + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + fixture.setScheme(scheme); + + } + + /** + * Run the void stopNotification() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ +/* @Test + public void testStopNotification_1() + throws Exception { + Handler handler = new Handler(); + + Mockito.doNothing().when(mockStdPolicyEngine).notification(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + StdPolicyEngine fixture = new StdPolicyEngine("Test/config_pass.properties", NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + + //verify(mockStdPolicyEngine, times(1)).fixture("Test/config_pass.properties", NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler); + + fixture.stopNotification(); + }*/ + + /** + * Run the String updateConfigFirewallPolicy(String,JsonObject,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @Test + public void testUpdateConfigFirewallPolicy() + throws Exception { + response.setResponseMessage("success"); + String json= "{\"serviceTypeId\": \"/v0/firewall/pan\",\"configName\": \"rule1607\",\"deploymentOption\":{\"deployNow\": false},\"securityZoneId\": \"/v0/firewall/pan\",\"serviceGroups\": [{\"name\": \"1607Group\",\"description\": null,\"members\": [{\"type\": \"REFERENCE\",\"name\": \"SList\"},{\"type\": \"REFERENCE\",\"name\": \"Syslog\"}]}, {\"name\": \"Syslog\",\"description\": \"NA\",\"type\": \"SERVICE\",\"transportProtocol\": \"udp\",\"appProtocol\": null,\"ports\": \"514\"}, {\"name\": \"SList\",\"description\": \"Service List\",\"type\": \"SERVICE\",\"transportProtocol\": \"tcp\",\"appProtocol\": null,\"ports\": \"8080\"}],\"addressGroups\": [{\"name\": \"1607Group\",\"description\": null,\"members\": [{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"},{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"}]},{\"name\": \"PL_CCE3\",\"description\": \"CCE Routers\",\"members\":[{\"type\": \"REFERENCE\",\"name\": \"10.11.12.13/14\"}]}],\"firewallRuleList\": [{\"position\": \"1\",\"ruleName\": \"1607Rule\",\"fromZones\": [\"Trusted\"],\"toZones\": [\"Untrusted\"],\"negateSource\": false,\"negateDestination\": false,\"sourceList\": [{\"type\": \"REFERENCE\",\"name\": \"PL_CCE3\"}, {\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"destinationList\": [{\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"sourceServices\": [],\"destServices\": [{\"type\": \"REFERENCE\",\"name\": \"1607Group\"}],\"action\": \"accept\",\"description\": \"Rule for 1607 templates\",\"enabled\": true,\"log\": true}]}"; + String policyName = "testing"; + JsonObject firewallJson = buildJSON(json); + String policyScope = "test"; + UUID requestID = UUID.randomUUID(); + String riskLevel = ""; + String riskType = ""; + String guard = ""; + String date = ""; + + String result = fixture.updateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, date); + + assertNotNull(result); + } + + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/3/16 2:03 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdPolicyEngineTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java new file mode 100644 index 000000000..2cb21ef19 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java @@ -0,0 +1,348 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.openecomp.policy.api.PolicyResponseStatus; +import org.openecomp.policy.std.StdPolicyResponse; + +import static org.junit.Assert.*; + +/** + * The class StdPolicyResponseTest contains tests for the class {@link StdPolicyResponse}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class StdPolicyResponseTest { + /** + * Run the Map getActionAdvised() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetActionAdvised_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getActionAdvised(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Map getActionTaken() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetActionTaken_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getActionTaken(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getPolicyResponseMessage() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyResponseMessage_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyResponseMessage(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyResponseStatus getPolicyResponseStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyResponseStatus_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + PolicyResponseStatus result = fixture.getPolicyResponseStatus(); + + // add additional test code here + assertNotNull(result); + assertEquals("action_advised", result.toString()); + assertEquals("ACTION_ADVISED", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the Map getRequestAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestAttributes_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getRequestAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the void setActionAdvised(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetActionAdvised_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + Map actionAdvised = new Hashtable(); + + fixture.setActionAdvised(actionAdvised); + + // add additional test code here + } + + /** + * Run the void setActionTaken(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetActionTaken_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + Map actionTaken = new Hashtable(); + + fixture.setActionTaken(actionTaken); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseMessage(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseMessage_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + String policyResponseMessage = ""; + + fixture.setPolicyResponseMessage(policyResponseMessage); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseStatus_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED; + + fixture.setPolicyResponseStatus(policyResponseStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseStatus_2() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + String policyResponseMessage = ""; + PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED; + + fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus); + + // add additional test code here + } + + /** + * Run the void setRequestAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestAttributes_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + Map requestAttributes = new Hashtable(); + + fixture.setRequestAttributes(requestAttributes); + + // add additional test code here + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToString_1() + throws Exception { + StdPolicyResponse fixture = new StdPolicyResponse(); + fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED); + fixture.setRequestAttributes(new Hashtable()); + fixture.setActionAdvised(new Hashtable()); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("PolicyResponse [ policyResponseStatus=action_advised, policyResponseMessage=, ]", result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdPolicyResponseTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java new file mode 100644 index 000000000..0a0865c82 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import org.junit.*; +import org.openecomp.policy.std.StdRemovedPolicy; + +import static org.junit.Assert.*; + +/** + * The class StdRemovedPolicyTest contains tests for the class {@link StdRemovedPolicy}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class StdRemovedPolicyTest { + /** + * Run the StdRemovedPolicy() constructor test. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testStdRemovedPolicy_1() + throws Exception { + StdRemovedPolicy result = new StdRemovedPolicy(); + assertNotNull(result); + // add additional test code here + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_1() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName(""); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_2() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName((String) null); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_3() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName(""); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getVersionNo() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetVersionNo_1() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName(""); + + String result = fixture.getVersionNo(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the void setPolicyName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyName_1() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName(""); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setVersionNo(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetVersionNo_1() + throws Exception { + StdRemovedPolicy fixture = new StdRemovedPolicy(); + fixture.setVersionNo(""); + fixture.setPolicyName(""); + String versionNo = ""; + + fixture.setVersionNo(versionNo); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdRemovedPolicyTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java new file mode 100644 index 000000000..4412dbdb7 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java @@ -0,0 +1,1433 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; + +import javax.json.JsonObject; + +import org.junit.*; +import org.openecomp.policy.api.PolicyConfigStatus; +import org.openecomp.policy.api.PolicyDecision; +import org.openecomp.policy.api.PolicyResponseStatus; +import org.openecomp.policy.api.PolicyType; +import org.openecomp.policy.std.StdStatus; + +import static org.junit.Assert.*; + +import org.w3c.dom.Document; + +/** + * The class StdStatusTest contains tests for the class {@link StdStatus}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class StdStatusTest { + /** + * Run the Map getActionAdvised() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetActionAdvised_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getActionAdvised(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Map getActionTaken() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetActionTaken_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getActionTaken(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Map getMatchingConditions() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetMatchingConditions_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getMatchingConditions(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getPolicyConfigMessage() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyConfigMessage_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyConfigMessage(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyConfigStatus getPolicyConfigStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyConfigStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + PolicyConfigStatus result = fixture.getPolicyConfigStatus(); + + // add additional test code here + assertNotNull(result); + assertEquals("not_found", result.toString()); + assertEquals("CONFIG_NOT_FOUND", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the PolicyDecision getPolicyDecision() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyDecision_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + PolicyDecision result = fixture.getDecision(); + + // add additional test code here + assertNotNull(result); + assertEquals("deny", result.toString()); + assertEquals("DENY", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_2() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName((String) null); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String getPolicyName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyName_3() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyResponseMessage() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyResponseMessage_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyResponseMessage(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyResponseStatus getPolicyResponseStatus() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyResponseStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + PolicyResponseStatus result = fixture.getPolicyResponseStatus(); + + // add additional test code here + assertNotNull(result); + assertEquals("action_advised", result.toString()); + assertEquals("ACTION_ADVISED", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getPolicyVersion() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyVersion_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.getPolicyVersion(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the Map getRequestAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestAttributes_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getRequestAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Map getResponseAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetResponseAttributes_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Map result = fixture.getResponseAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the PolicyType getType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetType_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + PolicyType result = fixture.getType(); + + // add additional test code here + assertNotNull(result); + assertEquals("json", result.toString()); + assertEquals("JSON", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the void setActionAdvised(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetActionAdvised_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Map actionAdvised = new Hashtable(); + + fixture.setActionAdvised(actionAdvised); + + // add additional test code here + } + + /** + * Run the void setActionTaken(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetActionTaken_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Map actionTaken = new Hashtable(); + + fixture.setActionTaken(actionTaken); + + // add additional test code here + } + + /** + * Run the void setConfigStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetConfigStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String configStatus = ""; + + fixture.setConfigStatus(configStatus); + + // add additional test code here + } + + /** + * Run the void setDocument(Document) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetDocument_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Document document = null; + + fixture.setDocument(document); + + // add additional test code here + } + + /** + * Run the void setJsonObject(JsonObject) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetJsonObject_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + JsonObject jsonObject = null; + + fixture.setJsonObject(jsonObject); + + // add additional test code here + } + + /** + * Run the void setMatchingConditions(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetMatchingConditions_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Map matchingConditions = new Hashtable(); + + fixture.setMatchingConditions(matchingConditions); + + // add additional test code here + } + + /** + * Run the void setOther(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetOther_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String other = ""; + + fixture.setOther(other); + + // add additional test code here + } + + /** + * Run the void setPolicyConfigStatus(PolicyConfigStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyConfigStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + + fixture.setPolicyConfigStatus(policyConfigStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyConfigStatus(String,PolicyConfigStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyConfigStatus_2() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String configStatus = ""; + PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + + fixture.setPolicyConfigStatus(configStatus, policyConfigStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyDecision(PolicyDecision) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyDecision_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + PolicyDecision policyDecision = PolicyDecision.DENY; + + fixture.setDecision(policyDecision); + + // add additional test code here + } + + /** + * Run the void setPolicyName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyName_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseMessage(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseMessage_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String policyResponseMessage = ""; + + fixture.setPolicyResponseMessage(policyResponseMessage); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED; + + fixture.setPolicyResponseStatus(policyResponseStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyResponseStatus_2() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String policyResponseMessage = ""; + PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED; + + fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus); + + // add additional test code here + } + + /** + * Run the void setPolicyType(PolicyType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyType_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + PolicyType policyType = PolicyType.JSON; + + fixture.setPolicyType(policyType); + + // add additional test code here + } + + /** + * Run the void setPolicyVersion(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyVersion_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String policyVersion = ""; + + fixture.setPolicyVersion(policyVersion); + + // add additional test code here + } + + /** + * Run the void setProperties(Properties) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetProperties_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Properties properties = new Properties(); + + fixture.setProperties(properties); + + // add additional test code here + } + + /** + * Run the void setRequestAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestAttributes_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Map requestAttributes = new Hashtable(); + + fixture.setRequestAttributes(requestAttributes); + + // add additional test code here + } + + /** + * Run the void setResposneAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetResposneAttributes_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + Map responseAttributes = new Hashtable(); + + fixture.setResposneAttributes(responseAttributes); + + // add additional test code here + } + + /** + * Run the void setStatus(String,PolicyResponseStatus,PolicyConfigStatus) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetStatus_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + String message = ""; + PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED; + PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND; + + fixture.setStatus(message, policyResponseStatus, policyConfigStatus); + + // add additional test code here + } + + /** + * Run the JsonObject toJSON() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToJSON_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + JsonObject result = fixture.toJSON(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Run the String toOther() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToOther_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + String result = fixture.toOther(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the Properties toProperties() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToProperties_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Properties result = fixture.toProperties(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the Document toXML() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToXML_1() + throws Exception { + StdStatus fixture = new StdStatus(); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setPolicyName(""); + fixture.setPolicyType(PolicyType.JSON); + fixture.setResposneAttributes(new Hashtable()); + fixture.setMatchingConditions(new Hashtable()); + fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND); + fixture.setJsonObject((JsonObject) null); + fixture.setDocument((Document) null); + fixture.setProperties(new Properties()); + fixture.setRequestAttributes(new Hashtable()); + fixture.setPolicyVersion(""); + fixture.setActionAdvised(new Hashtable()); + fixture.setOther(""); + fixture.setDecision(PolicyDecision.DENY); + fixture.setDetails(""); + fixture.setActionTaken(new Hashtable()); + + Document result = fixture.toXML(); + + // add additional test code here + assertEquals(null, result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(StdStatusTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java new file mode 100644 index 000000000..75bfc39ad --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineAPI + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +/** + * + */ +package org.openecomp.policy.std.test; -- cgit 1.2.3-korg