From 073cc188efe9abb4c010cf674e34e2cf46ef1c52 Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Mon, 31 Jul 2017 08:47:35 +0000 Subject: [POLICY-73] replace openecomp for policy-engine Change-Id: I54072f6bcd388c0e05562614ee89b4ae7ad67004 Signed-off-by: Guo Ruijing Signed-off-by: Pamela Dragosh --- .../onap/policy/std/test/AutoClientEndTest.java | 228 ++++ .../onap/policy/std/test/AutoClientUEBTest.java | 567 ++++++++ .../java/org/onap/policy/std/test/Handler.java | 126 ++ .../onap/policy/std/test/ManualClientEndTest.java | 126 ++ .../policy/std/test/ManualClientEndUEBTest.java | 119 ++ .../org/onap/policy/std/test/MatchStoreTest.java | 776 +++++++++++ .../java/org/onap/policy/std/test/MatchesTest.java | 216 +++ .../policy/std/test/NotificationStoreTest.java | 359 +++++ .../policy/std/test/NotificationUnMarshalTest.java | 256 ++++ .../onap/policy/std/test/StdLoadedPolicyTest.java | 314 +++++ .../policy/std/test/StdPDPNotificationTest.java | 311 +++++ .../std/test/StdPolicyChangeResponseTest.java | 166 +++ .../onap/policy/std/test/StdPolicyConfigTest.java | 821 +++++++++++ .../policy/std/test/StdPolicyResponseTest.java | 348 +++++ .../onap/policy/std/test/StdRemovedPolicyTest.java | 206 +++ .../org/onap/policy/std/test/StdStatusTest.java | 1433 ++++++++++++++++++++ .../org/onap/policy/std/test/package-info.java | 27 + .../org/onap/policy/test/ActionPolicyApiTest.java | 239 ++++ .../org/onap/policy/test/AttributeTypeTest.java | 81 ++ .../org/onap/policy/test/ConfigBasePolicyTest.java | 325 +++++ .../onap/policy/test/ConfigFirewallPolicyTest.java | 254 ++++ .../policy/test/ConfigRequestParametersTest.java | 362 +++++ .../onap/policy/test/DecisionPolicyApiTest.java | 219 +++ .../policy/test/DecisionRequestParametersTest.java | 232 ++++ .../policy/test/DeletePolicyConditionTest.java | 91 ++ .../policy/test/DeletePolicyParametersTest.java | 314 +++++ .../policy/test/EventRequestParametersTest.java | 193 +++ .../policy/test/GetConfigByPolicyNameTest.java | 63 + .../policy/test/GetConfigStringStringMapTest.java | 259 ++++ .../policy/test/GetConfigStringStringTest.java | 213 +++ .../org/onap/policy/test/GetConfigStringTest.java | 170 +++ .../org/onap/policy/test/ImportParametersTest.java | 403 ++++++ .../org/onap/policy/test/LoadedPolicyTest.java | 72 + .../onap/policy/test/NotificationHandlerTest.java | 72 + .../onap/policy/test/NotificationSchemeTest.java | 91 ++ .../org/onap/policy/test/NotificationTypeTest.java | 91 ++ .../org/onap/policy/test/PDPNotificationTest.java | 72 + .../onap/policy/test/PolicyChangeResponseTest.java | 72 + .../java/org/onap/policy/test/PolicyClassTest.java | 91 ++ .../policy/test/PolicyConfigExceptionTest.java | 183 +++ .../onap/policy/test/PolicyConfigStatusTest.java | 133 ++ .../org/onap/policy/test/PolicyConfigTest.java | 72 + .../org/onap/policy/test/PolicyConfigTypeTest.java | 91 ++ .../policy/test/PolicyDecisionExceptionTest.java | 183 +++ .../org/onap/policy/test/PolicyDecisionTest.java | 91 ++ .../policy/test/PolicyEngineExceptionTest.java | 183 +++ .../policy/test/PolicyEngineInterfaceTest.java | 670 +++++++++ .../org/onap/policy/test/PolicyEngineTest.java | 170 +++ .../onap/policy/test/PolicyEventExceptionTest.java | 183 +++ .../org/onap/policy/test/PolicyParametersTest.java | 1409 +++++++++++++++++++ .../onap/policy/test/PolicyResponseStatusTest.java | 154 +++ .../org/onap/policy/test/PolicyResponseTest.java | 72 + .../java/org/onap/policy/test/PolicyTypeTest.java | 91 ++ .../onap/policy/test/PushPolicyParametersTest.java | 269 ++++ .../org/onap/policy/test/RemovedPolicyTest.java | 72 + .../java/org/onap/policy/test/SendEventTest.java | 155 +++ .../test/java/org/onap/policy/test/TestRunner.java | 49 + .../java/org/onap/policy/test/UpdateTypeTest.java | 91 ++ .../java/org/onap/policy/test/package-info.java | 24 + .../policy/std/test/AutoClientEndTest.java | 228 ---- .../policy/std/test/AutoClientUEBTest.java | 567 -------- .../org/openecomp/policy/std/test/Handler.java | 126 -- .../policy/std/test/ManualClientEndTest.java | 126 -- .../policy/std/test/ManualClientEndUEBTest.java | 119 -- .../openecomp/policy/std/test/MatchStoreTest.java | 776 ----------- .../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/StdPolicyResponseTest.java | 348 ----- .../policy/std/test/StdRemovedPolicyTest.java | 206 --- .../openecomp/policy/std/test/StdStatusTest.java | 1433 -------------------- .../openecomp/policy/std/test/package-info.java | 27 - .../openecomp/policy/test/ActionPolicyApiTest.java | 239 ---- .../openecomp/policy/test/AttributeTypeTest.java | 81 -- .../policy/test/ConfigBasePolicyTest.java | 325 ----- .../policy/test/ConfigFirewallPolicyTest.java | 254 ---- .../policy/test/ConfigRequestParametersTest.java | 362 ----- .../policy/test/DecisionPolicyApiTest.java | 219 --- .../policy/test/DecisionRequestParametersTest.java | 232 ---- .../policy/test/DeletePolicyConditionTest.java | 91 -- .../policy/test/DeletePolicyParametersTest.java | 314 ----- .../policy/test/EventRequestParametersTest.java | 193 --- .../policy/test/GetConfigByPolicyNameTest.java | 63 - .../policy/test/GetConfigStringStringMapTest.java | 259 ---- .../policy/test/GetConfigStringStringTest.java | 213 --- .../openecomp/policy/test/GetConfigStringTest.java | 170 --- .../policy/test/ImportParametersTest.java | 403 ------ .../openecomp/policy/test/LoadedPolicyTest.java | 72 - .../policy/test/NotificationHandlerTest.java | 72 - .../policy/test/NotificationSchemeTest.java | 91 -- .../policy/test/NotificationTypeTest.java | 91 -- .../openecomp/policy/test/PDPNotificationTest.java | 72 - .../policy/test/PolicyChangeResponseTest.java | 72 - .../org/openecomp/policy/test/PolicyClassTest.java | 91 -- .../policy/test/PolicyConfigExceptionTest.java | 183 --- .../policy/test/PolicyConfigStatusTest.java | 133 -- .../openecomp/policy/test/PolicyConfigTest.java | 72 - .../policy/test/PolicyConfigTypeTest.java | 91 -- .../policy/test/PolicyDecisionExceptionTest.java | 183 --- .../openecomp/policy/test/PolicyDecisionTest.java | 91 -- .../policy/test/PolicyEngineExceptionTest.java | 183 --- .../policy/test/PolicyEngineInterfaceTest.java | 670 --------- .../openecomp/policy/test/PolicyEngineTest.java | 170 --- .../policy/test/PolicyEventExceptionTest.java | 183 --- .../policy/test/PolicyParametersTest.java | 1409 ------------------- .../policy/test/PolicyResponseStatusTest.java | 154 --- .../openecomp/policy/test/PolicyResponseTest.java | 72 - .../org/openecomp/policy/test/PolicyTypeTest.java | 91 -- .../policy/test/PushPolicyParametersTest.java | 269 ---- .../openecomp/policy/test/RemovedPolicyTest.java | 72 - .../org/openecomp/policy/test/SendEventTest.java | 155 --- .../java/org/openecomp/policy/test/TestRunner.java | 49 - .../org/openecomp/policy/test/UpdateTypeTest.java | 91 -- .../org/openecomp/policy/test/package-info.java | 24 - 118 files changed, 14723 insertions(+), 14723 deletions(-) create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientEndTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/Handler.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/std/test/package-info.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java create mode 100644 PolicyEngineAPI/src/test/java/org/onap/policy/test/package-info.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ActionPolicyApiTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/AttributeTypeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigBasePolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigFirewallPolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigRequestParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionPolicyApiTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionRequestParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyConditionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/EventRequestParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigByPolicyNameTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringMapTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ImportParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/LoadedPolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationHandlerTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationSchemeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationTypeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PDPNotificationTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyChangeResponseTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyClassTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigExceptionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigStatusTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTypeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionExceptionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineExceptionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineInterfaceTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEventExceptionTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseStatusTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyTypeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PushPolicyParametersTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/RemovedPolicyTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/SendEventTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/TestRunner.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/UpdateTypeTest.java delete mode 100644 PolicyEngineAPI/src/test/java/org/openecomp/policy/test/package-info.java (limited to 'PolicyEngineAPI/src/test') diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientEndTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientEndTest.java new file mode 100644 index 000000000..203b9f54f --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientEndTest.java @@ -0,0 +1,228 @@ +/*- + * ============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.onap.policy.std.test; + +import static org.junit.Assert.assertNotNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.NotificationHandler; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.std.AutoClientEnd; +import org.onap.policy.std.StdPolicyEngine; + +/** + * 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.onap.policy.std.AutoClientEnd + assertNotNull(result); + } + + + /** + * 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.onap.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.onap.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.onap.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.onap.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", (String) null); + + 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/onap/policy/std/test/AutoClientUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java new file mode 100644 index 000000000..94c2ac781 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java @@ -0,0 +1,567 @@ +/*- + * ============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.onap.policy.std.test; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.*; +import org.onap.policy.api.NotificationHandler; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.std.AutoClientUEB; + +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 = ""; + String apiKey = ""; + String apiSecret = ""; + List uebURLList = new LinkedList(); + + AutoClientUEB result = new AutoClientUEB(url, uebURLList, apiKey, apiSecret); + + // 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.onap.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.onap.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.onap.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.onap.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.onap.policy.std.AutoClientUEB + assertTrue(result); + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_1() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_2() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_3() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_4() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(), "", ""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_5() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_6() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_7() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_8() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_9() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_10() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_11() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_12() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_13() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_14() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_15() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void run() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testRun_16() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.run(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void setAuto(NotificationScheme,NotificationHandler) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetAuto_1() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + NotificationHandler handler = null; + + fixture.setAuto(scheme, handler); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Run the void setScheme(NotificationScheme) method test. + * + * @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.onap.policy.std.AutoClientUEB + } + + /** + * Run the void terminate() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testTerminate_1() + throws Exception { + AutoClientUEB fixture = new AutoClientUEB("", new LinkedList(),"",""); + fixture.isRunning = true; + + fixture.terminate(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB + } + + /** + * Perform pre-test initialization. + * + * @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 + List urlList = new LinkedList(); + urlList.add("test2.com"); + AutoClientUEB client = new AutoClientUEB("test.com", urlList, "testKey", "testSecret"); + NotificationHandler handler = null; + 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/onap/policy/std/test/Handler.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/Handler.java new file mode 100644 index 000000000..388ca078d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/Handler.java @@ -0,0 +1,126 @@ +/*- + * ============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.onap.policy.std.test; + +import java.util.Collection; + +import org.onap.policy.api.LoadedPolicy; +import org.onap.policy.api.NotificationHandler; +import org.onap.policy.api.NotificationType; +import org.onap.policy.api.PDPNotification; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyConfigStatus; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.RemovedPolicy; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class Handler implements NotificationHandler{ + + private static final Logger LOGGER = FlexLogger.getLogger(Handler.class); + + @Override + public void notificationReceived(PDPNotification notification) { + System.out.println("Notification Received..."); + 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"); + @SuppressWarnings("deprecation") + 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) { + LOGGER.error("Exception Occured"+e); + } catch (PolicyConfigException e) { + LOGGER.error("Exception Occured"+e); + } + } + } + }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"); + @SuppressWarnings("deprecation") + 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) { + LOGGER.error("Exception Occured"+e); + } catch (PolicyConfigException e) { + LOGGER.error("Exception Occured"+e); + } + } + } + } + + +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java new file mode 100644 index 000000000..2ae522c1d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java @@ -0,0 +1,126 @@ +/*- + * ============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.onap.policy.std.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.api.PDPNotification; +import org.onap.policy.std.ManualClientEnd; + +/** + * 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 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/onap/policy/std/test/ManualClientEndUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java new file mode 100644 index 000000000..77b0c6f49 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java @@ -0,0 +1,119 @@ +/*- + * ============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.onap.policy.std.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.api.PDPNotification; +import org.onap.policy.std.ManualClientEndUEB; +import org.onap.policy.std.StdPDPNotification; + +/** + * 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"; + 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 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); + } + + /** + * 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/onap/policy/std/test/MatchStoreTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java new file mode 100644 index 000000000..856474dd8 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java @@ -0,0 +1,776 @@ +/*- + * ============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.onap.policy.std.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.HashSet; +import java.util.Hashtable; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.PDPNotification; +import org.onap.policy.std.MatchStore; +import org.onap.policy.std.Matches; +import org.onap.policy.std.StdPDPNotification; + +/** + * 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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.setOnapName(""); + + 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.onap.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.onap.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.onap.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/onap/policy/std/test/MatchesTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java new file mode 100644 index 000000000..f71d93cb8 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.onap.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.setOnapName(""); + 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.setOnapName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + + String result = fixture.getConfigName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getOnapName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetOnapName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setOnapName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + + String result = fixture.getOnapName(); + + // 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.setOnapName(""); + 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.setOnapName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + String configName = ""; + + fixture.setConfigName(configName); + + // add additional test code here + } + + /** + * Run the void setOnapName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetOnapName_1() + throws Exception { + Matches fixture = new Matches(); + fixture.setOnapName(""); + fixture.setConfigAttributes(new Hashtable()); + fixture.setConfigName(""); + String onapName = ""; + + fixture.setOnapName(onapName); + + // 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/onap/policy/std/test/NotificationStoreTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java new file mode 100644 index 000000000..ed7383e1a --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import org.junit.*; +import org.onap.policy.std.NotificationStore; +import org.onap.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/onap/policy/std/test/NotificationUnMarshalTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java new file mode 100644 index 000000000..fb42f98aa --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import static org.junit.Assert.assertNotNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.std.NotificationUnMarshal; +import org.onap.policy.std.StdPDPNotification; + +/** + * 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/onap/policy/std/test/StdLoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java new file mode 100644 index 000000000..c45a5aca7 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.onap.policy.api.UpdateType; +import org.onap.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/onap/policy/std/test/StdPDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java new file mode 100644 index 000000000..6a558006d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Collection; +import java.util.LinkedList; + +import org.junit.*; +import org.onap.policy.api.LoadedPolicy; +import org.onap.policy.api.NotificationType; +import org.onap.policy.api.RemovedPolicy; +import org.onap.policy.std.StdLoadedPolicy; +import org.onap.policy.std.StdPDPNotification; +import org.onap.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/onap/policy/std/test/StdPolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java new file mode 100644 index 000000000..5ce53d133 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import org.junit.*; +import org.onap.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/onap/policy/std/test/StdPolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java new file mode 100644 index 000000000..736f51b57 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; + +import javax.json.JsonObject; + +import org.junit.*; +import org.onap.policy.api.PolicyConfigStatus; +import org.onap.policy.api.PolicyType; +import org.onap.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/onap/policy/std/test/StdPolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java new file mode 100644 index 000000000..11179aece --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; + +import org.junit.*; +import org.onap.policy.api.PolicyResponseStatus; +import org.onap.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/onap/policy/std/test/StdRemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java new file mode 100644 index 000000000..2482c3015 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import org.junit.*; +import org.onap.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/onap/policy/std/test/StdStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java new file mode 100644 index 000000000..b72d2568d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; + +import javax.json.JsonObject; + +import org.junit.*; +import org.onap.policy.api.PolicyConfigStatus; +import org.onap.policy.api.PolicyDecision; +import org.onap.policy.api.PolicyResponseStatus; +import org.onap.policy.api.PolicyType; +import org.onap.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/onap/policy/std/test/package-info.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/package-info.java new file mode 100644 index 000000000..4c98f98a9 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/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.onap.policy.std.test; diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java new file mode 100644 index 000000000..a66256432 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java @@ -0,0 +1,239 @@ +/*- + * ============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.onap.policy.test; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.policy.api.AttributeType; +import org.onap.policy.api.PolicyChangeResponse; +import org.onap.policy.api.PolicyClass; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.std.StdPolicyChangeResponse; + +import junit.framework.TestCase; + +public class ActionPolicyApiTest extends TestCase { + + private static final Logger logger = FlexLogger.getLogger(ActionPolicyApiTest.class); + + private PolicyEngine policyEngine = null; + private PolicyEngine mockPolicyEngine = null; + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + PolicyParameters policyParameters = new PolicyParameters(); + + @Before + protected void setUp() throws Exception { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + + mockPolicyEngine = Mockito.mock(PolicyEngine.class); + + policyParameters.setPolicyClass(PolicyClass.Action); //required + policyParameters.setPolicyName("test.junitTest"); //required + policyParameters.setPolicyDescription("testing"); //optional + //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI + + //Set the Component Attributes... These are Optional + Map configAttributes = new HashMap(); + configAttributes.put("test", "testing"); + + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + + policyParameters.setActionPerformer("PEP"); + policyParameters.setActionAttribute("testing"); + policyParameters.setRequestID(UUID.randomUUID()); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + @Test + public final void testCreatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.createPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + @Test + public final void testUpdatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.updatePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + + } + + @Test + public final void testCreatePolicyNullPolicyName() { + response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyScope() { + response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullActionAttributes() { + response.setResponseMessage("PE300 - Data Issue: No Action Attribute given."); + policyParameters.setActionAttribute(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullActionPerformer() { + response.setResponseMessage("PE300 - Data Issue: No Action Performer given."); + policyParameters.setActionPerformer(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyInvalidActionPerformer() { + response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given."); + policyParameters.setActionPerformer("testfail"); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyName() { + response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyScope() { + response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullActionAttributes() { + response.setResponseMessage("PE300 - Data Issue: No Action Attribute given."); + policyParameters.setActionAttribute(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullActionPerformer() { + response.setResponseMessage("PE300 - Data Issue: No Action Performer given."); + policyParameters.setActionPerformer(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyInvalidActionPerformer() { + response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given."); + policyParameters.setActionPerformer("testfail"); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java new file mode 100644 index 000000000..62c447fae --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java @@ -0,0 +1,81 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.AttributeType; + +import static org.junit.Assert.*; + +/** + * The class AttributeTypeTest contains tests for the class {@link AttributeType}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class AttributeTypeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToString_1() + throws Exception { + AttributeType fixture = AttributeType.MATCHING; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("matching", 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 + } + +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java new file mode 100644 index 000000000..5d5a076ae --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java @@ -0,0 +1,325 @@ +/*- + * ============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.onap.policy.test; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.policy.api.AttributeType; +import org.onap.policy.api.PolicyChangeResponse; +import org.onap.policy.api.PolicyConfigType; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.api.PolicyType; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.std.StdPolicyChangeResponse; + +import junit.framework.TestCase; + +/** + * The class ConfigBasePolicyTest contains tests for the class + * {@link PolicyEngine} + * + * @pattern JUnit Test Case + * * + */ +public class ConfigBasePolicyTest extends TestCase { + + private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); + + private PolicyEngine policyEngine = null; + private PolicyEngine mockPolicyEngine = null; + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + PolicyParameters policyParameters = new PolicyParameters(); + + /** + * Perform pre-test initialization + * + * @throws Exception + * + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + + mockPolicyEngine = Mockito.mock(PolicyEngine.class); + + policyParameters.setPolicyConfigType(PolicyConfigType.Base); //required + policyParameters.setPolicyName("test.junitTest"); //required + policyParameters.setOnapName("test"); + policyParameters.setConfigName("testBase"); + policyParameters.setConfigBodyType(PolicyType.OTHER); + policyParameters.setConfigBody("testing"); + policyParameters.setPolicyDescription("testing"); //optional + //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI + + //Set the Component Attributes... These are Optional + Map configAttributes = new HashMap(); + configAttributes.put("test", "testing"); + + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + + policyParameters.setRequestID(UUID.randomUUID()); + } + + /** + * Perform post-test clean up + * + * @throws Exception + * + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + // Add additional tear down code here + } + + /** + * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test + */ + public void testCreatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.createPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String createConfigPolicy() method test + */ + @SuppressWarnings("deprecation") + @Test + public void testCreateConfigPolicy() { + String response = "success"; + String result = null; + try { + + Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test + */ + public void testUpdatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.updatePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String updateConfigPolicy() method test + */ + @SuppressWarnings("deprecation") + @Test + public void testUpdateConfigPolicy() { + String response = "success"; + String result = null; + try { + + Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + @Test + public final void testCreatePolicyNullPolicyName() { + response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyScope() { + response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullOnapName() { + response.setResponseMessage("PE300 - Data Issue: No ONAP Name given."); + policyParameters.setOnapName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyConfigName() { + response.setResponseMessage("PE300 - Data Issue: No Config Name given."); + policyParameters.setConfigName(null);; + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyConfigBodyType() { + response.setResponseMessage("PE300 - Data Issue: No Config Body Type given."); + policyParameters.setConfigBodyType(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyConfigBody() { + response.setResponseMessage("PE300 - Data Issue: No Config Body given."); + policyParameters.setConfigBody(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyName() { + response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyScope() { + response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullOnapName() { + response.setResponseMessage("PE300 - Data Issue: No ONAP Name given."); + policyParameters.setOnapName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyConfigName() { + response.setResponseMessage("PE300 - Data Issue: No Config Name given."); + policyParameters.setConfigName(null);; + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyConfigBodyType() { + response.setResponseMessage("PE300 - Data Issue: No Config Body Type given."); + policyParameters.setConfigBodyType(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyConfigBody() { + response.setResponseMessage("PE300 - Data Issue: No Config Body given."); + policyParameters.setConfigBody(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + //assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } +} \ No newline at end of file diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java new file mode 100644 index 000000000..78ae2493b --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java @@ -0,0 +1,254 @@ +/*- + * ============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.onap.policy.test; + +import java.io.StringReader; +import java.util.UUID; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; + +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.policy.api.PolicyChangeResponse; +import org.onap.policy.api.PolicyConfigType; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.std.StdPolicyChangeResponse; + +import junit.framework.TestCase; + +public class ConfigFirewallPolicyTest extends TestCase { + + private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); + + private PolicyEngine policyEngine = null; + private PolicyEngine mockPolicyEngine = null; + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + PolicyParameters policyParameters = new PolicyParameters(); + String json = null; + + /** + * Perform pre-test initialization + * + * @throws Exception + * + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + + mockPolicyEngine = Mockito.mock(PolicyEngine.class); + + policyParameters.setPolicyConfigType(PolicyConfigType.Firewall); //required + policyParameters.setPolicyName("test.junitTest"); //required + + 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; + + policyParameters.setConfigBody(buildJSON(json).toString()); + + //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI + policyParameters.setRequestID(UUID.randomUUID()); + } + + 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; + } + /** + * Perform post-test clean up + * + * @throws Exception + * + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + // Add additional tear down code here + } + + /** + * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test + */ + public void testCreatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.createPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String createConfigFirewallPolicy() method test + */ + @SuppressWarnings("deprecation") + @Test + public void testCreateConfigFirewallPolicy() { + String response = "success"; + String result = null; + JsonObject jsonObj = buildJSON(json); + try { + + Mockito.when(mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test + */ + public void testUpdatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.updatePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String updateConfigFirewallPolicy() method test + */ + @SuppressWarnings("deprecation") + @Test + public void testUpdateConfigFirewallPolicy() { + String response = "success"; + String result = null; + JsonObject jsonObj = buildJSON(json); + try { + + Mockito.when(mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + @Test + public final void testCreatePolicyNullPolicyName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyScope() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyConfigBody() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setConfigBody(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyScope() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyConfigBody() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setConfigBody(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java new file mode 100644 index 000000000..91025f5c0 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java @@ -0,0 +1,362 @@ +/*- + * ============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.onap.policy.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.UUID; + +import org.junit.*; +import org.onap.policy.api.ConfigRequestParameters; + +import static org.junit.Assert.*; + +/** + * The class ConfigRequestParametersTest contains tests for the class {@link ConfigRequestParameters}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class ConfigRequestParametersTest { + /** + * Run the ConfigRequestParameters() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testConfigRequestParameters_1() + throws Exception { + + ConfigRequestParameters result = new ConfigRequestParameters(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getPolicyName()); + assertEquals(null, result.getConfigName()); + assertEquals(null, result.getConfigAttributes()); + assertEquals(null, result.getRequestID()); + assertEquals(null, result.getOnapName()); + assertEquals(Boolean.FALSE, result.getUnique()); + } + + /** + * Run the ConfigRequestParameters(String,String,String,Map,Boolean,UUID) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testConfigRequestParameters_2() + throws Exception { + String policyName = ""; + String onapComponentName = ""; + String configName = ""; + Map configAttributes = new Hashtable(); + Boolean unique = new Boolean(true); + UUID requestID = UUID.randomUUID(); + + ConfigRequestParameters result = createConfigRequest(policyName, onapComponentName, configName, configAttributes, unique, requestID); + + // add additional test code here + assertNotNull(result); + assertEquals("", result.getPolicyName()); + assertEquals("", result.getConfigName()); + assertEquals("", result.getOnapName()); + assertEquals(Boolean.TRUE, result.getUnique()); + } + + /** + * Run the Map getConfigAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetConfigAttributes_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + + 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:40 PM + */ + @Test + public void testGetConfigName_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + + String result = fixture.getConfigName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getOnapName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetOnapName_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + + String result = fixture.getOnapName(); + + // 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_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.fromString("6b5aa070-90bc-46a6-9a59-e1fe526df7ae")); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("6b5aa070-90bc-46a6-9a59-e1fe526df7ae", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-7324574836520519762L, result.getLeastSignificantBits()); + assertEquals(7735671715287287462L, result.getMostSignificantBits()); + } + + /** + * Run the Boolean getUnique() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetUnique_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + + Boolean result = fixture.getUnique(); + + // add additional test code here + assertNotNull(result); + assertEquals("true", result.toString()); + assertEquals(true, result.booleanValue()); + } + + /** + * Run the void makeUnique(Boolean) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testMakeUnique_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + Boolean unique = new Boolean(true); + + fixture.makeUnique(unique); + + // add additional test code here + } + + /** + * Run the void setConfigAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetConfigAttributes_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + 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:40 PM + */ + @Test + public void testSetConfigName_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + String configName = ""; + + fixture.setConfigName(configName); + + // add additional test code here + } + + /** + * Run the void setOnapName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetOnapName_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + String onapComponentName = ""; + + fixture.setOnapName(onapComponentName); + + // 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 { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(ConfigRequestParametersTest.class); + } + + private ConfigRequestParameters createConfigRequest(String policyName, String onapComponentName, String configName, Map configAttributes, Boolean unique, UUID requestID){ + ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); + configRequestParameters.setRequestID(requestID); + configRequestParameters.setPolicyName(policyName); + configRequestParameters.setOnapName(onapComponentName); + configRequestParameters.setConfigName(configName); + configRequestParameters.setConfigAttributes(configAttributes); + configRequestParameters.makeUnique(unique); + return configRequestParameters; + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java new file mode 100644 index 000000000..a80093470 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java @@ -0,0 +1,219 @@ +/*- + * ============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.onap.policy.test; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.policy.api.AttributeType; +import org.onap.policy.api.PolicyChangeResponse; +import org.onap.policy.api.PolicyClass; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.std.StdPolicyChangeResponse; + +import junit.framework.TestCase; + +/** + * The class DecisionPolicyApiTest contains tests for the class + * {@link PolicyEngine} + * + * @pattern JUnit Test Case + * * + */ +public class DecisionPolicyApiTest extends TestCase { + + private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); + + private PolicyEngine policyEngine = null; + private PolicyEngine mockPolicyEngine = null; + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + PolicyParameters policyParameters = new PolicyParameters(); + + /** + * Perform pre-test initialization + * + * @throws Exception + * + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + + mockPolicyEngine = Mockito.mock(PolicyEngine.class); + + policyParameters.setPolicyClass(PolicyClass.Decision); //required + policyParameters.setPolicyName("test.junitTest"); //required + policyParameters.setOnapName("test"); + policyParameters.setPolicyDescription("testing"); //optional + //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI + + //Set the Component Attributes... These are Optional + Map configAttributes = new HashMap(); + configAttributes.put("test", "testing"); + + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + + //Set the settings... These are Optional +/* Map settingsMap = new HashMap(); + settingsMap.put("server", "5"); + + Map> settings = new HashMap>(); + settings.put(AttributeType.SETTINGS, settingsMap); + policyParameters.setSettings(settings);*/ + + policyParameters.setRequestID(UUID.randomUUID()); + } + + /** + * Perform post-test clean up + * + * @throws Exception + * + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + // Add additional tear down code here + } + + /** + * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test + */ + public void testCreatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.createPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test + */ + public void testUpdatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + try { + + Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.updatePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + @Test + public final void testCreatePolicyNullPolicyName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullPolicyScope() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testCreatePolicyNullOnapName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setOnapName(null); + try{ + result = policyEngine.createPolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullPolicyScope() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setPolicyName("test"); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } + + @Test + public final void testUpdatePolicyNullOnapName() { + response.setResponseMessage("PE500 - Process Flow Issue: :500:"); + policyParameters.setOnapName(null); + try{ + result = policyEngine.updatePolicy(policyParameters); + } catch (Exception e){ + logger.warn(e.getMessage()); + } + assertEquals(result.getResponseMessage(), response.getResponseMessage()); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java new file mode 100644 index 000000000..746822f94 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java @@ -0,0 +1,232 @@ +/*- + * ============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.onap.policy.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.UUID; + +import org.junit.*; +import org.onap.policy.api.DecisionRequestParameters; + +import static org.junit.Assert.*; + +/** + * The class DecisionRequestParametersTest contains tests for the class {@link DecisionRequestParameters}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class DecisionRequestParametersTest { + /** + * Run the DecisionRequestParameters() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testDecisionRequestParameters_1() + throws Exception { + + DecisionRequestParameters result = new DecisionRequestParameters(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getONAPComponentName()); + assertEquals(null, result.getDecisionAttributes()); + assertEquals(null, result.getRequestID()); + } + + /** + * Run the DecisionRequestParameters(String,Map,UUID) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testDecisionRequestParameters_2() + throws Exception { + String onapComponentName = ""; + Map decisionAttributes = new Hashtable(); + UUID requestID = UUID.randomUUID(); + + DecisionRequestParameters result = new DecisionRequestParameters(onapComponentName, decisionAttributes, requestID); + + // add additional test code here + assertNotNull(result); + assertEquals("", result.getONAPComponentName()); + } + + /** + * Run the Map getDecisionAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetDecisionAttributes_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); + + Map result = fixture.getDecisionAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getONAPComponentName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetONAPComponentName_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); + + String result = fixture.getONAPComponentName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.fromString("d1db6a6d-7140-4864-8200-6b541261fdd2")); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("d1db6a6d-7140-4864-8200-6b541261fdd2", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-9079138839949083182L, result.getLeastSignificantBits()); + assertEquals(-3324946881598961564L, result.getMostSignificantBits()); + } + + /** + * Run the void setDecisionAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDecisionAttributes_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); + Map decisionAttributes = new Hashtable(); + + fixture.setDecisionAttributes(decisionAttributes); + + // add additional test code here + } + + /** + * Run the void setONAPComponentName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetONAPComponentName_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); + String onapComponentName = ""; + + fixture.setONAPComponentName(onapComponentName); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(DecisionRequestParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java new file mode 100644 index 000000000..2513816bb --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.DeletePolicyCondition; + +import static org.junit.Assert.*; + +/** + * The class DeletePolicyConditionTest contains tests for the class {@link DeletePolicyCondition}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class DeletePolicyConditionTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + DeletePolicyCondition fixture = DeletePolicyCondition.ALL; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("All Versions", 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(DeletePolicyConditionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java new file mode 100644 index 000000000..423b839f6 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.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.onap.policy.test; + +import java.util.UUID; + +import org.junit.*; +import org.onap.policy.api.DeletePolicyCondition; +import org.onap.policy.api.DeletePolicyParameters; + +import static org.junit.Assert.*; + +/** + * The class DeletePolicyParametersTest contains tests for the class {@link DeletePolicyParameters}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class DeletePolicyParametersTest { + /** + * Run the DeletePolicyCondition getDeleteCondition() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetDeleteCondition_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + + DeletePolicyCondition result = fixture.getDeleteCondition(); + + // add additional test code here + assertNotNull(result); + assertEquals("All Versions", result.toString()); + assertEquals("ALL", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getPdpGroup() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPdpGroup_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + + String result = fixture.getPdpGroup(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyComponent() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyComponent_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + + String result = fixture.getPolicyComponent(); + + // 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_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d")); + fixture.setPdpGroup(""); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("482e90e2-2ad7-4265-9893-4cfe08ef1e3d", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-7452528304412746179L, result.getLeastSignificantBits()); + assertEquals(5201253920715260517L, result.getMostSignificantBits()); + } + + /** + * Run the void setDeleteCondition(DeletePolicyCondition) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetDeleteCondition_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + DeletePolicyCondition deleteCondition = DeletePolicyCondition.ALL; + + fixture.setDeleteCondition(deleteCondition); + + // add additional test code here + } + + /** + * Run the void setPdpGroup(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPdpGroup_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + String pdpGroup = ""; + + fixture.setPdpGroup(pdpGroup); + + // add additional test code here + } + + /** + * Run the void setPolicyComponent(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyComponent_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + String policyComponent = ""; + + fixture.setPolicyComponent(policyComponent); + + // 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 { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + DeletePolicyParameters fixture = new DeletePolicyParameters(); + fixture.setPolicyComponent(""); + fixture.setPolicyName(""); + fixture.setDeleteCondition(DeletePolicyCondition.ALL); + fixture.setRequestID(UUID.randomUUID()); + fixture.setPdpGroup(""); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(DeletePolicyParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java new file mode 100644 index 000000000..4fecea8c2 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java @@ -0,0 +1,193 @@ +/*- + * ============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.onap.policy.test; + +import java.util.Hashtable; +import java.util.Map; +import java.util.UUID; + +import org.junit.*; +import org.onap.policy.api.EventRequestParameters; + +import static org.junit.Assert.*; + +/** + * The class EventRequestParametersTest contains tests for the class {@link EventRequestParameters}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class EventRequestParametersTest { + /** + * Run the EventRequestParameters() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testEventRequestParameters_1() + throws Exception { + + EventRequestParameters result = new EventRequestParameters(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getEventAttributes()); + assertEquals(null, result.getRequestID()); + } + + /** + * Run the EventRequestParameters(Map,UUID) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testEventRequestParameters_2() + throws Exception { + Map eventAttributes = new Hashtable(); + UUID requestID = UUID.randomUUID(); + + EventRequestParameters result = new EventRequestParameters(eventAttributes, requestID); + + // add additional test code here + assertNotNull(result); + } + + /** + * Run the Map getEventAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetEventAttributes_1() + throws Exception { + EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); + + Map result = fixture.getEventAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.fromString("5b15376d-569b-4772-ac75-9362043f6a6c")); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("5b15376d-569b-4772-ac75-9362043f6a6c", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-6019743277723456916L, result.getLeastSignificantBits()); + assertEquals(6563212974706345842L, result.getMostSignificantBits()); + } + + /** + * Run the void setEventAttributes(Map) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetEventAttributes_1() + throws Exception { + EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); + Map eventAttributes = new Hashtable(); + + fixture.setEventAttributes(eventAttributes); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(EventRequestParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java new file mode 100644 index 000000000..07af71eaf --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java @@ -0,0 +1,63 @@ +/*- + * ============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.onap.policy.test; + +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +import junit.framework.TestCase; + +public class GetConfigByPolicyNameTest extends TestCase { + private PolicyEngine policyEngine = null; + private String policyName = null; + private Collection policyConfig = null; + private static final Logger logger = FlexLogger.getLogger(GetConfigByPolicyNameTest.class); + @Before + public void setUp() { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigPolicyNameNotValid(){ + policyName = null; + try{ + policyConfig = policyEngine.getConfigByPolicyName(policyName); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java new file mode 100644 index 000000000..f70a16a98 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java @@ -0,0 +1,259 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyConfigStatus; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyType; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class GetConfigStringStringMapTest { + + private PolicyEngine policyEngine = null; + private String onapComponentName = null; + private String configName = null; + private Map configAttributes = new HashMap(); + private Collection policyConfig = null; + private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringMapTest.class); + @Before + public void setUp() { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringMapFail() { + onapComponentName = null; + configName = null; + configAttributes = null; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringMapFail1() { + onapComponentName = null; + configName = "testFail"; + configAttributes.put("TestValue", "Fail"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringMapFail2() { + onapComponentName = "TestFail"; + configName = null; + configAttributes.put("TestValue", "Fail"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringMapFail3() { + onapComponentName = "TestFail"; + configName = "configFail"; + configAttributes= null; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringMapfail4() { + onapComponentName = "TestFail"; + configName = "configFail"; + configAttributes.put("", ""); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringMapNotValid() { + onapComponentName = "TestFail"; + configName = "configFail"; + configAttributes.put("Action:com.test.fail", "Value"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertNull(policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringMapValidJSON() { + onapComponentName = "JSON"; + configName = "JSONconfig"; + configAttributes.put("Resource.com:test:resource:json", "Test"); + configAttributes.put("Action.com:test:action:json", "TestJSON"); + configAttributes.put("Subject.com:test:subject:json", "TestSubject"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.JSON,policyConfig.getType()); + assertNotNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringMapValidXML() { + onapComponentName = "XML"; + configName = "XMLconfig"; + configAttributes.put("Resource.com:test:resource:json", "Test"); + configAttributes.put("Action.com:test:action:json", "TestJSON"); + configAttributes.put("Subject.com:test:subject:json", "TestSubject"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.XML,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNotNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringMapValidProperties() { + onapComponentName = "Properties"; + configName = "PropConfig" ; + configAttributes.put("Resource.com:test:resource:json", "Test"); + configAttributes.put("Action.com:test:action:json", "TestJSON"); + configAttributes.put("Subject.com:test:subject:json", "TestSubject"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNotNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringMapValidOther() { + onapComponentName = "Other"; + configName = "OtherConfig" ; + configAttributes.put("Resource.com:test:resource:json", "Test"); + configAttributes.put("Action.com:test:action:json", "TestJSON"); + configAttributes.put("Subject.com:test:subject:json", "TestSubject"); + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.OTHER,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNotNull(policyConfig.toOther()); + } + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java new file mode 100644 index 000000000..0a6db2dd4 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java @@ -0,0 +1,213 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyConfigStatus; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyType; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class GetConfigStringStringTest { + + private PolicyEngine policyEngine = null; + private String onapComponentName = null; + private String configName = null; + private Collection policyConfig = null; + private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringTest.class); + @Before + public void setUp() { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringFail() { + onapComponentName = null; + configName = null; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringFail1() { + onapComponentName = null; + configName = ""; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + @Test + public void testGetConfigStringStringFail2() { + onapComponentName = ""; + configName = null; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringNotvalid() { + onapComponentName = "fail"; + configName = "fail"; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertNull(policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringValidJSON() { + onapComponentName = "JSON"; + configName = "JSONconfig"; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.JSON,policyConfig.getType()); + assertNotNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringValidXML() { + onapComponentName = "XML"; + configName = "XMLconfig"; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.XML,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNotNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringValidProperties() { + onapComponentName = "Properties"; + configName = "PropConfig" ; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNotNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringStringValidOther() { + onapComponentName = "Other"; + configName = "OtherConfig" ; + try { + policyConfig = policyEngine.getConfig(onapComponentName, configName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.OTHER,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNotNull(policyConfig.toOther()); + } + } + +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java new file mode 100644 index 000000000..f87a59c09 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java @@ -0,0 +1,170 @@ +/*- + * ============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.onap.policy.test; + +import java.util.Collection; + +import org.junit.Before; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +import junit.framework.TestCase; + +public class GetConfigStringTest extends TestCase{ + + private PolicyEngine policyEngine = null; + private String onapComponentName = null; + private Collection policyConfig = null; + private static final Logger logger = FlexLogger.getLogger(GetConfigStringTest.class); + @Before + public void setUp() { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + } + + //@Test + @SuppressWarnings("deprecation") + public void testGetConfigStringFail() { + onapComponentName = null; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + /*@Test + public void testGetConfigStringNotvalid() { + onapComponentName = "fail"; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertNull(policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + */ + + /*@Test + public void testGetConfigStringValidJSON() { + onapComponentName = "JSON"; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.JSON,policyConfig.getType()); + assertNotNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + */ + /*@Test + public void testGetConfigStringValidXML() { + onapComponentName = "XML"; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.XML,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNotNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + */ + /*@Test + public void testGetConfigStringValidProperties() { + onapComponentName = "Properties"; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNotNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNull(policyConfig.toOther()); + } + } + */ + /*@Test + public void testGetConfigStringValidOther() { + onapComponentName = "Other"; + try { + policyConfig = policyEngine.getConfig(onapComponentName); + } catch (PolicyConfigException e) { + logger.warn(e.getMessage()); + } + for(PolicyConfig policyConfig : this.policyConfig){ + logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig); + assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); + assertNotNull(policyConfig.getPolicyConfigMessage()); + assertEquals(PolicyType.OTHER,policyConfig.getType()); + assertNull(policyConfig.toJSON()); + assertNull(policyConfig.toProperties()); + assertNull(policyConfig.toXML()); + assertNotNull(policyConfig.toOther()); + } + } + */ +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java new file mode 100644 index 000000000..be3e9c39b --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java @@ -0,0 +1,403 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.UUID; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.ImportParameters; + +/** + * The class ImportParametersTest contains tests for the class {@link ImportParameters}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class ImportParametersTest { + /** + * Run the String getDescription() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetDescription_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + + String result = fixture.getDescription(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getFilePath() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetFilePath_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + + String result = fixture.getFilePath(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.fromString("731dca0a-fe99-456c-8ad2-87cff8437b2f")); + fixture.setDescription(""); + fixture.setServiceName(""); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("731dca0a-fe99-456c-8ad2-87cff8437b2f", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-8443537024073106641L, result.getLeastSignificantBits()); + assertEquals(8295008237256263020L, result.getMostSignificantBits()); + } + + /** + * Run the String getServiceName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetServiceName_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + + String result = fixture.getServiceName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the ImportParameters.IMPORT_TYPE getServiceType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetServiceType_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + + ImportParameters.IMPORT_TYPE result = fixture.getServiceType(); + + // add additional test code here + assertNotNull(result); + assertEquals("MICROSERVICE", result.name()); + assertEquals("MICROSERVICE", result.toString()); + assertEquals(0, result.ordinal()); + } + + /** + * Run the String getVersion() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetVersion_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + + String result = fixture.getVersion(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the void setDescription(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetDescription_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + String description = ""; + + fixture.setDescription(description); + + // add additional test code here + } + + /** + * Run the void setFilePath(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetFilePath_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + String filePath = ""; + + fixture.setFilePath(filePath); + + // add additional test code here + } + + /** + * Run the void setImportParameters(String,String,UUID,String,IMPORT_TYPE,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetImportParameters_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + String serviceName = ""; + String description = ""; + UUID requestID = UUID.randomUUID(); + String filePath = ""; + ImportParameters.IMPORT_TYPE importType = ImportParameters.IMPORT_TYPE.MICROSERVICE; + String version = ""; + + fixture.setImportParameters(serviceName, description, requestID, filePath, importType, version); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // add additional test code here + } + + /** + * Run the void setServiceName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetServiceName_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + String serviceName = ""; + + fixture.setServiceName(serviceName); + + // add additional test code here + } + + /** + * Run the void setServiceType(IMPORT_TYPE) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetServiceType_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + ImportParameters.IMPORT_TYPE enumImportType = ImportParameters.IMPORT_TYPE.MICROSERVICE; + + fixture.setServiceType(enumImportType); + + // add additional test code here + } + + /** + * Run the void setVersion(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetVersion_1() + throws Exception { + ImportParameters fixture = new ImportParameters(); + fixture.setFilePath(""); + fixture.setVersion(""); + fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); + fixture.setRequestID(UUID.randomUUID()); + fixture.setDescription(""); + fixture.setServiceName(""); + String version = ""; + + fixture.setVersion(version); + + // 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(ImportParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java new file mode 100644 index 000000000..1cc9de8df --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.LoadedPolicy; + +/** + * The class LoadedPolicyTest contains tests for the class {@link LoadedPolicy}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class LoadedPolicyTest { + /** + * 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(LoadedPolicyTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java new file mode 100644 index 000000000..4b996ce35 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.NotificationHandler; + +/** + * The class NotificationHandlerTest contains tests for the class {@link NotificationHandler}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class NotificationHandlerTest { + /** + * 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(NotificationHandlerTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java new file mode 100644 index 000000000..3274cf3ac --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.NotificationScheme; + +import static org.junit.Assert.*; + +/** + * The class NotificationSchemeTest contains tests for the class {@link NotificationScheme}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class NotificationSchemeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToString_1() + throws Exception { + NotificationScheme fixture = NotificationScheme.AUTO_ALL_NOTIFICATIONS; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("auto_all_notifications", 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(NotificationSchemeTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java new file mode 100644 index 000000000..53ef086e2 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.NotificationType; + +import static org.junit.Assert.*; + +/** + * The class NotificationTypeTest contains tests for the class {@link NotificationType}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class NotificationTypeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToString_1() + throws Exception { + NotificationType fixture = NotificationType.BOTH; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("both", 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(NotificationTypeTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java new file mode 100644 index 000000000..50d0aa324 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.PDPNotification; + +/** + * The class PDPNotificationTest contains tests for the class {@link PDPNotification}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PDPNotificationTest { + /** + * 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(PDPNotificationTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java new file mode 100644 index 000000000..e8fd6346a --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.PolicyChangeResponse; + +/** + * The class PolicyChangeResponseTest contains tests for the class {@link PolicyChangeResponse}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyChangeResponseTest { + /** + * 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(PolicyChangeResponseTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java new file mode 100644 index 000000000..24eafc1ad --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyClass; + +import static org.junit.Assert.*; + +/** + * The class PolicyClassTest contains tests for the class {@link PolicyClass}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class PolicyClassTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyClass fixture = PolicyClass.Action; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("Action", 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(PolicyClassTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java new file mode 100644 index 000000000..60b11b5c4 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java @@ -0,0 +1,183 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyConfigException; + +import static org.junit.Assert.*; + +/** + * The class PolicyConfigExceptionTest contains tests for the class {@link PolicyConfigException}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class PolicyConfigExceptionTest { + /** + * Run the PolicyConfigException() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyConfigException_1() + throws Exception { + + PolicyConfigException result = new PolicyConfigException(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyConfigException", result.toString()); + assertEquals(null, result.getLocalizedMessage()); + assertEquals(null, result.getMessage()); + } + + /** + * Run the PolicyConfigException(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyConfigException_2() + throws Exception { + String message = ""; + + PolicyConfigException result = new PolicyConfigException(message); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyConfigException(Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyConfigException_3() + throws Exception { + Throwable cause = new Throwable(); + + PolicyConfigException result = new PolicyConfigException(cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyConfigException: java.lang.Throwable", result.toString()); + assertEquals("java.lang.Throwable", result.getLocalizedMessage()); + assertEquals("java.lang.Throwable", result.getMessage()); + } + + /** + * Run the PolicyConfigException(String,Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyConfigException_4() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + + PolicyConfigException result = new PolicyConfigException(message, cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyConfigException(String,Throwable,boolean,boolean) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyConfigException_5() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + boolean enableSuppression = true; + boolean writableStackTrace = true; + + PolicyConfigException result = new PolicyConfigException(message, cause, enableSuppression, writableStackTrace); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * 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(PolicyConfigExceptionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java new file mode 100644 index 000000000..7a93f0505 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java @@ -0,0 +1,133 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyConfigStatus; + +import static org.junit.Assert.*; + +/** + * The class PolicyConfigStatusTest contains tests for the class {@link PolicyConfigStatus}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyConfigStatusTest { + /** + * Run the PolicyConfigStatus getStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetStatus_1() + throws Exception { + String configStatus = ""; + + PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus); + + // add additional test code here + assertNotNull(result); + assertEquals("not_found", result.toString()); + assertEquals("CONFIG_NOT_FOUND", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the PolicyConfigStatus getStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetStatus_2() + throws Exception { + String configStatus = ""; + + PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus); + + // 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 toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyConfigStatus fixture = PolicyConfigStatus.CONFIG_NOT_FOUND; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("not_found", 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(PolicyConfigStatusTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java new file mode 100644 index 000000000..0aa4fbbfa --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.PolicyConfig; + +/** + * The class PolicyConfigTest contains tests for the class {@link PolicyConfig}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyConfigTest { + /** + * 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(PolicyConfigTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java new file mode 100644 index 000000000..e5e0b5494 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyConfigType; + +import static org.junit.Assert.*; + +/** + * The class PolicyConfigTypeTest contains tests for the class {@link PolicyConfigType}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyConfigTypeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyConfigType fixture = PolicyConfigType.BRMS_PARAM; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("BRMS_Param", 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(PolicyConfigTypeTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java new file mode 100644 index 000000000..f0ee88151 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java @@ -0,0 +1,183 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyDecisionException; + +import static org.junit.Assert.*; + +/** + * The class PolicyDecisionExceptionTest contains tests for the class {@link PolicyDecisionException}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class PolicyDecisionExceptionTest { + /** + * Run the PolicyDecisionException() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyDecisionException_1() + throws Exception { + + PolicyDecisionException result = new PolicyDecisionException(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyDecisionException", result.toString()); + assertEquals(null, result.getLocalizedMessage()); + assertEquals(null, result.getMessage()); + } + + /** + * Run the PolicyDecisionException(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyDecisionException_2() + throws Exception { + String message = ""; + + PolicyDecisionException result = new PolicyDecisionException(message); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyDecisionException(Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyDecisionException_3() + throws Exception { + Throwable cause = new Throwable(); + + PolicyDecisionException result = new PolicyDecisionException(cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyDecisionException: java.lang.Throwable", result.toString()); + assertEquals("java.lang.Throwable", result.getLocalizedMessage()); + assertEquals("java.lang.Throwable", result.getMessage()); + } + + /** + * Run the PolicyDecisionException(String,Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyDecisionException_4() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + + PolicyDecisionException result = new PolicyDecisionException(message, cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyDecisionException(String,Throwable,boolean,boolean) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyDecisionException_5() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + boolean enableSuppression = true; + boolean writableStackTrace = true; + + PolicyDecisionException result = new PolicyDecisionException(message, cause, enableSuppression, writableStackTrace); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * 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(PolicyDecisionExceptionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java new file mode 100644 index 000000000..4d9523859 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyDecision; + +import static org.junit.Assert.*; + +/** + * The class PolicyDecisionTest contains tests for the class {@link PolicyDecision}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyDecisionTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyDecision fixture = PolicyDecision.DENY; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("deny", 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(PolicyDecisionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java new file mode 100644 index 000000000..58c45b97c --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java @@ -0,0 +1,183 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyEngineException; + +import static org.junit.Assert.*; + +/** + * The class PolicyEngineExceptionTest contains tests for the class {@link PolicyEngineException}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyEngineExceptionTest { + /** + * Run the PolicyEngineException() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testPolicyEngineException_1() + throws Exception { + + PolicyEngineException result = new PolicyEngineException(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyEngineException", result.toString()); + assertEquals(null, result.getLocalizedMessage()); + assertEquals(null, result.getMessage()); + } + + /** + * Run the PolicyEngineException(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testPolicyEngineException_2() + throws Exception { + String message = ""; + + PolicyEngineException result = new PolicyEngineException(message); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyEngineException(Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testPolicyEngineException_3() + throws Exception { + Throwable cause = new Throwable(); + + PolicyEngineException result = new PolicyEngineException(cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEngineException: java.lang.Throwable", result.toString()); + assertEquals("java.lang.Throwable", result.getLocalizedMessage()); + assertEquals("java.lang.Throwable", result.getMessage()); + } + + /** + * Run the PolicyEngineException(String,Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testPolicyEngineException_4() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + + PolicyEngineException result = new PolicyEngineException(message, cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyEngineException(String,Throwable,boolean,boolean) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testPolicyEngineException_5() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + boolean enableSuppression = true; + boolean writableStackTrace = true; + + PolicyEngineException result = new PolicyEngineException(message, cause, enableSuppression, writableStackTrace); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * 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(PolicyEngineExceptionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java new file mode 100644 index 000000000..be9e0e7e8 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java @@ -0,0 +1,670 @@ +/*- + * ============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.onap.policy.test; + +import java.io.StringReader; +import java.net.HttpURLConnection; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; + +import org.mockito.Mockito; +import org.onap.policy.api.AttributeType; +import org.onap.policy.api.ConfigRequestParameters; +import org.onap.policy.api.DecisionRequestParameters; +import org.onap.policy.api.DecisionResponse; +import org.onap.policy.api.DeletePolicyCondition; +import org.onap.policy.api.DeletePolicyParameters; +import org.onap.policy.api.EventRequestParameters; +import org.onap.policy.api.ImportParameters; +import org.onap.policy.api.ImportParameters.IMPORT_TYPE; +import org.onap.policy.api.NotificationHandler; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.api.PDPNotification; +import org.onap.policy.api.PolicyChangeResponse; +import org.onap.policy.api.PolicyClass; +import org.onap.policy.api.PolicyConfig; +import org.onap.policy.api.PolicyConfigException; +import org.onap.policy.api.PolicyDecisionException; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyEventException; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.api.PolicyResponse; +import org.onap.policy.api.PushPolicyParameters; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.std.StdPDPNotification; +import org.onap.policy.std.StdPolicyChangeResponse; +import org.onap.policy.std.StdPolicyResponse; + +import junit.framework.TestCase; + +/** + * The class PolicyEngineInterfaceTest contains tests for the + * class {@link PolicyEngine} + * + * @pattern JUnit Test Case + * + * @generatedBy CodePro at 5/27/16 10:33 AM + * + * + * @version $Revision$ + */ +public class PolicyEngineInterfaceTest extends TestCase { + + private static final Logger logger = FlexLogger.getLogger(PolicyEngineInterfaceTest.class); + + private PolicyEngine policyEngine = null; + private PolicyEngine mockPolicyEngine = null; + private Collection policyConfig = null; + private UUID requestID = UUID.randomUUID(); + + + PolicyChangeResponse result = null; + StdPolicyChangeResponse response = new StdPolicyChangeResponse(); + + + /** + * Construct new test instance + * + * @param name the test name + */ + public PolicyEngineInterfaceTest(String name) { + super(name); + } + + /** + * Perform pre-test initialization + * + * @throws Exception + * + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + + mockPolicyEngine = Mockito.mock(PolicyEngine.class); + HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); + Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_OK); + + } + + /** + * Perform post-test clean up + * + * @throws Exception + * + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + // Add additional tear down code here + } + + /** + * Run the Collection getConfigByPolicyName(String) method + * test + */ + @SuppressWarnings("deprecation") + public void testGetConfigByPolicyName() { + String policyName = null; + try{ + policyConfig = policyEngine.getConfigByPolicyName(policyName); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + public void testGetConfigByPolicyName2() { + String policyName = null; + + try{ + policyConfig = policyEngine.getConfigByPolicyName(policyName, requestID); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + /** + * Run the Collection getConfig(String) method test + */ + @SuppressWarnings("deprecation") + public void testGetConfig() { + String onapName = null; + + try{ + policyConfig = policyEngine.getConfig(onapName); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + public void testGetConfig2() { + String onapName = null; + + try{ + policyConfig = policyEngine.getConfig(onapName,requestID); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + + @SuppressWarnings("deprecation") + public void testGetConfig3() { + String onapName = null; + String configName = null; + + try{ + policyConfig = policyEngine.getConfig(onapName,configName,requestID); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + public void testGetConfig4() { + String onapName = null; + String configName = null; + Map configAttributes = null; + + try{ + policyConfig = policyEngine.getConfig(onapName,configName,configAttributes); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + @SuppressWarnings("deprecation") + public void testGetConfig5() { + String onapName = null; + String configName = null; + Map configAttributes = null; + + try{ + policyConfig = policyEngine.getConfig(onapName,configName,configAttributes,requestID); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + public void testGetConfig6() { + ConfigRequestParameters parameters = new ConfigRequestParameters(); + + try{ + policyConfig = policyEngine.getConfig(parameters); + } catch (PolicyConfigException e){ + logger.warn(e.getMessage()); + } + assertNull(policyConfig); + } + + + /** + * Run the Collection sendEvent(Map) method + * test + */ + @SuppressWarnings("deprecation") + public void testSendEvent() + { + Collection result = null; + Collection response = null; + Map eventAttributes = null; + + try { + Mockito.when(mockPolicyEngine.sendEvent(eventAttributes)).thenReturn(result); + result = mockPolicyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.error("Exception Occured"+e); + } + + + assertEquals(result,response); + + } + + @SuppressWarnings("deprecation") + public void testSendEvent2() + { + Collection result = null; + Collection response = null; + Map eventAttributes = null; + + try { + Mockito.when(mockPolicyEngine.sendEvent(eventAttributes,requestID)).thenReturn(result); + result = mockPolicyEngine.sendEvent(eventAttributes,requestID); + } catch (PolicyEventException e) { + logger.error("Exception Occured"+e); + } + + + assertEquals(result,response); + + } + + public void testSendEvent3() + { + Collection result = null; + Collection response = null; + EventRequestParameters parameters = new EventRequestParameters(); + + try { + Mockito.when(mockPolicyEngine.sendEvent(parameters)).thenReturn(result); + result = mockPolicyEngine.sendEvent(parameters); + } catch (PolicyEventException e) { + logger.error("Exception Occured"+e); + } + + assertEquals(result,response); + + } + + + + /** + * Run the PolicyDecision getDecision(String, Map) method + * test + */ + @SuppressWarnings("deprecation") + public void testGetDecision() + { + String onapComponentName = null; + Map decisionAttributes = null; + + DecisionResponse result = null; + + try { + Mockito.when(mockPolicyEngine.getDecision(onapComponentName,decisionAttributes)).thenReturn(null); + result = mockPolicyEngine.getDecision(onapComponentName,decisionAttributes); + } catch (PolicyDecisionException e) { + logger.error("Exception Occured"+e); + } + + assertEquals(result,null); + } + + @SuppressWarnings("deprecation") + public void testGetDecision2() + { + String onapComponentName = null; + Map decisionAttributes = null; + + DecisionResponse result = null; + + try { + Mockito.when(mockPolicyEngine.getDecision(onapComponentName,decisionAttributes,requestID)).thenReturn(null); + result = mockPolicyEngine.getDecision(onapComponentName,decisionAttributes); + } catch (PolicyDecisionException e) { + logger.error("Exception Occured"+e); + } + + assertEquals(result,null); + } + + public void testGetDecision3() + { + DecisionRequestParameters parameters = new DecisionRequestParameters(); + DecisionResponse result = null; + + try { + Mockito.when(mockPolicyEngine.getDecision(parameters)).thenReturn(null); + result = mockPolicyEngine.getDecision(parameters); + } catch (PolicyDecisionException e) { + logger.error("Exception Occured"+e); + } + + assertEquals(result,null); + } + + /** + * Run the void setNotification(NotificationScheme, NotificationHandler) + * method test + */ + public void testSetNotification() { + // add test code here + + NotificationScheme scheme = null; + NotificationHandler handler = null; + + Mockito.doNothing().when(mockPolicyEngine).setNotification(scheme, handler); + mockPolicyEngine.setNotification(scheme, handler); + //assertTrue(true); + } + + /** + * Run the void clearNotification() method test + */ + public void testClearNotification() { + // add test code here + + Mockito.doNothing().when(mockPolicyEngine).clearNotification(); + mockPolicyEngine.clearNotification(); + //assertTrue(true); + } + + /** + * Run the void setScheme(NotificationScheme) method test + */ + public void testSetScheme() { + NotificationScheme scheme = null; + + Mockito.doNothing().when(mockPolicyEngine).setScheme(scheme); + mockPolicyEngine.setScheme(scheme); + //assertTrue(true); + } + + /** + * Run the PDPNotification getNotification() method test + */ + public void testGetNotification() { + PDPNotification result = null; + StdPDPNotification response = null; + Mockito.when(mockPolicyEngine.getNotification()).thenReturn(response); + result = mockPolicyEngine.getNotification(); + + assertEquals(result,response); + } + + /** + * Run the String createConfigPolicy(String, String, String, String, + * Map, String, String, String, UUID) method test + */ + @SuppressWarnings("deprecation") + public void testCreateConfigPolicy() + { + String response = "success"; + String result = null; + try { + + Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String updateConfigPolicy(String, String, String, String, + * Map, String, String, String, UUID) method test + */ + @SuppressWarnings("deprecation") + public void testUpdateConfigPolicy() + { + String response = "success"; + String result = null; + try { + + Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String createConfigFirewallPolicy(String, JsonObject, String, + * UUID) method test + */ + @SuppressWarnings("deprecation") + public void testCreateConfigFirewallPolicy() { + String response = "success"; + String result = null; + 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; + JsonObject jsonObj = buildJSON(json); + try { + + Mockito.when(mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String updateConfigFirewallPolicy(String, JsonObject, String, + * UUID) method test + */ + @SuppressWarnings("deprecation") + public void testUpdateConfigFirewallPolicy() { + String response = "success"; + String result = null; + 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; + JsonObject jsonObj = buildJSON(json); + try { + + Mockito.when(mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); + result = mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test + */ + public void testCreatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + PolicyParameters policyParameters = new PolicyParameters(); + + policyParameters.setPolicyClass(PolicyClass.Action); //required + policyParameters.setPolicyName("test.junitTest"); //required + policyParameters.setPolicyDescription("testing"); //optional + + //Set the Component Attributes... These are Optional + Map configAttributes = new HashMap(); + configAttributes.put("test", "testing"); + + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + + policyParameters.setActionPerformer("PEP"); + policyParameters.setActionAttribute("testing"); + policyParameters.setRequestID(UUID.randomUUID()); + + try { + + //stdPolicyEngine = Mockito.mock(StdPolicyEngine.class); + //Mockito.when(stdPolicyEngine.callPAP(newPAPPolicy, new String[] {"operation=create", "apiflag=api", "policyType=Action"}, null, "Action")).thenReturn(callPapResponse); + Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.createPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + logger.error("Exception Occured"+e); + } + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test + */ + public void testUpdatePolicy() { + response.setResponseMessage("success"); + PolicyChangeResponse result = null; + PolicyParameters policyParameters = new PolicyParameters(); + + policyParameters.setPolicyClass(PolicyClass.Action); //required + policyParameters.setPolicyName("test.junitTest"); //required + policyParameters.setPolicyDescription("testing"); //optional + + //Set the Component Attributes... These are Optional + Map configAttributes = new HashMap(); + configAttributes.put("test", "testing"); + + Map> attributes = new HashMap>(); + attributes.put(AttributeType.MATCHING, configAttributes); + policyParameters.setAttributes(attributes); + + policyParameters.setActionPerformer("PEP"); + policyParameters.setActionAttribute("testing"); + policyParameters.setRequestID(UUID.randomUUID()); + + try { + + Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.updatePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + assertEquals(result, response); + } + + /** + * Run the String pushPolicy(String, String, String, String, UUID) method + * test + */ + @SuppressWarnings("deprecation") + public void testPushPolicy() { + String response = "Success"; + String result = null; + try { + + Mockito.when(mockPolicyEngine.pushPolicy("testing","test","Base","default",requestID)).thenReturn(response); + result = mockPolicyEngine.pushPolicy("testing","test","Base","default",requestID); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + + assertEquals(result, response); + } + + public void testPushPolicy2() { + PushPolicyParameters policyParameters = new PushPolicyParameters(); + PolicyChangeResponse result = null; + + //String policyScope = null; + policyParameters.setPolicyName("test.junitTest"); + policyParameters.setPolicyType("Action"); + policyParameters.setPdpGroup("Default"); + + try { + + Mockito.when(mockPolicyEngine.pushPolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.pushPolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse deletePolicy(DeletePolicyParameters) method + * test + */ + public void testDeletePolicy() { + DeletePolicyParameters policyParameters = new DeletePolicyParameters(); + PolicyChangeResponse result = null; + + //String policyScope = null; + policyParameters.setPolicyName("test.junitTest.1.xml"); + policyParameters.setDeleteCondition(DeletePolicyCondition.ALL); + policyParameters.setPolicyComponent("PAP"); + policyParameters.setPdpGroup("Default"); + + try { + + Mockito.when(mockPolicyEngine.deletePolicy(policyParameters)).thenReturn(response); + result = mockPolicyEngine.deletePolicy(policyParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + + assertEquals(result, response); + } + + /** + * Run the PolicyChangeResponse policyEngineImport(ImportParameters) method + * test + */ + public void testPolicyEngineImport() { + ImportParameters importParameters = new ImportParameters(); + PolicyChangeResponse result = null; + + importParameters.setFilePath("C:\\Workspaces\\models\\TestingModel\\ControllerServiceSampleSdnlServiceInstance-v0.1.0-SNAPSHOT.zip"); + importParameters.setServiceName("ControllerServiceSampleSdnlServiceInstance"); + + importParameters.setRequestID(UUID.randomUUID()); + importParameters.setServiceType(IMPORT_TYPE.MICROSERVICE); + importParameters.setVersion("1607-2"); + + + try { + + Mockito.when(mockPolicyEngine.policyEngineImport(importParameters)).thenReturn(response); + result = mockPolicyEngine.policyEngineImport(importParameters); + + } catch (Exception e) { + logger.warn(e.getMessage()); + } + + assertEquals(result, response); + } + + 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; + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineTest.java new file mode 100644 index 000000000..abfab075b --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineTest.java @@ -0,0 +1,170 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.junit.Test; +import org.onap.policy.api.NotificationScheme; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class PolicyEngineTest { + + private static final Logger logger = FlexLogger.getLogger(PolicyEngineTest.class); + private PolicyEngine policyEngine = null; + private String filePath = null; + + @Test + public void testPolicyEngineForFail() { + filePath = null; + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNull(policyEngine); + // Test even for this case. + filePath = "NotNull"; + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNull(policyEngine); + } + + @Test + public void testPolicyEngineforPropertyFileError() { + filePath = "Test/config_error.property"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNull(policyEngine); + } + + @Test + public void testPolicyEngineforPDPURLError() { + String filePath = "Test/config_fail.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNull(policyEngine); + } + + @Test + public void testPolicyEngineForPass() { + String filePath = "Test/config_pass.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + @Test + public void testPolicyEngineForUEBPass() { + String filePath = "Test/config_UEB_pass.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + + @Test + public void testPolicyEngineForUEBBadType() { + String filePath = "Test/config_UEB_bad_type.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + @Test + public void testPolicyEngineForUEBBadServerType() { + String filePath = "Test/config_UEB_badservers.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + @Test + public void testPolicyEngineNotficationAutoUEB() { + String filePath = "Test/config_UEB_pass.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + policyEngine.setScheme(NotificationScheme.AUTO_ALL_NOTIFICATIONS); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + @Test + public void testPolicyEngineNotficationAuto() { + String filePath = "Test/config_pass.properties"; + isFileAvailable(filePath); + try { + policyEngine = new PolicyEngine(filePath); + policyEngine.setScheme(NotificationScheme.AUTO_ALL_NOTIFICATIONS); + //policyEngine.getNotification(); + } catch (PolicyEngineException e) { + logger.warn(e.getMessage()); + } + assertNotNull(policyEngine); + } + + public void isFileAvailable(String filePath) { + Path file = Paths.get(filePath); + if (Files.notExists(file)) { + logger.error("File Doesn't Exist "+ file.toString()); + fail("File: " +filePath + " Not found"); + } + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java new file mode 100644 index 000000000..6f7573352 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java @@ -0,0 +1,183 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyEventException; + +import static org.junit.Assert.*; + +/** + * The class PolicyEventExceptionTest contains tests for the class {@link PolicyEventException}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class PolicyEventExceptionTest { + /** + * Run the PolicyEventException() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyEventException_1() + throws Exception { + + PolicyEventException result = new PolicyEventException(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyEventException", result.toString()); + assertEquals(null, result.getLocalizedMessage()); + assertEquals(null, result.getMessage()); + } + + /** + * Run the PolicyEventException(String) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyEventException_2() + throws Exception { + String message = ""; + + PolicyEventException result = new PolicyEventException(message); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getCause()); + assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyEventException(Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyEventException_3() + throws Exception { + Throwable cause = new Throwable(); + + PolicyEventException result = new PolicyEventException(cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEventException: java.lang.Throwable", result.toString()); + assertEquals("java.lang.Throwable", result.getLocalizedMessage()); + assertEquals("java.lang.Throwable", result.getMessage()); + } + + /** + * Run the PolicyEventException(String,Throwable) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyEventException_4() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + + PolicyEventException result = new PolicyEventException(message, cause); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * Run the PolicyEventException(String,Throwable,boolean,boolean) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPolicyEventException_5() + throws Exception { + String message = ""; + Throwable cause = new Throwable(); + boolean enableSuppression = true; + boolean writableStackTrace = true; + + PolicyEventException result = new PolicyEventException(message, cause, enableSuppression, writableStackTrace); + + // add additional test code here + assertNotNull(result); + assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString()); + assertEquals("", result.getLocalizedMessage()); + assertEquals("", result.getMessage()); + } + + /** + * 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(PolicyEventExceptionTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyParametersTest.java new file mode 100644 index 000000000..ff192dcab --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyParametersTest.java @@ -0,0 +1,1409 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.api.AttributeType; +import org.onap.policy.api.PolicyClass; +import org.onap.policy.api.PolicyConfigType; +import org.onap.policy.api.PolicyParameters; +import org.onap.policy.api.PolicyType; + +/** + * The class PolicyParametersTest contains tests for the class {@link PolicyParameters}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyParametersTest { + /** + * Run the String getActionAttribute() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetActionAttribute_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getActionAttribute(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getActionPerformer() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetActionPerformer_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getActionPerformer(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the Map> getAttributes() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetAttributes_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + Map> result = fixture.getAttributes(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getConfigBody() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetConfigBody_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getConfigBody(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyType getConfigBodyType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetConfigBodyType_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + PolicyType result = fixture.getConfigBodyType(); + + // add additional test code here + assertNotNull(result); + assertEquals("json", result.toString()); + assertEquals("JSON", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the String getConfigName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetConfigName_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getConfigName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the List getDynamicRuleAlgorithmField1() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetDynamicRuleAlgorithmField1_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + List result = fixture.getDynamicRuleAlgorithmField1(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the List getDynamicRuleAlgorithmField2() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetDynamicRuleAlgorithmField2_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + List result = fixture.getDynamicRuleAlgorithmField2(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the List getDynamicRuleAlgorithmFunctions() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetDynamicRuleAlgorithmFunctions_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + List result = fixture.getDynamicRuleAlgorithmFunctions(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the List getDynamicRuleAlgorithmLabels() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetDynamicRuleAlgorithmLabels_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + List result = fixture.getDynamicRuleAlgorithmLabels(); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String getOnapName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetOnapName_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getOnapName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the PolicyClass getPolicyClass() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyClass_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + PolicyClass result = fixture.getPolicyClass(); + + // add additional test code here + assertNotNull(result); + assertEquals("Action", result.toString()); + assertEquals("Action", result.name()); + assertEquals(1, result.ordinal()); + } + + /** + * Run the PolicyConfigType getPolicyConfigType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyConfigType_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + PolicyConfigType result = (PolicyConfigType) fixture.getPolicyConfigType(); + + // add additional test code here + assertNotNull(result); + assertEquals("BRMS_Param", result.toString()); + assertEquals("BRMS_PARAM", result.name()); + assertEquals(5, result.ordinal()); + } + + /** + * Run the String getPolicyDescription() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPolicyDescription_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getPolicyDescription(); + + // 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_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPriority() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetPriority_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + String result = fixture.getPriority(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetRequestID_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.fromString("878d319c-2799-4684-b480-99f40e1042b2")); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("878d319c-2799-4684-b480-99f40e1042b2", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-5440179076376542542L, result.getLeastSignificantBits()); + assertEquals(-8679226360124062076L, result.getMostSignificantBits()); + } + + /** + * Run the void setActionAttribute(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetActionAttribute_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String actionAttribute = ""; + + fixture.setActionAttribute(actionAttribute); + + // add additional test code here + } + + /** + * Run the void setActionPerformer(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetActionPerformer_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String actionPerformer = ""; + + fixture.setActionPerformer(actionPerformer); + + // add additional test code here + } + + /** + * Run the void setAttributes(Map>) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetAttributes_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + Map> attributes = new Hashtable>(); + + fixture.setAttributes(attributes); + + // add additional test code here + } + + /** + * Run the void setConfigBody(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigBody_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String configBody = ""; + + fixture.setConfigBody(configBody); + + // add additional test code here + } + + /** + * Run the void setConfigBodyType(PolicyType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigBodyType_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + PolicyType configBodyType = PolicyType.JSON; + + fixture.setConfigBodyType(configBodyType); + + // add additional test code here + } + + /** + * Run the void setConfigFirewallPolicyParameters(String,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigFirewallPolicyParameters_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String policyName = ""; + String firewallJson = ""; + UUID requestID = UUID.randomUUID(); + + fixture.setConfigFirewallPolicyParameters(policyName, firewallJson, requestID); + + // 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 { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String configName = ""; + + fixture.setConfigName(configName); + + // add additional test code here + } + + /** + * Run the void setConfigPolicyParameters(PolicyConfigType,String,String,String,String,Map>,PolicyType,String,UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetConfigPolicyParameters_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + PolicyConfigType policyConfigType = PolicyConfigType.BRMS_PARAM; + String policyName = ""; + String policyDescription = ""; + String onapName = ""; + String configName = ""; + Map> attributes = new Hashtable>(); + PolicyType configBodyType = PolicyType.JSON; + String configBody = ""; + UUID requestID = UUID.randomUUID(); + + fixture.setConfigPolicyParameters(policyConfigType, policyName, policyDescription, onapName, configName, attributes, configBodyType, configBody, requestID); + + // add additional test code here + } + + /** + * Run the void setDynamicRuleAlgorithmField1(List) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDynamicRuleAlgorithmField1_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + List dynamicRuleAlgorithmField1 = new LinkedList(); + + fixture.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1); + + // add additional test code here + } + + /** + * Run the void setDynamicRuleAlgorithmField2(List) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDynamicRuleAlgorithmField2_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + List dynamicRuleAlgorithmField2 = new LinkedList(); + + fixture.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2); + + // add additional test code here + } + + /** + * Run the void setDynamicRuleAlgorithmFunctions(List) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDynamicRuleAlgorithmFunctions_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + List dynamicRuleAlgorithmFunctions = new LinkedList(); + + fixture.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions); + + // add additional test code here + } + + /** + * Run the void setDynamicRuleAlgorithmLabels(List) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetDynamicRuleAlgorithmLabels_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + List dynamicRuleAlgorithmLabels = new LinkedList(); + + fixture.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels); + + // add additional test code here + } + + /** + * Run the void setOnapName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetOnapName_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String onapName = ""; + + fixture.setOnapName(onapName); + + // add additional test code here + } + + /** + * Run the void setPolicyClass(PolicyClass) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyClass_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + PolicyClass policyClass = PolicyClass.Action; + + fixture.setPolicyClass(policyClass); + + // add additional test code here + } + + /** + * Run the void setPolicyConfigType(PolicyConfigType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyConfigType_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + PolicyConfigType policyConfigType = PolicyConfigType.BRMS_PARAM; + + fixture.setPolicyConfigType(policyConfigType); + + // add additional test code here + } + + /** + * Run the void setPolicyDescription(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPolicyDescription_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String policyDescription = ""; + + fixture.setPolicyDescription(policyDescription); + + // 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 { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setPriority(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetPriority_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + String priority = ""; + + fixture.setPriority(priority); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + PolicyParameters fixture = new PolicyParameters(); + fixture.setRequestID(UUID.randomUUID()); + fixture.setActionAttribute(""); + fixture.setAttributes(new Hashtable>()); + fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); + fixture.setPolicyDescription(""); + + fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); + fixture.setDynamicRuleAlgorithmField2(new LinkedList()); + fixture.setPolicyName(""); + fixture.setConfigName(""); + fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); + fixture.setPolicyClass(PolicyClass.Action); + fixture.setOnapName(""); + fixture.setConfigBodyType(PolicyType.JSON); + fixture.setDynamicRuleAlgorithmField1(new LinkedList()); + fixture.setPriority(""); + fixture.setActionPerformer(""); + fixture.setConfigBody(""); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(PolicyParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java new file mode 100644 index 000000000..294f0929d --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java @@ -0,0 +1,154 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyResponseStatus; + +import static org.junit.Assert.*; + +/** + * The class PolicyResponseStatusTest contains tests for the class {@link PolicyResponseStatus}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyResponseStatusTest { + /** + * Run the PolicyResponseStatus getStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetStatus_1() + throws Exception { + String responseStatus = ""; + + PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); + + // add additional test code here + assertNotNull(result); + assertEquals("no_action", result.toString()); + assertEquals("NO_ACTION_REQUIRED", result.name()); + assertEquals(0, result.ordinal()); + } + + /** + * Run the PolicyResponseStatus getStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetStatus_2() + throws Exception { + String responseStatus = ""; + + PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); + + // add additional test code here + assertNotNull(result); + assertEquals("no_action", result.toString()); + assertEquals("NO_ACTION_REQUIRED", result.name()); + assertEquals(0, result.ordinal()); + } + + /** + * Run the PolicyResponseStatus getStatus(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testGetStatus_3() + throws Exception { + String responseStatus = ""; + + PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); + + // add additional test code here + assertNotNull(result); + assertEquals("no_action", result.toString()); + assertEquals("NO_ACTION_REQUIRED", result.name()); + assertEquals(0, result.ordinal()); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("action_advised", 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(PolicyResponseStatusTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java new file mode 100644 index 000000000..b0a71d375 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.PolicyResponse; + +/** + * The class PolicyResponseTest contains tests for the class {@link PolicyResponse}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyResponseTest { + /** + * 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(PolicyResponseTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java new file mode 100644 index 000000000..9f1a608da --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.PolicyType; + +import static org.junit.Assert.*; + +/** + * The class PolicyTypeTest contains tests for the class {@link PolicyType}. + * + * @generatedBy CodePro at 6/1/16 1:41 PM + * @version $Revision: 1.0 $ + */ +public class PolicyTypeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() + throws Exception { + PolicyType fixture = PolicyType.JSON; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("json", 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(PolicyTypeTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java new file mode 100644 index 000000000..832589757 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java @@ -0,0 +1,269 @@ +/*- + * ============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.onap.policy.test; + +import java.util.UUID; + +import org.junit.*; +import org.onap.policy.api.PushPolicyParameters; + +import static org.junit.Assert.*; + +/** + * The class PushPolicyParametersTest contains tests for the class {@link PushPolicyParameters}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class PushPolicyParametersTest { + /** + * Run the PushPolicyParameters() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPushPolicyParameters_1() + throws Exception { + + PushPolicyParameters result = new PushPolicyParameters(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getPolicyName()); + assertEquals(null, result.getRequestID()); + assertEquals(null, result.getPolicyType()); + assertEquals(null, result.getPdpGroup()); + } + + /** + * Run the PushPolicyParameters(String,String,String,UUID) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testPushPolicyParameters_2() + throws Exception { + String policyName = ""; + String policyType = ""; + String pdpGroup = ""; + UUID requestID = UUID.randomUUID(); + + PushPolicyParameters result = new PushPolicyParameters(policyName, policyType, pdpGroup, requestID); + + // add additional test code here + assertNotNull(result); + assertEquals("", result.getPolicyName()); + assertEquals("", result.getPolicyType()); + assertEquals("", result.getPdpGroup()); + } + + /** + * Run the String getPdpGroup() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPdpGroup_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + + String result = fixture.getPdpGroup(); + + // 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_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + + String result = fixture.getPolicyName(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String getPolicyType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetPolicyType_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + + String result = fixture.getPolicyType(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the UUID getRequestID() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testGetRequestID() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.fromString("d1dbaac1-0944-4f07-9ce7-733c697537ea")); + + UUID result = fixture.getRequestID(); + + // add additional test code here + assertNotNull(result); + assertEquals("d1dbaac1-0944-4f07-9ce7-733c697537ea", result.toString()); + assertEquals(4, result.version()); + assertEquals(2, result.variant()); + assertEquals(-7140611980868110358L, result.getLeastSignificantBits()); + assertEquals(-3324876153822097657L, result.getMostSignificantBits()); + } + + /** + * Run the void setPdpGroup(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPdpGroup_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + String pdpGroup = ""; + + fixture.setPdpGroup(pdpGroup); + + // 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 { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + String policyName = ""; + + fixture.setPolicyName(policyName); + + // add additional test code here + } + + /** + * Run the void setPolicyType(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetPolicyType_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + String policyType = ""; + + fixture.setPolicyType(policyType); + + // add additional test code here + } + + /** + * Run the void setRequestID(UUID) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:40 PM + */ + @Test + public void testSetRequestID_1() + throws Exception { + PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); + UUID requestID = UUID.randomUUID(); + + fixture.setRequestID(requestID); + + // 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(PushPolicyParametersTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java new file mode 100644 index 000000000..6a53cbfb1 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.After; +import org.junit.Before; +import org.onap.policy.api.RemovedPolicy; + +/** + * The class RemovedPolicyTest contains tests for the class {@link RemovedPolicy}. + * + * @generatedBy CodePro at 6/1/16 1:40 PM + * @version $Revision: 1.0 $ + */ +public class RemovedPolicyTest { + /** + * 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(RemovedPolicyTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java new file mode 100644 index 000000000..560ca463f --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java @@ -0,0 +1,155 @@ +/*- + * ============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.onap.policy.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.onap.policy.api.PolicyEngine; +import org.onap.policy.api.PolicyEngineException; +import org.onap.policy.api.PolicyEventException; +import org.onap.policy.api.PolicyResponse; +import org.onap.policy.api.PolicyResponseStatus; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class SendEventTest { + + private PolicyEngine policyEngine = null; + private Map eventAttributes = new HashMap(); + private Collection policyResponse = null; + private static final Logger logger = FlexLogger.getLogger(SendEventTest.class); + @Before + public void setUp() { + try { + policyEngine = new PolicyEngine("Test/config_pass.properties"); + } catch (PolicyEngineException e) { + logger.error(e.getMessage()); + fail("PolicyEngine Instantiation Error" + e); + } + logger.info("Loaded.. PolicyEngine"); + } + + //@Test + @SuppressWarnings("deprecation") + public void testSendEventFail() { + eventAttributes = null; + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + assertNull(policyResponse); + } + + //@Test + @SuppressWarnings("deprecation") + public void testSendEventFailNull() { + eventAttributes.put("", ""); + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + assertNull(policyResponse); + } + + // deprecated Test. + /*@Test + public void testSendEventFailAttribute() { + eventAttributes.put("Fail.key", "Value"); + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + assertNull(policyResponse.getPolicyResponseMessage()); + }*/ + + //@Test + @SuppressWarnings("deprecation") + public void testSendEventNotValid() { + eventAttributes.put("Action.fail", "Value"); + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + for(PolicyResponse policyResponse: this.policyResponse){ + logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse); + assertEquals(PolicyResponseStatus.NO_ACTION_REQUIRED, policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse.getPolicyResponseMessage()); + assertNotNull(policyResponse.getRequestAttributes()); + assertNull(policyResponse.getActionTaken()); + assertNull(policyResponse.getActionAdvised()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testSendEventActionAdvised() { + eventAttributes.put("Key", "Value"); + eventAttributes.put("cpu", "80"); + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + for(PolicyResponse policyResponse: this.policyResponse){ + logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse); + assertEquals(PolicyResponseStatus.ACTION_ADVISED, policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse.getPolicyResponseMessage()); + assertNotNull(policyResponse.getRequestAttributes()); + assertNull(policyResponse.getActionTaken()); + assertNotNull(policyResponse.getActionAdvised()); + } + } + + //@Test + @SuppressWarnings("deprecation") + public void testSendEventActionTaken() { + eventAttributes.put("Key", "Value"); + eventAttributes.put("cpu", "91"); + try { + policyResponse = policyEngine.sendEvent(eventAttributes); + } catch (PolicyEventException e) { + logger.warn(e.getMessage()); + } + for(PolicyResponse policyResponse: this.policyResponse){ + logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse); + assertEquals(PolicyResponseStatus.ACTION_TAKEN, policyResponse.getPolicyResponseStatus()); + assertNotNull(policyResponse.getPolicyResponseMessage()); + assertNotNull(policyResponse.getRequestAttributes()); + assertNotNull(policyResponse.getActionTaken()); + assertNull(policyResponse.getActionAdvised()); + } + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java new file mode 100644 index 000000000..87687f0ab --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; + +public class TestRunner { + public static void main(String[] args) { + Result result = JUnitCore.runClasses(PolicyEngineTest.class); + for(Failure failure: result.getFailures()) { + System.out.println("Failed Test: " + failure.toString()); + } + Result results = null; + if(result.wasSuccessful()) { + System.out.println("API Methods are being Tested.. "); + results = JUnitCore.runClasses(GetConfigByPolicyNameTest.class, GetConfigStringTest.class,GetConfigStringStringTest.class,GetConfigStringStringMapTest.class,SendEventTest.class); + for(Failure failure: results.getFailures()) { + System.out.println("Failed Test: " + failure.toString()); + } + System.out.println("Test Results.. "); + System.out.println("Stats: \nRun Time: " + (results.getRunTime()+result.getRunTime()) + "\nTotal Tests:" + results.getRunCount()+ result.getRunCount() + + "\nFailures: " + results.getFailureCount()+ result.getFailureCount()); + System.exit(1); + } + System.out.println("Test Failed.."); + System.out.println("Stats: \nRun Time: " + result.getRunTime() + "\nTests:" + result.getRunCount() + + "\nFailures: " + result.getFailureCount()); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java new file mode 100644 index 000000000..500d6c1c5 --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.policy.test; + +import org.junit.*; +import org.onap.policy.api.UpdateType; + +import static org.junit.Assert.*; + +/** + * The class UpdateTypeTest contains tests for the class {@link UpdateType}. + * + * @generatedBy CodePro at 6/1/16 1:39 PM + * @version $Revision: 1.0 $ + */ +public class UpdateTypeTest { + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:39 PM + */ + @Test + public void testToString_1() + throws Exception { + UpdateType fixture = UpdateType.NEW; + + String result = fixture.toString(); + + // add additional test code here + assertEquals("new", result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 6/1/16 1:39 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:39 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:39 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(UpdateTypeTest.class); + } +} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/package-info.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/package-info.java new file mode 100644 index 000000000..eb92f89bd --- /dev/null +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/package-info.java @@ -0,0 +1,24 @@ +/*- + * ============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========================================================= + */ + +/** + * API JUNIT TestCases. + */ +package org.onap.policy.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 deleted file mode 100644 index 86f15992a..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientEndTest.java +++ /dev/null @@ -1,228 +0,0 @@ -/*- - * ============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.assertNotNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.NotificationHandler; -import org.openecomp.policy.api.NotificationScheme; -import org.openecomp.policy.std.AutoClientEnd; -import org.openecomp.policy.std.StdPolicyEngine; - -/** - * 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 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", (String) null); - - 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 deleted file mode 100644 index 28889677b..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/AutoClientUEBTest.java +++ /dev/null @@ -1,567 +0,0 @@ -/*- - * ============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.AutoClientUEB; - -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 = ""; - String apiKey = ""; - String apiSecret = ""; - List uebURLList = new LinkedList(); - - AutoClientUEB result = new AutoClientUEB(url, uebURLList, apiKey, apiSecret); - - // 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 - List urlList = new LinkedList(); - urlList.add("test2.com"); - AutoClientUEB client = new AutoClientUEB("test.com", urlList, "testKey", "testSecret"); - NotificationHandler handler = null; - 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 deleted file mode 100644 index 9879174cb..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/Handler.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============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; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -public class Handler implements NotificationHandler{ - - private static final Logger LOGGER = FlexLogger.getLogger(Handler.class); - - @Override - public void notificationReceived(PDPNotification notification) { - System.out.println("Notification Received..."); - 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"); - @SuppressWarnings("deprecation") - 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) { - LOGGER.error("Exception Occured"+e); - } catch (PolicyConfigException e) { - LOGGER.error("Exception Occured"+e); - } - } - } - }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"); - @SuppressWarnings("deprecation") - 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) { - LOGGER.error("Exception Occured"+e); - } catch (PolicyConfigException e) { - LOGGER.error("Exception Occured"+e); - } - } - } - } - - -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java deleted file mode 100644 index c44dac606..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============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.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.NotificationScheme; -import org.openecomp.policy.api.PDPNotification; -import org.openecomp.policy.std.ManualClientEnd; - -/** - * 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 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 deleted file mode 100644 index f19697597..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/ManualClientEndUEBTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * ============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.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.LinkedList; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.NotificationScheme; -import org.openecomp.policy.api.PDPNotification; -import org.openecomp.policy.std.ManualClientEndUEB; -import org.openecomp.policy.std.StdPDPNotification; - -/** - * 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"; - 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 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); - } - - /** - * 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 deleted file mode 100644 index ab8946c60..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchStoreTest.java +++ /dev/null @@ -1,776 +0,0 @@ -/*- - * ============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.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.HashSet; -import java.util.Hashtable; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.PDPNotification; -import org.openecomp.policy.std.MatchStore; -import org.openecomp.policy.std.Matches; -import org.openecomp.policy.std.StdPDPNotification; - -/** - * 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 deleted file mode 100644 index cdc9b5595..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/MatchesTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index d54c4f4cb..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationStoreTest.java +++ /dev/null @@ -1,359 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 674c58a00..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/NotificationUnMarshalTest.java +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * ============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.assertNotNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.std.NotificationUnMarshal; -import org.openecomp.policy.std.StdPDPNotification; - -/** - * 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 deleted file mode 100644 index de8a6a7ad..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdLoadedPolicyTest.java +++ /dev/null @@ -1,314 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 1bda0e59f..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPDPNotificationTest.java +++ /dev/null @@ -1,311 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 45c70187d..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyChangeResponseTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index a34737477..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyConfigTest.java +++ /dev/null @@ -1,821 +0,0 @@ -/*- - * ============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/StdPolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java deleted file mode 100644 index a593c460b..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdPolicyResponseTest.java +++ /dev/null @@ -1,348 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 0a0865c82..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdRemovedPolicyTest.java +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 34918c2ea..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/StdStatusTest.java +++ /dev/null @@ -1,1433 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 75bfc39ad..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/std/test/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============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; diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ActionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ActionPolicyApiTest.java deleted file mode 100644 index 398efe0f1..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ActionPolicyApiTest.java +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * ============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.test; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.policy.api.AttributeType; -import org.openecomp.policy.api.PolicyChangeResponse; -import org.openecomp.policy.api.PolicyClass; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.std.StdPolicyChangeResponse; - -import junit.framework.TestCase; - -public class ActionPolicyApiTest extends TestCase { - - private static final Logger logger = FlexLogger.getLogger(ActionPolicyApiTest.class); - - private PolicyEngine policyEngine = null; - private PolicyEngine mockPolicyEngine = null; - - PolicyChangeResponse result = null; - StdPolicyChangeResponse response = new StdPolicyChangeResponse(); - PolicyParameters policyParameters = new PolicyParameters(); - - @Before - protected void setUp() throws Exception { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - - mockPolicyEngine = Mockito.mock(PolicyEngine.class); - - policyParameters.setPolicyClass(PolicyClass.Action); //required - policyParameters.setPolicyName("test.junitTest"); //required - policyParameters.setPolicyDescription("testing"); //optional - //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI - - //Set the Component Attributes... These are Optional - Map configAttributes = new HashMap(); - configAttributes.put("test", "testing"); - - Map> attributes = new HashMap>(); - attributes.put(AttributeType.MATCHING, configAttributes); - policyParameters.setAttributes(attributes); - - policyParameters.setActionPerformer("PEP"); - policyParameters.setActionAttribute("testing"); - policyParameters.setRequestID(UUID.randomUUID()); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - @Test - public final void testCreatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.createPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - @Test - public final void testUpdatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.updatePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - - } - - @Test - public final void testCreatePolicyNullPolicyName() { - response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyScope() { - response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullActionAttributes() { - response.setResponseMessage("PE300 - Data Issue: No Action Attribute given."); - policyParameters.setActionAttribute(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullActionPerformer() { - response.setResponseMessage("PE300 - Data Issue: No Action Performer given."); - policyParameters.setActionPerformer(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyInvalidActionPerformer() { - response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given."); - policyParameters.setActionPerformer("testfail"); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyName() { - response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyScope() { - response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullActionAttributes() { - response.setResponseMessage("PE300 - Data Issue: No Action Attribute given."); - policyParameters.setActionAttribute(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullActionPerformer() { - response.setResponseMessage("PE300 - Data Issue: No Action Performer given."); - policyParameters.setActionPerformer(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyInvalidActionPerformer() { - response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given."); - policyParameters.setActionPerformer("testfail"); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/AttributeTypeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/AttributeTypeTest.java deleted file mode 100644 index df8713ab8..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/AttributeTypeTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.AttributeType; - -import static org.junit.Assert.*; - -/** - * The class AttributeTypeTest contains tests for the class {@link AttributeType}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class AttributeTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testToString_1() - throws Exception { - AttributeType fixture = AttributeType.MATCHING; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("matching", 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 - } - -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigBasePolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigBasePolicyTest.java deleted file mode 100644 index 69de7fe87..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigBasePolicyTest.java +++ /dev/null @@ -1,325 +0,0 @@ -/*- - * ============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.test; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.policy.api.AttributeType; -import org.openecomp.policy.api.PolicyChangeResponse; -import org.openecomp.policy.api.PolicyConfigType; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.api.PolicyType; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.std.StdPolicyChangeResponse; - -import junit.framework.TestCase; - -/** - * The class ConfigBasePolicyTest contains tests for the class - * {@link PolicyEngine} - * - * @pattern JUnit Test Case - * * - */ -public class ConfigBasePolicyTest extends TestCase { - - private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); - - private PolicyEngine policyEngine = null; - private PolicyEngine mockPolicyEngine = null; - - PolicyChangeResponse result = null; - StdPolicyChangeResponse response = new StdPolicyChangeResponse(); - PolicyParameters policyParameters = new PolicyParameters(); - - /** - * Perform pre-test initialization - * - * @throws Exception - * - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - - mockPolicyEngine = Mockito.mock(PolicyEngine.class); - - policyParameters.setPolicyConfigType(PolicyConfigType.Base); //required - policyParameters.setPolicyName("test.junitTest"); //required - policyParameters.setEcompName("test"); - policyParameters.setConfigName("testBase"); - policyParameters.setConfigBodyType(PolicyType.OTHER); - policyParameters.setConfigBody("testing"); - policyParameters.setPolicyDescription("testing"); //optional - //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI - - //Set the Component Attributes... These are Optional - Map configAttributes = new HashMap(); - configAttributes.put("test", "testing"); - - Map> attributes = new HashMap>(); - attributes.put(AttributeType.MATCHING, configAttributes); - policyParameters.setAttributes(attributes); - - policyParameters.setRequestID(UUID.randomUUID()); - } - - /** - * Perform post-test clean up - * - * @throws Exception - * - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - // Add additional tear down code here - } - - /** - * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test - */ - public void testCreatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.createPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String createConfigPolicy() method test - */ - @SuppressWarnings("deprecation") - @Test - public void testCreateConfigPolicy() { - String response = "success"; - String result = null; - try { - - Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test - */ - public void testUpdatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.updatePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String updateConfigPolicy() method test - */ - @SuppressWarnings("deprecation") - @Test - public void testUpdateConfigPolicy() { - String response = "success"; - String result = null; - try { - - Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - @Test - public final void testCreatePolicyNullPolicyName() { - response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyScope() { - response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullEcompName() { - response.setResponseMessage("PE300 - Data Issue: No ECOMP Name given."); - policyParameters.setEcompName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyConfigName() { - response.setResponseMessage("PE300 - Data Issue: No Config Name given."); - policyParameters.setConfigName(null);; - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyConfigBodyType() { - response.setResponseMessage("PE300 - Data Issue: No Config Body Type given."); - policyParameters.setConfigBodyType(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyConfigBody() { - response.setResponseMessage("PE300 - Data Issue: No Config Body given."); - policyParameters.setConfigBody(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyName() { - response.setResponseMessage("PE300 - Data Issue: No Policy Name given."); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyScope() { - response.setResponseMessage("PE300 - Data Issue: No Policy Scope given."); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullEcompName() { - response.setResponseMessage("PE300 - Data Issue: No ECOMP Name given."); - policyParameters.setEcompName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyConfigName() { - response.setResponseMessage("PE300 - Data Issue: No Config Name given."); - policyParameters.setConfigName(null);; - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyConfigBodyType() { - response.setResponseMessage("PE300 - Data Issue: No Config Body Type given."); - policyParameters.setConfigBodyType(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyConfigBody() { - response.setResponseMessage("PE300 - Data Issue: No Config Body given."); - policyParameters.setConfigBody(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - //assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } -} \ No newline at end of file diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigFirewallPolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigFirewallPolicyTest.java deleted file mode 100644 index 280f06e10..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigFirewallPolicyTest.java +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ============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.test; - -import java.io.StringReader; -import java.util.UUID; - -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonReader; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.policy.api.PolicyChangeResponse; -import org.openecomp.policy.api.PolicyConfigType; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.std.StdPolicyChangeResponse; - -import junit.framework.TestCase; - -public class ConfigFirewallPolicyTest extends TestCase { - - private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); - - private PolicyEngine policyEngine = null; - private PolicyEngine mockPolicyEngine = null; - - PolicyChangeResponse result = null; - StdPolicyChangeResponse response = new StdPolicyChangeResponse(); - PolicyParameters policyParameters = new PolicyParameters(); - String json = null; - - /** - * Perform pre-test initialization - * - * @throws Exception - * - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - - mockPolicyEngine = Mockito.mock(PolicyEngine.class); - - policyParameters.setPolicyConfigType(PolicyConfigType.Firewall); //required - policyParameters.setPolicyName("test.junitTest"); //required - - 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; - - policyParameters.setConfigBody(buildJSON(json).toString()); - - //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI - policyParameters.setRequestID(UUID.randomUUID()); - } - - 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; - } - /** - * Perform post-test clean up - * - * @throws Exception - * - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - // Add additional tear down code here - } - - /** - * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test - */ - public void testCreatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.createPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String createConfigFirewallPolicy() method test - */ - @SuppressWarnings("deprecation") - @Test - public void testCreateConfigFirewallPolicy() { - String response = "success"; - String result = null; - JsonObject jsonObj = buildJSON(json); - try { - - Mockito.when(mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test - */ - public void testUpdatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.updatePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String updateConfigFirewallPolicy() method test - */ - @SuppressWarnings("deprecation") - @Test - public void testUpdateConfigFirewallPolicy() { - String response = "success"; - String result = null; - JsonObject jsonObj = buildJSON(json); - try { - - Mockito.when(mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - @Test - public final void testCreatePolicyNullPolicyName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyScope() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyConfigBody() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setConfigBody(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyScope() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyConfigBody() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setConfigBody(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigRequestParametersTest.java deleted file mode 100644 index 0e8f912c9..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ConfigRequestParametersTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/*- - * ============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.test; - -import java.util.Hashtable; -import java.util.Map; -import java.util.UUID; - -import org.junit.*; -import org.openecomp.policy.api.ConfigRequestParameters; - -import static org.junit.Assert.*; - -/** - * The class ConfigRequestParametersTest contains tests for the class {@link ConfigRequestParameters}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class ConfigRequestParametersTest { - /** - * Run the ConfigRequestParameters() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testConfigRequestParameters_1() - throws Exception { - - ConfigRequestParameters result = new ConfigRequestParameters(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getPolicyName()); - assertEquals(null, result.getConfigName()); - assertEquals(null, result.getConfigAttributes()); - assertEquals(null, result.getRequestID()); - assertEquals(null, result.getEcompName()); - assertEquals(Boolean.FALSE, result.getUnique()); - } - - /** - * Run the ConfigRequestParameters(String,String,String,Map,Boolean,UUID) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testConfigRequestParameters_2() - throws Exception { - String policyName = ""; - String eCOMPComponentName = ""; - String configName = ""; - Map configAttributes = new Hashtable(); - Boolean unique = new Boolean(true); - UUID requestID = UUID.randomUUID(); - - ConfigRequestParameters result = createConfigRequest(policyName, eCOMPComponentName, configName, configAttributes, unique, requestID); - - // add additional test code here - assertNotNull(result); - assertEquals("", result.getPolicyName()); - assertEquals("", result.getConfigName()); - assertEquals("", result.getEcompName()); - assertEquals(Boolean.TRUE, result.getUnique()); - } - - /** - * Run the Map getConfigAttributes() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetConfigAttributes_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - - 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:40 PM - */ - @Test - public void testGetConfigName_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - - 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:40 PM - */ - @Test - public void testGetEcompName_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - - String result = fixture.getEcompName(); - - // 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_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - - String result = fixture.getPolicyName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.fromString("6b5aa070-90bc-46a6-9a59-e1fe526df7ae")); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("6b5aa070-90bc-46a6-9a59-e1fe526df7ae", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-7324574836520519762L, result.getLeastSignificantBits()); - assertEquals(7735671715287287462L, result.getMostSignificantBits()); - } - - /** - * Run the Boolean getUnique() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetUnique_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - - Boolean result = fixture.getUnique(); - - // add additional test code here - assertNotNull(result); - assertEquals("true", result.toString()); - assertEquals(true, result.booleanValue()); - } - - /** - * Run the void makeUnique(Boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testMakeUnique_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - Boolean unique = new Boolean(true); - - fixture.makeUnique(unique); - - // add additional test code here - } - - /** - * Run the void setConfigAttributes(Map) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetConfigAttributes_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - 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:40 PM - */ - @Test - public void testSetConfigName_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - 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:40 PM - */ - @Test - public void testSetEcompName_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - String eCOMPComponentName = ""; - - fixture.setEcompName(eCOMPComponentName); - - // 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 { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - String policyName = ""; - - fixture.setPolicyName(policyName); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable(), new Boolean(true), UUID.randomUUID()); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(ConfigRequestParametersTest.class); - } - - private ConfigRequestParameters createConfigRequest(String policyName, String eCOMPComponentName, String configName, Map configAttributes, Boolean unique, UUID requestID){ - ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); - configRequestParameters.setRequestID(requestID); - configRequestParameters.setPolicyName(policyName); - configRequestParameters.setEcompName(eCOMPComponentName); - configRequestParameters.setConfigName(configName); - configRequestParameters.setConfigAttributes(configAttributes); - configRequestParameters.makeUnique(unique); - return configRequestParameters; - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionPolicyApiTest.java deleted file mode 100644 index 82ba1c7ca..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionPolicyApiTest.java +++ /dev/null @@ -1,219 +0,0 @@ -/*- - * ============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.test; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.policy.api.AttributeType; -import org.openecomp.policy.api.PolicyChangeResponse; -import org.openecomp.policy.api.PolicyClass; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.std.StdPolicyChangeResponse; - -import junit.framework.TestCase; - -/** - * The class DecisionPolicyApiTest contains tests for the class - * {@link PolicyEngine} - * - * @pattern JUnit Test Case - * * - */ -public class DecisionPolicyApiTest extends TestCase { - - private static final Logger logger = FlexLogger.getLogger(DecisionPolicyApiTest.class); - - private PolicyEngine policyEngine = null; - private PolicyEngine mockPolicyEngine = null; - - PolicyChangeResponse result = null; - StdPolicyChangeResponse response = new StdPolicyChangeResponse(); - PolicyParameters policyParameters = new PolicyParameters(); - - /** - * Perform pre-test initialization - * - * @throws Exception - * - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - - mockPolicyEngine = Mockito.mock(PolicyEngine.class); - - policyParameters.setPolicyClass(PolicyClass.Decision); //required - policyParameters.setPolicyName("test.junitTest"); //required - policyParameters.setEcompName("test"); - policyParameters.setPolicyDescription("testing"); //optional - //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI - - //Set the Component Attributes... These are Optional - Map configAttributes = new HashMap(); - configAttributes.put("test", "testing"); - - Map> attributes = new HashMap>(); - attributes.put(AttributeType.MATCHING, configAttributes); - policyParameters.setAttributes(attributes); - - //Set the settings... These are Optional -/* Map settingsMap = new HashMap(); - settingsMap.put("server", "5"); - - Map> settings = new HashMap>(); - settings.put(AttributeType.SETTINGS, settingsMap); - policyParameters.setSettings(settings);*/ - - policyParameters.setRequestID(UUID.randomUUID()); - } - - /** - * Perform post-test clean up - * - * @throws Exception - * - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - // Add additional tear down code here - } - - /** - * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test - */ - public void testCreatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.createPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test - */ - public void testUpdatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - try { - - Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.updatePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - @Test - public final void testCreatePolicyNullPolicyName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullPolicyScope() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testCreatePolicyNullEcompName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setEcompName(null); - try{ - result = policyEngine.createPolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullPolicyScope() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setPolicyName("test"); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } - - @Test - public final void testUpdatePolicyNullEcompName() { - response.setResponseMessage("PE500 - Process Flow Issue: :500:"); - policyParameters.setEcompName(null); - try{ - result = policyEngine.updatePolicy(policyParameters); - } catch (Exception e){ - logger.warn(e.getMessage()); - } - assertEquals(result.getResponseMessage(), response.getResponseMessage()); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionRequestParametersTest.java deleted file mode 100644 index d8fdfbc0a..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DecisionRequestParametersTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/*- - * ============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.test; - -import java.util.Hashtable; -import java.util.Map; -import java.util.UUID; - -import org.junit.*; -import org.openecomp.policy.api.DecisionRequestParameters; - -import static org.junit.Assert.*; - -/** - * The class DecisionRequestParametersTest contains tests for the class {@link DecisionRequestParameters}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class DecisionRequestParametersTest { - /** - * Run the DecisionRequestParameters() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testDecisionRequestParameters_1() - throws Exception { - - DecisionRequestParameters result = new DecisionRequestParameters(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getECOMPComponentName()); - assertEquals(null, result.getDecisionAttributes()); - assertEquals(null, result.getRequestID()); - } - - /** - * Run the DecisionRequestParameters(String,Map,UUID) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testDecisionRequestParameters_2() - throws Exception { - String eCOMPComponentName = ""; - Map decisionAttributes = new Hashtable(); - UUID requestID = UUID.randomUUID(); - - DecisionRequestParameters result = new DecisionRequestParameters(eCOMPComponentName, decisionAttributes, requestID); - - // add additional test code here - assertNotNull(result); - assertEquals("", result.getECOMPComponentName()); - } - - /** - * Run the Map getDecisionAttributes() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetDecisionAttributes_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); - - Map result = fixture.getDecisionAttributes(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the String getECOMPComponentName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetECOMPComponentName_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); - - String result = fixture.getECOMPComponentName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.fromString("d1db6a6d-7140-4864-8200-6b541261fdd2")); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("d1db6a6d-7140-4864-8200-6b541261fdd2", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-9079138839949083182L, result.getLeastSignificantBits()); - assertEquals(-3324946881598961564L, result.getMostSignificantBits()); - } - - /** - * Run the void setDecisionAttributes(Map) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetDecisionAttributes_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); - Map decisionAttributes = new Hashtable(); - - fixture.setDecisionAttributes(decisionAttributes); - - // add additional test code here - } - - /** - * Run the void setECOMPComponentName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetECOMPComponentName_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); - String eCOMPComponentName = ""; - - fixture.setECOMPComponentName(eCOMPComponentName); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable(), UUID.randomUUID()); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(DecisionRequestParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyConditionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyConditionTest.java deleted file mode 100644 index c2941202b..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyConditionTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.DeletePolicyCondition; - -import static org.junit.Assert.*; - -/** - * The class DeletePolicyConditionTest contains tests for the class {@link DeletePolicyCondition}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class DeletePolicyConditionTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - DeletePolicyCondition fixture = DeletePolicyCondition.ALL; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("All Versions", 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(DeletePolicyConditionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyParametersTest.java deleted file mode 100644 index 7723f9819..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/DeletePolicyParametersTest.java +++ /dev/null @@ -1,314 +0,0 @@ -/*- - * ============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.test; - -import java.util.UUID; - -import org.junit.*; -import org.openecomp.policy.api.DeletePolicyCondition; -import org.openecomp.policy.api.DeletePolicyParameters; - -import static org.junit.Assert.*; - -/** - * The class DeletePolicyParametersTest contains tests for the class {@link DeletePolicyParameters}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class DeletePolicyParametersTest { - /** - * Run the DeletePolicyCondition getDeleteCondition() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetDeleteCondition_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - - DeletePolicyCondition result = fixture.getDeleteCondition(); - - // add additional test code here - assertNotNull(result); - assertEquals("All Versions", result.toString()); - assertEquals("ALL", result.name()); - assertEquals(1, result.ordinal()); - } - - /** - * Run the String getPdpGroup() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetPdpGroup_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - - String result = fixture.getPdpGroup(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the String getPolicyComponent() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetPolicyComponent_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - - String result = fixture.getPolicyComponent(); - - // 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_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - - String result = fixture.getPolicyName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d")); - fixture.setPdpGroup(""); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("482e90e2-2ad7-4265-9893-4cfe08ef1e3d", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-7452528304412746179L, result.getLeastSignificantBits()); - assertEquals(5201253920715260517L, result.getMostSignificantBits()); - } - - /** - * Run the void setDeleteCondition(DeletePolicyCondition) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetDeleteCondition_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - DeletePolicyCondition deleteCondition = DeletePolicyCondition.ALL; - - fixture.setDeleteCondition(deleteCondition); - - // add additional test code here - } - - /** - * Run the void setPdpGroup(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetPdpGroup_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - String pdpGroup = ""; - - fixture.setPdpGroup(pdpGroup); - - // add additional test code here - } - - /** - * Run the void setPolicyComponent(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetPolicyComponent_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - String policyComponent = ""; - - fixture.setPolicyComponent(policyComponent); - - // 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 { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - String policyName = ""; - - fixture.setPolicyName(policyName); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - DeletePolicyParameters fixture = new DeletePolicyParameters(); - fixture.setPolicyComponent(""); - fixture.setPolicyName(""); - fixture.setDeleteCondition(DeletePolicyCondition.ALL); - fixture.setRequestID(UUID.randomUUID()); - fixture.setPdpGroup(""); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(DeletePolicyParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/EventRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/EventRequestParametersTest.java deleted file mode 100644 index abfc31f8b..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/EventRequestParametersTest.java +++ /dev/null @@ -1,193 +0,0 @@ -/*- - * ============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.test; - -import java.util.Hashtable; -import java.util.Map; -import java.util.UUID; - -import org.junit.*; -import org.openecomp.policy.api.EventRequestParameters; - -import static org.junit.Assert.*; - -/** - * The class EventRequestParametersTest contains tests for the class {@link EventRequestParameters}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class EventRequestParametersTest { - /** - * Run the EventRequestParameters() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testEventRequestParameters_1() - throws Exception { - - EventRequestParameters result = new EventRequestParameters(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getEventAttributes()); - assertEquals(null, result.getRequestID()); - } - - /** - * Run the EventRequestParameters(Map,UUID) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testEventRequestParameters_2() - throws Exception { - Map eventAttributes = new Hashtable(); - UUID requestID = UUID.randomUUID(); - - EventRequestParameters result = new EventRequestParameters(eventAttributes, requestID); - - // add additional test code here - assertNotNull(result); - } - - /** - * Run the Map getEventAttributes() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetEventAttributes_1() - throws Exception { - EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); - - Map result = fixture.getEventAttributes(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.fromString("5b15376d-569b-4772-ac75-9362043f6a6c")); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("5b15376d-569b-4772-ac75-9362043f6a6c", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-6019743277723456916L, result.getLeastSignificantBits()); - assertEquals(6563212974706345842L, result.getMostSignificantBits()); - } - - /** - * Run the void setEventAttributes(Map) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetEventAttributes_1() - throws Exception { - EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); - Map eventAttributes = new Hashtable(); - - fixture.setEventAttributes(eventAttributes); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - EventRequestParameters fixture = new EventRequestParameters(new Hashtable(), UUID.randomUUID()); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(EventRequestParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigByPolicyNameTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigByPolicyNameTest.java deleted file mode 100644 index 7bfa27c6e..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigByPolicyNameTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============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.test; - -import java.util.Collection; - -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.PolicyConfig; -import org.openecomp.policy.api.PolicyConfigException; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -import junit.framework.TestCase; - -public class GetConfigByPolicyNameTest extends TestCase { - private PolicyEngine policyEngine = null; - private String policyName = null; - private Collection policyConfig = null; - private static final Logger logger = FlexLogger.getLogger(GetConfigByPolicyNameTest.class); - @Before - public void setUp() { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigPolicyNameNotValid(){ - policyName = null; - try{ - policyConfig = policyEngine.getConfigByPolicyName(policyName); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringMapTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringMapTest.java deleted file mode 100644 index c5b7f8f6d..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringMapTest.java +++ /dev/null @@ -1,259 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -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.PolicyType; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -public class GetConfigStringStringMapTest { - - private PolicyEngine policyEngine = null; - private String eCOMPComponentName = null; - private String configName = null; - private Map configAttributes = new HashMap(); - private Collection policyConfig = null; - private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringMapTest.class); - @Before - public void setUp() { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringMapFail() { - eCOMPComponentName = null; - configName = null; - configAttributes = null; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringMapFail1() { - eCOMPComponentName = null; - configName = "testFail"; - configAttributes.put("TestValue", "Fail"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringMapFail2() { - eCOMPComponentName = "TestFail"; - configName = null; - configAttributes.put("TestValue", "Fail"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringMapFail3() { - eCOMPComponentName = "TestFail"; - configName = "configFail"; - configAttributes= null; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringMapfail4() { - eCOMPComponentName = "TestFail"; - configName = "configFail"; - configAttributes.put("", ""); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringMapNotValid() { - eCOMPComponentName = "TestFail"; - configName = "configFail"; - configAttributes.put("Action:com.test.fail", "Value"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertNull(policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringMapValidJSON() { - eCOMPComponentName = "JSON"; - configName = "JSONconfig"; - configAttributes.put("Resource.com:test:resource:json", "Test"); - configAttributes.put("Action.com:test:action:json", "TestJSON"); - configAttributes.put("Subject.com:test:subject:json", "TestSubject"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.JSON,policyConfig.getType()); - assertNotNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringMapValidXML() { - eCOMPComponentName = "XML"; - configName = "XMLconfig"; - configAttributes.put("Resource.com:test:resource:json", "Test"); - configAttributes.put("Action.com:test:action:json", "TestJSON"); - configAttributes.put("Subject.com:test:subject:json", "TestSubject"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.XML,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNotNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringMapValidProperties() { - eCOMPComponentName = "Properties"; - configName = "PropConfig" ; - configAttributes.put("Resource.com:test:resource:json", "Test"); - configAttributes.put("Action.com:test:action:json", "TestJSON"); - configAttributes.put("Subject.com:test:subject:json", "TestSubject"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNotNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringMapValidOther() { - eCOMPComponentName = "Other"; - configName = "OtherConfig" ; - configAttributes.put("Resource.com:test:resource:json", "Test"); - configAttributes.put("Action.com:test:action:json", "TestJSON"); - configAttributes.put("Subject.com:test:subject:json", "TestSubject"); - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName, configAttributes); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.OTHER,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNotNull(policyConfig.toOther()); - } - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringTest.java deleted file mode 100644 index b55abd734..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringStringTest.java +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -import java.util.Collection; - -import org.junit.Before; -import org.junit.Test; -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.PolicyType; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -public class GetConfigStringStringTest { - - private PolicyEngine policyEngine = null; - private String eCOMPComponentName = null; - private String configName = null; - private Collection policyConfig = null; - private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringTest.class); - @Before - public void setUp() { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringFail() { - eCOMPComponentName = null; - configName = null; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringFail1() { - eCOMPComponentName = null; - configName = ""; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - @Test - public void testGetConfigStringStringFail2() { - eCOMPComponentName = ""; - configName = null; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringNotvalid() { - eCOMPComponentName = "fail"; - configName = "fail"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertNull(policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringValidJSON() { - eCOMPComponentName = "JSON"; - configName = "JSONconfig"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.JSON,policyConfig.getType()); - assertNotNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringValidXML() { - eCOMPComponentName = "XML"; - configName = "XMLconfig"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.XML,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNotNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringValidProperties() { - eCOMPComponentName = "Properties"; - configName = "PropConfig" ; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNotNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringStringValidOther() { - eCOMPComponentName = "Other"; - configName = "OtherConfig" ; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName, configName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.OTHER,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNotNull(policyConfig.toOther()); - } - } - -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringTest.java deleted file mode 100644 index ffa1913aa..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/GetConfigStringTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============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.test; - -import java.util.Collection; - -import org.junit.Before; -import org.openecomp.policy.api.PolicyConfig; -import org.openecomp.policy.api.PolicyConfigException; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -import junit.framework.TestCase; - -public class GetConfigStringTest extends TestCase{ - - private PolicyEngine policyEngine = null; - private String eCOMPComponentName = null; - private Collection policyConfig = null; - private static final Logger logger = FlexLogger.getLogger(GetConfigStringTest.class); - @Before - public void setUp() { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - } - - //@Test - @SuppressWarnings("deprecation") - public void testGetConfigStringFail() { - eCOMPComponentName = null; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - /*@Test - public void testGetConfigStringNotvalid() { - eCOMPComponentName = "fail"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertNull(policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - */ - - /*@Test - public void testGetConfigStringValidJSON() { - eCOMPComponentName = "JSON"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.JSON,policyConfig.getType()); - assertNotNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - */ - /*@Test - public void testGetConfigStringValidXML() { - eCOMPComponentName = "XML"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.XML,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNotNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - */ - /*@Test - public void testGetConfigStringValidProperties() { - eCOMPComponentName = "Properties"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.PROPERTIES,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNotNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNull(policyConfig.toOther()); - } - } - */ - /*@Test - public void testGetConfigStringValidOther() { - eCOMPComponentName = "Other"; - try { - policyConfig = policyEngine.getConfig(eCOMPComponentName); - } catch (PolicyConfigException e) { - logger.warn(e.getMessage()); - } - for(PolicyConfig policyConfig : this.policyConfig){ - logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig); - assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus()); - assertNotNull(policyConfig.getPolicyConfigMessage()); - assertEquals(PolicyType.OTHER,policyConfig.getType()); - assertNull(policyConfig.toJSON()); - assertNull(policyConfig.toProperties()); - assertNull(policyConfig.toXML()); - assertNotNull(policyConfig.toOther()); - } - } - */ -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ImportParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ImportParametersTest.java deleted file mode 100644 index 3719b5d2f..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/ImportParametersTest.java +++ /dev/null @@ -1,403 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.ImportParameters; - -/** - * The class ImportParametersTest contains tests for the class {@link ImportParameters}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class ImportParametersTest { - /** - * Run the String getDescription() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetDescription_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - - String result = fixture.getDescription(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the String getFilePath() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetFilePath_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - - String result = fixture.getFilePath(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.fromString("731dca0a-fe99-456c-8ad2-87cff8437b2f")); - fixture.setDescription(""); - fixture.setServiceName(""); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("731dca0a-fe99-456c-8ad2-87cff8437b2f", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-8443537024073106641L, result.getLeastSignificantBits()); - assertEquals(8295008237256263020L, result.getMostSignificantBits()); - } - - /** - * Run the String getServiceName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetServiceName_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - - String result = fixture.getServiceName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the ImportParameters.IMPORT_TYPE getServiceType() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetServiceType_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - - ImportParameters.IMPORT_TYPE result = fixture.getServiceType(); - - // add additional test code here - assertNotNull(result); - assertEquals("MICROSERVICE", result.name()); - assertEquals("MICROSERVICE", result.toString()); - assertEquals(0, result.ordinal()); - } - - /** - * Run the String getVersion() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetVersion_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - - String result = fixture.getVersion(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the void setDescription(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetDescription_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - String description = ""; - - fixture.setDescription(description); - - // add additional test code here - } - - /** - * Run the void setFilePath(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetFilePath_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - String filePath = ""; - - fixture.setFilePath(filePath); - - // add additional test code here - } - - /** - * Run the void setImportParameters(String,String,UUID,String,IMPORT_TYPE,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetImportParameters_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - String serviceName = ""; - String description = ""; - UUID requestID = UUID.randomUUID(); - String filePath = ""; - ImportParameters.IMPORT_TYPE importType = ImportParameters.IMPORT_TYPE.MICROSERVICE; - String version = ""; - - fixture.setImportParameters(serviceName, description, requestID, filePath, importType, version); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // add additional test code here - } - - /** - * Run the void setServiceName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetServiceName_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - String serviceName = ""; - - fixture.setServiceName(serviceName); - - // add additional test code here - } - - /** - * Run the void setServiceType(IMPORT_TYPE) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetServiceType_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - ImportParameters.IMPORT_TYPE enumImportType = ImportParameters.IMPORT_TYPE.MICROSERVICE; - - fixture.setServiceType(enumImportType); - - // add additional test code here - } - - /** - * Run the void setVersion(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetVersion_1() - throws Exception { - ImportParameters fixture = new ImportParameters(); - fixture.setFilePath(""); - fixture.setVersion(""); - fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE); - fixture.setRequestID(UUID.randomUUID()); - fixture.setDescription(""); - fixture.setServiceName(""); - String version = ""; - - fixture.setVersion(version); - - // 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(ImportParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/LoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/LoadedPolicyTest.java deleted file mode 100644 index 0748d0ad9..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/LoadedPolicyTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.LoadedPolicy; - -/** - * The class LoadedPolicyTest contains tests for the class {@link LoadedPolicy}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class LoadedPolicyTest { - /** - * 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(LoadedPolicyTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationHandlerTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationHandlerTest.java deleted file mode 100644 index 68ba3a773..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationHandlerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.NotificationHandler; - -/** - * The class NotificationHandlerTest contains tests for the class {@link NotificationHandler}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class NotificationHandlerTest { - /** - * 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(NotificationHandlerTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationSchemeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationSchemeTest.java deleted file mode 100644 index 1cb105c2f..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationSchemeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.NotificationScheme; - -import static org.junit.Assert.*; - -/** - * The class NotificationSchemeTest contains tests for the class {@link NotificationScheme}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class NotificationSchemeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testToString_1() - throws Exception { - NotificationScheme fixture = NotificationScheme.AUTO_ALL_NOTIFICATIONS; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("auto_all_notifications", 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(NotificationSchemeTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationTypeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationTypeTest.java deleted file mode 100644 index 95dce6a60..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/NotificationTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.NotificationType; - -import static org.junit.Assert.*; - -/** - * The class NotificationTypeTest contains tests for the class {@link NotificationType}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class NotificationTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testToString_1() - throws Exception { - NotificationType fixture = NotificationType.BOTH; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("both", 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(NotificationTypeTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PDPNotificationTest.java deleted file mode 100644 index 43754f8df..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PDPNotificationTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.PDPNotification; - -/** - * The class PDPNotificationTest contains tests for the class {@link PDPNotification}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PDPNotificationTest { - /** - * 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(PDPNotificationTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyChangeResponseTest.java deleted file mode 100644 index d36ae44c2..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyChangeResponseTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.PolicyChangeResponse; - -/** - * The class PolicyChangeResponseTest contains tests for the class {@link PolicyChangeResponse}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyChangeResponseTest { - /** - * 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(PolicyChangeResponseTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyClassTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyClassTest.java deleted file mode 100644 index 28e5beefd..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyClassTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyClass; - -import static org.junit.Assert.*; - -/** - * The class PolicyClassTest contains tests for the class {@link PolicyClass}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class PolicyClassTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyClass fixture = PolicyClass.Action; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("Action", 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(PolicyClassTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigExceptionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigExceptionTest.java deleted file mode 100644 index 4134eacc2..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigExceptionTest.java +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyConfigException; - -import static org.junit.Assert.*; - -/** - * The class PolicyConfigExceptionTest contains tests for the class {@link PolicyConfigException}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class PolicyConfigExceptionTest { - /** - * Run the PolicyConfigException() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyConfigException_1() - throws Exception { - - PolicyConfigException result = new PolicyConfigException(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyConfigException", result.toString()); - assertEquals(null, result.getLocalizedMessage()); - assertEquals(null, result.getMessage()); - } - - /** - * Run the PolicyConfigException(String) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyConfigException_2() - throws Exception { - String message = ""; - - PolicyConfigException result = new PolicyConfigException(message); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyConfigException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyConfigException(Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyConfigException_3() - throws Exception { - Throwable cause = new Throwable(); - - PolicyConfigException result = new PolicyConfigException(cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyConfigException: java.lang.Throwable", result.toString()); - assertEquals("java.lang.Throwable", result.getLocalizedMessage()); - assertEquals("java.lang.Throwable", result.getMessage()); - } - - /** - * Run the PolicyConfigException(String,Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyConfigException_4() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - - PolicyConfigException result = new PolicyConfigException(message, cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyConfigException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyConfigException(String,Throwable,boolean,boolean) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyConfigException_5() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - boolean enableSuppression = true; - boolean writableStackTrace = true; - - PolicyConfigException result = new PolicyConfigException(message, cause, enableSuppression, writableStackTrace); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyConfigException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * 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(PolicyConfigExceptionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigStatusTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigStatusTest.java deleted file mode 100644 index c40253890..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigStatusTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyConfigStatus; - -import static org.junit.Assert.*; - -/** - * The class PolicyConfigStatusTest contains tests for the class {@link PolicyConfigStatus}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyConfigStatusTest { - /** - * Run the PolicyConfigStatus getStatus(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetStatus_1() - throws Exception { - String configStatus = ""; - - PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus); - - // add additional test code here - assertNotNull(result); - assertEquals("not_found", result.toString()); - assertEquals("CONFIG_NOT_FOUND", result.name()); - assertEquals(1, result.ordinal()); - } - - /** - * Run the PolicyConfigStatus getStatus(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetStatus_2() - throws Exception { - String configStatus = ""; - - PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus); - - // 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 toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyConfigStatus fixture = PolicyConfigStatus.CONFIG_NOT_FOUND; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("not_found", 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(PolicyConfigStatusTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTest.java deleted file mode 100644 index c6247fcdf..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.PolicyConfig; - -/** - * The class PolicyConfigTest contains tests for the class {@link PolicyConfig}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyConfigTest { - /** - * 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(PolicyConfigTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTypeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTypeTest.java deleted file mode 100644 index cd6c6a977..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyConfigTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyConfigType; - -import static org.junit.Assert.*; - -/** - * The class PolicyConfigTypeTest contains tests for the class {@link PolicyConfigType}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyConfigTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyConfigType fixture = PolicyConfigType.BRMS_PARAM; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("BRMS_Param", 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(PolicyConfigTypeTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionExceptionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionExceptionTest.java deleted file mode 100644 index 95dfd7acd..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionExceptionTest.java +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyDecisionException; - -import static org.junit.Assert.*; - -/** - * The class PolicyDecisionExceptionTest contains tests for the class {@link PolicyDecisionException}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class PolicyDecisionExceptionTest { - /** - * Run the PolicyDecisionException() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyDecisionException_1() - throws Exception { - - PolicyDecisionException result = new PolicyDecisionException(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyDecisionException", result.toString()); - assertEquals(null, result.getLocalizedMessage()); - assertEquals(null, result.getMessage()); - } - - /** - * Run the PolicyDecisionException(String) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyDecisionException_2() - throws Exception { - String message = ""; - - PolicyDecisionException result = new PolicyDecisionException(message); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyDecisionException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyDecisionException(Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyDecisionException_3() - throws Exception { - Throwable cause = new Throwable(); - - PolicyDecisionException result = new PolicyDecisionException(cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyDecisionException: java.lang.Throwable", result.toString()); - assertEquals("java.lang.Throwable", result.getLocalizedMessage()); - assertEquals("java.lang.Throwable", result.getMessage()); - } - - /** - * Run the PolicyDecisionException(String,Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyDecisionException_4() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - - PolicyDecisionException result = new PolicyDecisionException(message, cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyDecisionException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyDecisionException(String,Throwable,boolean,boolean) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyDecisionException_5() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - boolean enableSuppression = true; - boolean writableStackTrace = true; - - PolicyDecisionException result = new PolicyDecisionException(message, cause, enableSuppression, writableStackTrace); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyDecisionException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * 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(PolicyDecisionExceptionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionTest.java deleted file mode 100644 index 12069abeb..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyDecisionTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyDecision; - -import static org.junit.Assert.*; - -/** - * The class PolicyDecisionTest contains tests for the class {@link PolicyDecision}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyDecisionTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyDecision fixture = PolicyDecision.DENY; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("deny", 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(PolicyDecisionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineExceptionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineExceptionTest.java deleted file mode 100644 index d21fb12e2..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineExceptionTest.java +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyEngineException; - -import static org.junit.Assert.*; - -/** - * The class PolicyEngineExceptionTest contains tests for the class {@link PolicyEngineException}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyEngineExceptionTest { - /** - * Run the PolicyEngineException() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testPolicyEngineException_1() - throws Exception { - - PolicyEngineException result = new PolicyEngineException(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyEngineException", result.toString()); - assertEquals(null, result.getLocalizedMessage()); - assertEquals(null, result.getMessage()); - } - - /** - * Run the PolicyEngineException(String) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testPolicyEngineException_2() - throws Exception { - String message = ""; - - PolicyEngineException result = new PolicyEngineException(message); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyEngineException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyEngineException(Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testPolicyEngineException_3() - throws Exception { - Throwable cause = new Throwable(); - - PolicyEngineException result = new PolicyEngineException(cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEngineException: java.lang.Throwable", result.toString()); - assertEquals("java.lang.Throwable", result.getLocalizedMessage()); - assertEquals("java.lang.Throwable", result.getMessage()); - } - - /** - * Run the PolicyEngineException(String,Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testPolicyEngineException_4() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - - PolicyEngineException result = new PolicyEngineException(message, cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEngineException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyEngineException(String,Throwable,boolean,boolean) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testPolicyEngineException_5() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - boolean enableSuppression = true; - boolean writableStackTrace = true; - - PolicyEngineException result = new PolicyEngineException(message, cause, enableSuppression, writableStackTrace); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEngineException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * 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(PolicyEngineExceptionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineInterfaceTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineInterfaceTest.java deleted file mode 100644 index fd5f65fa3..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineInterfaceTest.java +++ /dev/null @@ -1,670 +0,0 @@ -/*- - * ============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.test; - -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonReader; - -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.EventRequestParameters; -import org.openecomp.policy.api.ImportParameters; -import org.openecomp.policy.api.ImportParameters.IMPORT_TYPE; -import org.openecomp.policy.api.NotificationHandler; -import org.openecomp.policy.api.NotificationScheme; -import org.openecomp.policy.api.PDPNotification; -import org.openecomp.policy.api.PolicyChangeResponse; -import org.openecomp.policy.api.PolicyClass; -import org.openecomp.policy.api.PolicyConfig; -import org.openecomp.policy.api.PolicyConfigException; -import org.openecomp.policy.api.PolicyDecisionException; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyEventException; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.api.PolicyResponse; -import org.openecomp.policy.api.PushPolicyParameters; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.std.StdPDPNotification; -import org.openecomp.policy.std.StdPolicyChangeResponse; -import org.openecomp.policy.std.StdPolicyResponse; - -import junit.framework.TestCase; - -/** - * The class PolicyEngineInterfaceTest contains tests for the - * class {@link PolicyEngine} - * - * @pattern JUnit Test Case - * - * @generatedBy CodePro at 5/27/16 10:33 AM - * - * - * @version $Revision$ - */ -public class PolicyEngineInterfaceTest extends TestCase { - - private static final Logger logger = FlexLogger.getLogger(PolicyEngineInterfaceTest.class); - - private PolicyEngine policyEngine = null; - private PolicyEngine mockPolicyEngine = null; - private Collection policyConfig = null; - private UUID requestID = UUID.randomUUID(); - - - PolicyChangeResponse result = null; - StdPolicyChangeResponse response = new StdPolicyChangeResponse(); - - - /** - * Construct new test instance - * - * @param name the test name - */ - public PolicyEngineInterfaceTest(String name) { - super(name); - } - - /** - * Perform pre-test initialization - * - * @throws Exception - * - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - - mockPolicyEngine = Mockito.mock(PolicyEngine.class); - HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); - Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_OK); - - } - - /** - * Perform post-test clean up - * - * @throws Exception - * - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - // Add additional tear down code here - } - - /** - * Run the Collection getConfigByPolicyName(String) method - * test - */ - @SuppressWarnings("deprecation") - public void testGetConfigByPolicyName() { - String policyName = null; - try{ - policyConfig = policyEngine.getConfigByPolicyName(policyName); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - public void testGetConfigByPolicyName2() { - String policyName = null; - - try{ - policyConfig = policyEngine.getConfigByPolicyName(policyName, requestID); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - /** - * Run the Collection getConfig(String) method test - */ - @SuppressWarnings("deprecation") - public void testGetConfig() { - String ecompName = null; - - try{ - policyConfig = policyEngine.getConfig(ecompName); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - public void testGetConfig2() { - String ecompName = null; - - try{ - policyConfig = policyEngine.getConfig(ecompName,requestID); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - - @SuppressWarnings("deprecation") - public void testGetConfig3() { - String ecompName = null; - String configName = null; - - try{ - policyConfig = policyEngine.getConfig(ecompName,configName,requestID); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - public void testGetConfig4() { - String ecompName = null; - String configName = null; - Map configAttributes = null; - - try{ - policyConfig = policyEngine.getConfig(ecompName,configName,configAttributes); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - @SuppressWarnings("deprecation") - public void testGetConfig5() { - String ecompName = null; - String configName = null; - Map configAttributes = null; - - try{ - policyConfig = policyEngine.getConfig(ecompName,configName,configAttributes,requestID); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - public void testGetConfig6() { - ConfigRequestParameters parameters = new ConfigRequestParameters(); - - try{ - policyConfig = policyEngine.getConfig(parameters); - } catch (PolicyConfigException e){ - logger.warn(e.getMessage()); - } - assertNull(policyConfig); - } - - - /** - * Run the Collection sendEvent(Map) method - * test - */ - @SuppressWarnings("deprecation") - public void testSendEvent() - { - Collection result = null; - Collection response = null; - Map eventAttributes = null; - - try { - Mockito.when(mockPolicyEngine.sendEvent(eventAttributes)).thenReturn(result); - result = mockPolicyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.error("Exception Occured"+e); - } - - - assertEquals(result,response); - - } - - @SuppressWarnings("deprecation") - public void testSendEvent2() - { - Collection result = null; - Collection response = null; - Map eventAttributes = null; - - try { - Mockito.when(mockPolicyEngine.sendEvent(eventAttributes,requestID)).thenReturn(result); - result = mockPolicyEngine.sendEvent(eventAttributes,requestID); - } catch (PolicyEventException e) { - logger.error("Exception Occured"+e); - } - - - assertEquals(result,response); - - } - - public void testSendEvent3() - { - Collection result = null; - Collection response = null; - EventRequestParameters parameters = new EventRequestParameters(); - - try { - Mockito.when(mockPolicyEngine.sendEvent(parameters)).thenReturn(result); - result = mockPolicyEngine.sendEvent(parameters); - } catch (PolicyEventException e) { - logger.error("Exception Occured"+e); - } - - assertEquals(result,response); - - } - - - - /** - * Run the PolicyDecision getDecision(String, Map) method - * test - */ - @SuppressWarnings("deprecation") - public void testGetDecision() - { - String eCOMPComponentName = null; - Map decisionAttributes = null; - - DecisionResponse result = null; - - try { - Mockito.when(mockPolicyEngine.getDecision(eCOMPComponentName,decisionAttributes)).thenReturn(null); - result = mockPolicyEngine.getDecision(eCOMPComponentName,decisionAttributes); - } catch (PolicyDecisionException e) { - logger.error("Exception Occured"+e); - } - - assertEquals(result,null); - } - - @SuppressWarnings("deprecation") - public void testGetDecision2() - { - String eCOMPComponentName = null; - Map decisionAttributes = null; - - DecisionResponse result = null; - - try { - Mockito.when(mockPolicyEngine.getDecision(eCOMPComponentName,decisionAttributes,requestID)).thenReturn(null); - result = mockPolicyEngine.getDecision(eCOMPComponentName,decisionAttributes); - } catch (PolicyDecisionException e) { - logger.error("Exception Occured"+e); - } - - assertEquals(result,null); - } - - public void testGetDecision3() - { - DecisionRequestParameters parameters = new DecisionRequestParameters(); - DecisionResponse result = null; - - try { - Mockito.when(mockPolicyEngine.getDecision(parameters)).thenReturn(null); - result = mockPolicyEngine.getDecision(parameters); - } catch (PolicyDecisionException e) { - logger.error("Exception Occured"+e); - } - - assertEquals(result,null); - } - - /** - * Run the void setNotification(NotificationScheme, NotificationHandler) - * method test - */ - public void testSetNotification() { - // add test code here - - NotificationScheme scheme = null; - NotificationHandler handler = null; - - Mockito.doNothing().when(mockPolicyEngine).setNotification(scheme, handler); - mockPolicyEngine.setNotification(scheme, handler); - //assertTrue(true); - } - - /** - * Run the void clearNotification() method test - */ - public void testClearNotification() { - // add test code here - - Mockito.doNothing().when(mockPolicyEngine).clearNotification(); - mockPolicyEngine.clearNotification(); - //assertTrue(true); - } - - /** - * Run the void setScheme(NotificationScheme) method test - */ - public void testSetScheme() { - NotificationScheme scheme = null; - - Mockito.doNothing().when(mockPolicyEngine).setScheme(scheme); - mockPolicyEngine.setScheme(scheme); - //assertTrue(true); - } - - /** - * Run the PDPNotification getNotification() method test - */ - public void testGetNotification() { - PDPNotification result = null; - StdPDPNotification response = null; - Mockito.when(mockPolicyEngine.getNotification()).thenReturn(response); - result = mockPolicyEngine.getNotification(); - - assertEquals(result,response); - } - - /** - * Run the String createConfigPolicy(String, String, String, String, - * Map, String, String, String, UUID) method test - */ - @SuppressWarnings("deprecation") - public void testCreateConfigPolicy() - { - String response = "success"; - String result = null; - try { - - Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String updateConfigPolicy(String, String, String, String, - * Map, String, String, String, UUID) method test - */ - @SuppressWarnings("deprecation") - public void testUpdateConfigPolicy() - { - String response = "success"; - String result = null; - try { - - Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String createConfigFirewallPolicy(String, JsonObject, String, - * UUID) method test - */ - @SuppressWarnings("deprecation") - public void testCreateConfigFirewallPolicy() { - String response = "success"; - String result = null; - 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; - JsonObject jsonObj = buildJSON(json); - try { - - Mockito.when(mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.createConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String updateConfigFirewallPolicy(String, JsonObject, String, - * UUID) method test - */ - @SuppressWarnings("deprecation") - public void testUpdateConfigFirewallPolicy() { - String response = "success"; - String result = null; - 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\":\"SUBNET\",\"value\":\"10.11.12.13/14\"},{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]},{\"name\":\"PL_CCE3\",\"description\":\"CCE Routers\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"10.11.12.13/14\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"1607Rule\",\"fromZones\":[\"Trusted\"],\"toZones\":[\"Untrusted\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"value\":\"PL_CCE3\"},{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"value\":\"1607Group\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"1607Group\"}],\"action\":\"accept\",\"description\":\"Rule for 1607 templates\",\"enabled\":true,\"log\":true}]}"; - JsonObject jsonObj = buildJSON(json); - try { - - Mockito.when(mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null)).thenReturn(response); - result = mockPolicyEngine.updateConfigFirewallPolicy("testPolicy",jsonObj, "test", null, null, null, null, null); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test - */ - public void testCreatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - PolicyParameters policyParameters = new PolicyParameters(); - - policyParameters.setPolicyClass(PolicyClass.Action); //required - policyParameters.setPolicyName("test.junitTest"); //required - policyParameters.setPolicyDescription("testing"); //optional - - //Set the Component Attributes... These are Optional - Map configAttributes = new HashMap(); - configAttributes.put("test", "testing"); - - Map> attributes = new HashMap>(); - attributes.put(AttributeType.MATCHING, configAttributes); - policyParameters.setAttributes(attributes); - - policyParameters.setActionPerformer("PEP"); - policyParameters.setActionAttribute("testing"); - policyParameters.setRequestID(UUID.randomUUID()); - - try { - - //stdPolicyEngine = Mockito.mock(StdPolicyEngine.class); - //Mockito.when(stdPolicyEngine.callPAP(newPAPPolicy, new String[] {"operation=create", "apiflag=api", "policyType=Action"}, null, "Action")).thenReturn(callPapResponse); - Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.createPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - logger.error("Exception Occured"+e); - } - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test - */ - public void testUpdatePolicy() { - response.setResponseMessage("success"); - PolicyChangeResponse result = null; - PolicyParameters policyParameters = new PolicyParameters(); - - policyParameters.setPolicyClass(PolicyClass.Action); //required - policyParameters.setPolicyName("test.junitTest"); //required - policyParameters.setPolicyDescription("testing"); //optional - - //Set the Component Attributes... These are Optional - Map configAttributes = new HashMap(); - configAttributes.put("test", "testing"); - - Map> attributes = new HashMap>(); - attributes.put(AttributeType.MATCHING, configAttributes); - policyParameters.setAttributes(attributes); - - policyParameters.setActionPerformer("PEP"); - policyParameters.setActionAttribute("testing"); - policyParameters.setRequestID(UUID.randomUUID()); - - try { - - Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.updatePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - assertEquals(result, response); - } - - /** - * Run the String pushPolicy(String, String, String, String, UUID) method - * test - */ - @SuppressWarnings("deprecation") - public void testPushPolicy() { - String response = "Success"; - String result = null; - try { - - Mockito.when(mockPolicyEngine.pushPolicy("testing","test","Base","default",requestID)).thenReturn(response); - result = mockPolicyEngine.pushPolicy("testing","test","Base","default",requestID); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - - assertEquals(result, response); - } - - public void testPushPolicy2() { - PushPolicyParameters policyParameters = new PushPolicyParameters(); - PolicyChangeResponse result = null; - - //String policyScope = null; - policyParameters.setPolicyName("test.junitTest"); - policyParameters.setPolicyType("Action"); - policyParameters.setPdpGroup("Default"); - - try { - - Mockito.when(mockPolicyEngine.pushPolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.pushPolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse deletePolicy(DeletePolicyParameters) method - * test - */ - public void testDeletePolicy() { - DeletePolicyParameters policyParameters = new DeletePolicyParameters(); - PolicyChangeResponse result = null; - - //String policyScope = null; - policyParameters.setPolicyName("test.junitTest.1.xml"); - policyParameters.setDeleteCondition(DeletePolicyCondition.ALL); - policyParameters.setPolicyComponent("PAP"); - policyParameters.setPdpGroup("Default"); - - try { - - Mockito.when(mockPolicyEngine.deletePolicy(policyParameters)).thenReturn(response); - result = mockPolicyEngine.deletePolicy(policyParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - - assertEquals(result, response); - } - - /** - * Run the PolicyChangeResponse policyEngineImport(ImportParameters) method - * test - */ - public void testPolicyEngineImport() { - ImportParameters importParameters = new ImportParameters(); - PolicyChangeResponse result = null; - - importParameters.setFilePath("C:\\Workspaces\\models\\TestingModel\\ControllerServiceSampleSdnlServiceInstance-v0.1.0-SNAPSHOT.zip"); - importParameters.setServiceName("ControllerServiceSampleSdnlServiceInstance"); - - importParameters.setRequestID(UUID.randomUUID()); - importParameters.setServiceType(IMPORT_TYPE.MICROSERVICE); - importParameters.setVersion("1607-2"); - - - try { - - Mockito.when(mockPolicyEngine.policyEngineImport(importParameters)).thenReturn(response); - result = mockPolicyEngine.policyEngineImport(importParameters); - - } catch (Exception e) { - logger.warn(e.getMessage()); - } - - assertEquals(result, response); - } - - 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; - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineTest.java deleted file mode 100644 index c36a921d4..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEngineTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.junit.Test; -import org.openecomp.policy.api.NotificationScheme; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -public class PolicyEngineTest { - - private static final Logger logger = FlexLogger.getLogger(PolicyEngineTest.class); - private PolicyEngine policyEngine = null; - private String filePath = null; - - @Test - public void testPolicyEngineForFail() { - filePath = null; - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNull(policyEngine); - // Test even for this case. - filePath = "NotNull"; - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNull(policyEngine); - } - - @Test - public void testPolicyEngineforPropertyFileError() { - filePath = "Test/config_error.property"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNull(policyEngine); - } - - @Test - public void testPolicyEngineforPDPURLError() { - String filePath = "Test/config_fail.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNull(policyEngine); - } - - @Test - public void testPolicyEngineForPass() { - String filePath = "Test/config_pass.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - @Test - public void testPolicyEngineForUEBPass() { - String filePath = "Test/config_UEB_pass.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - - @Test - public void testPolicyEngineForUEBBadType() { - String filePath = "Test/config_UEB_bad_type.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - @Test - public void testPolicyEngineForUEBBadServerType() { - String filePath = "Test/config_UEB_badservers.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - @Test - public void testPolicyEngineNotficationAutoUEB() { - String filePath = "Test/config_UEB_pass.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - policyEngine.setScheme(NotificationScheme.AUTO_ALL_NOTIFICATIONS); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - @Test - public void testPolicyEngineNotficationAuto() { - String filePath = "Test/config_pass.properties"; - isFileAvailable(filePath); - try { - policyEngine = new PolicyEngine(filePath); - policyEngine.setScheme(NotificationScheme.AUTO_ALL_NOTIFICATIONS); - //policyEngine.getNotification(); - } catch (PolicyEngineException e) { - logger.warn(e.getMessage()); - } - assertNotNull(policyEngine); - } - - public void isFileAvailable(String filePath) { - Path file = Paths.get(filePath); - if (Files.notExists(file)) { - logger.error("File Doesn't Exist "+ file.toString()); - fail("File: " +filePath + " Not found"); - } - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEventExceptionTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEventExceptionTest.java deleted file mode 100644 index fa8d5d1d8..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyEventExceptionTest.java +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyEventException; - -import static org.junit.Assert.*; - -/** - * The class PolicyEventExceptionTest contains tests for the class {@link PolicyEventException}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class PolicyEventExceptionTest { - /** - * Run the PolicyEventException() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyEventException_1() - throws Exception { - - PolicyEventException result = new PolicyEventException(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyEventException", result.toString()); - assertEquals(null, result.getLocalizedMessage()); - assertEquals(null, result.getMessage()); - } - - /** - * Run the PolicyEventException(String) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyEventException_2() - throws Exception { - String message = ""; - - PolicyEventException result = new PolicyEventException(message); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getCause()); - assertEquals("org.openecomp.policy.api.PolicyEventException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyEventException(Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyEventException_3() - throws Exception { - Throwable cause = new Throwable(); - - PolicyEventException result = new PolicyEventException(cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEventException: java.lang.Throwable", result.toString()); - assertEquals("java.lang.Throwable", result.getLocalizedMessage()); - assertEquals("java.lang.Throwable", result.getMessage()); - } - - /** - * Run the PolicyEventException(String,Throwable) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyEventException_4() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - - PolicyEventException result = new PolicyEventException(message, cause); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEventException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * Run the PolicyEventException(String,Throwable,boolean,boolean) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPolicyEventException_5() - throws Exception { - String message = ""; - Throwable cause = new Throwable(); - boolean enableSuppression = true; - boolean writableStackTrace = true; - - PolicyEventException result = new PolicyEventException(message, cause, enableSuppression, writableStackTrace); - - // add additional test code here - assertNotNull(result); - assertEquals("org.openecomp.policy.api.PolicyEventException: ", result.toString()); - assertEquals("", result.getLocalizedMessage()); - assertEquals("", result.getMessage()); - } - - /** - * 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(PolicyEventExceptionTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyParametersTest.java deleted file mode 100644 index eeb973b90..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyParametersTest.java +++ /dev/null @@ -1,1409 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.Hashtable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.policy.api.AttributeType; -import org.openecomp.policy.api.PolicyClass; -import org.openecomp.policy.api.PolicyConfigType; -import org.openecomp.policy.api.PolicyParameters; -import org.openecomp.policy.api.PolicyType; - -/** - * The class PolicyParametersTest contains tests for the class {@link PolicyParameters}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyParametersTest { - /** - * Run the String getActionAttribute() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetActionAttribute_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getActionAttribute(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the String getActionPerformer() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetActionPerformer_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getActionPerformer(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the Map> getAttributes() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetAttributes_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - Map> result = fixture.getAttributes(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the String getConfigBody() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetConfigBody_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getConfigBody(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the PolicyType getConfigBodyType() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetConfigBodyType_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - PolicyType result = fixture.getConfigBodyType(); - - // add additional test code here - assertNotNull(result); - assertEquals("json", result.toString()); - assertEquals("JSON", result.name()); - assertEquals(1, result.ordinal()); - } - - /** - * Run the String getConfigName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetConfigName_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getConfigName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the List getDynamicRuleAlgorithmField1() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetDynamicRuleAlgorithmField1_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - List result = fixture.getDynamicRuleAlgorithmField1(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the List getDynamicRuleAlgorithmField2() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetDynamicRuleAlgorithmField2_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - List result = fixture.getDynamicRuleAlgorithmField2(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the List getDynamicRuleAlgorithmFunctions() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetDynamicRuleAlgorithmFunctions_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - List result = fixture.getDynamicRuleAlgorithmFunctions(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the List getDynamicRuleAlgorithmLabels() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetDynamicRuleAlgorithmLabels_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - List result = fixture.getDynamicRuleAlgorithmLabels(); - - // add additional test code here - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the String getEcompName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetEcompName_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getEcompName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the PolicyClass getPolicyClass() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetPolicyClass_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - PolicyClass result = fixture.getPolicyClass(); - - // add additional test code here - assertNotNull(result); - assertEquals("Action", result.toString()); - assertEquals("Action", result.name()); - assertEquals(1, result.ordinal()); - } - - /** - * Run the PolicyConfigType getPolicyConfigType() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetPolicyConfigType_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - PolicyConfigType result = (PolicyConfigType) fixture.getPolicyConfigType(); - - // add additional test code here - assertNotNull(result); - assertEquals("BRMS_Param", result.toString()); - assertEquals("BRMS_PARAM", result.name()); - assertEquals(5, result.ordinal()); - } - - /** - * Run the String getPolicyDescription() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetPolicyDescription_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getPolicyDescription(); - - // 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_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getPolicyName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the String getPriority() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetPriority_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - String result = fixture.getPriority(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetRequestID_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.fromString("878d319c-2799-4684-b480-99f40e1042b2")); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("878d319c-2799-4684-b480-99f40e1042b2", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-5440179076376542542L, result.getLeastSignificantBits()); - assertEquals(-8679226360124062076L, result.getMostSignificantBits()); - } - - /** - * Run the void setActionAttribute(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetActionAttribute_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String actionAttribute = ""; - - fixture.setActionAttribute(actionAttribute); - - // add additional test code here - } - - /** - * Run the void setActionPerformer(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetActionPerformer_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String actionPerformer = ""; - - fixture.setActionPerformer(actionPerformer); - - // add additional test code here - } - - /** - * Run the void setAttributes(Map>) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetAttributes_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - Map> attributes = new Hashtable>(); - - fixture.setAttributes(attributes); - - // add additional test code here - } - - /** - * Run the void setConfigBody(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetConfigBody_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String configBody = ""; - - fixture.setConfigBody(configBody); - - // add additional test code here - } - - /** - * Run the void setConfigBodyType(PolicyType) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetConfigBodyType_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - PolicyType configBodyType = PolicyType.JSON; - - fixture.setConfigBodyType(configBodyType); - - // add additional test code here - } - - /** - * Run the void setConfigFirewallPolicyParameters(String,String,UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetConfigFirewallPolicyParameters_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String policyName = ""; - String firewallJson = ""; - UUID requestID = UUID.randomUUID(); - - fixture.setConfigFirewallPolicyParameters(policyName, firewallJson, requestID); - - // 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 { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String configName = ""; - - fixture.setConfigName(configName); - - // add additional test code here - } - - /** - * Run the void setConfigPolicyParameters(PolicyConfigType,String,String,String,String,Map>,PolicyType,String,UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetConfigPolicyParameters_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - PolicyConfigType policyConfigType = PolicyConfigType.BRMS_PARAM; - String policyName = ""; - String policyDescription = ""; - String ecompName = ""; - String configName = ""; - Map> attributes = new Hashtable>(); - PolicyType configBodyType = PolicyType.JSON; - String configBody = ""; - UUID requestID = UUID.randomUUID(); - - fixture.setConfigPolicyParameters(policyConfigType, policyName, policyDescription, ecompName, configName, attributes, configBodyType, configBody, requestID); - - // add additional test code here - } - - /** - * Run the void setDynamicRuleAlgorithmField1(List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetDynamicRuleAlgorithmField1_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - List dynamicRuleAlgorithmField1 = new LinkedList(); - - fixture.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1); - - // add additional test code here - } - - /** - * Run the void setDynamicRuleAlgorithmField2(List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetDynamicRuleAlgorithmField2_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - List dynamicRuleAlgorithmField2 = new LinkedList(); - - fixture.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2); - - // add additional test code here - } - - /** - * Run the void setDynamicRuleAlgorithmFunctions(List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetDynamicRuleAlgorithmFunctions_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - List dynamicRuleAlgorithmFunctions = new LinkedList(); - - fixture.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions); - - // add additional test code here - } - - /** - * Run the void setDynamicRuleAlgorithmLabels(List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetDynamicRuleAlgorithmLabels_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - List dynamicRuleAlgorithmLabels = new LinkedList(); - - fixture.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels); - - // 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 { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String ecompName = ""; - - fixture.setEcompName(ecompName); - - // add additional test code here - } - - /** - * Run the void setPolicyClass(PolicyClass) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetPolicyClass_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - PolicyClass policyClass = PolicyClass.Action; - - fixture.setPolicyClass(policyClass); - - // add additional test code here - } - - /** - * Run the void setPolicyConfigType(PolicyConfigType) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetPolicyConfigType_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - PolicyConfigType policyConfigType = PolicyConfigType.BRMS_PARAM; - - fixture.setPolicyConfigType(policyConfigType); - - // add additional test code here - } - - /** - * Run the void setPolicyDescription(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetPolicyDescription_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String policyDescription = ""; - - fixture.setPolicyDescription(policyDescription); - - // 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 { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String policyName = ""; - - fixture.setPolicyName(policyName); - - // add additional test code here - } - - /** - * Run the void setPriority(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetPriority_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - String priority = ""; - - fixture.setPriority(priority); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - PolicyParameters fixture = new PolicyParameters(); - fixture.setRequestID(UUID.randomUUID()); - fixture.setActionAttribute(""); - fixture.setAttributes(new Hashtable>()); - fixture.setDynamicRuleAlgorithmLabels(new LinkedList()); - fixture.setPolicyDescription(""); - - fixture.setPolicyConfigType(PolicyConfigType.BRMS_PARAM); - fixture.setDynamicRuleAlgorithmField2(new LinkedList()); - fixture.setPolicyName(""); - fixture.setConfigName(""); - fixture.setDynamicRuleAlgorithmFunctions(new LinkedList()); - fixture.setPolicyClass(PolicyClass.Action); - fixture.setEcompName(""); - fixture.setConfigBodyType(PolicyType.JSON); - fixture.setDynamicRuleAlgorithmField1(new LinkedList()); - fixture.setPriority(""); - fixture.setActionPerformer(""); - fixture.setConfigBody(""); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(PolicyParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseStatusTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseStatusTest.java deleted file mode 100644 index 5841571bd..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseStatusTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyResponseStatus; - -import static org.junit.Assert.*; - -/** - * The class PolicyResponseStatusTest contains tests for the class {@link PolicyResponseStatus}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyResponseStatusTest { - /** - * Run the PolicyResponseStatus getStatus(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetStatus_1() - throws Exception { - String responseStatus = ""; - - PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); - - // add additional test code here - assertNotNull(result); - assertEquals("no_action", result.toString()); - assertEquals("NO_ACTION_REQUIRED", result.name()); - assertEquals(0, result.ordinal()); - } - - /** - * Run the PolicyResponseStatus getStatus(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetStatus_2() - throws Exception { - String responseStatus = ""; - - PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); - - // add additional test code here - assertNotNull(result); - assertEquals("no_action", result.toString()); - assertEquals("NO_ACTION_REQUIRED", result.name()); - assertEquals(0, result.ordinal()); - } - - /** - * Run the PolicyResponseStatus getStatus(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testGetStatus_3() - throws Exception { - String responseStatus = ""; - - PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus); - - // add additional test code here - assertNotNull(result); - assertEquals("no_action", result.toString()); - assertEquals("NO_ACTION_REQUIRED", result.name()); - assertEquals(0, result.ordinal()); - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("action_advised", 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(PolicyResponseStatusTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseTest.java deleted file mode 100644 index ec6ac09f0..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyResponseTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.PolicyResponse; - -/** - * The class PolicyResponseTest contains tests for the class {@link PolicyResponse}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyResponseTest { - /** - * 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(PolicyResponseTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyTypeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyTypeTest.java deleted file mode 100644 index 5b31e857b..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PolicyTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.PolicyType; - -import static org.junit.Assert.*; - -/** - * The class PolicyTypeTest contains tests for the class {@link PolicyType}. - * - * @generatedBy CodePro at 6/1/16 1:41 PM - * @version $Revision: 1.0 $ - */ -public class PolicyTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyType fixture = PolicyType.JSON; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("json", 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(PolicyTypeTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PushPolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PushPolicyParametersTest.java deleted file mode 100644 index ef005f1f4..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/PushPolicyParametersTest.java +++ /dev/null @@ -1,269 +0,0 @@ -/*- - * ============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.test; - -import java.util.UUID; - -import org.junit.*; -import org.openecomp.policy.api.PushPolicyParameters; - -import static org.junit.Assert.*; - -/** - * The class PushPolicyParametersTest contains tests for the class {@link PushPolicyParameters}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class PushPolicyParametersTest { - /** - * Run the PushPolicyParameters() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPushPolicyParameters_1() - throws Exception { - - PushPolicyParameters result = new PushPolicyParameters(); - - // add additional test code here - assertNotNull(result); - assertEquals(null, result.getPolicyName()); - assertEquals(null, result.getRequestID()); - assertEquals(null, result.getPolicyType()); - assertEquals(null, result.getPdpGroup()); - } - - /** - * Run the PushPolicyParameters(String,String,String,UUID) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testPushPolicyParameters_2() - throws Exception { - String policyName = ""; - String policyType = ""; - String pdpGroup = ""; - UUID requestID = UUID.randomUUID(); - - PushPolicyParameters result = new PushPolicyParameters(policyName, policyType, pdpGroup, requestID); - - // add additional test code here - assertNotNull(result); - assertEquals("", result.getPolicyName()); - assertEquals("", result.getPolicyType()); - assertEquals("", result.getPdpGroup()); - } - - /** - * Run the String getPdpGroup() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetPdpGroup_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - - String result = fixture.getPdpGroup(); - - // 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_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - - String result = fixture.getPolicyName(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the String getPolicyType() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetPolicyType_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - - String result = fixture.getPolicyType(); - - // add additional test code here - assertEquals("", result); - } - - /** - * Run the UUID getRequestID() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testGetRequestID() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.fromString("d1dbaac1-0944-4f07-9ce7-733c697537ea")); - - UUID result = fixture.getRequestID(); - - // add additional test code here - assertNotNull(result); - assertEquals("d1dbaac1-0944-4f07-9ce7-733c697537ea", result.toString()); - assertEquals(4, result.version()); - assertEquals(2, result.variant()); - assertEquals(-7140611980868110358L, result.getLeastSignificantBits()); - assertEquals(-3324876153822097657L, result.getMostSignificantBits()); - } - - /** - * Run the void setPdpGroup(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetPdpGroup_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - String pdpGroup = ""; - - fixture.setPdpGroup(pdpGroup); - - // 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 { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - String policyName = ""; - - fixture.setPolicyName(policyName); - - // add additional test code here - } - - /** - * Run the void setPolicyType(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetPolicyType_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - String policyType = ""; - - fixture.setPolicyType(policyType); - - // add additional test code here - } - - /** - * Run the void setRequestID(UUID) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:40 PM - */ - @Test - public void testSetRequestID_1() - throws Exception { - PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID()); - UUID requestID = UUID.randomUUID(); - - fixture.setRequestID(requestID); - - // 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(PushPolicyParametersTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/RemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/RemovedPolicyTest.java deleted file mode 100644 index ef77e6d5f..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/RemovedPolicyTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============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.test; - -import org.junit.After; -import org.junit.Before; -import org.openecomp.policy.api.RemovedPolicy; - -/** - * The class RemovedPolicyTest contains tests for the class {@link RemovedPolicy}. - * - * @generatedBy CodePro at 6/1/16 1:40 PM - * @version $Revision: 1.0 $ - */ -public class RemovedPolicyTest { - /** - * 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(RemovedPolicyTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/SendEventTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/SendEventTest.java deleted file mode 100644 index 5757f8915..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/SendEventTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============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.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.openecomp.policy.api.PolicyEngine; -import org.openecomp.policy.api.PolicyEngineException; -import org.openecomp.policy.api.PolicyEventException; -import org.openecomp.policy.api.PolicyResponse; -import org.openecomp.policy.api.PolicyResponseStatus; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - -public class SendEventTest { - - private PolicyEngine policyEngine = null; - private Map eventAttributes = new HashMap(); - private Collection policyResponse = null; - private static final Logger logger = FlexLogger.getLogger(SendEventTest.class); - @Before - public void setUp() { - try { - policyEngine = new PolicyEngine("Test/config_pass.properties"); - } catch (PolicyEngineException e) { - logger.error(e.getMessage()); - fail("PolicyEngine Instantiation Error" + e); - } - logger.info("Loaded.. PolicyEngine"); - } - - //@Test - @SuppressWarnings("deprecation") - public void testSendEventFail() { - eventAttributes = null; - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - assertNull(policyResponse); - } - - //@Test - @SuppressWarnings("deprecation") - public void testSendEventFailNull() { - eventAttributes.put("", ""); - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - assertNull(policyResponse); - } - - // deprecated Test. - /*@Test - public void testSendEventFailAttribute() { - eventAttributes.put("Fail.key", "Value"); - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - assertNull(policyResponse.getPolicyResponseMessage()); - }*/ - - //@Test - @SuppressWarnings("deprecation") - public void testSendEventNotValid() { - eventAttributes.put("Action.fail", "Value"); - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - for(PolicyResponse policyResponse: this.policyResponse){ - logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse); - assertEquals(PolicyResponseStatus.NO_ACTION_REQUIRED, policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse.getPolicyResponseMessage()); - assertNotNull(policyResponse.getRequestAttributes()); - assertNull(policyResponse.getActionTaken()); - assertNull(policyResponse.getActionAdvised()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testSendEventActionAdvised() { - eventAttributes.put("Key", "Value"); - eventAttributes.put("cpu", "80"); - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - for(PolicyResponse policyResponse: this.policyResponse){ - logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse); - assertEquals(PolicyResponseStatus.ACTION_ADVISED, policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse.getPolicyResponseMessage()); - assertNotNull(policyResponse.getRequestAttributes()); - assertNull(policyResponse.getActionTaken()); - assertNotNull(policyResponse.getActionAdvised()); - } - } - - //@Test - @SuppressWarnings("deprecation") - public void testSendEventActionTaken() { - eventAttributes.put("Key", "Value"); - eventAttributes.put("cpu", "91"); - try { - policyResponse = policyEngine.sendEvent(eventAttributes); - } catch (PolicyEventException e) { - logger.warn(e.getMessage()); - } - for(PolicyResponse policyResponse: this.policyResponse){ - logger.info(policyResponse.getPolicyResponseMessage() + " , " + policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse); - assertEquals(PolicyResponseStatus.ACTION_TAKEN, policyResponse.getPolicyResponseStatus()); - assertNotNull(policyResponse.getPolicyResponseMessage()); - assertNotNull(policyResponse.getRequestAttributes()); - assertNotNull(policyResponse.getActionTaken()); - assertNull(policyResponse.getActionAdvised()); - } - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/TestRunner.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/TestRunner.java deleted file mode 100644 index 69cbd834e..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/TestRunner.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============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.test; - -import org.junit.runner.JUnitCore; -import org.junit.runner.Result; -import org.junit.runner.notification.Failure; - -public class TestRunner { - public static void main(String[] args) { - Result result = JUnitCore.runClasses(PolicyEngineTest.class); - for(Failure failure: result.getFailures()) { - System.out.println("Failed Test: " + failure.toString()); - } - Result results = null; - if(result.wasSuccessful()) { - System.out.println("API Methods are being Tested.. "); - results = JUnitCore.runClasses(GetConfigByPolicyNameTest.class, GetConfigStringTest.class,GetConfigStringStringTest.class,GetConfigStringStringMapTest.class,SendEventTest.class); - for(Failure failure: results.getFailures()) { - System.out.println("Failed Test: " + failure.toString()); - } - System.out.println("Test Results.. "); - System.out.println("Stats: \nRun Time: " + (results.getRunTime()+result.getRunTime()) + "\nTotal Tests:" + results.getRunCount()+ result.getRunCount() - + "\nFailures: " + results.getFailureCount()+ result.getFailureCount()); - System.exit(1); - } - System.out.println("Test Failed.."); - System.out.println("Stats: \nRun Time: " + result.getRunTime() + "\nTests:" + result.getRunCount() - + "\nFailures: " + result.getFailureCount()); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/UpdateTypeTest.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/UpdateTypeTest.java deleted file mode 100644 index 909a05f0e..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/UpdateTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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.test; - -import org.junit.*; -import org.openecomp.policy.api.UpdateType; - -import static org.junit.Assert.*; - -/** - * The class UpdateTypeTest contains tests for the class {@link UpdateType}. - * - * @generatedBy CodePro at 6/1/16 1:39 PM - * @version $Revision: 1.0 $ - */ -public class UpdateTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:39 PM - */ - @Test - public void testToString_1() - throws Exception { - UpdateType fixture = UpdateType.NEW; - - String result = fixture.toString(); - - // add additional test code here - assertEquals("new", result); - } - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 6/1/16 1:39 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:39 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:39 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(UpdateTypeTest.class); - } -} diff --git a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/package-info.java b/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/package-info.java deleted file mode 100644 index e678c4be2..000000000 --- a/PolicyEngineAPI/src/test/java/org/openecomp/policy/test/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * ============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========================================================= - */ - -/** - * API JUNIT TestCases. - */ -package org.openecomp.policy.test; -- cgit 1.2.3-korg