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 --- .../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 - 42 files changed, 8324 deletions(-) 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/java/org/openecomp/policy/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