summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java41
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java66
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java170
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java431
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java90
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java34
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java30
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java42
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java69
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java41
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java19
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java40
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java24
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java8
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java68
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java98
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java22
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java81
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java199
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java31
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java385
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java30
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java142
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java218
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java36
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java242
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java32
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java63
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java53
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java107
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java107
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/ManualClientEndDMAAPTest.java48
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java1420
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java294
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/DummyNotificationHandler.java182
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java20
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java123
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java159
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java610
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java546
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java532
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java263
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java615
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java341
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java2817
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/utils/PolicyConstantsTest.java38
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/APIPolicyConfigResponseTest.java92
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java390
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java104
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java553
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java430
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java656
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java329
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java393
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryParametersTest.java44
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java313
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java63
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java442
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java353
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java172
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java721
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/MetricsRequestParametersTest.java22
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java107
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java107
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java299
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java121
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java299
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java299
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java1185
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java299
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyExceptionTest.java117
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java463
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java77
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java229
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDecisionResponseTest.java23
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDictionaryResponseTest.java32
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/StdMetricsResponseTest.java35
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java51
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java107
85 files changed, 10228 insertions, 10188 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
index a04859b27..b80eaed89 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,13 +23,11 @@ package org.onap.policy.pap.xacml.rest.components;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
-
import java.util.HashMap;
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;
@@ -35,7 +35,6 @@ import org.mockito.Mockito;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
-
import com.att.research.xacml.util.XACMLProperties;
@@ -50,14 +49,14 @@ public class ActionPolicyTest {
Map<String, String> attributeMap = new HashMap<>();
ActionPolicy component = null;
-
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,
+ "src/test/resources/xacml.pap.properties");
dynamicRuleAlgorithmLabels.add("test");
dynamicRuleAlgorithmField1.add("testField1");
@@ -66,13 +65,14 @@ public class ActionPolicyTest {
policyAdapter.setPolicyName("Test.Action_junitTest");
policyAdapter.setPolicyDescription("test");
- policyAdapter.setRuleCombiningAlgId("urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
+ policyAdapter.setRuleCombiningAlgId(
+ "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
policyAdapter.setPolicyType("Action");
policyAdapter.setEditPolicy(false);
policyAdapter.setDomainDir("Test");
policyAdapter.setNewFileName("Test.Action_junitTest.1.xml");
policyAdapter.setHighestVersion(1);
- policyAdapter.setPolicyID("urn:xacml:policy:id:"+UUID.randomUUID());
+ policyAdapter.setPolicyID("urn:xacml:policy:id:" + UUID.randomUUID());
policyAdapter.setActionDictHeader("");
policyAdapter.setActionDictType("REST");
@@ -98,31 +98,32 @@ public class ActionPolicyTest {
* @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {
- }
+ public void tearDown() throws Exception {}
-/* *//**
- * Test method for {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#savePolicies()}.
+ /**
+ * Test method for
+ * {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#savePolicies()}.
*/
@Test
public void testSavePolicies() {
ActionPolicy mockAction = Mockito.mock(component.getClass());
Map<String, String> successMap = new HashMap<>();
-
+
successMap.put("success", "success");
try {
when(mockAction.savePolicies()).thenReturn(successMap);
successMap = mockAction.savePolicies();
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
}
- assertEquals(successMap.get("success"),"success");
+ assertEquals(successMap.get("success"), "success");
}
/**
- * Test method for {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#prepareToSave()}.
+ * Test method for
+ * {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#prepareToSave()}.
*/
@Test
public void testPrepareToSave() {
@@ -132,10 +133,8 @@ public class ActionPolicyTest {
try {
response = component.prepareToSave();
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
}
assertTrue(response);
-
}
-
-} \ No newline at end of file
+}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java
index a31d5a393..39586ba1b 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -29,38 +31,38 @@ import org.mockito.Mockito;
import org.onap.policy.rest.dao.CommonClassDao;
public class BRMSPolicyTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
- @Test
- public void testConstructor1() {
- CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate();
- assertNotNull(template);
- }
+ @Test
+ public void testConstructor1() {
+ CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate();
+ assertNotNull(template);
+ }
- @Test
- public void testConstructor2() {
- CommonClassDao commonClassDao = null;
- CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(commonClassDao);
- assertNotNull(template);
- }
+ @Test
+ public void testConstructor2() {
+ CommonClassDao commonClassDao = null;
+ CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(commonClassDao);
+ assertNotNull(template);
+ }
- @Test
- public void testReadFile() throws IOException {
- String goodRule = "declare Params\nparam1 : int\nend\n";
- String badRule = "declare Params\nparam1+ : int\nend\n";
- assertEquals(CreateBRMSRuleTemplate.validateRuleParams(goodRule), true);
- assertEquals(CreateBRMSRuleTemplate.validateRuleParams(badRule), false);
- }
+ @Test
+ public void testReadFile() throws IOException {
+ String goodRule = "declare Params\nparam1 : int\nend\n";
+ String badRule = "declare Params\nparam1+ : int\nend\n";
+ assertEquals(CreateBRMSRuleTemplate.validateRuleParams(goodRule), true);
+ assertEquals(CreateBRMSRuleTemplate.validateRuleParams(badRule), false);
+ }
- @Test
- public void testAdd() {
- CommonClassDao dao = Mockito.mock(CommonClassDao.class);
- CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(dao);
- String rule = "package foo\n";
- String ruleName = "testName";
- String description = "testDesc";
- String userID = "testID";
- assertEquals(1, template.addRule(rule, ruleName, description, userID).size());
- }
+ @Test
+ public void testAdd() {
+ CommonClassDao dao = Mockito.mock(CommonClassDao.class);
+ CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(dao);
+ String rule = "package foo\n";
+ String ruleName = "testName";
+ String description = "testDesc";
+ String userID = "testID";
+ assertEquals(1, template.addRule(rule, ruleName, description, userID).size());
+ }
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
index 7910aed11..1334f96a0 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,13 +24,10 @@ package org.onap.policy.pap.xacml.rest.controller;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.io.BufferedReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
-
import javax.servlet.http.HttpServletRequest;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -40,7 +39,8 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.springframework.mock.web.MockHttpServletResponse;
public class DecisionPolicyDictionaryControllerTest {
- private static Logger logger = FlexLogger.getLogger(DecisionPolicyDictionaryControllerTest.class);
+ private static Logger logger =
+ FlexLogger.getLogger(DecisionPolicyDictionaryControllerTest.class);
private static CommonClassDao commonClassDao;
private String jsonString = null;
private HttpServletRequest request = null;
@@ -51,21 +51,26 @@ public class DecisionPolicyDictionaryControllerTest {
logger.info("setUp: Entering");
commonClassDao = Mockito.mock(CommonClassDao.class);
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-
- jsonString = "{\"attributeDictionaryDatas\": {\"error\": \"\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+
+ jsonString =
+ "{\"attributeDictionaryDatas\": {\"error\": \"\",\"inprocess\": false,\"model\": "
+ + "{\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
+ + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
-
- //--- mock the getReader() call
- when(request.getReader()).thenReturn(br);
-
+
+ // --- mock the getReader() call
+ when(request.getReader()).thenReturn(br);
+
controller = new DecisionPolicyDictionaryController(commonClassDao);
new DictionaryUtils(commonClassDao);
DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
@@ -74,22 +79,22 @@ public class DecisionPolicyDictionaryControllerTest {
}
@After
- public void tearDown() throws Exception {
- }
+ public void tearDown() throws Exception {}
@Test
public void testGetSettingsDictionaryByNameEntityData() {
logger.info("testGetSettingsDictionaryByNameEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getSettingsDictionaryByNameEntityData(request, response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("settingsDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
@@ -101,15 +106,16 @@ public class DecisionPolicyDictionaryControllerTest {
public void testGetSettingsDictionaryEntityData() {
logger.info("testGetSettingsDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getSettingsDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("settingsDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
@@ -121,21 +127,24 @@ public class DecisionPolicyDictionaryControllerTest {
public void testSaveSettingsDictionary() {
logger.info("testSaveSettingsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
-
+
try {
// mock the getReader() call
- jsonString = "{\"settingsDictionaryData\":{\"xacmlId\":\"testMMRestAPI1\",\"datatypeBean\":{\"shortName\":\"string\"},\"description\":\"test\",\"priority\":\"High\"}, \"userid\":\"test\"}";
+ jsonString = "{\"settingsDictionaryData\":{\"xacmlId\":\"testMMRestAPI1\","
+ + "\"datatypeBean\": {\"shortName\":\"string\"},\"description\":\"test\","
+ + "\"priority\":\"High\"}, \"userid\":\"test\"}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveSettingsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("settingsDictionaryDatas"));
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
@@ -147,130 +156,135 @@ public class DecisionPolicyDictionaryControllerTest {
public void testRemoveSettingsDictionary() {
logger.info("testRemoveSettingsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\","
+ + "\"subScopename\": \"\"},\"policy\": "
+ + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeSettingsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("settingsDictionaryDatas"));
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
-
logger.info("testRemoveSettingsDictionary: exit");
-
}
@Test
public void testGetRainyDayDictionaryByNameEntityData() {
logger.info("testGetRainyDayDictionaryByNameEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getRainyDayDictionaryByNameEntityData(request, response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("rainyDayDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
-
logger.info("testGetRainyDayDictionaryByNameEntityData: exit");
-
}
@Test
public void testGetRainyDayDictionaryEntityData() {
logger.info("testGetRainyDayDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getRainyDayDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("rainyDayDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
-
logger.info("testGetRainyDayDictionaryEntityData: exit");
-
}
@Test
public void testSaveRainyDayDictionary() {
logger.info("testSaveRainyDayDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
-
+
try {
// mock the getReader() call
- jsonString = "{\"rainyDayDictionaryData\":{\"bbid\":\"BB2\",\"workstep\":\"1\",\"userDataTypeValues\":[{\"$$hashKey\":\"object:233\",\"treatment\":\"test1\"},{\"$$hashKey\":\"object:239\",\"treatment\":\"test2\"}]},\"userid\":\"mm117s\"}";
+ jsonString =
+ "{\"rainyDayDictionaryData\":{\"bbid\":\"BB2\",\"workstep\":\"1\",\"userDataTypeValues\""
+ + ":[{\"$$hashKey\":\"object:233\",\"treatment\":\"test1\"},{\"$$hashKey\":\"object:239\","
+ + "\"treatment\":\"test2\"}]},\"userid\":\"mm117s\"}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveRainyDayDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("rainyDayDictionaryDatas"));
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
-
logger.info("testSaveRainyDayDictionary: exit");
-
}
@Test
public void testRemoveRainyDayDictionary() {
logger.info("testRemoveRainyDayDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": "
+ + "\"someone\",\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeRainyDayDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("rainyDayDictionaryDatas"));
} catch (Exception e) {
- logger.error("Exception Occured"+e);
+ logger.error("Exception Occured" + e);
fail("Exception: " + e);
}
-
logger.info("testRemoveRainyDayDictionary: exit");
-
}
-
-} \ No newline at end of file
+}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java
index 2e9df2592..213d774bd 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -26,15 +28,12 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.io.BufferedReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-
import javax.servlet.http.HttpServletRequest;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -49,12 +48,11 @@ import org.onap.policy.rest.jpa.UserInfo;
import org.springframework.mock.web.MockHttpServletResponse;
/**
- * The class <code>MicroServiceDictionaryControllerTest</code> contains tests
- * for the class {@link <code>MicroServiceDictionaryController</code>}*
+ * The class <code>MicroServiceDictionaryControllerTest</code> contains tests for the class
+ * {@link <code>MicroServiceDictionaryController</code>}*
*
- * All JUnits are designed to run in the local development environment
- * where they have write privileges and can execute time-sensitive
- * tasks.
+ * All JUnits are designed to run in the local development environment where they have write
+ * privileges and can execute time-sensitive tasks.
*/
public class MicroServiceDictionaryControllerTest {
@@ -64,7 +62,7 @@ public class MicroServiceDictionaryControllerTest {
private String jsonString = null;
private HttpServletRequest request = null;
private MicroServiceDictionaryController controller = null;
- BufferedReader br = null;
+ BufferedReader br = null;
@Before
public void setUp() throws Exception {
@@ -73,64 +71,71 @@ public class MicroServiceDictionaryControllerTest {
UserInfo userInfo = new UserInfo();
userInfo.setUserLoginId("testUserId");
userInfo.setUserName("John");
- when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing")).thenReturn(userInfo);
-
- List<String> listIds = new ArrayList<String>();
+ when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing"))
+ .thenReturn(userInfo);
+
+ List<String> listIds = new ArrayList<String>();
listIds.add("Jack");
when(commonClassDao.getDataByColumn(DCAEuuid.class, "name")).thenReturn(listIds);
-
- List<String> microList = new ArrayList<String>();
+
+ List<String> microList = new ArrayList<String>();
microList.add("MC-Model");
- when(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name")).thenReturn(microList);
-
- List<Object> listId = new ArrayList<Object>();
+ when(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name"))
+ .thenReturn(microList);
+
+ List<Object> listId = new ArrayList<Object>();
listId.add("smith");
when(commonClassDao.getData(DCAEuuid.class)).thenReturn(listId);
MicroServiceModels microServiceModels = new MicroServiceModels();
-
+
doNothing().when(commonClassDao).delete(microServiceModels);
MicroServiceDictionaryController.setCommonClassDao(commonClassDao);
controller = new MicroServiceDictionaryController();
-
+
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-
- jsonString = "{\"microServiceModelsDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
-
+
+ jsonString =
+ "{\"microServiceModelsDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+ + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+ + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+
br = new BufferedReader(new StringReader(jsonString));
- //--- mock the getReader() call
- when(request.getReader()).thenReturn(br);
+ // --- mock the getReader() call
+ when(request.getReader()).thenReturn(br);
new DictionaryUtils(commonClassDao);
DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
- mock(DictionaryUtils.class);
+ mock(DictionaryUtils.class);
logger.info("setUp: exit");
}
-
@Test
public void testSaveMicroServiceHeaderDefaultValues() {
logger.info("testSaveMicroServiceHeaderDefaultValues: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"modelAttributeDictionaryData\": {\"onapName\": \"test\", \"guard\": false,\"priority\": \"3\","
- + " \"riskType\": \"test\", \"riskLevel\": \"7\", \"modelName\": \"testname\"}}";
+ jsonString =
+ "{\"modelAttributeDictionaryData\": {\"onapName\": \"test\",\"guard\": false,\"priority\": \"3\","
+ + " \"riskType\": \"test\", \"riskLevel\": \"7\", \"modelName\": \"testname\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveMicroServiceHeaderDefaultValues(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -144,12 +149,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceHeaderDefaultsEntityDataByName() {
logger.info("testGetMicroServiceHeaderDefaultsEntityDataByName: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceHeaderDefaultsEntityDataByName(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -162,12 +168,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceHeaderDefaultsEntityData() {
logger.info("testGetMicroServiceHeaderDefaultsEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceHeaderDefaultsEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -180,24 +187,29 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveMicroServiceHeaderDefaults() {
logger.info("testRemoveMicroServiceHeaderDefaults: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceHeaderDefaults(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -212,12 +224,13 @@ public class MicroServiceDictionaryControllerTest {
logger.info("testGetDCAEUUIDDictionaryByNameEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getDCAEUUIDDictionaryByNameEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -231,12 +244,13 @@ public class MicroServiceDictionaryControllerTest {
logger.info("testGetDCAEUUIDDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getDCAEUUIDDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -249,29 +263,33 @@ public class MicroServiceDictionaryControllerTest {
public void testSaveDCAEUUIDDictionary() {
logger.info("testSaveDCAEUUIDDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"dcaeUUIDDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"dcaeUUIDDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+ + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+ + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
+ + " \"version\": \"\",\"createdBy\": \"someone\",\"modifiedBy\": \"someone\","
+ + "\"content\": \"\",\"recursive\": false},\"tempModel\": "
+ + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveDCAEUUIDDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testSaveDCAEUUIDDictionary: exit");
}
@@ -279,29 +297,32 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveDCAEUUIDDictionary() {
logger.info("testRemoveDCAEUUIDDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceConfigNameDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceConfigNameDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testRemoveDCAEUUIDDictionary: exit");
}
@@ -309,12 +330,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceConfigNameByNameDictionaryEntityData() {
logger.info("testGetMicroServiceConfigNameByNameDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceConfigNameByNameDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceConfigNameDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -327,12 +349,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceConfigNameDictionaryEntityData() {
logger.info("testGetMicroServiceConfigNameByNameDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceConfigNameDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceConfigNameDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -345,29 +368,33 @@ public class MicroServiceDictionaryControllerTest {
public void testSaveMicroServiceConfigNameDictionary() {
logger.info("testSaveMicroServiceConfigNameDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"microServiceConfigNameDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"microServiceConfigNameDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+ + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+ + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\","
+ + "\"subScopename\": \"\"},\"policy\": "
+ + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveMicroServiceConfigNameDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceConfigNameDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testSaveMicroServiceConfigNameDictionary: exit");
}
@@ -375,29 +402,32 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveMicroServiceConfigNameDictionary() {
logger.info("testRemoveMicroServiceConfigNameDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceConfigNameDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceConfigNameDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testRemoveMicroServiceConfigNameDictionary: exit");
}
@@ -406,12 +436,13 @@ public class MicroServiceDictionaryControllerTest {
logger.info("testGetMicroServiceLocationByNameDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceLocationByNameDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceLocationDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -424,12 +455,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceLocationDictionaryEntityData() {
logger.info("testGetMicroServiceLocationDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceLocationDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceLocationDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -442,24 +474,30 @@ public class MicroServiceDictionaryControllerTest {
public void testSaveMicroServiceLocationDictionary() {
logger.info("testSaveMicroServiceLocationDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"microServiceLocationDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"microServiceLocationDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+ + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+ + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\","
+ + "\"version\": \"\",\"createdBy\": \"someone\",\"modifiedBy\": \"someone\","
+ + "\"content\": \"\",\"recursive\": false},\"tempModel\": "
+ + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveMicroServiceLocationDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceLocationDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -472,30 +510,32 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveMicroServiceLocationDictionary() {
logger.info("testRemoveMicroServiceLocationDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},\"policy\": "
+ + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceLocationDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceLocationDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testRemoveMicroServiceLocationDictionary: exit");
}
@@ -503,12 +543,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceAttributeByNameDictionaryEntityData() {
logger.info("testGetMicroServiceAttributeByNameDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceAttributeByNameDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceAttributeDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -521,12 +562,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceAttributeDictionaryEntityData() {
logger.info("testGetMicroServiceAttributeDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceAttributeDictionaryEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceAttributeDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -539,29 +581,33 @@ public class MicroServiceDictionaryControllerTest {
public void testSaveMicroServiceAttributeDictionary() {
logger.info("testSaveMicroServiceAttributeDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"modelAttributeDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"modelAttributeDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+ + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+ + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},\"tempModel\": "
+ + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.saveMicroServiceAttributeDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceAttributeDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testSaveMicroServiceAttributeDictionary: exit");
}
@@ -569,24 +615,29 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveMicroServiceAttributeDictionary() {
logger.info("testRemoveMicroServiceAttributeDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},\"tempModel\": "
+ + "{\"name\": \"testingdata\",\"subScopename\": \"\"},\"policy\": "
+ + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceAttributeDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceAttributeDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -599,12 +650,13 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceModelsDictionaryByNameEntityData() {
logger.info("testGetMicroServiceModelsDictionaryByNameEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
controller.getMicroServiceModelsDictionaryByNameEntityData(response);
try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
logger.info("response.getContentAsString(): " + response.getContentAsString());
} catch (UnsupportedEncodingException e) {
fail("Exception: " + e);
@@ -617,7 +669,7 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceModelsDictionaryByVersionEntityData() {
logger.info("testGetMicroServiceModelsDictionaryByVersionEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -628,7 +680,8 @@ public class MicroServiceDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.getMicroServiceModelsDictionaryByVersionEntityData(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("No model name given"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("No model name given"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -641,7 +694,7 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceModelsDictionaryEntityData() {
logger.info("testGetMicroServiceModelsDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -652,7 +705,8 @@ public class MicroServiceDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.getMicroServiceModelsDictionaryEntityData(response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -665,7 +719,7 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceModelsDictionaryEntityDataServiceVersion() {
logger.info("testGetMicroServiceModelsDictionaryEntityDataServiceVersion: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -676,7 +730,8 @@ public class MicroServiceDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.getMicroServiceModelsDictionaryEntityDataServiceVersion(response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -689,7 +744,7 @@ public class MicroServiceDictionaryControllerTest {
public void testGetMicroServiceModelsDictionaryClassEntityData() {
logger.info("testGetMicroServiceModelsDictionaryClassEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -700,7 +755,8 @@ public class MicroServiceDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.getMicroServiceModelsDictionaryClassEntityData(response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryClassDatas"));
+ assertTrue(response.getContentAsString() != null && response.getContentAsString()
+ .contains("microServiceModelsDictionaryClassDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -713,7 +769,7 @@ public class MicroServiceDictionaryControllerTest {
public void testSaveMicroServiceModelsDictionary() {
logger.info("testSaveMicroServiceModelsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
@@ -721,7 +777,8 @@ public class MicroServiceDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.saveMicroServiceModelsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -734,31 +791,33 @@ public class MicroServiceDictionaryControllerTest {
public void testRemoveMicroServiceModelsDictionary() {
logger.info("testRemoveMicroServiceModelsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeMicroServiceModelsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
-
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testRemoveMicroServiceModelsDictionary: exit");
}
-
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
index dd355d948..5e0b7ce28 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -24,15 +26,12 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.io.BufferedReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-
import javax.servlet.http.HttpServletRequest;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -55,7 +54,7 @@ public class OptimizationDictionaryControllerTest {
private String jsonString = null;
private HttpServletRequest request = null;
private OptimizationDictionaryController controller = null;
- BufferedReader br = null;
+ BufferedReader br = null;
@Before
public void setUp() throws Exception {
@@ -64,33 +63,39 @@ public class OptimizationDictionaryControllerTest {
UserInfo userInfo = new UserInfo();
userInfo.setUserLoginId("testUserId");
userInfo.setUserName("John");
- when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing")).thenReturn(userInfo);
-
+ when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing"))
+ .thenReturn(userInfo);
+
OptimizationModels optimziationModels = new OptimizationModels();
-
+
doNothing().when(commonClassDao).delete(optimziationModels);
- OptimizationDictionaryController.setCommonClassDao(commonClassDao);
+ OptimizationDictionaryController.setCommonClassDao(commonClassDao);
controller = new OptimizationDictionaryController();
-
+
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-
- jsonString = "{\"optimizationModelsDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
-
+
+ jsonString =
+ "{\"optimizationModelsDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,\"model\":"
+ + " {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
+ + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", \"version\": \"\","
+ + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+ + "\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+
br = new BufferedReader(new StringReader(jsonString));
- //--- mock the getReader() call
- when(request.getReader()).thenReturn(br);
+ // --- mock the getReader() call
+ when(request.getReader()).thenReturn(br);
new DictionaryUtils(commonClassDao);
DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
- mock(DictionaryUtils.class);
+ mock(DictionaryUtils.class);
logger.info("setUp: exit");
}
@@ -98,7 +103,7 @@ public class OptimizationDictionaryControllerTest {
public void testGetOptimizationModelsDictionaryEntityData() {
logger.info("testGetOptimizationModelsDictionaryEntityData: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
String modelJson = "{\"optimizationModelsDictionaryData\":[\"modelName\"]}";
BufferedReader br = new BufferedReader(new StringReader(modelJson));
@@ -109,7 +114,8 @@ public class OptimizationDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.getOptimizationModelsDictionaryEntityData(response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -122,7 +128,7 @@ public class OptimizationDictionaryControllerTest {
public void testSaveOptimizationModelsDictionary() {
logger.info("testSaveOptimizationModelsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
@@ -130,7 +136,8 @@ public class OptimizationDictionaryControllerTest {
when(request.getReader()).thenReturn(br);
controller.saveOptimizationModelsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
@@ -143,31 +150,34 @@ public class OptimizationDictionaryControllerTest {
public void testRemoveOptimizationModelsDictionary() {
logger.info("testRemoveOptimizationModelsDictionary: Entering");
- MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletResponse response = new MockHttpServletResponse();
request = mock(HttpServletRequest.class);
try {
// mock the getReader() call
- jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
- + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
- + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
- + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
- + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
- + " \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
- + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
- + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+ jsonString =
+ "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\","
+ + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+ + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+ + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+ + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+ + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+ + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+ + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+ + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+ + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+ + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
BufferedReader br = new BufferedReader(new StringReader(jsonString));
when(request.getReader()).thenReturn(br);
controller.removeOptimizationModelsDictionary(request, response);
logger.info("response.getContentAsString(): " + response.getContentAsString());
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
} catch (Exception e) {
fail("Exception: " + e);
}
-
logger.info("testRemoveOptimizationModelsDictionary: exit");
}
-
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java
index 6b58184fe..ca6860ae8 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -24,21 +26,21 @@ import static org.junit.Assert.assertNull;
import org.junit.Test;
public class DictionaryHandlerTest {
- @Test
- public void negTestHandler() {
- // Set the system property temporarily
- String systemKey = "dictionary.impl.className";
- String oldProperty = System.getProperty(systemKey);
- System.setProperty(systemKey, "foobar");
+ @Test
+ public void negTestHandler() {
+ // Set the system property temporarily
+ String systemKey = "dictionary.impl.className";
+ String oldProperty = System.getProperty(systemKey);
+ System.setProperty(systemKey, "foobar");
- // Run negative test on instance
- assertNull(DictionaryHandler.getInstance());
+ // Run negative test on instance
+ assertNull(DictionaryHandler.getInstance());
- // Restore the original system property
- if (oldProperty != null) {
- System.setProperty(systemKey, oldProperty);
- } else {
- System.clearProperty(systemKey);
+ // Restore the original system property
+ if (oldProperty != null) {
+ System.setProperty(systemKey, oldProperty);
+ } else {
+ System.clearProperty(systemKey);
+ }
}
- }
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java
index 9b45c3b53..81b5927c1 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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
@@ -29,19 +31,19 @@ import org.junit.Test;
import org.mockito.Mockito;
public class JPAUtilsTest {
- @Test(expected = IllegalAccessException.class)
- public void testJPAUtils() throws IllegalAccessException {
- // Setup test data
- EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
- EntityManager em = Mockito.mock(EntityManager.class);
- Query query = Mockito.mock(Query.class);
- Mockito.when(emf.createEntityManager()).thenReturn(em);
- Mockito.when(em.createNamedQuery(Mockito.any())).thenReturn(query);
+ @Test(expected = IllegalAccessException.class)
+ public void testJPAUtils() throws IllegalAccessException {
+ // Setup test data
+ EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
+ EntityManager em = Mockito.mock(EntityManager.class);
+ Query query = Mockito.mock(Query.class);
+ Mockito.when(emf.createEntityManager()).thenReturn(em);
+ Mockito.when(em.createNamedQuery(Mockito.any())).thenReturn(query);
- // Test lockdown
- JPAUtils utils = JPAUtils.getJPAUtilsInstance(emf);
- assertEquals(utils.dbLockdownIgnoreErrors(), false);
- utils.dbLockdown();
- fail("Expecting an exception");
- }
+ // Test lockdown
+ JPAUtils utils = JPAUtils.getJPAUtilsInstance(emf);
+ assertEquals(utils.dbLockdownIgnoreErrors(), false);
+ utils.dbLockdown();
+ fail("Expecting an exception");
+ }
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java
index 4e5535c13..e3a575456 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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
@@ -24,28 +26,28 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class JsonMessageTest {
- @Test
- public void testSetAndGet() {
- String data = "testData";
- String data2 = "testData2";
- String data3 = "testData3";
+ @Test
+ public void testSetAndGet() {
+ String data = "testData";
+ String data2 = "testData2";
+ String data3 = "testData3";
- // Test constructors
- JsonMessage msg = new JsonMessage(data);
- assertEquals(msg.getData(), data);
+ // Test constructors
+ JsonMessage msg = new JsonMessage(data);
+ assertEquals(msg.getData(), data);
- JsonMessage msg2 = new JsonMessage(data, data2);
- assertEquals(msg2.getData2(), data2);
+ JsonMessage msg2 = new JsonMessage(data, data2);
+ assertEquals(msg2.getData2(), data2);
- JsonMessage msg3 = new JsonMessage(data, data2, data3);
- assertEquals(msg3.getData3(), data3);
+ JsonMessage msg3 = new JsonMessage(data, data2, data3);
+ assertEquals(msg3.getData3(), data3);
- // Test set and get
- msg.setData(data);
- msg.setData2(data2);
- msg.setData3(data3);
- assertEquals(msg.getData(), data);
- assertEquals(msg.getData2(), data2);
- assertEquals(msg.getData3(), data3);
- }
+ // Test set and get
+ msg.setData(data);
+ msg.setData2(data2);
+ msg.setData3(data3);
+ assertEquals(msg.getData(), data);
+ assertEquals(msg.getData2(), data2);
+ assertEquals(msg.getData3(), data3);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
index 133d4a860..fb11e246c 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
@@ -1,15 +1,17 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP Policy Engine
+ * ONAP Portal SDK
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -36,37 +38,36 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
public class ExternalAppConfigTest {
- @Test
- public void testConfig() throws MalformedURLException {
- // Setup test data
- ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
- UrlResource value = new UrlResource("http://localhost");
- Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
- ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
- InterceptorRegistry interceptor = new InterceptorRegistry();
- RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
- Registerable reg = Mockito.mock(Registerable.class);
- Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
- schedulerRegistryAdapter.setRegistry(reg);
- WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
- schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
- Mockito.when(workflowScheduleService.triggerWorkflowScheduling())
- .thenReturn(Collections.emptyList());
+ @Test
+ public void testConfig() throws MalformedURLException {
+ // Setup test data
+ ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
+ UrlResource value = new UrlResource("http://localhost");
+ Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
+ ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
+ InterceptorRegistry interceptor = new InterceptorRegistry();
+ RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
+ Registerable reg = Mockito.mock(Registerable.class);
+ Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
+ schedulerRegistryAdapter.setRegistry(reg);
+ WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
+ schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
+ Mockito.when(workflowScheduleService.triggerWorkflowScheduling()).thenReturn(Collections.emptyList());
- // Test constructor
- ExternalAppConfig config = new ExternalAppConfig();
- assertNotNull(config);
+ // Test constructor
+ ExternalAppConfig config = new ExternalAppConfig();
+ assertNotNull(config);
- // Test set and get
- config.setApplicationContext(ctx);
- assertNotNull(config.viewResolver());
- config.addResourceHandlers(registry);
- assertNotNull(config.dataAccessService());
- assertNotNull(config.addTileDefinitions());
- config.addInterceptors(interceptor);
- assertNotNull(config.cacheManager());
- config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
- assertNull(config.schedulerFactoryBean());
- assertNotNull(config.loginStrategy());
- }
+ // Test set and get
+ config.setApplicationContext(ctx);
+ assertNotNull(config.viewResolver());
+ config.addResourceHandlers(registry);
+ assertNotNull(config.dataAccessService());
+ assertNotNull(config.addTileDefinitions());
+ config.addInterceptors(interceptor);
+ assertNotNull(config.cacheManager());
+ config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
+ assertNull(config.schedulerFactoryBean());
+ assertNotNull(config.loginStrategy());
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
index 81bf7e95a..7a2ab1654 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,26 +22,25 @@
package org.onap.portalapp.conf;
import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
public class ExternalAppInitializerTest {
- @Test
- public void testExternalAppInitializer(){
- ExternalAppInitializer initializer = new ExternalAppInitializer();
- assertTrue(initializer.getRootConfigClasses()!=null);
- assertTrue(initializer.getServletConfigClasses()!=null);
- assertTrue(initializer.getServletMappings()!=null);
- }
-
- @Test
- public void testExternalAppConfig(){
- ExternalAppConfig appConfig = new ExternalAppConfig();
- assertTrue(appConfig.dataAccessService()!=null);
- assertTrue(appConfig.addTileDefinitions()!=null);
- assertTrue(appConfig.cacheManager()!=null);
- assertTrue(appConfig.loginStrategy()!=null);
- assertTrue(appConfig.viewResolver()!=null);
- }
+ @Test
+ public void testExternalAppInitializer() {
+ ExternalAppInitializer initializer = new ExternalAppInitializer();
+ assertTrue(initializer.getRootConfigClasses() != null);
+ assertTrue(initializer.getServletConfigClasses() != null);
+ assertTrue(initializer.getServletMappings() != null);
+ }
+
+ @Test
+ public void testExternalAppConfig() {
+ ExternalAppConfig appConfig = new ExternalAppConfig();
+ assertTrue(appConfig.dataAccessService() != null);
+ assertTrue(appConfig.addTileDefinitions() != null);
+ assertTrue(appConfig.cacheManager() != null);
+ assertTrue(appConfig.loginStrategy() != null);
+ assertTrue(appConfig.viewResolver() != null);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
index 6762e4aee..25d878e8c 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,15 +22,14 @@
package org.onap.portalapp.conf;
import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
public class HibernateMappingLocationsTest {
- @Test
- public void testHibernateMappingLocations(){
- HibernateMappingLocations locations = new HibernateMappingLocations();
- assertTrue(locations.getMappingLocations()!=null);
- assertTrue(locations.getPackagesToScan()!=null);
- }
+ @Test
+ public void testHibernateMappingLocations() {
+ HibernateMappingLocations locations = new HibernateMappingLocations();
+ assertTrue(locations.getMappingLocations() != null);
+ assertTrue(locations.getPackagesToScan() != null);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
index 210b1d94f..65fe12376 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -32,21 +34,21 @@ import com.mockrunner.mock.web.MockHttpServletRequest;
import com.mockrunner.mock.web.MockHttpServletResponse;
public class SecurityXssFilterTest {
- @Test
- public void testGets() throws ServletException, IOException {
- SecurityXssFilter filter = new SecurityXssFilter();
- assertNotNull(filter);
-
- MockHttpServletRequest request = new MockHttpServletRequest();
- request.setMethod("POST");
- request.setBodyContent("testBody");
- request.setupAddParameter("testKey", "testVal");
- request.setAttribute("testKey", "testVal");
- request.setRequestURI("testVal");
- request.setRequestURL("testVal");
- MockHttpServletResponse response = new MockHttpServletResponse();
- FilterChain filterChain = Mockito.mock(FilterChain.class);
- filter.doFilterInternal(request, response, filterChain);
- assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
- }
+ @Test
+ public void testGets() throws ServletException, IOException {
+ SecurityXssFilter filter = new SecurityXssFilter();
+ assertNotNull(filter);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setMethod("POST");
+ request.setBodyContent("testBody");
+ request.setupAddParameter("testKey", "testVal");
+ request.setAttribute("testKey", "testVal");
+ request.setRequestURI("testVal");
+ request.setRequestURL("testVal");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ FilterChain filterChain = Mockito.mock(FilterChain.class);
+ filter.doFilterInternal(request, response, filterChain);
+ assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
index 25b677988..ac13bdc13 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -27,13 +29,13 @@ import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.springframework.mock.web.MockHttpServletRequest;
public class LoginStrategyImplTest {
- @Test
- public void testLoginStrategyImpl() throws PortalAPIException {
- LoginStrategyImpl impl = new LoginStrategyImpl();
- MockHttpServletRequest request = new MockHttpServletRequest();
- Cookie cookie1 = new Cookie("EPService", "serviceName");
- Cookie cookie2 = new Cookie("UserId", "userName");
- request.setCookies(cookie1, cookie2);
- assertNull(impl.getUserId(request));
- }
+ @Test
+ public void testLoginStrategyImpl() throws PortalAPIException {
+ LoginStrategyImpl impl = new LoginStrategyImpl();
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ Cookie cookie1 = new Cookie("EPService", "serviceName");
+ Cookie cookie2 = new Cookie("UserId", "userName");
+ request.setCookies(cookie1, cookie2);
+ assertNull(impl.getUserId(request));
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
index 0f406b163..675a87e43 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,10 +24,8 @@ package org.onap.portalapp.scheduler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
index b49ad6a6d..a7386aa8a 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -30,39 +32,39 @@ import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
public class RegistryAdapterTest {
- @Rule
- public final ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public final ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void testRegistryAdapter() {
+ RegistryAdapter adapter = new RegistryAdapter();
+ SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
+ Registerable registry = null;
+ WorkflowScheduleService workflowScheduleService = null;
+
+ adapter.setSchedulerBean(schedulerBean);
+ assertEquals(adapter.getSchedulerBean(), schedulerBean);
+ adapter.setRegistry(registry);
+ assertEquals(adapter.getRegistry(), registry);
+ adapter.setWorkflowScheduleService(workflowScheduleService);
+ assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
+ }
- @Test
- public void testRegistryAdapter() {
- RegistryAdapter adapter = new RegistryAdapter();
- SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
- Registerable registry = null;
- WorkflowScheduleService workflowScheduleService = null;
+ @Test
+ public void testRegistryAdapterNegCase1() {
+ thrown.expect(NullPointerException.class);
- adapter.setSchedulerBean(schedulerBean);
- assertEquals(adapter.getSchedulerBean(), schedulerBean);
- adapter.setRegistry(registry);
- assertEquals(adapter.getRegistry(), registry);
- adapter.setWorkflowScheduleService(workflowScheduleService);
- assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
- }
-
- @Test
- public void testRegistryAdapterNegCase1() {
- thrown.expect(NullPointerException.class);
+ RegistryAdapter adapter = new RegistryAdapter();
+ adapter.getTriggers();
+ fail("Expecting an exception.");
+ }
- RegistryAdapter adapter = new RegistryAdapter();
- adapter.getTriggers();
- fail("Expecting an exception.");
- }
-
- @Test
- public void testRegistryAdapterNegCase2() {
- thrown.expect(NullPointerException.class);
+ @Test
+ public void testRegistryAdapterNegCase2() {
+ thrown.expect(NullPointerException.class);
- RegistryAdapter adapter = new RegistryAdapter();
- adapter.addCoreTriggers();
- fail("Expecting an exception.");
- }
+ RegistryAdapter adapter = new RegistryAdapter();
+ adapter.addCoreTriggers();
+ fail("Expecting an exception.");
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
index 30a38d4ba..116f705bc 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,10 +22,8 @@
package org.onap.portalapp.service;
import static org.junit.Assert.*;
-
import java.util.SortedSet;
import java.util.TreeSet;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -33,54 +33,54 @@ import org.onap.portalsdk.core.domain.User;
public class AdminAuthExtensionTest {
- private CommonClassDao commonClassDao;
- private AdminAuthExtension extension;
- private User user;
+ private CommonClassDao commonClassDao;
+ private AdminAuthExtension extension;
+ private User user;
- @Before
- public void setUp(){
- extension = new AdminAuthExtension();
- commonClassDao = Mockito.mock(CommonClassDao.class);
- Mockito.doNothing().when(commonClassDao).updateQuery("");
- Mockito.doNothing().when(commonClassDao).save(new Object());
- extension.setCommonClassDao(commonClassDao);
- user = new User();
- user.setFirstName("Test");
- user.setLoginId("Test");
- }
+ @Before
+ public void setUp() {
+ extension = new AdminAuthExtension();
+ commonClassDao = Mockito.mock(CommonClassDao.class);
+ Mockito.doNothing().when(commonClassDao).updateQuery("");
+ Mockito.doNothing().when(commonClassDao).save(new Object());
+ extension.setCommonClassDao(commonClassDao);
+ user = new User();
+ user.setFirstName("Test");
+ user.setLoginId("Test");
+ }
- @Test
- public void testAdminAuthExtension(){
- try{
- callSaveUserFunction("Policy Super Admin");
- callSaveUserFunction("Policy Super Editor");
- callSaveUserFunction("Policy Super Guest");
- callSaveUserFunction("Policy Admin");
- callSaveUserFunction("Policy Editor");
- callSaveUserFunction("Policy Guest");
- extension.editUserExtension(user);
- extension.saveUserRoleExtension(null, user);
- }catch(Exception e){
- fail("Not Expecting any exception.");
- }
- }
+ @Test
+ public void testAdminAuthExtension() {
+ try {
+ callSaveUserFunction("Policy Super Admin");
+ callSaveUserFunction("Policy Super Editor");
+ callSaveUserFunction("Policy Super Guest");
+ callSaveUserFunction("Policy Admin");
+ callSaveUserFunction("Policy Editor");
+ callSaveUserFunction("Policy Guest");
+ extension.editUserExtension(user);
+ extension.saveUserRoleExtension(null, user);
+ } catch (Exception e) {
+ fail("Not Expecting any exception.");
+ }
+ }
- @Test
- public void expectException(){
- try{
- extension.saveUserExtension(null);
- }catch(Exception e){
- assertEquals(NullPointerException.class, e.getClass());
- }
- }
+ @Test
+ public void expectException() {
+ try {
+ extension.saveUserExtension(null);
+ } catch (Exception e) {
+ assertEquals(NullPointerException.class, e.getClass());
+ }
+ }
- public void callSaveUserFunction(String roleName){
- SortedSet<Role> roles = new TreeSet<>();
- Role role = new Role();
- role.setName(roleName);
- roles.add(role);
- user.setRoles(roles);
- extension.saveUserExtension(user);
- }
+ public void callSaveUserFunction(String roleName) {
+ SortedSet<Role> roles = new TreeSet<>();
+ Role role = new Role();
+ role.setName(roleName);
+ roles.add(role);
+ user.setRoles(roles);
+ extension.saveUserExtension(user);
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java
index 221481723..0166a128a 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -28,11 +30,13 @@ import org.junit.Test;
import org.onap.policy.xacml.api.XACMLErrorConstants;
public class XACMLErrorConstantsTest {
- @Test
- public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
- Constructor<XACMLErrorConstants> constructor = XACMLErrorConstants.class.getDeclaredConstructor();
- assertTrue(Modifier.isPrivate(constructor.getModifiers()));
- constructor.setAccessible(true);
- constructor.newInstance();
- }
+ @Test
+ public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException, InstantiationException {
+ Constructor<XACMLErrorConstants> constructor =
+ XACMLErrorConstants.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
index 2e0a0de17..6ab9790c1 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,58 +23,55 @@ package org.onap.policy.xacml.test.std.pap;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import java.io.IOException;
import java.util.Properties;
-
import org.junit.Test;
import org.onap.policy.xacml.std.pap.StdEngineFactory;
-
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.std.pap.StdEngine;
import com.att.research.xacml.util.FactoryException;
public class StdEngineFactoryTest {
- @Test
- public void testStdEngineFactory() throws FactoryException, PAPException, IOException {
- StdEngineFactory stdFactory = new StdEngineFactory();
- System.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
- assertTrue(stdFactory.newEngine() != null);
- Properties properties = new Properties();
- properties.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
- assertTrue(stdFactory.newEngine(properties) != null);
+ @Test
+ public void testStdEngineFactory() throws FactoryException, PAPException, IOException {
+ StdEngineFactory stdFactory = new StdEngineFactory();
+ System.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
+ assertTrue(stdFactory.newEngine() != null);
+ Properties properties = new Properties();
+ properties.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
+ assertTrue(stdFactory.newEngine(properties) != null);
- StdEngineFactory stdFactoryNew = new StdEngineFactory();
- System.setProperty("xacml.pap.pdps", "src/test/resources/pdpstest");
- assertTrue(stdFactoryNew.newEngine() != null);
- }
+ StdEngineFactory stdFactoryNew = new StdEngineFactory();
+ System.setProperty("xacml.pap.pdps", "src/test/resources/pdpstest");
+ assertTrue(stdFactoryNew.newEngine() != null);
+ }
- @Test
- public void testNegativeCase() throws Exception {
- // Setup test data
- Properties props = new Properties();
- String tmpdir = System.getProperty("java.io.tmpdir");
- props.setProperty(StdEngine.PROP_PAP_REPO, tmpdir);
+ @Test
+ public void testNegativeCase() throws Exception {
+ // Setup test data
+ Properties props = new Properties();
+ String tmpdir = System.getProperty("java.io.tmpdir");
+ props.setProperty(StdEngine.PROP_PAP_REPO, tmpdir);
- // Set the system property temporarily
- String systemKey = StdEngine.PROP_PAP_REPO;
- String oldProperty = System.getProperty(systemKey);
- System.setProperty(systemKey, tmpdir);
+ // Set the system property temporarily
+ String systemKey = StdEngine.PROP_PAP_REPO;
+ String oldProperty = System.getProperty(systemKey);
+ System.setProperty(systemKey, tmpdir);
- // Test factory failure cases
- try {
- StdEngineFactory factory = new StdEngineFactory();
- factory.newEngine();
- factory.newEngine(props);
- } catch (Exception ex) {
- fail("Not expecting any exceptions: " + ex);
- }
+ // Test factory failure cases
+ try {
+ StdEngineFactory factory = new StdEngineFactory();
+ factory.newEngine();
+ factory.newEngine(props);
+ } catch (Exception ex) {
+ fail("Not expecting any exceptions: " + ex);
+ }
- // Restore the original system property
- if (oldProperty != null) {
- System.setProperty(systemKey, oldProperty);
- } else {
- System.clearProperty(systemKey);
+ // Restore the original system property
+ if (oldProperty != null) {
+ System.setProperty(systemKey, oldProperty);
+ } else {
+ System.clearProperty(systemKey);
+ }
}
- }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
index f0ee8dd73..79b43b130 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -52,16 +54,20 @@ public class StdEngineTest {
private Path repository;
Properties properties = new Properties();
StdEngine stdEngine = null;
-
+
@Rule
public ExpectedException expectedException = ExpectedException.none();
-
+
@BeforeClass
- public static void setUpClass() throws IOException{
+ public static void setUpClass() throws IOException {
new File("target/test/resources/pdps").mkdirs();
new File("target/test/resources/emptyPapGroupsDefault").mkdirs();
- Files.copy(Paths.get("src/test/resources/pdps/xacml.properties"), Paths.get("target/test/resources/pdps/xacml.properties"), StandardCopyOption.REPLACE_EXISTING);
- Files.copy(Paths.get("src/test/resources/emptyPapGroupsDefault/xacml.properties"), Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties"), StandardCopyOption.REPLACE_EXISTING);
+ Files.copy(Paths.get("src/test/resources/pdps/xacml.properties"),
+ Paths.get("target/test/resources/pdps/xacml.properties"),
+ StandardCopyOption.REPLACE_EXISTING);
+ Files.copy(Paths.get("src/test/resources/emptyPapGroupsDefault/xacml.properties"),
+ Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties"),
+ StandardCopyOption.REPLACE_EXISTING);
}
@Before
@@ -100,47 +106,53 @@ public class StdEngineTest {
public void testNoRepository() throws PAPException, IOException {
expectedException.expect(PAPException.class);
expectedException.expectMessage("No repository specified.");
- new StdEngine((Path)null);
+ new StdEngine((Path) null);
}
-
+
@Test
public void testRepositoryDoesNotExist() throws PAPException, IOException {
repository = Paths.get("target/test/resources/nonExisting");
new StdEngine(repository);
-
- assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/default/xacml.pip.properties")));
- assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/default/xacml.policy.properties")));
+
+ assertTrue(Files.exists(
+ Paths.get("target/test/resources/nonExisting/default/xacml.pip.properties")));
+ assertTrue(Files.exists(
+ Paths.get("target/test/resources/nonExisting/default/xacml.policy.properties")));
assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/xacml.properties")));
FileUtils.deleteDirectory(repository.toFile());
}
-
+
@Test
public void testEmptyPapGroupsDefault() throws PAPException, IOException {
System.setProperty("xacml.pap.groups.default", "");
repository = Paths.get("target/test/resources/emptyPapGroupsDefault");
new StdEngine(repository);
-
- assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/default/xacml.pip.properties")));
- assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/default/xacml.policy.properties")));
- assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties")));
+
+ assertTrue(Files.exists(Paths
+ .get("target/test/resources/emptyPapGroupsDefault/default/xacml.pip.properties")));
+ assertTrue(Files.exists(Paths.get(
+ "target/test/resources/emptyPapGroupsDefault/default/xacml.policy.properties")));
+ assertTrue(Files
+ .exists(Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties")));
}
-
+
@Test
- public void testNewGroupAndRemoveGroup() throws NullPointerException, PAPException, IOException {
+ public void testNewGroupAndRemoveGroup()
+ throws NullPointerException, PAPException, IOException {
OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
assertNotNull(newGroup);
stdEngine.removeGroup(stdEngine.getGroup("newGroup"), null);
assertNull(stdEngine.getGroup("newGroup"));
}
-
+
@Test
public void testRemoveGroupNull() throws NullPointerException, PAPException, IOException {
expectedException.expect(NullPointerException.class);
stdEngine.removeGroup(null, null);
assertNull(stdEngine.getGroup("newGroup"));
}
-
+
@Test
public void testRemoveGroupUnknown() throws NullPointerException, PAPException, IOException {
OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
@@ -149,7 +161,7 @@ public class StdEngineTest {
expectedException.expectMessage("The group 'unknownId' does not exist");
stdEngine.removeGroup(unknownGroup, null);
}
-
+
@Test
public void testRemoveGroupDefault() throws NullPointerException, PAPException, IOException {
OnapPDPGroup defaultGroup = stdEngine.getDefaultGroup();
@@ -158,141 +170,145 @@ public class StdEngineTest {
expectedException.expectMessage("You cannot delete the default group.");
stdEngine.removeGroup(defaultGroup, null);
}
-
+
@Test
public void testSetDefaultGroup() throws NullPointerException, PAPException, IOException {
OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
assertNotNull(newGroup);
-
+
OnapPDPGroup defaultGroup = stdEngine.getDefaultGroup();
assertEquals("default", defaultGroup.getName());
stdEngine.setDefaultGroup(newGroup);
assertEquals(newGroup, stdEngine.getDefaultGroup());
-
+
stdEngine.setDefaultGroup(defaultGroup);
stdEngine.removeGroup(stdEngine.getGroup("newGroup"), null);
}
-
+
@Test
- public void testPdps() throws NullPointerException, PAPException{
+ public void testPdps() throws NullPointerException, PAPException {
OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
assertEquals(0, group1.getPdps().size());
-
+
stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
assertEquals(1, group1.getPdps().size());
assertEquals("newPdp", group1.getPdps().iterator().next().getId());
assertEquals("newPdpName", group1.getPdps().iterator().next().getName());
assertEquals("A new pdp", group1.getPdps().iterator().next().getDescription());
-
+
OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
assertEquals(0, group2.getPdps().size());
-
+
stdEngine.movePDP(group1.getOnapPdps().iterator().next(), group2);
assertEquals(0, group1.getPdps().size());
assertEquals(1, group2.getPdps().size());
-
+
OnapPDP pdp = group2.getOnapPdps().iterator().next();
pdp.setName("AnUpdatedName");;
pdp.setDescription("An updated description");
stdEngine.updatePDP(pdp);
assertEquals("AnUpdatedName", group2.getPdps().iterator().next().getName());
assertEquals("An updated description", group2.getPdps().iterator().next().getDescription());
-
+
stdEngine.removePDP(group2.getOnapPdps().iterator().next());
assertEquals(0, group1.getPdps().size());
assertEquals(0, group2.getPdps().size());
}
-
+
@Test
- public void testNewPdpNullGroup() throws NullPointerException, PAPException{
+ public void testNewPdpNullGroup() throws NullPointerException, PAPException {
expectedException.expect(PAPException.class);
expectedException.expectMessage("You must specify which group the PDP will belong to.");
stdEngine.newPDP("newPdp", null, "newPdpName", "A new pdp", 1);
}
-
+
@Test
- public void testNewPdpUnknownGroup() throws NullPointerException, PAPException{
+ public void testNewPdpUnknownGroup() throws NullPointerException, PAPException {
OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
expectedException.expect(PAPException.class);
expectedException.expectMessage("Unknown group, not in our list.");
stdEngine.newPDP("newPdp", unknownGroup, "newPdpName", "A new pdp", 1);
}
-
+
@Test
- public void testNewPdpAlreadyExistingPdp() throws NullPointerException, PAPException{
+ public void testNewPdpAlreadyExistingPdp() throws NullPointerException, PAPException {
OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
assertEquals(0, group1.getPdps().size());
-
+
stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
assertEquals(1, group1.getPdps().size());
-
+
expectedException.expect(PAPException.class);
expectedException.expectMessage("A PDP with this ID exists.");
stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
}
-
+
@Test
- public void testRemoveGroupWithPdps() throws NullPointerException, PAPException{
+ public void testRemoveGroupWithPdps() throws NullPointerException, PAPException {
OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
-
+
stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
assertEquals(1, group1.getPdps().size());
-
+
OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
assertEquals(0, group2.getPdps().size());
-
+
stdEngine.removeGroup(group1, group2);
assertNull(stdEngine.getGroup("newGroup"));
assertEquals(1, group2.getPdps().size());
}
-
+
@Test
- public void testRemoveGroupWithPdpsNoTarget() throws NullPointerException, PAPException{
+ public void testRemoveGroupWithPdpsNoTarget() throws NullPointerException, PAPException {
OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
-
+
stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
assertEquals(1, group1.getPdps().size());
-
+
OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
assertEquals(0, group2.getPdps().size());
-
+
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("Group targeted for deletion has PDPs, you must provide a new group for them.");
+ expectedException.expectMessage(
+ "Group targeted for deletion has PDPs, you must provide a new group for them.");
stdEngine.removeGroup(group1, null);
}
-
+
@Test
public void testUpdateGroupName() throws NullPointerException, PAPException, IOException {
OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
-
+
OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup);
updatedGroup.setName("AnUpdatedName");
stdEngine.updateGroup(updatedGroup);
assertNull(stdEngine.getGroup("newGroup"));
assertNotNull(stdEngine.getGroup("AnUpdatedName"));
assertEquals("AnUpdatedName", stdEngine.getGroup("AnUpdatedName").getName());
- assertEquals("Description of new group", stdEngine.getGroup("AnUpdatedName").getDescription());
+ assertEquals("Description of new group",
+ stdEngine.getGroup("AnUpdatedName").getDescription());
}
-
+
@Test
- public void testUpdateGroupDescription() throws NullPointerException, PAPException, IOException {
+ public void testUpdateGroupDescription()
+ throws NullPointerException, PAPException, IOException {
OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
-
- OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup.getId(), newGroup.getName(), "An updated description", Paths.get("target/test/resources/pdps/newGroup"));
+
+ OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup.getId(), newGroup.getName(),
+ "An updated description", Paths.get("target/test/resources/pdps/newGroup"));
updatedGroup.setDescription("An updated description");
stdEngine.updateGroup(updatedGroup);
assertEquals("newGroup", stdEngine.getGroup("newGroup").getName());
assertEquals("An updated description", stdEngine.getGroup("newGroup").getDescription());
}
-
+
@Test
public void testUpdateGroupNull() throws NullPointerException, PAPException, IOException {
expectedException.expect(PAPException.class);
expectedException.expectMessage("Group or id is null");
stdEngine.updateGroup(null);
}
-
+
@Test
public void testUpdateGroupIdNull() throws NullPointerException, PAPException, IOException {
StdPDPGroup group = new StdPDPGroup(null, null);
@@ -300,7 +316,7 @@ public class StdEngineTest {
expectedException.expectMessage("Group or id is null");
stdEngine.updateGroup(group);
}
-
+
@Test
public void testUpdateGroupNameNull() throws NullPointerException, PAPException, IOException {
StdPDPGroup group = new StdPDPGroup("groupId", null);
@@ -308,15 +324,16 @@ public class StdEngineTest {
expectedException.expectMessage("New name for group cannot be null or blank");
stdEngine.updateGroup(group);
}
-
+
@Test
- public void testUpdateGroupNameEmptyString() throws NullPointerException, PAPException, IOException {
+ public void testUpdateGroupNameEmptyString()
+ throws NullPointerException, PAPException, IOException {
StdPDPGroup group = new StdPDPGroup("groupId", "", "description", null);
expectedException.expect(PAPException.class);
expectedException.expectMessage("New name for group cannot be null or blank");
stdEngine.updateGroup(group);
}
-
+
@Test
public void testUpdateGroupUnknown() throws NullPointerException, PAPException, IOException {
StdPDPGroup group = new StdPDPGroup("groupId", "groupName", "description", null);
@@ -324,69 +341,77 @@ public class StdEngineTest {
expectedException.expectMessage("Update found no existing group with id 'groupId'");
stdEngine.updateGroup(group);
}
-
+
@Test
- public void testPublishAndRemovePolicy() throws NullPointerException, PAPException, FileNotFoundException{
+ public void testPublishAndRemovePolicy()
+ throws NullPointerException, PAPException, FileNotFoundException {
OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
- InputStream inputStream = new FileInputStream("src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
- stdEngine.publishPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml", "Config_BRMS_Param_BRMSParamvFWDemoPolicy", true, inputStream, newGroup);
+ InputStream inputStream = new FileInputStream(
+ "src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
+ stdEngine.publishPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml",
+ "Config_BRMS_Param_BRMSParamvFWDemoPolicy", true, inputStream, newGroup);
PDPPolicy policy = newGroup.getPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
assertNotNull(policy);
-
+
stdEngine.removePolicy(policy, newGroup);
assertNull(newGroup.getPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml"));
}
-
+
@Test
- public void testPublishPolicyNull() throws NullPointerException, PAPException, FileNotFoundException{
+ public void testPublishPolicyNull()
+ throws NullPointerException, PAPException, FileNotFoundException {
expectedException.expect(NullPointerException.class);
stdEngine.publishPolicy(null, null, true, null, null);
}
-
+
@Test
- public void testPublishPolicyUnknownGroup() throws NullPointerException, PAPException, FileNotFoundException{
+ public void testPublishPolicyUnknownGroup()
+ throws NullPointerException, PAPException, FileNotFoundException {
OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
expectedException.expect(PAPException.class);
expectedException.expectMessage("Unknown PDP Group: unknownId");
stdEngine.publishPolicy(null, null, true, null, unknownGroup);
}
-
+
@Test
- public void testRemovePolicyNull() throws NullPointerException, PAPException, FileNotFoundException{
+ public void testRemovePolicyNull()
+ throws NullPointerException, PAPException, FileNotFoundException {
expectedException.expect(NullPointerException.class);
stdEngine.removePolicy(null, null);
}
-
+
@Test
- public void testRemovePolicyUnknownGroup() throws NullPointerException, PAPException, FileNotFoundException{
+ public void testRemovePolicyUnknownGroup()
+ throws NullPointerException, PAPException, FileNotFoundException {
OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
expectedException.expect(PAPException.class);
expectedException.expectMessage("Unknown PDP Group: unknownId");
stdEngine.removePolicy(null, unknownGroup);
}
-
- private OnapPDPGroup createGroup(final String name, final String description) throws NullPointerException, PAPException{
+
+ private OnapPDPGroup createGroup(final String name, final String description)
+ throws NullPointerException, PAPException {
ensureGroupDoesntExist(name);
stdEngine.newGroup(name, description);
return stdEngine.getGroup(name);
}
-
+
@After
- public void tearDown() throws PAPException{
+ public void tearDown() throws PAPException {
ensureGroupDoesntExist("newGroup");
ensureGroupDoesntExist("anotherNewGroup");
ensureGroupDoesntExist("AnUpdatedName");
}
-
- private void ensureGroupDoesntExist(final String groupName) throws PAPException{
+
+ private void ensureGroupDoesntExist(final String groupName) throws PAPException {
OnapPDPGroup group = stdEngine.getGroup(groupName);
- if (group != null){
- for (OnapPDP pdp: group.getOnapPdps()){
+ if (group != null) {
+ for (OnapPDP pdp : group.getOnapPdps()) {
stdEngine.removePDP(pdp);
}
- stdEngine.removeGroup(group, null);
- }
+ stdEngine.removeGroup(group, null);
+ }
}
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java
index 3e1d81578..55413d83b 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -223,35 +225,35 @@ public class StdPDPGroupStatusTest {
stdPDPGroupStatus.addFailedPipConfig(new StdPDPPIPConfig());
assertFalse(stdPDPGroupStatus.pipConfigOK());
}
-
+
@Test
public void testPdpsOKOutOfSyncPdp() {
assertTrue(stdPDPGroupStatus.pdpsOK());
stdPDPGroupStatus.addOutOfSynchPDP(new StdPDP());
assertFalse(stdPDPGroupStatus.pdpsOK());
}
-
+
@Test
public void testPdpsOKFailedPdp() {
assertTrue(stdPDPGroupStatus.pdpsOK());
stdPDPGroupStatus.addFailedPDP(new StdPDP());
assertFalse(stdPDPGroupStatus.pdpsOK());
}
-
+
@Test
public void testPdpsOKLastUpdateFailedPdp() {
assertTrue(stdPDPGroupStatus.pdpsOK());
stdPDPGroupStatus.addLastUpdateFailedPDP(new StdPDP());
assertFalse(stdPDPGroupStatus.pdpsOK());
}
-
+
@Test
public void testPdpsOKUnknownPdp() {
assertTrue(stdPDPGroupStatus.pdpsOK());
stdPDPGroupStatus.addUnknownPDP(new StdPDP());
assertFalse(stdPDPGroupStatus.pdpsOK());
}
-
+
@Test
public void testIsGroupOkFailedPolicy() {
stdPDPGroupStatus.setStatus(Status.OK);
@@ -259,7 +261,7 @@ public class StdPDPGroupStatusTest {
stdPDPGroupStatus.addFailedPolicy(new StdPDPPolicy());
assertFalse(stdPDPGroupStatus.isGroupOk());
}
-
+
@Test
public void testIsGroupOkFailedPipConfig() {
stdPDPGroupStatus.setStatus(Status.OK);
@@ -267,30 +269,30 @@ public class StdPDPGroupStatusTest {
stdPDPGroupStatus.addFailedPipConfig(new StdPDPPIPConfig());
assertFalse(stdPDPGroupStatus.isGroupOk());
}
-
+
@Test
public void testIsGroupOkFailedPdp() {
stdPDPGroupStatus.setStatus(Status.OK);
assertTrue(stdPDPGroupStatus.isGroupOk());
stdPDPGroupStatus.addLastUpdateFailedPDP(new StdPDP());
assertFalse(stdPDPGroupStatus.isGroupOk());
- }
-
+ }
+
@Test
public void testIsGroupOkLoadErrors() {
stdPDPGroupStatus.setStatus(Status.OK);
assertTrue(stdPDPGroupStatus.isGroupOk());
stdPDPGroupStatus.addLoadError("A load error");
assertFalse(stdPDPGroupStatus.isGroupOk());
- }
-
+ }
+
@Test
public void testIsGroupOkStatusOutOfSynch() {
stdPDPGroupStatus.setStatus(Status.OK);
assertTrue(stdPDPGroupStatus.isGroupOk());
stdPDPGroupStatus.setStatus(Status.OUT_OF_SYNCH);
assertFalse(stdPDPGroupStatus.isGroupOk());
- }
+ }
@Test
public void testConstructor() {
@@ -477,5 +479,4 @@ public class StdPDPGroupStatusTest {
public void testEqualsInstanceOfDiffClass() {
assertFalse(stdPDPGroupStatus.equals(""));
}
-
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java
index 323b0348a..e5e058a5c 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,12 +22,10 @@
package org.onap.policy.xacml.test.std.pap;
import static org.junit.Assert.assertTrue;
-
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Set;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -36,194 +36,191 @@ import org.onap.policy.xacml.std.pap.StdPDPGroup;
public class StdPDPGroupTest {
- private static Logger logger = FlexLogger.getLogger(StdPDPGroupTest.class);
-
- private StdPDPGroup stdPDPGroup;
- private Path repository;
- private StdPDP testPdp = new StdPDP();
- private StdPDP testPdp1 = new StdPDP();
-
- @Before
- public void setUp(){
-
- try {
- stdPDPGroup = new StdPDPGroup();
- repository = Paths.get("src/test/resources/pdps");
- testPdp1.setId("100");
-
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
-
- @Test
- public void testGetStatus() {
- try {
- assertTrue(stdPDPGroup.getStatus() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetId() {
- try {
- stdPDPGroup.setId("testId");
- assertTrue(stdPDPGroup.getId() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testIsDefaultGroup() {
- try {
- stdPDPGroup.setDefaultGroup(true);
- assertTrue(stdPDPGroup.isDefaultGroup() == true);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetName() {
- try {
- stdPDPGroup.setName("testing");
- assertTrue(stdPDPGroup.getName() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetDescription() {
- try {
- stdPDPGroup.setDescription("description");
- assertTrue(stdPDPGroup.getDescription() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetDirectory() {
- try {
- stdPDPGroup.setDirectory(repository);
- assertTrue(stdPDPGroup.getDirectory() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetSelectedPolicies() {
- try {
- assertTrue(stdPDPGroup.getSelectedPolicies() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetOperation() {
- try {
- stdPDPGroup.setOperation("test");
- assertTrue(stdPDPGroup.getOperation() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetPdps() {
- try {
- stdPDPGroup.setOnapPdps(new HashSet<>());
- assertTrue(stdPDPGroup.getPdps() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetOnapPdps() {
- try {
- stdPDPGroup.setOnapPdps(new HashSet<>());
- assertTrue(stdPDPGroup.getOnapPdps() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testAddPDP() {
- try {
- assertTrue(stdPDPGroup.addPDP(testPdp) == true);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testRemovePDP() {
- try {
- assertTrue(stdPDPGroup.removePDP(testPdp) == false);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetPolicies() {
- try {
- stdPDPGroup.setPolicies(new HashSet());
- assertTrue(stdPDPGroup.getPolicies() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetPolicy() {
- try {
- assertTrue(stdPDPGroup.getPolicy("wrongId") == null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
-
- @Test
- public void testGetPipConfigs() {
- try {
- stdPDPGroup.setPipConfigs(new HashSet());
- assertTrue(stdPDPGroup.getPipConfigs() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetPipConfig() {
- try {
- Set pipConfigs = new HashSet();
- StdPDP testPdp = new StdPDP();
- testPdp.setId("20");
- pipConfigs.add(testPdp);
- stdPDPGroup.setId("testId");
- assertTrue(stdPDPGroup.getPipConfig("222") == null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
- @Test
- public void testGetPipConfigProperties() {
- try {
- assertTrue(stdPDPGroup.getPipConfigProperties() != null);
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
+ private static Logger logger = FlexLogger.getLogger(StdPDPGroupTest.class);
+
+ private StdPDPGroup stdPDPGroup;
+ private Path repository;
+ private StdPDP testPdp = new StdPDP();
+ private StdPDP testPdp1 = new StdPDP();
+
+ @Before
+ public void setUp() {
+
+ try {
+ stdPDPGroup = new StdPDPGroup();
+ repository = Paths.get("src/test/resources/pdps");
+ testPdp1.setId("100");
+
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetStatus() {
+ try {
+ assertTrue(stdPDPGroup.getStatus() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetId() {
+ try {
+ stdPDPGroup.setId("testId");
+ assertTrue(stdPDPGroup.getId() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testIsDefaultGroup() {
+ try {
+ stdPDPGroup.setDefaultGroup(true);
+ assertTrue(stdPDPGroup.isDefaultGroup() == true);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetName() {
+ try {
+ stdPDPGroup.setName("testing");
+ assertTrue(stdPDPGroup.getName() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetDescription() {
+ try {
+ stdPDPGroup.setDescription("description");
+ assertTrue(stdPDPGroup.getDescription() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetDirectory() {
+ try {
+ stdPDPGroup.setDirectory(repository);
+ assertTrue(stdPDPGroup.getDirectory() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetSelectedPolicies() {
+ try {
+ assertTrue(stdPDPGroup.getSelectedPolicies() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetOperation() {
+ try {
+ stdPDPGroup.setOperation("test");
+ assertTrue(stdPDPGroup.getOperation() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPdps() {
+ try {
+ stdPDPGroup.setOnapPdps(new HashSet<>());
+ assertTrue(stdPDPGroup.getPdps() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetOnapPdps() {
+ try {
+ stdPDPGroup.setOnapPdps(new HashSet<>());
+ assertTrue(stdPDPGroup.getOnapPdps() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testAddPDP() {
+ try {
+ assertTrue(stdPDPGroup.addPDP(testPdp) == true);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testRemovePDP() {
+ try {
+ assertTrue(stdPDPGroup.removePDP(testPdp) == false);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPolicies() {
+ try {
+ stdPDPGroup.setPolicies(new HashSet());
+ assertTrue(stdPDPGroup.getPolicies() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPolicy() {
+ try {
+ assertTrue(stdPDPGroup.getPolicy("wrongId") == null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPipConfigs() {
+ try {
+ stdPDPGroup.setPipConfigs(new HashSet());
+ assertTrue(stdPDPGroup.getPipConfigs() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPipConfig() {
+ try {
+ Set pipConfigs = new HashSet();
+ StdPDP testPdp = new StdPDP();
+ testPdp.setId("20");
+ pipConfigs.add(testPdp);
+ stdPDPGroup.setId("testId");
+ assertTrue(stdPDPGroup.getPipConfig("222") == null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetPipConfigProperties() {
+ try {
+ assertTrue(stdPDPGroup.getPipConfigProperties() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java
index 1be34ee00..cea7c32c7 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -28,16 +30,16 @@ import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier;
import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
public class StdPDPItemSetChangeNotifierTest {
- @Test
- public void testNotifier() {
- StdPDPItemSetChangeNotifier notifier = new StdPDPItemSetChangeNotifier();
- StdItemSetChangeListener listener = Mockito.mock(StdItemSetChangeListener.class);
- notifier.addItemSetChangeListener(listener);
- notifier.removeItemSetChangeListener(listener);
- notifier.fireChanged();
- OnapPDP pdp = Mockito.mock(OnapPDP.class);
- notifier.firePDPChanged(pdp);
- OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class);
- notifier.firePDPGroupChanged(group);
- }
+ @Test
+ public void testNotifier() {
+ StdPDPItemSetChangeNotifier notifier = new StdPDPItemSetChangeNotifier();
+ StdItemSetChangeListener listener = Mockito.mock(StdItemSetChangeListener.class);
+ notifier.addItemSetChangeListener(listener);
+ notifier.removeItemSetChangeListener(listener);
+ notifier.fireChanged();
+ OnapPDP pdp = Mockito.mock(OnapPDP.class);
+ notifier.firePDPChanged(pdp);
+ OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class);
+ notifier.firePDPGroupChanged(group);
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java
index 05b8ae7cc..b5713d362 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -32,76 +34,76 @@ import org.junit.Test;
import org.onap.policy.xacml.std.pap.StdPDPPIPConfig;
public class StdPDPPIPConfigTest {
- @Test
- public void testConfig() {
- // Setup test data
- String id = "testID";
- String value = "testVal";
- Properties props = new Properties();
- props.setProperty(id + ".classname", value);
- Map<String, String> map = new HashMap<String, String>();
- map.put(id, value);
+ @Test
+ public void testConfig() {
+ // Setup test data
+ String id = "testID";
+ String value = "testVal";
+ Properties props = new Properties();
+ props.setProperty(id + ".classname", value);
+ Map<String, String> map = new HashMap<String, String>();
+ map.put(id, value);
- // Test constructors
- StdPDPPIPConfig config = new StdPDPPIPConfig();
- assertNotNull(config);
- StdPDPPIPConfig config2 = new StdPDPPIPConfig(id);
- assertNotNull(config2);
- StdPDPPIPConfig config3 = new StdPDPPIPConfig(id, value, value);
- assertNotNull(config3);
- StdPDPPIPConfig config4 = new StdPDPPIPConfig(id, props);
- assertNotNull(config4);
- StdPDPPIPConfig config5 = new StdPDPPIPConfig(id, props);
- assertNotNull(config5);
+ // Test constructors
+ StdPDPPIPConfig config = new StdPDPPIPConfig();
+ assertNotNull(config);
+ StdPDPPIPConfig config2 = new StdPDPPIPConfig(id);
+ assertNotNull(config2);
+ StdPDPPIPConfig config3 = new StdPDPPIPConfig(id, value, value);
+ assertNotNull(config3);
+ StdPDPPIPConfig config4 = new StdPDPPIPConfig(id, props);
+ assertNotNull(config4);
+ StdPDPPIPConfig config5 = new StdPDPPIPConfig(id, props);
+ assertNotNull(config5);
- // Test set and get
- config.setId(value);
- assertEquals(value, config.getId());
- config.setName(value);
- assertEquals(value, config.getName());
- config.setDescription(value);
- assertEquals(value, config.getDescription());
- config.setClassname(value);
- assertEquals(value, config.getClassname());
- config.setValues(map);
- assertEquals(map, config.getConfiguration());
- assertEquals(true, config.isConfigured());
- config.setConfig(map);
- assertEquals(map, config.getConfig());
+ // Test set and get
+ config.setId(value);
+ assertEquals(value, config.getId());
+ config.setName(value);
+ assertEquals(value, config.getName());
+ config.setDescription(value);
+ assertEquals(value, config.getDescription());
+ config.setClassname(value);
+ assertEquals(value, config.getClassname());
+ config.setValues(map);
+ assertEquals(map, config.getConfiguration());
+ assertEquals(true, config.isConfigured());
+ config.setConfig(map);
+ assertEquals(map, config.getConfig());
- // Test equals combinations
- assertEquals(true, config4.equals(config5));
- assertEquals(true, config4.equals(config4));
- assertEquals(false, config4.equals(null));
- assertEquals(false, config4.equals(value));
- config4.setClassname(null);
- config5.setClassname(value);
- assertEquals(false, config4.equals(config5));
- config4.setClassname(id);
- assertEquals(false, config4.equals(config5));
- config4.setClassname(value);
- config5.setConfig(map);
- assertEquals(false, config4.equals(config5));
- config4.setConfig(null);
- assertEquals(false, config4.equals(config5));
- config4.setConfig(map);
- config5.setDescription(value);
- assertEquals(false, config4.equals(config5));
- config4.setDescription(id);
- assertEquals(false, config4.equals(config5));
- config4.setDescription(value);
- config4.setId(null);
- assertEquals(false, config4.equals(config5));
- config4.setId(value);
- assertEquals(false, config4.equals(config5));
- config4.setId(id);
- config5.setName(value);
- assertEquals(false, config4.equals(config5));
- config4.setName(id);
- assertEquals(false, config4.equals(config5));
- assertThat(config.hashCode(), is(not(0)));
+ // Test equals combinations
+ assertEquals(true, config4.equals(config5));
+ assertEquals(true, config4.equals(config4));
+ assertEquals(false, config4.equals(null));
+ assertEquals(false, config4.equals(value));
+ config4.setClassname(null);
+ config5.setClassname(value);
+ assertEquals(false, config4.equals(config5));
+ config4.setClassname(id);
+ assertEquals(false, config4.equals(config5));
+ config4.setClassname(value);
+ config5.setConfig(map);
+ assertEquals(false, config4.equals(config5));
+ config4.setConfig(null);
+ assertEquals(false, config4.equals(config5));
+ config4.setConfig(map);
+ config5.setDescription(value);
+ assertEquals(false, config4.equals(config5));
+ config4.setDescription(id);
+ assertEquals(false, config4.equals(config5));
+ config4.setDescription(value);
+ config4.setId(null);
+ assertEquals(false, config4.equals(config5));
+ config4.setId(value);
+ assertEquals(false, config4.equals(config5));
+ config4.setId(id);
+ config5.setName(value);
+ assertEquals(false, config4.equals(config5));
+ config4.setName(id);
+ assertEquals(false, config4.equals(config5));
+ assertThat(config.hashCode(), is(not(0)));
- // Test toString
- assertThat(config.toString().length(), is(not(0)));
- }
+ // Test toString
+ assertThat(config.toString().length(), is(not(0)));
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java
index 26af008b6..7aaa381ce 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java
@@ -3,14 +3,15 @@
* ONAP-XACML
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
* ================================================================================
* 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.
@@ -36,129 +37,114 @@ import org.onap.policy.xacml.std.pap.StdPDPPolicy;
import com.att.research.xacml.api.pap.PAPException;
import org.onap.policy.xacml.std.pap.StdPDPPolicyParams;
-
public class StdPDPPolicyTest {
- @Test
- public void testPolicy() throws URISyntaxException, IOException, PAPException {
- // Set up test data
- String value = "testVal";
- URI uri = new URI("http://localhost/");
- int[] array = {1, 1};
+ @Test
+ public void testPolicy() throws URISyntaxException, IOException, PAPException {
+ // Set up test data
+ String value = "testVal";
+ URI uri = new URI("http://localhost/");
+ int[] array = {1, 1};
- // Test constructors
- StdPDPPolicy policy = new StdPDPPolicy(value, true);
- assertNotNull(policy);
- StdPDPPolicy policy2 = new StdPDPPolicy(value, true, value);
- assertNotNull(policy2);
- StdPDPPolicy policy4 = new StdPDPPolicy();
- assertNotNull(policy4);
+ // Test constructors
+ StdPDPPolicy policy = new StdPDPPolicy(value, true);
+ assertNotNull(policy);
+ StdPDPPolicy policy2 = new StdPDPPolicy(value, true, value);
+ assertNotNull(policy2);
+ StdPDPPolicy policy4 = new StdPDPPolicy();
+ assertNotNull(policy4);
- StdPDPPolicy policy5 = new StdPDPPolicy(StdPDPPolicyParams.builder()
- .id(value)
- .isRoot(true)
- .name(value)
- .location(uri)
- .isValid(false)
- .policyId(value)
- .description(value)
- .version("1")
- .build());
- assertNotNull(policy5);
- StdPDPPolicy policy6 = new StdPDPPolicy(value, true, value, uri, false);
- assertNotNull(policy6);
- StdPDPPolicy policy8 = new StdPDPPolicy(value, true, value, uri, false);
- assertNotNull(policy8);
+ StdPDPPolicy policy5 = new StdPDPPolicy(
+ StdPDPPolicyParams.builder().id(value).isRoot(true).name(value).location(uri)
+ .isValid(false).policyId(value).description(value).version("1").build());
+ assertNotNull(policy5);
+ StdPDPPolicy policy6 = new StdPDPPolicy(value, true, value, uri, false);
+ assertNotNull(policy6);
+ StdPDPPolicy policy8 = new StdPDPPolicy(value, true, value, uri, false);
+ assertNotNull(policy8);
- // Test set and get
- policy.setId(value);
- assertEquals(value, policy.getId());
- policy.setName(value);
- assertEquals(value, policy.getName());
- policy.setPolicyId(value);
- assertEquals(value, policy.getPolicyId());
- policy.setDescription(value);
- assertEquals(value, policy.getDescription());
- policy.setVersion("1");
- assertEquals("1", policy.getVersion());
- assertEquals(1, policy.getVersionInts()[0]);
- assertEquals(true, policy.isRoot());
- policy.setValid(true);
- assertEquals(true, policy.isValid());
- assertEquals(uri, policy5.getLocation());
- policy.setRoot(false);
- assertEquals(false, policy.isRoot());
- policy.setLocation(uri);
- assertEquals(uri, policy.getLocation());
+ // Test set and get
+ policy.setId(value);
+ assertEquals(value, policy.getId());
+ policy.setName(value);
+ assertEquals(value, policy.getName());
+ policy.setPolicyId(value);
+ assertEquals(value, policy.getPolicyId());
+ policy.setDescription(value);
+ assertEquals(value, policy.getDescription());
+ policy.setVersion("1");
+ assertEquals("1", policy.getVersion());
+ assertEquals(1, policy.getVersionInts()[0]);
+ assertEquals(true, policy.isRoot());
+ policy.setValid(true);
+ assertEquals(true, policy.isValid());
+ assertEquals(uri, policy5.getLocation());
+ policy.setRoot(false);
+ assertEquals(false, policy.isRoot());
+ policy.setLocation(uri);
+ assertEquals(uri, policy.getLocation());
- // Test equals combinations
- assertThat(policy.hashCode(), is(not(0)));
- assertEquals(true, policy.equals(policy));
- assertEquals(false, policy.equals(null));
- assertEquals(false, policy.equals(value));
- assertEquals(true, policy6.equals(policy8));
- policy6.setId("1");
- assertEquals(false, policy6.equals(policy8));
- policy6.setId(null);
- assertEquals(false, policy6.equals(policy8));
- policy8.setId(null);
- assertEquals(true, policy6.equals(policy8));
- policy8.setPolicyId(value);
- assertEquals(false, policy6.equals(policy8));
- policy6.setPolicyId("1");
- policy8.setPolicyId("2");
- assertEquals(false, policy6.equals(policy8));
- policy8.setPolicyId("1");
- policy6.setVersion("1");
- policy8.setVersion("2");
- assertEquals(false, policy6.equals(policy8));
+ // Test equals combinations
+ assertThat(policy.hashCode(), is(not(0)));
+ assertEquals(true, policy.equals(policy));
+ assertEquals(false, policy.equals(null));
+ assertEquals(false, policy.equals(value));
+ assertEquals(true, policy6.equals(policy8));
+ policy6.setId("1");
+ assertEquals(false, policy6.equals(policy8));
+ policy6.setId(null);
+ assertEquals(false, policy6.equals(policy8));
+ policy8.setId(null);
+ assertEquals(true, policy6.equals(policy8));
+ policy8.setPolicyId(value);
+ assertEquals(false, policy6.equals(policy8));
+ policy6.setPolicyId("1");
+ policy8.setPolicyId("2");
+ assertEquals(false, policy6.equals(policy8));
+ policy8.setPolicyId("1");
+ policy6.setVersion("1");
+ policy8.setVersion("2");
+ assertEquals(false, policy6.equals(policy8));
- // Test toString
- assertThat(policy.toString().length(), is(not(0)));
- assertEquals("1.1", StdPDPPolicy.versionArrayToString(array));
- assertEquals("", StdPDPPolicy.versionArrayToString(null));
- assertEquals(0, StdPDPPolicy.versionStringToArray(null).length);
- }
+ // Test toString
+ assertThat(policy.toString().length(), is(not(0)));
+ assertEquals("1.1", StdPDPPolicy.versionArrayToString(array));
+ assertEquals("", StdPDPPolicy.versionArrayToString(null));
+ assertEquals(0, StdPDPPolicy.versionStringToArray(null).length);
+ }
- @Test(expected = ConnectException.class)
- public void negTestStream() throws URISyntaxException, IOException, PAPException {
- // Set up test data
- String value = "testVal";
- URI uri = new URI("http://localhost:54287");
- StdPDPPolicy policy = new StdPDPPolicy(StdPDPPolicyParams.builder()
- .id(value)
- .isRoot(true)
- .name(value)
- .location(uri)
- .isValid(false)
- .policyId(value)
- .description(value)
- .version("1")
- .build());
+ @Test(expected = ConnectException.class)
+ public void negTestStream() throws URISyntaxException, IOException, PAPException {
+ // Set up test data
+ String value = "testVal";
+ URI uri = new URI("http://localhost:54287");
+ StdPDPPolicy policy = new StdPDPPolicy(
+ StdPDPPolicyParams.builder().id(value).isRoot(true).name(value).location(uri)
+ .isValid(false).policyId(value).description(value).version("1").build());
- // Negative test stream
- policy.getStream();
- }
+ // Negative test stream
+ policy.getStream();
+ }
- @Test(expected = ConnectException.class)
- public void negTestConstructor1() throws URISyntaxException, IOException {
- // Set up test data
- String value = "testVal";
- URI uri = new URI("http://localhost:54287");
+ @Test(expected = ConnectException.class)
+ public void negTestConstructor1() throws URISyntaxException, IOException {
+ // Set up test data
+ String value = "testVal";
+ URI uri = new URI("http://localhost:54287");
- // Test constructor
- StdPDPPolicy policy = new StdPDPPolicy(value, true, value, uri);
- assertNotNull(policy);
- }
+ // Test constructor
+ StdPDPPolicy policy = new StdPDPPolicy(value, true, value, uri);
+ assertNotNull(policy);
+ }
- @Test(expected = ConnectException.class)
- public void negTestConstructor2() throws URISyntaxException, IOException {
- // Set up test data
- String value = "testVal";
- URI uri = new URI("http://localhost:54287");
- Properties props = new Properties();
+ @Test(expected = ConnectException.class)
+ public void negTestConstructor2() throws URISyntaxException, IOException {
+ // Set up test data
+ String value = "testVal";
+ URI uri = new URI("http://localhost:54287");
+ Properties props = new Properties();
- // Test constructor
- StdPDPPolicy policy = new StdPDPPolicy(value, true, uri, props);
- assertNotNull(policy);
- }
+ // Test constructor
+ StdPDPPolicy policy = new StdPDPPolicy(value, true, uri, props);
+ assertNotNull(policy);
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java
index c99eef8ee..dfdbf5f16 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java
@@ -2,12 +2,14 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -132,33 +134,33 @@ public class StdPDPStatusTest {
stdPDPStatus.setStatus(Status.OUT_OF_SYNCH);
assertFalse(stdPDPStatus.isOk());
}
-
+
@Test
public void testAddLoadError() {
stdPDPStatus.addLoadError("An error");
assertEquals("An error", stdPDPStatus.getLoadErrors().iterator().next());
}
-
+
@Test
public void testAddLoadWarning() {
stdPDPStatus.addLoadWarning("A warning");
assertEquals("A warning", stdPDPStatus.getLoadWarnings().iterator().next());
}
-
+
@Test
public void testAddLoadedPolicy() {
PDPPolicy policy = new StdPDPPolicy();
stdPDPStatus.addLoadedPolicy(policy);
assertEquals(policy, stdPDPStatus.getLoadedPolicies().iterator().next());
}
-
+
@Test
public void testAddRootPolicy() {
PDPPolicy policy = new StdPDPPolicy();
stdPDPStatus.addRootPolicy(policy);
assertEquals(policy, stdPDPStatus.getLoadedRootPolicies().iterator().next());
}
-
+
@Test
public void testAddAllLoadedRootPolicy() {
Set<PDPPolicy> policies = new HashSet<>();
@@ -167,9 +169,9 @@ public class StdPDPStatusTest {
stdPDPStatus.addAllLoadedRootPolicies(policies);
assertEquals(policies, stdPDPStatus.getLoadedRootPolicies());
}
-
+
@Test
- public void testAddLoadedPipConfig(){
+ public void testAddLoadedPipConfig() {
PDPPIPConfig pipConfig = new StdPDPPIPConfig();
stdPDPStatus.addLoadedPipConfig(pipConfig);
assertEquals(pipConfig, stdPDPStatus.getLoadedPipConfigs().iterator().next());
@@ -214,12 +216,16 @@ public class StdPDPStatusTest {
assertEquals(loadedPIPConfigs, stdPDPStatus1.getLoadedPipConfigs());
assertEquals(failedPIPConfigs, stdPDPStatus1.getFailedPipConfigs());
- assertEquals("StdPDPStatus [status=UP_TO_DATE, loadErrors=[An error], loadWarnings=[An error], loadedPolicies=[StdPDPPolicy "
- + "[id=null, name=null, policyId=null, description=null, version=, isRoot=false, isValid=false, location=null]], "
- + "loadedRootPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null, version=, isRoot=false, "
- + "isValid=false, location=null]], failedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null, "
- + "version=, isRoot=false, isValid=false, location=null]], loadedPIPConfigs=[StdPDPPIPConfig [id=null, name=null, "
- + "description=null, classname=null, config={}]], failedPIPConfigs=[StdPDPPIPConfig [id=null, name=null, description=null, classname=null, config={}]]]",
+ assertEquals(
+ "StdPDPStatus [status=UP_TO_DATE, loadErrors=[An error], loadWarnings=[An error],"
+ + " loadedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+ + " version=, isRoot=false, isValid=false, location=null]],"
+ + " loadedRootPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+ + " version=, isRoot=false, isValid=false, location=null]],"
+ + " failedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+ + " version=, isRoot=false, isValid=false, location=null]], loadedPIPConfigs=[StdPDPPIPConfig"
+ + " [id=null, name=null, description=null, classname=null, config={}]], failedPIPConfigs="
+ + "[StdPDPPIPConfig [id=null, name=null, description=null, classname=null, config={}]]]",
stdPDPStatus1.toString());
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java
index e62f1fdb1..0beb28275 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -40,132 +42,132 @@ import com.att.research.xacml.api.pap.PDPPolicy;
public class StdPDPTest {
- private static Logger logger = FlexLogger.getLogger(StdPDPTest.class);
+ private static Logger logger = FlexLogger.getLogger(StdPDPTest.class);
- private StdPDP stdPDP;
+ private StdPDP stdPDP;
- @Before
- public void setUp() {
+ @Before
+ public void setUp() {
- try {
- stdPDP = new StdPDP();
- } catch (Exception e) {
- logger.error(e);
+ try {
+ stdPDP = new StdPDP();
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetId() {
- try {
- stdPDP.setId("testId");
- assertTrue(stdPDP.getId() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testGetId() {
+ try {
+ stdPDP.setId("testId");
+ assertTrue(stdPDP.getId() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetName() {
- try {
- stdPDP.setName("abc");
- assertTrue(stdPDP.getName() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testGetName() {
+ try {
+ stdPDP.setName("abc");
+ assertTrue(stdPDP.getName() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetDescription() {
- try {
- stdPDP.setDescription("somee here");
- assertTrue(stdPDP.getDescription() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testGetDescription() {
+ try {
+ stdPDP.setDescription("somee here");
+ assertTrue(stdPDP.getDescription() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetStatus() {
- try {
- stdPDP.setStatus(new StdPDPStatus());
- assertTrue(stdPDP.getStatus() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testGetStatus() {
+ try {
+ stdPDP.setStatus(new StdPDPStatus());
+ assertTrue(stdPDP.getStatus() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetPipConfigs() {
- try {
- assertTrue(stdPDP.getPipConfigs() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testGetPipConfigs() {
+ try {
+ assertTrue(stdPDP.getPipConfigs() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+
+ @Test
+ public void testGetJmxPort() {
+ try {
+ stdPDP.setJmxPort(123);
+ assertTrue(stdPDP.getJmxPort() != null);
+ } catch (Exception e) {
+ logger.error(e);
+ }
}
- }
-
- @Test
- public void testGetJmxPort() {
- try {
- stdPDP.setJmxPort(123);
- assertTrue(stdPDP.getJmxPort() != null);
- } catch (Exception e) {
- logger.error(e);
+
+ @Test
+ public void testPDP() {
+ // Set up test data
+ String id = "testID";
+ String value = "testVal";
+ Properties props = new Properties();
+ props.setProperty(id + ".name", value);
+ props.setProperty(id + ".description", value);
+ props.setProperty(id + ".jmxport", "0");
+ Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+
+ // Test constructors
+ StdPDP pdp = new StdPDP(id, 0);
+ assertNotNull(pdp);
+ StdPDP pdp2 = new StdPDP(id, value, 0);
+ assertNotNull(pdp2);
+ StdPDP pdp3 = new StdPDP(id, value, value, 0);
+ assertNotNull(pdp3);
+ StdPDP pdp4 = new StdPDP(id, props);
+ assertNotNull(pdp4);
+ StdPDP pdp5 = new StdPDP(id, props);
+ assertNotNull(pdp5);
+
+ // Test set and get
+ pdp.setPipConfigs(pipConfigs);
+ assertEquals(pipConfigs, pdp.getPipConfigs());
+ pdp.setPolicies(policies);
+ assertEquals(policies, pdp.getPolicies());
+
+ // Test equals combinations
+ assertEquals(true, pdp4.equals(pdp5));
+ assertEquals(true, pdp4.equals(pdp4));
+ assertEquals(false, pdp4.equals(null));
+ assertEquals(false, pdp4.equals(value));
+ pdp4.setId(null);
+ assertEquals(false, pdp4.equals(value));
+ pdp5.setId(id);
+ assertEquals(false, pdp4.equals(pdp5));
+ pdp4.setId(value);
+ assertEquals(false, pdp4.equals(pdp5));
+ assertThat(pdp.hashCode(), is(not(0)));
+
+ // Test compare
+ assertEquals(-1, pdp4.compareTo(null));
+ assertEquals(0, pdp4.compareTo(pdp4));
+ pdp5.setName(null);
+ assertEquals(-1, pdp4.compareTo(pdp5));
+ pdp4.setName(null);
+ pdp5.setName(value);
+ assertEquals(1, pdp4.compareTo(pdp5));
+
+ // Test toString
+ assertThat(pdp.toString().length(), is(not(0)));
}
- }
-
- @Test
- public void testPDP() {
- // Set up test data
- String id = "testID";
- String value = "testVal";
- Properties props = new Properties();
- props.setProperty(id + ".name", value);
- props.setProperty(id + ".description", value);
- props.setProperty(id + ".jmxport", "0");
- Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
- Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
-
- // Test constructors
- StdPDP pdp = new StdPDP(id, 0);
- assertNotNull(pdp);
- StdPDP pdp2 = new StdPDP(id, value, 0);
- assertNotNull(pdp2);
- StdPDP pdp3 = new StdPDP(id, value, value, 0);
- assertNotNull(pdp3);
- StdPDP pdp4 = new StdPDP(id, props);
- assertNotNull(pdp4);
- StdPDP pdp5 = new StdPDP(id, props);
- assertNotNull(pdp5);
-
- // Test set and get
- pdp.setPipConfigs(pipConfigs);
- assertEquals(pipConfigs, pdp.getPipConfigs());
- pdp.setPolicies(policies);
- assertEquals(policies, pdp.getPolicies());
-
- // Test equals combinations
- assertEquals(true, pdp4.equals(pdp5));
- assertEquals(true, pdp4.equals(pdp4));
- assertEquals(false, pdp4.equals(null));
- assertEquals(false, pdp4.equals(value));
- pdp4.setId(null);
- assertEquals(false, pdp4.equals(value));
- pdp5.setId(id);
- assertEquals(false, pdp4.equals(pdp5));
- pdp4.setId(value);
- assertEquals(false, pdp4.equals(pdp5));
- assertThat(pdp.hashCode(), is(not(0)));
-
- // Test compare
- assertEquals(-1, pdp4.compareTo(null));
- assertEquals(0, pdp4.compareTo(pdp4));
- pdp5.setName(null);
- assertEquals(-1, pdp4.compareTo(pdp5));
- pdp4.setName(null);
- pdp5.setName(value);
- assertEquals(1, pdp4.compareTo(pdp5));
-
- // Test toString
- assertThat(pdp.toString().length(), is(not(0)));
- }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java
index bc9a67460..2b43ce753 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -32,17 +34,17 @@ import com.att.research.xacml.std.StdMutableAttribute;
import com.att.research.xacml.std.pip.StdPIPRequest;
public class OperationHistoryEngineTest {
- @Test
- public void testBaseNegativeCase() throws PIPException {
- OperationHistoryEngine engine = new OperationHistoryEngine();
- Collection<PIPRequest> required = engine.attributesRequired();
- assertEquals(required.size(), 0);
- Collection<PIPRequest> provided = engine.attributesProvided();
- assertEquals(provided.size(), 0);
-
- Attribute attribute = new StdMutableAttribute();
- PIPRequest pipRequest = new StdPIPRequest(attribute);
- PIPResponse response = engine.getAttributes(pipRequest, null);
- assertEquals(response.getStatus().isOk(), true);
- }
+ @Test
+ public void testBaseNegativeCase() throws PIPException {
+ OperationHistoryEngine engine = new OperationHistoryEngine();
+ Collection<PIPRequest> required = engine.attributesRequired();
+ assertEquals(required.size(), 0);
+ Collection<PIPRequest> provided = engine.attributesProvided();
+ assertEquals(provided.size(), 0);
+
+ Attribute attribute = new StdMutableAttribute();
+ PIPRequest pipRequest = new StdPIPRequest(attribute);
+ PIPResponse response = engine.getAttributes(pipRequest, null);
+ assertEquals(response.getStatus().isOk(), true);
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
index f60645fef..319198e69 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -34,32 +36,33 @@ import com.att.research.xacml.util.XACMLProperties;
import com.att.research.xacml.api.XACML3;
public class AAFEngineTest {
- @Test
- public void aafEngineTest(){
- String testId = "testId";
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.properties");
- AAFEngine aafEngine = new AAFEngine();
- assertTrue(AAFEngine.DEFAULT_DESCRIPTION.equals("PIP for authenticating aaf attributes using the AAF REST interface"));
- assertTrue(AAFEngine.DEFAULT_ISSUER.equals("aaf"));
-
- Properties props = new Properties();
- try {
- aafEngine.configure(testId, props);
- assertEquals(aafEngine.getName(), testId);
- assertEquals(aafEngine.getDescription(), AAFEngine.DEFAULT_DESCRIPTION);
- assertEquals(aafEngine.getIssuer(), AAFEngine.DEFAULT_ISSUER);
- assertEquals(aafEngine.attributesProvided().size(), 2);
- assertEquals(aafEngine.attributesRequired().size(), 5);
-
- PIPRequest pipRequest = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, AAFEngine.AAF_RESPONSE_ID, XACML3.ID_DATATYPE_STRING);
- StdPIPFinderFactory pipFactory = new StdPIPFinderFactory();
- PIPFinder pipFinder = pipFactory.getFinder();
- assertEquals(pipFinder.getPIPEngines().size(), 0);
- PIPResponse pipResponse = aafEngine.getAttributes(pipRequest, pipFinder);
- assertEquals(pipResponse.getStatus().isOk(), true);
- }
- catch (Exception ex) {
- fail("Not expecting any exceptions");
- }
- }
+ @Test
+ public void aafEngineTest() {
+ String testId = "testId";
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.properties");
+ AAFEngine aafEngine = new AAFEngine();
+ assertTrue(AAFEngine.DEFAULT_DESCRIPTION
+ .equals("PIP for authenticating aaf attributes using the AAF REST interface"));
+ assertTrue(AAFEngine.DEFAULT_ISSUER.equals("aaf"));
+
+ Properties props = new Properties();
+ try {
+ aafEngine.configure(testId, props);
+ assertEquals(aafEngine.getName(), testId);
+ assertEquals(aafEngine.getDescription(), AAFEngine.DEFAULT_DESCRIPTION);
+ assertEquals(aafEngine.getIssuer(), AAFEngine.DEFAULT_ISSUER);
+ assertEquals(aafEngine.attributesProvided().size(), 2);
+ assertEquals(aafEngine.attributesRequired().size(), 5);
+
+ PIPRequest pipRequest = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+ AAFEngine.AAF_RESPONSE_ID, XACML3.ID_DATATYPE_STRING);
+ StdPIPFinderFactory pipFactory = new StdPIPFinderFactory();
+ PIPFinder pipFinder = pipFactory.getFinder();
+ assertEquals(pipFinder.getPIPEngines().size(), 0);
+ PIPResponse pipResponse = aafEngine.getAttributes(pipRequest, pipFinder);
+ assertEquals(pipResponse.getStatus().isOk(), true);
+ } catch (Exception ex) {
+ fail("Not expecting any exceptions");
+ }
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java
index 041acdee6..291bae808 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,33 +22,32 @@
package org.onap.policy.xacml.test.util;
import static org.junit.Assert.*;
-
import org.junit.Test;
import org.onap.policy.xacml.util.MetricsUtil;
public class MetricsUtilTest {
-
- @Test
- public void metricsUtilTest(){
- MetricsUtil.AvgLatency avgLatency = new MetricsUtil.AvgLatency();
- avgLatency.compute(0);
- assertTrue(avgLatency.avg() == 0);
- avgLatency.compute(2);
- assertTrue(avgLatency.avg() == 1);
- avgLatency.reset();
- assertTrue(avgLatency.avg() == 0);
-
- MetricsUtil.MaxLatency maxLatency = new MetricsUtil.MaxLatency();
- maxLatency.compute(2);
- assertTrue(maxLatency.max() == 2);
- maxLatency.reset();
- assertTrue(maxLatency.max() < 0);
-
- MetricsUtil.MinLatency minLatency = new MetricsUtil.MinLatency();
- minLatency.compute(2);
- assertTrue(minLatency.min() == 2);
- minLatency.reset();
- assertTrue(minLatency.min() > 0);
- }
+
+ @Test
+ public void metricsUtilTest() {
+ MetricsUtil.AvgLatency avgLatency = new MetricsUtil.AvgLatency();
+ avgLatency.compute(0);
+ assertTrue(avgLatency.avg() == 0);
+ avgLatency.compute(2);
+ assertTrue(avgLatency.avg() == 1);
+ avgLatency.reset();
+ assertTrue(avgLatency.avg() == 0);
+
+ MetricsUtil.MaxLatency maxLatency = new MetricsUtil.MaxLatency();
+ maxLatency.compute(2);
+ assertTrue(maxLatency.max() == 2);
+ maxLatency.reset();
+ assertTrue(maxLatency.max() < 0);
+
+ MetricsUtil.MinLatency minLatency = new MetricsUtil.MinLatency();
+ minLatency.compute(2);
+ assertTrue(minLatency.min() == 2);
+ minLatency.reset();
+ assertTrue(minLatency.min() > 0);
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java
index 09dcf837f..0270a8901 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,68 +23,69 @@ package org.onap.policy.xacml.test.util;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.xacml.util.XACMLPolicyScanner;
-
import com.att.research.xacml.util.XACMLPolicyScanner.Callback;
public class XACMLPolicyScannerTest {
- private static final Log logger = LogFactory.getLog(XACMLPolicyScannerTest.class);
- private static Path configPolicyPathValue;
- private static Path actionPolicyPathValue;
-
- @Before
- public void setUp() {
- File templateFile;
- ClassLoader classLoader = getClass().getClassLoader();
+ private static final Log logger = LogFactory.getLog(XACMLPolicyScannerTest.class);
+ private static Path configPolicyPathValue;
+ private static Path actionPolicyPathValue;
+
+ @Before
+ public void setUp() {
+ File templateFile;
+ ClassLoader classLoader = getClass().getClassLoader();
+ try {
+ templateFile =
+ new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
+ configPolicyPathValue = templateFile.toPath();
+ templateFile =
+ new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
+ actionPolicyPathValue = templateFile.toPath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured" + e1);
+ }
+ }
+
+ @Test
+ public void xacmlPolicyScannerTest() throws IOException {
+ Callback callback = null;
try {
- templateFile = new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
- configPolicyPathValue = templateFile.toPath();
- templateFile = new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
- actionPolicyPathValue = templateFile.toPath();
- } catch (Exception e1) {
- logger.error("Exception Occured"+e1);
- }
- }
-
- @Test
- public void xacmlPolicyScannerTest() throws IOException{
- Callback callback = null;
- try{
- XACMLPolicyScanner actionScanner = new XACMLPolicyScanner(actionPolicyPathValue, callback);
- assertTrue(actionScanner.getPolicyObject() != null);
- Object actionObject = actionScanner.scan();
- assertTrue(actionObject != null);
-
- XACMLPolicyScanner scanner = new XACMLPolicyScanner(configPolicyPathValue, callback);
- assertTrue(scanner.getPolicyObject() != null);
- Object object = scanner.scan();
- assertTrue(object != null);
- String id = XACMLPolicyScanner.getID(scanner.getPolicyObject());
- assertTrue(id.equals("urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1"));
- String version = XACMLPolicyScanner.getVersion(scanner.getPolicyObject());
- assertTrue(version.equals("1"));
- String versionFromPath = XACMLPolicyScanner.getVersion(configPolicyPathValue);
- assertTrue(versionFromPath.equals("1"));
- List<String> returnValue = XACMLPolicyScanner.getCreatedByModifiedBy(configPolicyPathValue);
- assertTrue(returnValue.get(0).equals("test"));
- String createdBy = XACMLPolicyScanner.getCreatedBy(configPolicyPathValue);
- assertTrue(createdBy.equals("test"));
- String modifiedBy = XACMLPolicyScanner.getModifiedBy(configPolicyPathValue);
- assertTrue(modifiedBy.equals("test"));
- }catch(Exception e){
- fail();
- logger.error("Exception Occured"+e);
- }
- }
+ XACMLPolicyScanner actionScanner =
+ new XACMLPolicyScanner(actionPolicyPathValue, callback);
+ assertTrue(actionScanner.getPolicyObject() != null);
+ Object actionObject = actionScanner.scan();
+ assertTrue(actionObject != null);
+
+ XACMLPolicyScanner scanner = new XACMLPolicyScanner(configPolicyPathValue, callback);
+ assertTrue(scanner.getPolicyObject() != null);
+ Object object = scanner.scan();
+ assertTrue(object != null);
+ String id = XACMLPolicyScanner.getID(scanner.getPolicyObject());
+ assertTrue(id.equals("urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1"));
+ String version = XACMLPolicyScanner.getVersion(scanner.getPolicyObject());
+ assertTrue(version.equals("1"));
+ String versionFromPath = XACMLPolicyScanner.getVersion(configPolicyPathValue);
+ assertTrue(versionFromPath.equals("1"));
+ List<String> returnValue =
+ XACMLPolicyScanner.getCreatedByModifiedBy(configPolicyPathValue);
+ assertTrue(returnValue.get(0).equals("test"));
+ String createdBy = XACMLPolicyScanner.getCreatedBy(configPolicyPathValue);
+ assertTrue(createdBy.equals("test"));
+ String modifiedBy = XACMLPolicyScanner.getModifiedBy(configPolicyPathValue);
+ assertTrue(modifiedBy.equals("test"));
+ } catch (Exception e) {
+ fail();
+ logger.error("Exception Occured" + e);
+ }
+ }
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
index 446a87d1a..4cf40a315 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java
@@ -1,15 +1,17 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* ONAP-XACML
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,73 +23,74 @@ package org.onap.policy.xacml.test.util;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Path;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.xacml.util.XACMLPolicyWriter;
-
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
public class XACMLPolicyWriterTest {
- private static final Log logger = LogFactory.getLog(XACMLPolicyWriterTest.class);
- private static Path configPolicyPathValue;
- private static Path actionPolicyPathValue;
+ private static final Log logger = LogFactory.getLog(XACMLPolicyWriterTest.class);
+ private static Path configPolicyPathValue;
+ private static Path actionPolicyPathValue;
- @Before
- public void setUp() {
- File templateFile;
- ClassLoader classLoader = getClass().getClassLoader();
- try {
- templateFile = new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
- configPolicyPathValue = templateFile.toPath();
- templateFile = new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
- actionPolicyPathValue = templateFile.toPath();
- } catch (Exception e1) {
- logger.error("Exception Occured" + e1);
+ @Before
+ public void setUp() {
+ File templateFile;
+ ClassLoader classLoader = getClass().getClassLoader();
+ try {
+ templateFile =
+ new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
+ configPolicyPathValue = templateFile.toPath();
+ templateFile =
+ new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
+ actionPolicyPathValue = templateFile.toPath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured" + e1);
+ }
}
- }
- @SuppressWarnings("static-access")
- @Test
- public void xacmlPolicyWriterTest() throws IOException {
- XACMLPolicyWriter writer = new XACMLPolicyWriter();
- String configResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(configPolicyPathValue);
- assertTrue(configResponseValue.equals("txt"));
- String actionResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(actionPolicyPathValue);
- assertTrue(actionResponseValue.equals("json"));
- }
+ @SuppressWarnings("static-access")
+ @Test
+ public void xacmlPolicyWriterTest() throws IOException {
+ XACMLPolicyWriter writer = new XACMLPolicyWriter();
+ String configResponseValue =
+ writer.changeFileNameInXmlWhenRenamePolicy(configPolicyPathValue);
+ assertTrue(configResponseValue.equals("txt"));
+ String actionResponseValue =
+ writer.changeFileNameInXmlWhenRenamePolicy(actionPolicyPathValue);
+ assertTrue(actionResponseValue.equals("json"));
+ }
+
+ @Test
+ public void testWrites() throws Exception {
+ // Set up test data
+ PolicyType policyType = new PolicyType();
+ OutputStream os = new ByteArrayOutputStream();
+ File tmpfile = File.createTempFile("foo", null);
+ Path filename = tmpfile.toPath();
+ PolicySetType policySet = new PolicySetType();
- @Test
- public void testWrites() throws Exception {
- // Set up test data
- PolicyType policyType = new PolicyType();
- OutputStream os = new ByteArrayOutputStream();
- File tmpfile = File.createTempFile("foo", null);
- Path filename = tmpfile.toPath();
- PolicySetType policySet = new PolicySetType();
-
- // delete tmp file before running the test
- tmpfile.delete();
+ // delete tmp file before running the test
+ tmpfile.delete();
- // ensure its deleted after writePolicyFile() re-creates it
- tmpfile.deleteOnExit();
+ // ensure its deleted after writePolicyFile() re-creates it
+ tmpfile.deleteOnExit();
- // Test write combinations
- assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policySet));
- assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policyType));
- assertNotNull(XACMLPolicyWriter.getXmlAsInputStream(policyType));
- XACMLPolicyWriter.writePolicyFile(os, policySet);
- assertNotNull(os.toString());
- XACMLPolicyWriter.writePolicyFile(os, policyType);
- assertNotNull(os.toString());
- }
+ // Test write combinations
+ assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policySet));
+ assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policyType));
+ assertNotNull(XACMLPolicyWriter.getXmlAsInputStream(policyType));
+ XACMLPolicyWriter.writePolicyFile(os, policySet);
+ assertNotNull(os.toString());
+ XACMLPolicyWriter.writePolicyFile(os, policyType);
+ assertNotNull(os.toString());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/ManualClientEndDMAAPTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/ManualClientEndDMAAPTest.java
index 8c0c6c4e0..b19e07f9d 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/ManualClientEndDMAAPTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/ManualClientEndDMAAPTest.java
@@ -1,15 +1,17 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP Policy Engine
+ * PolicyEngineAPI
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -29,24 +31,24 @@ import org.onap.policy.api.NotificationScheme;
import org.onap.policy.api.PDPNotification;
public class ManualClientEndDMAAPTest {
- @Test
- public void testStaticMethods() {
- // Negative test result
- PDPNotification notification = ManualClientEndDMAAP.result(NotificationScheme.AUTO_ALL_NOTIFICATIONS);
- assertNull(notification);
-
- // Negative test create and start
- String topic = "testTopic";
- String uniqueID = "testID";
- List<String> dmaapList = new ArrayList<String>();
- String aafLogin = "testLogin";
- String aafPassword = "testPassword";
- try {
- ManualClientEndDMAAP.createTopic(topic, uniqueID, dmaapList, aafLogin, aafPassword);
- ManualClientEndDMAAP.start(dmaapList, topic, aafLogin, aafPassword, uniqueID);
- }
- catch (Exception ex) {
- fail("Not expecting any exception: " + ex);
- }
- }
+ @Test
+ public void testStaticMethods() {
+ // Negative test result
+ PDPNotification notification =
+ ManualClientEndDMAAP.result(NotificationScheme.AUTO_ALL_NOTIFICATIONS);
+ assertNull(notification);
+
+ // Negative test create and start
+ String topic = "testTopic";
+ String uniqueID = "testID";
+ List<String> dmaapList = new ArrayList<String>();
+ String aafLogin = "testLogin";
+ String aafPassword = "testPassword";
+ try {
+ ManualClientEndDMAAP.createTopic(topic, uniqueID, dmaapList, aafLogin, aafPassword);
+ ManualClientEndDMAAP.start(dmaapList, topic, aafLogin, aafPassword, uniqueID);
+ } catch (Exception ex) {
+ fail("Not expecting any exception: " + ex);
+ }
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java
index 4ede02806..90e00c2c3 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -111,877 +113,889 @@ import org.springframework.web.client.RestClientException;
@RunWith(PowerMockRunner.class)
public class StdPolicyEngineTest {
- private static final String ONAP_NAME_VAL = "ONAP_NAME";
- private static final String POLICY_VERSION = "1.0.0";
- private static final String POLICY_NAME = "ONAP";
- private static final String COMMENTS = "";
- private static final UUID REQUEST_UUID = UUID.randomUUID();
- private static final String SERVER_NAME = "localhost.com";
- private static final String PDP_PROP_VALUE = "http://localhost:8092/pdp/ , test, test";
- private static final String PDP_PROP_VALUE_1 = "https://localhost:8091/pdp/ , onap, onap";
- private static final String JSON_CONFIGURATION = "{\"name\":\"value\"}";
- private static final String XML_CONFIGURATION =
- "<map><entry><string>name</string><string>value</string></entry></map>";
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static final String CONFIG_PROPERTIES_FILE = "config_pass.properties";
- private static final String INVALID_CONFIG_PROPERTY_FILE = "config_fail.properties";
-
- @Test
- public void testStdPolicyEngineInitialize_noException() throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- creatPropertyFile(file, getDefaultProperties());
-
- final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- assertEquals("TEST", StdPolicyEngine.getEnvironment());
- assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
- assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
- assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME), policyEngine.getNotificationURLList());
- }
-
- @Test
- public void testStdPolicyEngineWithPropertiesInitialize_noException() throws Exception {
- final StdPolicyEngine policyEngine = new StdPolicyEngine(getDefaultProperties(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- assertEquals("TEST", StdPolicyEngine.getEnvironment());
- assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
- assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
- assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME), policyEngine.getNotificationURLList());
- }
-
- @Test
- public void testStdPolicyEngineInitializeWithSingleServerName_noException() throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- creatPropertyFile(file, properties);
-
- final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- assertEquals(Arrays.asList(SERVER_NAME), policyEngine.getNotificationURLList());
- }
-
- @Test
- public void testStdPolicyEngineInitializeWithSingleNotificationType_noException()
- throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- creatPropertyFile(file, properties);
-
- final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- assertEquals(Arrays.asList(UEB), policyEngine.getNotificationType());
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineInitialize_InvalidPropertyFile_Exception()
- throws PolicyEngineException {
- new StdPolicyEngine("Invalid.properties", (String) null);
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineInitialize_InvalidPropertyFileWithExt_Exception()
- throws Exception {
- final File emptyFile = temporaryFolder.newFile("EmptyFile.txt");
- new StdPolicyEngine(emptyFile.toString(), (String) null);
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineInitialize_NullArguments_Exception() throws Exception {
- new StdPolicyEngine((String) null, (String) null);
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineWithPropertiesInitialize_NullArguments_Exception()
- throws Exception {
- new StdPolicyEngine((Properties) null, (String) null);
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineInitialize_PropertyFileMissingMandatoryProperties_Exception()
- throws Exception {
- final File file = temporaryFolder.newFile(INVALID_CONFIG_PROPERTY_FILE);
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
- creatPropertyFile(file, properties);
-
- new StdPolicyEngine(file.toString(), (String) null);
- }
-
- @Test
- public void testStdPolicyEngineInitialize_MultiplePdp_noException() throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME,
- PDP_PROP_VALUE + PolicyConfigConstants.SEMICOLLON + PDP_PROP_VALUE_1);
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- creatPropertyFile(file, properties);
-
- final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
- StdPolicyEngine.rotatePDPList();
- assertEquals("https://localhost:8091/pdp/", StdPolicyEngine.getPDPURL());
- assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
- assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME), policyEngine.getNotificationURLList());
- }
-
- @Test(expected = PolicyEngineException.class)
- public void testStdPolicyEngineInitialize_NoPDP_noException() throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- final Properties properties = new Properties();
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- creatPropertyFile(file, properties);
-
- new StdPolicyEngine(file.toString(), (String) null);
- }
-
- @Test
- public void testStdPolicyEngineInitializeNotificationTypeDMMAP_noException() throws Exception {
- final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
-
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, DMAAP);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- creatPropertyFile(file, properties);
-
- final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
- policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
-
- assertEquals(Arrays.asList(DMAAP), policyEngine.getNotificationType());
-
- }
-
- @Test
- public void testStdPolicyEngineSendEvent_noException() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doReturn(new ResponseEntity<>(getStdPolicyResponse(), HttpStatus.ACCEPTED))
- .when(spyPolicyEngine).callNewPDP(eq(SEND_EVENT_RESOURCE_NAME), any(), any(), any());
-
- final Collection<PolicyResponse> actualPolicyResponses =
+ private static final String ONAP_NAME_VAL = "ONAP_NAME";
+ private static final String POLICY_VERSION = "1.0.0";
+ private static final String POLICY_NAME = "ONAP";
+ private static final String COMMENTS = "";
+ private static final UUID REQUEST_UUID = UUID.randomUUID();
+ private static final String SERVER_NAME = "localhost.com";
+ private static final String PDP_PROP_VALUE = "http://localhost:8092/pdp/ , test, test";
+ private static final String PDP_PROP_VALUE_1 = "https://localhost:8091/pdp/ , onap, onap";
+ private static final String JSON_CONFIGURATION = "{\"name\":\"value\"}";
+ private static final String XML_CONFIGURATION =
+ "<map><entry><string>name</string><string>value</string></entry></map>";
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ private static final String CONFIG_PROPERTIES_FILE = "config_pass.properties";
+ private static final String INVALID_CONFIG_PROPERTY_FILE = "config_fail.properties";
+
+ @Test
+ public void testStdPolicyEngineInitialize_noException() throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ creatPropertyFile(file, getDefaultProperties());
+
+ final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ assertEquals("TEST", StdPolicyEngine.getEnvironment());
+ assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
+ assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
+ assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME),
+ policyEngine.getNotificationURLList());
+ }
+
+ @Test
+ public void testStdPolicyEngineWithPropertiesInitialize_noException() throws Exception {
+ final StdPolicyEngine policyEngine =
+ new StdPolicyEngine(getDefaultProperties(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ assertEquals("TEST", StdPolicyEngine.getEnvironment());
+ assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
+ assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
+ assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME),
+ policyEngine.getNotificationURLList());
+ }
+
+ @Test
+ public void testStdPolicyEngineInitializeWithSingleServerName_noException() throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ creatPropertyFile(file, properties);
+
+ final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ assertEquals(Arrays.asList(SERVER_NAME), policyEngine.getNotificationURLList());
+ }
+
+ @Test
+ public void testStdPolicyEngineInitializeWithSingleNotificationType_noException()
+ throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ creatPropertyFile(file, properties);
+
+ final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ assertEquals(Arrays.asList(UEB), policyEngine.getNotificationType());
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineInitialize_InvalidPropertyFile_Exception()
+ throws PolicyEngineException {
+ new StdPolicyEngine("Invalid.properties", (String) null);
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineInitialize_InvalidPropertyFileWithExt_Exception()
+ throws Exception {
+ final File emptyFile = temporaryFolder.newFile("EmptyFile.txt");
+ new StdPolicyEngine(emptyFile.toString(), (String) null);
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineInitialize_NullArguments_Exception() throws Exception {
+ new StdPolicyEngine((String) null, (String) null);
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineWithPropertiesInitialize_NullArguments_Exception()
+ throws Exception {
+ new StdPolicyEngine((Properties) null, (String) null);
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineInitialize_PropertyFileMissingMandatoryProperties_Exception()
+ throws Exception {
+ final File file = temporaryFolder.newFile(INVALID_CONFIG_PROPERTY_FILE);
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
+ creatPropertyFile(file, properties);
+
+ new StdPolicyEngine(file.toString(), (String) null);
+ }
+
+ @Test
+ public void testStdPolicyEngineInitialize_MultiplePdp_noException() throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME,
+ PDP_PROP_VALUE + PolicyConfigConstants.SEMICOLLON + PDP_PROP_VALUE_1);
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ creatPropertyFile(file, properties);
+
+ final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ assertEquals("http://localhost:8092/pdp/", StdPolicyEngine.getPDPURL());
+ StdPolicyEngine.rotatePDPList();
+ assertEquals("https://localhost:8091/pdp/", StdPolicyEngine.getPDPURL());
+ assertEquals(Arrays.asList(UEB, DMAAP), policyEngine.getNotificationType());
+ assertEquals(Arrays.asList(SERVER_NAME, SERVER_NAME),
+ policyEngine.getNotificationURLList());
+ }
+
+ @Test(expected = PolicyEngineException.class)
+ public void testStdPolicyEngineInitialize_NoPDP_noException() throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ final Properties properties = new Properties();
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ creatPropertyFile(file, properties);
+
+ new StdPolicyEngine(file.toString(), (String) null);
+ }
+
+ @Test
+ public void testStdPolicyEngineInitializeNotificationTypeDMMAP_noException() throws Exception {
+ final File file = temporaryFolder.newFile(CONFIG_PROPERTIES_FILE);
+
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, DMAAP);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ creatPropertyFile(file, properties);
+
+ final StdPolicyEngine policyEngine = new StdPolicyEngine(file.toString(), (String) null);
+ policyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+
+ assertEquals(Arrays.asList(DMAAP), policyEngine.getNotificationType());
+
+ }
+
+ @Test
+ public void testStdPolicyEngineSendEvent_noException() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doReturn(new ResponseEntity<>(getStdPolicyResponse(), HttpStatus.ACCEPTED))
+ .when(spyPolicyEngine)
+ .callNewPDP(eq(SEND_EVENT_RESOURCE_NAME), any(), any(), any());
+
+ final Collection<PolicyResponse> actualPolicyResponses =
+ spyPolicyEngine.sendEvent(Collections.emptyMap(), REQUEST_UUID);
+
+ assertEquals(1, actualPolicyResponses.size());
+
+ }
+
+ @Test(expected = PolicyEventException.class)
+ public void testStdPolicyEngineSendEvent_NullEventRequestParameters_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ spyPolicyEngine.sendEvent((EventRequestParameters) null);
+ }
+
+ @Test(expected = PolicyEventException.class)
+ public void testStdPolicyEngineSendEvent_EventRequestParameters_CallPDPThrow401Exception_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ Mockito.doThrow(new RuntimeException(new RestClientException("Error 401")))
+ .when(spyPolicyEngine).callNewPDP(any(), any(), any(), any());
spyPolicyEngine.sendEvent(Collections.emptyMap(), REQUEST_UUID);
+ }
- assertEquals(1, actualPolicyResponses.size());
+ @Test
+ public void testStdPolicyEngineSendEvent_EventRequestParameters_noException() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- }
+ final ResponseEntity<StdPolicyResponse[]> stubbedResponse =
+ new ResponseEntity<>(getStdPolicyResponse(), HttpStatus.ACCEPTED);
- @Test(expected = PolicyEventException.class)
- public void testStdPolicyEngineSendEvent_NullEventRequestParameters_Exception() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- spyPolicyEngine.sendEvent((EventRequestParameters) null);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(SEND_EVENT_RESOURCE_NAME),
+ any(), any(), any());
- @Test(expected = PolicyEventException.class)
- public void testStdPolicyEngineSendEvent_EventRequestParameters_CallPDPThrow401Exception_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- Mockito.doThrow(new RuntimeException(new RestClientException("Error 401")))
- .when(spyPolicyEngine).callNewPDP(any(), any(), any(), any());
- spyPolicyEngine.sendEvent(Collections.emptyMap(), REQUEST_UUID);
- }
+ final EventRequestParameters eventRequestParameters = new EventRequestParameters();
+ eventRequestParameters.setEventAttributes(Collections.emptyMap());
+ eventRequestParameters.setRequestID(REQUEST_UUID);
- @Test
- public void testStdPolicyEngineSendEvent_EventRequestParameters_noException() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final Collection<PolicyResponse> actualPolicyResponses =
+ spyPolicyEngine.sendEvent(eventRequestParameters);
- final ResponseEntity<StdPolicyResponse[]> stubbedResponse =
- new ResponseEntity<>(getStdPolicyResponse(), HttpStatus.ACCEPTED);
+ assertEquals(1, actualPolicyResponses.size());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(SEND_EVENT_RESOURCE_NAME), any(),
- any(), any());
+ }
- final EventRequestParameters eventRequestParameters = new EventRequestParameters();
- eventRequestParameters.setEventAttributes(Collections.emptyMap());
- eventRequestParameters.setRequestID(REQUEST_UUID);
+ @Test
+ public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigJSON_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- final Collection<PolicyResponse> actualPolicyResponses =
- spyPolicyEngine.sendEvent(eventRequestParameters);
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
+ getAPIPolicyConfigResponse(PolicyType.JSON, JSON_CONFIGURATION),
+ HttpStatus.ACCEPTED);
- assertEquals(1, actualPolicyResponses.size());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- }
+ final Collection<PolicyConfig> actualPolicyResponses =
+ spyPolicyEngine.getConfig(new ConfigRequestParameters());
- @Test
- public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigJSON_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertEquals(1, actualPolicyResponses.size());
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
- getAPIPolicyConfigResponse(PolicyType.JSON, JSON_CONFIGURATION), HttpStatus.ACCEPTED);
+ final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
+ assertNotNull(actualPolicyConfig.toJSON());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ }
- final Collection<PolicyConfig> actualPolicyResponses =
- spyPolicyEngine.getConfig(new ConfigRequestParameters());
+ @Test
+ public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigOther_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertEquals(1, actualPolicyResponses.size());
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
+ getAPIPolicyConfigResponse(PolicyType.OTHER, COMMENTS), HttpStatus.ACCEPTED);
- final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
- assertNotNull(actualPolicyConfig.toJSON());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- }
+ final Collection<PolicyConfig> actualPolicyResponses =
+ spyPolicyEngine.getConfig(new ConfigRequestParameters());
- @Test
- public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigOther_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertEquals(1, actualPolicyResponses.size());
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
- getAPIPolicyConfigResponse(PolicyType.OTHER, COMMENTS), HttpStatus.ACCEPTED);
+ final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
+ assertNotNull(actualPolicyConfig.toOther());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ }
- final Collection<PolicyConfig> actualPolicyResponses =
- spyPolicyEngine.getConfig(new ConfigRequestParameters());
+ @Test
+ public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigXML_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertEquals(1, actualPolicyResponses.size());
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
+ getAPIPolicyConfigResponse(PolicyType.XML, XML_CONFIGURATION), HttpStatus.ACCEPTED);
- final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
- assertNotNull(actualPolicyConfig.toOther());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- }
+ final Collection<PolicyConfig> actualPolicyResponses =
+ spyPolicyEngine.getConfig(new ConfigRequestParameters());
- @Test
- public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigXML_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertEquals(1, actualPolicyResponses.size());
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
- getAPIPolicyConfigResponse(PolicyType.XML, XML_CONFIGURATION), HttpStatus.ACCEPTED);
+ final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
+ assertNotNull(actualPolicyConfig.toXML());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ }
- final Collection<PolicyConfig> actualPolicyResponses =
- spyPolicyEngine.getConfig(new ConfigRequestParameters());
+ @Test
+ public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigProperties_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertEquals(1, actualPolicyResponses.size());
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
+ getAPIPolicyConfigResponse(PolicyType.PROPERTIES, COMMENTS), HttpStatus.ACCEPTED);
- final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
- assertNotNull(actualPolicyConfig.toXML());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- }
+ final Collection<PolicyConfig> actualPolicyResponses =
+ spyPolicyEngine.getConfig(new ConfigRequestParameters());
- @Test
- public void testStdPolicyEngineGetConfig_ConfigRequestParametersPolicyConfigProperties_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertEquals(1, actualPolicyResponses.size());
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse = new ResponseEntity<>(
- getAPIPolicyConfigResponse(PolicyType.PROPERTIES, COMMENTS), HttpStatus.ACCEPTED);
+ final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
+ assertNotNull(actualPolicyConfig.toProperties());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ }
- final Collection<PolicyConfig> actualPolicyResponses =
+ @Test(expected = PolicyConfigException.class)
+ public void testStdPolicyEngineSendEvent_ConfigRequestParameters_CallPDPThrow404Exception_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new RuntimeException(new RestClientException("Error 404"))).when(spyPolicyEngine)
+ .callNewPDP(any(), any(), any(), any());
spyPolicyEngine.getConfig(new ConfigRequestParameters());
+ }
- assertEquals(1, actualPolicyResponses.size());
+ @Test
+ public void testStdPolicyEngineListConfig_ConfigRequestParametersPolicyConfigProperties_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- final PolicyConfig actualPolicyConfig = actualPolicyResponses.iterator().next();
- assertNotNull(actualPolicyConfig.toProperties());
+ final APIPolicyConfigResponse[] apiPolicyConfigResponse =
+ getAPIPolicyConfigResponse(PolicyType.JSON, JSON_CONFIGURATION);
- }
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse =
+ new ResponseEntity<>(apiPolicyConfigResponse, HttpStatus.ACCEPTED);
- @Test(expected = PolicyConfigException.class)
- public void testStdPolicyEngineSendEvent_ConfigRequestParameters_CallPDPThrow404Exception_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new RuntimeException(new RestClientException("Error 404"))).when(spyPolicyEngine)
- .callNewPDP(any(), any(), any(), any());
- spyPolicyEngine.getConfig(new ConfigRequestParameters());
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- @Test
- public void testStdPolicyEngineListConfig_ConfigRequestParametersPolicyConfigProperties_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final Collection<String> actualResponse =
+ spyPolicyEngine.listConfig(new ConfigRequestParameters());
+ assertEquals(1, actualResponse.size());
+ assertNotNull(actualResponse.iterator().next());
- final APIPolicyConfigResponse[] apiPolicyConfigResponse =
- getAPIPolicyConfigResponse(PolicyType.JSON, JSON_CONFIGURATION);
+ }
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse =
- new ResponseEntity<>(apiPolicyConfigResponse, HttpStatus.ACCEPTED);
+ @Test
+ public void testStdPolicyEngineListConfig_ConfigRequestParametersMessageConfigContainsPE300_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ final APIPolicyConfigResponse[] apiPolicyConfigResponse = getAPIPolicyConfigResponse(
+ PolicyType.JSON, JSON_CONFIGURATION, PolicyConfigConstants.PE300);
- final Collection<String> actualResponse =
- spyPolicyEngine.listConfig(new ConfigRequestParameters());
- assertEquals(1, actualResponse.size());
- assertNotNull(actualResponse.iterator().next());
+ final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse =
+ new ResponseEntity<>(apiPolicyConfigResponse, HttpStatus.ACCEPTED);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- @Test
- public void testStdPolicyEngineListConfig_ConfigRequestParametersMessageConfigContainsPE300_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final Collection<String> actualResponse =
+ spyPolicyEngine.listConfig(new ConfigRequestParameters());
- final APIPolicyConfigResponse[] apiPolicyConfigResponse = getAPIPolicyConfigResponse(
- PolicyType.JSON, JSON_CONFIGURATION, PolicyConfigConstants.PE300);
+ assertEquals(1, actualResponse.size());
- final ResponseEntity<APIPolicyConfigResponse[]> stubbedResponse =
- new ResponseEntity<>(apiPolicyConfigResponse, HttpStatus.ACCEPTED);
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_CONFIG_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ @Test
+ public void testStdPolicyEngineListConfig_ConfigRequestParametersWithTestProperty_noException()
+ throws Exception {
+ final Properties defaultProperties = getDefaultProperties();
+ defaultProperties.setProperty(PolicyConfigConstants.JUNIT_PROP_NAME, "test");
+ final StdPolicyEngine spyPolicyEngine =
+ getSpyPolicyEngine("test" + CONFIG_PROPERTIES_FILE, defaultProperties);
- final Collection<String> actualResponse =
- spyPolicyEngine.listConfig(new ConfigRequestParameters());
+ final Collection<String> actualResponse =
+ spyPolicyEngine.listConfig(new ConfigRequestParameters());
- assertEquals(1, actualResponse.size());
+ assertEquals(1, actualResponse.size());
- }
+ }
- @Test
- public void testStdPolicyEngineListConfig_ConfigRequestParametersWithTestProperty_noException()
- throws Exception {
- final Properties defaultProperties = getDefaultProperties();
- defaultProperties.setProperty(PolicyConfigConstants.JUNIT_PROP_NAME, "test");
- final StdPolicyEngine spyPolicyEngine =
- getSpyPolicyEngine("test" + CONFIG_PROPERTIES_FILE, defaultProperties);
+ @Test
+ public void testStdPolicyEnginGetDecision_PolicyDecision_noException() throws Exception {
- final Collection<String> actualResponse =
- spyPolicyEngine.listConfig(new ConfigRequestParameters());
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertEquals(1, actualResponse.size());
+ final ResponseEntity<StdDecisionResponse> stubbedResponse =
+ new ResponseEntity<>(getStdDecisionResponse(), HttpStatus.ACCEPTED);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_DECISION_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- @Test
- public void testStdPolicyEnginGetDecision_PolicyDecision_noException() throws Exception {
+ final DecisionResponse actualResponse =
+ spyPolicyEngine.getDecision(ONAP_NAME_VAL, Collections.emptyMap(), REQUEST_UUID);
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertNotNull(actualResponse);
+ }
- final ResponseEntity<StdDecisionResponse> stubbedResponse =
- new ResponseEntity<>(getStdDecisionResponse(), HttpStatus.ACCEPTED);
+ @Test(expected = PolicyDecisionException.class)
+ public void testStdPolicyEngineGetDecision_PolicyDecision_CallPDPThrow400Exception_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new RuntimeException(new RestClientException("Error 400"))).when(spyPolicyEngine)
+ .callNewPDP(eq(GET_DECISION_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ spyPolicyEngine.getDecision(ONAP_NAME_VAL, Collections.emptyMap(), REQUEST_UUID);
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_DECISION_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ @Test
+ public void testStdPolicyEnginGetDecision_DecisionRequestParameters_noException()
+ throws Exception {
- final DecisionResponse actualResponse =
- spyPolicyEngine.getDecision(ONAP_NAME_VAL, Collections.emptyMap(), REQUEST_UUID);
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- }
+ final ResponseEntity<StdDecisionResponse> stubbedResponse =
+ new ResponseEntity<>(getStdDecisionResponse(), HttpStatus.ACCEPTED);
- @Test(expected = PolicyDecisionException.class)
- public void testStdPolicyEngineGetDecision_PolicyDecision_CallPDPThrow400Exception_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new RuntimeException(new RestClientException("Error 400"))).when(spyPolicyEngine)
- .callNewPDP(eq(GET_DECISION_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
- spyPolicyEngine.getDecision(ONAP_NAME_VAL, Collections.emptyMap(), REQUEST_UUID);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_DECISION_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- @Test
- public void testStdPolicyEnginGetDecision_DecisionRequestParameters_noException()
- throws Exception {
+ final DecisionRequestParameters requestParameters = new DecisionRequestParameters();
+ requestParameters.setOnapName(ONAP_NAME_VAL);
+ requestParameters.setRequestID(REQUEST_UUID);
+ requestParameters.setDecisionAttributes(Collections.emptyMap());
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final DecisionResponse actualResponse = spyPolicyEngine.getDecision(requestParameters);
- final ResponseEntity<StdDecisionResponse> stubbedResponse =
- new ResponseEntity<>(getStdDecisionResponse(), HttpStatus.ACCEPTED);
+ assertNotNull(actualResponse);
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_DECISION_RESOURCE_NAME),
- eq(HttpMethod.POST), any(), any());
+ @Test(expected = PolicyDecisionException.class)
+ public void ttestStdPolicyEnginGetDecision_NullDecisionRequestParameters_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ spyPolicyEngine.getDecision((DecisionRequestParameters) null);
+ }
- final DecisionRequestParameters requestParameters = new DecisionRequestParameters();
- requestParameters.setOnapName(ONAP_NAME_VAL);
- requestParameters.setRequestID(REQUEST_UUID);
- requestParameters.setDecisionAttributes(Collections.emptyMap());
+ @Test
+ public void testStdPolicyEnginGetMetrics_MetricsRequestParameters_noException()
+ throws Exception {
- final DecisionResponse actualResponse = spyPolicyEngine.getDecision(requestParameters);
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Metrics", HttpStatus.ACCEPTED);
- @Test(expected = PolicyDecisionException.class)
- public void ttestStdPolicyEnginGetDecision_NullDecisionRequestParameters_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- spyPolicyEngine.getDecision((DecisionRequestParameters) null);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_METRICS_RESOURCE_NAME),
+ eq(HttpMethod.GET), any(), any());
- @Test
- public void testStdPolicyEnginGetMetrics_MetricsRequestParameters_noException() throws Exception {
+ final MetricsResponse actualResponse =
+ spyPolicyEngine.getMetrics(new MetricsRequestParameters());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.ACCEPTED.value(), actualResponse.getResponseCode());
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ }
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Metrics", HttpStatus.ACCEPTED);
+ @Test
+ public void testStdPolicyEngineGetMetrics_MetricsRequestParametersCallPDPThrowHttpException_ResponseWithHttpCode()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new PolicyException(new HttpClientErrorException(HttpStatus.BAD_GATEWAY)))
+ .when(spyPolicyEngine)
+ .callNewPDP(eq(GET_METRICS_RESOURCE_NAME), eq(HttpMethod.GET), any(), any());
+
+ final MetricsResponse actualResponse =
+ spyPolicyEngine.getMetrics(new MetricsRequestParameters());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.BAD_GATEWAY.value(), actualResponse.getResponseCode());
+
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(GET_METRICS_RESOURCE_NAME),
- eq(HttpMethod.GET), any(), any());
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEngineGetMetrics_MetricsRequestParametersCallPDPThrowPolicyException_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(PolicyException.class).when(spyPolicyEngine)
+ .callNewPDP(eq(GET_METRICS_RESOURCE_NAME), eq(HttpMethod.GET), any(), any());
- final MetricsResponse actualResponse =
spyPolicyEngine.getMetrics(new MetricsRequestParameters());
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.ACCEPTED.value(), actualResponse.getResponseCode());
- }
+ }
- @Test
- public void testStdPolicyEngineGetMetrics_MetricsRequestParametersCallPDPThrowHttpException_ResponseWithHttpCode()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new PolicyException(new HttpClientErrorException(HttpStatus.BAD_GATEWAY)))
- .when(spyPolicyEngine)
- .callNewPDP(eq(GET_METRICS_RESOURCE_NAME), eq(HttpMethod.GET), any(), any());
+ @Test
+ public void testStdPolicyEnginPushPolicy_PushPolicyParameters_noException() throws Exception {
- final MetricsResponse actualResponse =
- spyPolicyEngine.getMetrics(new MetricsRequestParameters());
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.BAD_GATEWAY.value(), actualResponse.getResponseCode());
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test(expected = PolicyException.class)
- public void testStdPolicyEngineGetMetrics_MetricsRequestParametersCallPDPThrowPolicyException_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(PolicyException.class).when(spyPolicyEngine).callNewPDP(eq(GET_METRICS_RESOURCE_NAME),
- eq(HttpMethod.GET), any(), any());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- spyPolicyEngine.getMetrics(new MetricsRequestParameters());
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.pushPolicy(new PushPolicyParameters());
- }
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- @Test
- public void testStdPolicyEnginPushPolicy_PushPolicyParameters_noException() throws Exception {
+ @Test
+ public void testStdPolicyEnginePushPolicy_PushPolicyParametersThrowsHttpClientErrorException_ResponseWithHttpCode()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new PolicyException(new HttpClientErrorException(HttpStatus.BAD_GATEWAY)))
+ .when(spyPolicyEngine)
+ .callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.pushPolicy(new PushPolicyParameters());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.BAD_GATEWAY.value(), actualResponse.getResponseCode());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ }
+
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEnginePushPolicy_PushPolicyParameters_Exception() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(PolicyException.class).when(spyPolicyEngine)
+ .callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
- final PolicyChangeResponse actualResponse =
spyPolicyEngine.pushPolicy(new PushPolicyParameters());
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ }
- @Test
- public void testStdPolicyEnginePushPolicy_PushPolicyParametersThrowsHttpClientErrorException_ResponseWithHttpCode()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new PolicyException(new HttpClientErrorException(HttpStatus.BAD_GATEWAY)))
- .when(spyPolicyEngine)
- .callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
+ @Test
+ public void testStdPolicyEnginDeletePolicy_DeletePolicyParameters_noException()
+ throws Exception {
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.pushPolicy(new PushPolicyParameters());
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
+
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(DELETE_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.DELETE), any(), any());
+
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.deletePolicy(new DeletePolicyParameters());
+
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
+
+ @Test
+ public void testStdPolicyEnginGetDictionaryItem_DictionaryParameters_noException()
+ throws Exception {
+
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+
+ final ResponseEntity<APIDictionaryResponse> stubbedResponse =
+ new ResponseEntity<>(getAPIDictionaryResponse(), HttpStatus.OK);
+
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(
+ eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+
+ final DictionaryResponse actualResponse =
+ spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
+
+ assertNotNull(actualResponse);
+ }
+
+ @Test
+ public void testStdPolicyGetDictionaryItem_DictionaryParametersWithHttp400ExceptionThrown_ResponseWithHttpCode()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new RuntimeException(
+ new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Error 400")))
+ .when(spyPolicyEngine).callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.BAD_GATEWAY.value(), actualResponse.getResponseCode());
+ final DictionaryResponse actualResponse =
+ spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
- }
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.BAD_REQUEST.value(), actualResponse.getResponseCode());
- @Test(expected = PolicyException.class)
- public void testStdPolicyEnginePushPolicy_PushPolicyParameters_Exception() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(PolicyException.class).when(spyPolicyEngine).callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ }
- spyPolicyEngine.pushPolicy(new PushPolicyParameters());
+ @Test
+ public void testStdPolicyGetDictionaryItem_DictionaryParametersWithHttp401ExceptionThrown_ResponseWithHttpCode()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new RuntimeException(
+ new HttpClientErrorException(HttpStatus.UNAUTHORIZED, "Error 401")))
+ .when(spyPolicyEngine).callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- }
+ final DictionaryResponse actualResponse =
+ spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
- @Test
- public void testStdPolicyEnginDeletePolicy_DeletePolicyParameters_noException() throws Exception {
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.UNAUTHORIZED.value(), actualResponse.getResponseCode());
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ }
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ @Test
+ public void testStdPolicyGetDictionaryItem_DictionaryParametersWithRunTimeExceptionThrown_ResponseWithHttpCode()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doThrow(new RuntimeException(
+ new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Error")))
+ .when(spyPolicyEngine).callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME),
+ eq(HttpMethod.POST), any(), any());
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(DELETE_POLICY_RESOURCE_NAME),
- eq(HttpMethod.DELETE), any(), any());
+ final DictionaryResponse actualResponse =
+ spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.deletePolicy(new DeletePolicyParameters());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), actualResponse.getResponseCode());
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ }
- @Test
- public void testStdPolicyEnginGetDictionaryItem_DictionaryParameters_noException()
- throws Exception {
+ @Test
+ public void testStdPolicyEnginCreateDictionaryItem_DictionaryParameters_noException()
+ throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- final ResponseEntity<APIDictionaryResponse> stubbedResponse =
- new ResponseEntity<>(getAPIDictionaryResponse(), HttpStatus.OK);
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- doReturn(stubbedResponse).when(spyPolicyEngine)
- .callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(
+ eq(CREATE_DICTIONARY_ITEM_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
- final DictionaryResponse actualResponse =
- spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.createDictionaryItem(new DictionaryParameters());
- assertNotNull(actualResponse);
- }
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- @Test
- public void testStdPolicyGetDictionaryItem_DictionaryParametersWithHttp400ExceptionThrown_ResponseWithHttpCode()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new RuntimeException(new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Error 400")))
- .when(spyPolicyEngine)
- .callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ @Test
+ public void testStdPolicyEnginUpdateDictionaryItem_DictionaryParameters_noException()
+ throws Exception {
- final DictionaryResponse actualResponse =
- spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.BAD_REQUEST.value(), actualResponse.getResponseCode());
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- }
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(
+ eq(UPDATE_DICTIONARY_ITEM_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
- @Test
- public void testStdPolicyGetDictionaryItem_DictionaryParametersWithHttp401ExceptionThrown_ResponseWithHttpCode()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(
- new RuntimeException(new HttpClientErrorException(HttpStatus.UNAUTHORIZED, "Error 401")))
- .when(spyPolicyEngine)
- .callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.updateDictionaryItem(new DictionaryParameters());
- final DictionaryResponse actualResponse =
- spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.UNAUTHORIZED.value(), actualResponse.getResponseCode());
+ @Test
+ public void testStdPolicyEnginPolicyEngineImport_ImportParameters_noException()
+ throws Exception {
+ final File emptyfile = temporaryFolder.newFile("emptyFile.txt");
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test
- public void testStdPolicyGetDictionaryItem_DictionaryParametersWithRunTimeExceptionThrown_ResponseWithHttpCode()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doThrow(new RuntimeException(
- new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Error")))
- .when(spyPolicyEngine)
- .callNewPDP(eq(GET_DICTIONARY_ITEMS_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(
+ eq(POLICY_ENGINE_IMPORT_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
- final DictionaryResponse actualResponse =
- spyPolicyEngine.getDictionaryItem(new DictionaryParameters());
+ final ImportParameters importParameters = new ImportParameters();
+ importParameters.setFilePath(emptyfile.toString());
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.policyEngineImport(importParameters);
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), actualResponse.getResponseCode());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- }
+ @Test
+ public void testStdPolicyEnginCreatePolicy_PolicyParameters_noException() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- @Test
- public void testStdPolicyEnginCreateDictionaryItem_DictionaryParameters_noException()
- throws Exception {
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(CREATE_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.createPolicy(new PolicyParameters());
- doReturn(stubbedResponse).when(spyPolicyEngine)
- .callNewPDP(eq(CREATE_DICTIONARY_ITEM_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.createDictionaryItem(new DictionaryParameters());
+ @Test
+ public void testStdPolicyEnginUpdatePolicy_PolicyParameters_noException() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test
- public void testStdPolicyEnginUpdateDictionaryItem_DictionaryParameters_noException()
- throws Exception {
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ final PolicyChangeResponse actualResponse =
+ spyPolicyEngine.updatePolicy(new PolicyParameters());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ assertNotNull(actualResponse);
+ assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine)
- .callNewPDP(eq(UPDATE_DICTIONARY_ITEM_RESOURCE_NAME), eq(HttpMethod.PUT), any(), any());
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEnginPushPolicy_NullValues_Exception() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.updateDictionaryItem(new DictionaryParameters());
+ spyPolicyEngine.pushPolicy(null, null, null, null, null);
+ }
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEnginPushPolicy_EmptyPolicyScope_Exception() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- @Test
- public void testStdPolicyEnginPolicyEngineImport_ImportParameters_noException() throws Exception {
- final File emptyfile = temporaryFolder.newFile("emptyFile.txt");
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ spyPolicyEngine.pushPolicy("", null, null, null, null);
+ }
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEnginPushPolicy_EmptyPolicyName_Exception() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- doReturn(stubbedResponse).when(spyPolicyEngine)
- .callNewPDP(eq(POLICY_ENGINE_IMPORT_RESOURCE_NAME), eq(HttpMethod.POST), any(), any());
+ spyPolicyEngine.pushPolicy("POLICY_SCOPE", "", null, null, null);
+ }
- final ImportParameters importParameters = new ImportParameters();
- importParameters.setFilePath(emptyfile.toString());
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.policyEngineImport(importParameters);
+ @Test
+ public void testStdPolicyEnginPushPolicy_PolicyParameters_noException() throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test
- public void testStdPolicyEnginCreatePolicy_PolicyParameters_noException() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ final String actualResponse = spyPolicyEngine.pushPolicy("POLICY_SCOPE", ONAP_NAME_VAL,
+ "POLICY_TYPE", "POLICY_GROUP", REQUEST_UUID);
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(CREATE_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ assertNotNull(actualResponse);
+ }
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.createPolicy(new PolicyParameters());
+ @Test
+ public void testStdPolicyEnginCreateUpdateConfigPolicy_PolicyParameters_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test
- public void testStdPolicyEnginUpdatePolicy_PolicyParameters_noException() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ final String actualResponse = spyPolicyEngine.createUpdateConfigPolicy("POLICY_NAME",
+ ONAP_NAME_VAL, ONAP_NAME_VAL, "CONFIG_NAME", Collections.emptyMap(),
+ PolicyType.JSON.toString().toUpperCase(), "", "POLICY_SCOPE", REQUEST_UUID, "", "",
+ "", new Date().toString(), true);
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ assertNotNull(actualResponse);
+ }
- final PolicyChangeResponse actualResponse =
- spyPolicyEngine.updatePolicy(new PolicyParameters());
+ @Test(expected = PolicyException.class)
+ public void testStdPolicyEnginCreateUpdateConfigPolicy_NullPolicyName_Exception()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- assertNotNull(actualResponse);
- assertEquals(HttpStatus.OK.value(), actualResponse.getResponseCode());
- }
+ spyPolicyEngine.createUpdateConfigPolicy(null, null, null, null, null, null, null, null,
+ null, null, null, null, null, true);
+ }
- @Test(expected = PolicyException.class)
- public void testStdPolicyEnginPushPolicy_NullValues_Exception() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ @Test
+ public void testStdPolicyEnginCreateUpdateConfigFirewallPolicy_PolicyParameters_noException()
+ throws Exception {
+ final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
- spyPolicyEngine.pushPolicy(null, null, null, null, null);
- }
+ final ResponseEntity<String> stubbedResponse =
+ new ResponseEntity<>("Successful", HttpStatus.OK);
- @Test(expected = PolicyException.class)
- public void testStdPolicyEnginPushPolicy_EmptyPolicyScope_Exception() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
+ eq(HttpMethod.PUT), any(), any());
- spyPolicyEngine.pushPolicy("", null, null, null, null);
- }
+ final String actualResponse = spyPolicyEngine.createUpdateConfigFirewallPolicy(
+ "POLICY_NAME", getJsonObject(JSON_CONFIGURATION), "POLICY_SCOPE", REQUEST_UUID, "",
+ "", "", new Date().toString(), true);
- @Test(expected = PolicyException.class)
- public void testStdPolicyEnginPushPolicy_EmptyPolicyName_Exception() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ assertNotNull(actualResponse);
+ }
- spyPolicyEngine.pushPolicy("POLICY_SCOPE", "", null, null, null);
- }
+ private JsonObject getJsonObject(final String jsonString) {
+ try (final JsonReader jsonReader = Json.createReader(new StringReader(jsonString));) {
+ return jsonReader.readObject();
+ }
+ }
- @Test
- public void testStdPolicyEnginPushPolicy_PolicyParameters_noException() throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ private StdPolicyEngine getSpyPolicyEngine() throws IOException, PolicyEngineException {
+ return getSpyPolicyEngine(CONFIG_PROPERTIES_FILE, getDefaultProperties());
+ }
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ private StdPolicyEngine getSpyPolicyEngine(final String filename, final Properties properties)
+ throws IOException, PolicyEngineException {
+ final File file = temporaryFolder.newFile(filename);
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(PUSH_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ creatPropertyFile(file, properties);
- final String actualResponse = spyPolicyEngine.pushPolicy("POLICY_SCOPE", ONAP_NAME_VAL,
- "POLICY_TYPE", "POLICY_GROUP", REQUEST_UUID);
+ final StdPolicyEngine spyPolicyEngine =
+ spy(new StdPolicyEngine(file.toString(), (String) null));
+ spyPolicyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
+ return spyPolicyEngine;
+ }
- assertNotNull(actualResponse);
- }
+ private Properties getDefaultProperties() {
+ final Properties properties = new Properties();
+ properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
+ properties.setProperty(CLIENT_ID_PROP_NAME, "test");
+ properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
+ properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
+ properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
+ properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
+ properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
+ properties.setProperty(PolicyConfigConstants.JUNIT_PROP_NAME, "false");
+ return properties;
+ }
- @Test
- public void testStdPolicyEnginCreateUpdateConfigPolicy_PolicyParameters_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ private StdDecisionResponse getStdDecisionResponse() {
+ final StdDecisionResponse response = new StdDecisionResponse();
+ response.setDecision(PolicyDecision.PERMIT);
+ response.setDetails(PolicyDecision.PERMIT.name());
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
+ return response;
+ }
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
+ private APIDictionaryResponse getAPIDictionaryResponse() {
+ final APIDictionaryResponse response = new APIDictionaryResponse();
+ response.setResponseCode(0);
+ response.setResponseMessage("");
+ response.setDictionaryData(Collections.<String, String>emptyMap());
+ response.setDictionaryJson(Collections.<String, String>emptyMap());
+ return response;
+ }
- final String actualResponse =
- spyPolicyEngine.createUpdateConfigPolicy("POLICY_NAME", ONAP_NAME_VAL, ONAP_NAME_VAL,
- "CONFIG_NAME", Collections.emptyMap(), PolicyType.JSON.toString().toUpperCase(), "",
- "POLICY_SCOPE", REQUEST_UUID, "", "", "", new Date().toString(), true);
+ private StdPolicyResponse[] getStdPolicyResponse() {
+ final StdPolicyResponse response = new StdPolicyResponse();
+ response.setPolicyResponseStatus(PolicyResponseStatus.ACTION_TAKEN);
+ return new StdPolicyResponse[] {response};
+ }
+
+ private void creatPropertyFile(final File file, final Properties properties)
+ throws IOException {
+ try (final BufferedWriter bufferedWriter = Files.newBufferedWriter(file.toPath());) {
+ properties.store(bufferedWriter, COMMENTS);
+ }
+ }
- assertNotNull(actualResponse);
- }
+ private APIPolicyConfigResponse[] getAPIPolicyConfigResponse(final PolicyType policyType,
+ final String configuration) {
- @Test(expected = PolicyException.class)
- public void testStdPolicyEnginCreateUpdateConfigPolicy_NullPolicyName_Exception()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ return getAPIPolicyConfigResponse(policyType, configuration, null);
+ }
- spyPolicyEngine.createUpdateConfigPolicy(null, null, null, null, null, null, null, null, null,
- null, null, null, null, true);
- }
-
- @Test
- public void testStdPolicyEnginCreateUpdateConfigFirewallPolicy_PolicyParameters_noException()
- throws Exception {
- final StdPolicyEngine spyPolicyEngine = getSpyPolicyEngine();
+ private APIPolicyConfigResponse[] getAPIPolicyConfigResponse(final PolicyType policyType,
+ final String configuration, final String policyConfigMessage) {
+ final APIPolicyConfigResponse configResponse = new APIPolicyConfigResponse();
+ configResponse.setConfig(configuration);
+ configResponse.setMatchingConditions(getMatchingConditions());
+ configResponse.setPolicyConfigStatus(PolicyConfigStatus.CONFIG_RETRIEVED);
+ configResponse.setPolicyName(POLICY_NAME);
+ configResponse.setPolicyType(PolicyConfigType.BRMS_RAW);
+ configResponse.setType(policyType);
+ configResponse.setPolicyVersion(POLICY_VERSION);
+ configResponse.setProperty(Collections.emptyMap());
+ configResponse.setPolicyConfigMessage(policyConfigMessage);
+
+ return new APIPolicyConfigResponse[] {configResponse};
+ }
- final ResponseEntity<String> stubbedResponse =
- new ResponseEntity<>("Successful", HttpStatus.OK);
-
- doReturn(stubbedResponse).when(spyPolicyEngine).callNewPDP(eq(UPDATE_POLICY_RESOURCE_NAME),
- eq(HttpMethod.PUT), any(), any());
-
- final String actualResponse = spyPolicyEngine.createUpdateConfigFirewallPolicy("POLICY_NAME",
- getJsonObject(JSON_CONFIGURATION), "POLICY_SCOPE", REQUEST_UUID, "", "", "",
- new Date().toString(), true);
-
- assertNotNull(actualResponse);
- }
-
- private JsonObject getJsonObject(final String jsonString) {
- try (final JsonReader jsonReader = Json.createReader(new StringReader(jsonString));) {
- return jsonReader.readObject();
- }
- }
-
- private StdPolicyEngine getSpyPolicyEngine() throws IOException, PolicyEngineException {
- return getSpyPolicyEngine(CONFIG_PROPERTIES_FILE, getDefaultProperties());
- }
-
- private StdPolicyEngine getSpyPolicyEngine(final String filename, final Properties properties)
- throws IOException, PolicyEngineException {
- final File file = temporaryFolder.newFile(filename);
-
- creatPropertyFile(file, properties);
-
- final StdPolicyEngine spyPolicyEngine =
- spy(new StdPolicyEngine(file.toString(), (String) null));
- spyPolicyEngine.setScheme(NotificationScheme.MANUAL_NOTIFICATIONS);
- return spyPolicyEngine;
- }
-
- private Properties getDefaultProperties() {
- final Properties properties = new Properties();
- properties.setProperty(PDP_URL_PROP_NAME, PDP_PROP_VALUE);
- properties.setProperty(CLIENT_ID_PROP_NAME, "test");
- properties.setProperty(CLIENT_KEY_PROP_NAME, "test");
- properties.setProperty(NOTIFICATION_TYPE_PROP_NAME, UEB + COMMA + DMAAP);
- properties.setProperty(NOTIFICATION_SERVERS_PROP_NAME, SERVER_NAME + COMMA + SERVER_NAME);
- properties.setProperty(NOTIFICATION_TOPIC_PROP_NAME, "test");
- properties.setProperty(ENVIRONMENT_PROP_NAME, "TEST");
- properties.setProperty(PolicyConfigConstants.JUNIT_PROP_NAME, "false");
- return properties;
- }
-
- private StdDecisionResponse getStdDecisionResponse() {
- final StdDecisionResponse response = new StdDecisionResponse();
- response.setDecision(PolicyDecision.PERMIT);
- response.setDetails(PolicyDecision.PERMIT.name());
-
- return response;
- }
-
- private APIDictionaryResponse getAPIDictionaryResponse() {
- final APIDictionaryResponse response = new APIDictionaryResponse();
- response.setResponseCode(0);
- response.setResponseMessage("");
- response.setDictionaryData(Collections.<String, String>emptyMap());
- response.setDictionaryJson(Collections.<String, String>emptyMap());
- return response;
- }
-
- private StdPolicyResponse[] getStdPolicyResponse() {
- final StdPolicyResponse response = new StdPolicyResponse();
- response.setPolicyResponseStatus(PolicyResponseStatus.ACTION_TAKEN);
- return new StdPolicyResponse[] {response};
- }
-
- private void creatPropertyFile(final File file, final Properties properties) throws IOException {
- try (final BufferedWriter bufferedWriter = Files.newBufferedWriter(file.toPath());) {
- properties.store(bufferedWriter, COMMENTS);
- }
- }
-
- private APIPolicyConfigResponse[] getAPIPolicyConfigResponse(final PolicyType policyType,
- final String configuration) {
-
- return getAPIPolicyConfigResponse(policyType, configuration, null);
- }
-
- private APIPolicyConfigResponse[] getAPIPolicyConfigResponse(final PolicyType policyType,
- final String configuration, final String policyConfigMessage) {
- final APIPolicyConfigResponse configResponse = new APIPolicyConfigResponse();
- configResponse.setConfig(configuration);
- configResponse.setMatchingConditions(getMatchingConditions());
- configResponse.setPolicyConfigStatus(PolicyConfigStatus.CONFIG_RETRIEVED);
- configResponse.setPolicyName(POLICY_NAME);
- configResponse.setPolicyType(PolicyConfigType.BRMS_RAW);
- configResponse.setType(policyType);
- configResponse.setPolicyVersion(POLICY_VERSION);
- configResponse.setProperty(Collections.emptyMap());
- configResponse.setPolicyConfigMessage(policyConfigMessage);
-
- return new APIPolicyConfigResponse[] {configResponse};
- }
-
- private Map<String, String> getMatchingConditions() {
- final Map<String, String> attributes = new HashMap<>();
- attributes.put(ONAP_NAME, POLICY_NAME);
- attributes.put(CONFIG_NAME, "Configuration_name");
- return attributes;
- }
+ private Map<String, String> getMatchingConditions() {
+ final Map<String, String> attributes = new HashMap<>();
+ attributes.put(ONAP_NAME, POLICY_NAME);
+ attributes.put(CONFIG_NAME, "Configuration_name");
+ return attributes;
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java
index eef76bdd7..b6b9c4a95 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/AutoClientUEBTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,164 +24,158 @@ package org.onap.policy.std.test;
import java.util.LinkedList;
import java.util.List;
-
import org.junit.*;
import org.onap.policy.api.NotificationHandler;
import org.onap.policy.api.NotificationScheme;
import org.onap.policy.std.AutoClientUEB;
-
import static org.junit.Assert.*;
/**
- * The class <code>AutoClientUEBTest</code> contains tests for the class <code>{@link AutoClientUEB}</code>.
+ * The class <code>AutoClientUEBTest</code> contains tests for the class
+ * <code>{@link AutoClientUEB}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class AutoClientUEBTest {
- /**
- * Run the AutoClientUEB(String,List<String>) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testAutoClientUEB_1()
- throws Exception {
- String url = "";
- String apiKey = "";
- String apiSecret = "";
- List<String> uebURLList = new LinkedList<String>();
-
- AutoClientUEB result = new AutoClientUEB(url, uebURLList, apiKey, apiSecret);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.ExceptionInInitializerError
- // at org.apache.log4j.Logger.getLogger(Logger.java:104)
- // at org.onap.policy.std.AutoClientUEB.<clinit>(AutoClientUEB.java:39)
- assertNotNull(result);
- }
-
- /**
- * Run the String getNotficationType() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetNotficationType_1()
- throws Exception {
-
- String result = AutoClientUEB.getNotficationType();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB
- assertNull(result);
- }
-
- /**
- * Run the boolean getStatus() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetStatus_1()
- throws Exception {
-
- boolean result = AutoClientUEB.getStatus();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB
- assertFalse(result);
- }
-
- /**
- * Run the String getURL() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetURL_1()
- throws Exception {
-
- String result = AutoClientUEB.getURL();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB
- assertNotNull(result);
- }
-
- /**
- * Run the void setScheme(NotificationScheme) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetScheme_1()
- throws Exception {
- NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
-
- AutoClientUEB.setScheme(scheme);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.AutoClientUEB
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add set up code here
- List<String> urlList = new LinkedList<String>();
- urlList.add("test2.com");
- @SuppressWarnings("unused")
+ /**
+ * Run the AutoClientUEB(String,List<String>) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testAutoClientUEB_1() throws Exception {
+ String url = "";
+ String apiKey = "";
+ String apiSecret = "";
+ List<String> uebURLList = new LinkedList<String>();
+
+ AutoClientUEB result = new AutoClientUEB(url, uebURLList, apiKey, apiSecret);
+
+ // add additional test code here
+ // An unexpected exception was thrown in user code while executing this test:
+ // java.lang.ExceptionInInitializerError
+ // at org.apache.log4j.Logger.getLogger(Logger.java:104)
+ // at org.onap.policy.std.AutoClientUEB.<clinit>(AutoClientUEB.java:39)
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getNotficationType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetNotficationType_1() throws Exception {
+
+ String result = AutoClientUEB.getNotficationType();
+
+ // add additional test code here
+ // An unexpected exception was thrown in user code while executing this test:
+ // java.lang.NoClassDefFoundError: Could not initialize class
+ // org.onap.policy.std.AutoClientUEB
+ assertNull(result);
+ }
+
+ /**
+ * Run the boolean getStatus() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetStatus_1() throws Exception {
+
+ boolean result = AutoClientUEB.getStatus();
+
+ // add additional test code here
+ // An unexpected exception was thrown in user code while executing this test:
+ // java.lang.NoClassDefFoundError: Could not initialize class
+ // org.onap.policy.std.AutoClientUEB
+ assertFalse(result);
+ }
+
+ /**
+ * Run the String getURL() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetURL_1() throws Exception {
+
+ String result = AutoClientUEB.getURL();
+
+ // add additional test code here
+ // An unexpected exception was thrown in user code while executing this test:
+ // java.lang.NoClassDefFoundError: Could not initialize class
+ // org.onap.policy.std.AutoClientUEB
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the void setScheme(NotificationScheme) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetScheme_1() throws Exception {
+ NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
+
+ AutoClientUEB.setScheme(scheme);
+
+ // add additional test code here
+ // An unexpected exception was thrown in user code while executing this test:
+ // java.lang.NoClassDefFoundError: Could not initialize class
+ // org.onap.policy.std.AutoClientUEB
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add set up code here
+ List<String> urlList = new LinkedList<String>();
+ urlList.add("test2.com");
+ @SuppressWarnings("unused")
AutoClientUEB client = new AutoClientUEB("test.com", urlList, "testKey", "testSecret");
- NotificationHandler handler = null;
- AutoClientUEB.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(AutoClientUEBTest.class);
- }
+ NotificationHandler handler = null;
+ AutoClientUEB.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(AutoClientUEBTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/DummyNotificationHandler.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/DummyNotificationHandler.java
index cdc717597..7cfe92541 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/DummyNotificationHandler.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/DummyNotificationHandler.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,7 +23,6 @@
package org.onap.policy.std.test;
import java.util.Collection;
-
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationHandler;
import org.onap.policy.api.NotificationType;
@@ -35,92 +36,95 @@ import org.onap.policy.api.RemovedPolicy;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-public class DummyNotificationHandler implements NotificationHandler{
-
- private static final Logger LOGGER = FlexLogger.getLogger(DummyNotificationHandler.class);
-
- @Override
- public void notificationReceived(PDPNotification notification) {
- System.out.println("Notification Received...");
- System.out.println(notification.getNotificationType());
- if(notification.getNotificationType().equals(NotificationType.REMOVE)){
- System.out.println("Removed Policies: \n");
- for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
- System.out.println(removedPolicy.getPolicyName());
- System.out.println(removedPolicy.getVersionNo());
- }
- }else if(notification.getNotificationType().equals(NotificationType.UPDATE)){
- System.out.println("Updated Policies: \n");
- for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
- System.out.println("policyName : " + updatedPolicy.getPolicyName());
- System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
- if(updatedPolicy.getPolicyName().contains(".Config_")){
- System.out.println("Matches: " + updatedPolicy.getMatches());
- System.out.println("UpdateType: "+ updatedPolicy.getUpdateType());
- // Checking the Name is correct or not.
- try {
- PolicyEngine policyEngine = new PolicyEngine("config.properties");
- @SuppressWarnings("deprecation")
- Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
- for(PolicyConfig policyConfig: policyConfigs){
- if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){
- System.out.println("Policy Retrieved with this Name notified. ");
- }else{
- System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
- }
- // Also Test this case.
- if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){
- System.out.println("Policy Name is good. ");
- }else{
- System.err.println("\n\n Fail to check Name \n\n");
- }
- }
- } catch (PolicyEngineException e) {
- LOGGER.error("Exception Occured"+e);
- } catch (PolicyConfigException e) {
- LOGGER.error("Exception Occured"+e);
- }
- }
- }
- }else if(notification.getNotificationType().equals(NotificationType.BOTH)){
- System.out.println("Both updated and Removed Notification: \n");
- System.out.println("Removed Policies: \n");
- for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
- System.out.println(removedPolicy.getPolicyName());
- System.out.println(removedPolicy.getVersionNo());
- }
- System.out.println("Updated Policies: \n");
- for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
- System.out.println("policyName : " + updatedPolicy.getPolicyName());
- System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
- System.out.println("Matches: " + updatedPolicy.getMatches());
- System.out.println("UpdateType: "+ updatedPolicy.getUpdateType());
- // Checking the Name is correct or not.
- try {
- PolicyEngine policyEngine = new PolicyEngine("config.properties");
- @SuppressWarnings("deprecation")
- Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
- for(PolicyConfig policyConfig: policyConfigs){
- if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){
- System.out.println("Policy Retrieved with this Name notified. ");
- }else{
- System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
- }
- // Also Test this case.
- if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){
- System.out.println("Policy Name is good. ");
- }else{
- System.err.println("\n\n Fail to check Name \n\n");
- }
- }
- } catch (PolicyEngineException e) {
- LOGGER.error("Exception Occured"+e);
- } catch (PolicyConfigException e) {
- LOGGER.error("Exception Occured"+e);
- }
- }
- }
- }
+public class DummyNotificationHandler implements NotificationHandler {
+ private static final Logger LOGGER = FlexLogger.getLogger(DummyNotificationHandler.class);
+ @Override
+ public void notificationReceived(PDPNotification notification) {
+ System.out.println("Notification Received...");
+ System.out.println(notification.getNotificationType());
+ if (notification.getNotificationType().equals(NotificationType.REMOVE)) {
+ System.out.println("Removed Policies: \n");
+ for (RemovedPolicy removedPolicy : notification.getRemovedPolicies()) {
+ System.out.println(removedPolicy.getPolicyName());
+ System.out.println(removedPolicy.getVersionNo());
+ }
+ } else if (notification.getNotificationType().equals(NotificationType.UPDATE)) {
+ System.out.println("Updated Policies: \n");
+ for (LoadedPolicy updatedPolicy : notification.getLoadedPolicies()) {
+ System.out.println("policyName : " + updatedPolicy.getPolicyName());
+ System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
+ if (updatedPolicy.getPolicyName().contains(".Config_")) {
+ System.out.println("Matches: " + updatedPolicy.getMatches());
+ System.out.println("UpdateType: " + updatedPolicy.getUpdateType());
+ // Checking the Name is correct or not.
+ try {
+ PolicyEngine policyEngine = new PolicyEngine("config.properties");
+ @SuppressWarnings("deprecation")
+ Collection<PolicyConfig> policyConfigs =
+ policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
+ for (PolicyConfig policyConfig : policyConfigs) {
+ if (policyConfig.getPolicyConfigStatus()
+ .equals(PolicyConfigStatus.CONFIG_RETRIEVED)) {
+ System.out.println("Policy Retrieved with this Name notified. ");
+ } else {
+ System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
+ }
+ // Also Test this case.
+ if (policyConfig.getPolicyName()
+ .equals(updatedPolicy.getPolicyName())) {
+ System.out.println("Policy Name is good. ");
+ } else {
+ System.err.println("\n\n Fail to check Name \n\n");
+ }
+ }
+ } catch (PolicyEngineException e) {
+ LOGGER.error("Exception Occured" + e);
+ } catch (PolicyConfigException e) {
+ LOGGER.error("Exception Occured" + e);
+ }
+ }
+ }
+ } else if (notification.getNotificationType().equals(NotificationType.BOTH)) {
+ System.out.println("Both updated and Removed Notification: \n");
+ System.out.println("Removed Policies: \n");
+ for (RemovedPolicy removedPolicy : notification.getRemovedPolicies()) {
+ System.out.println(removedPolicy.getPolicyName());
+ System.out.println(removedPolicy.getVersionNo());
+ }
+ System.out.println("Updated Policies: \n");
+ for (LoadedPolicy updatedPolicy : notification.getLoadedPolicies()) {
+ System.out.println("policyName : " + updatedPolicy.getPolicyName());
+ System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
+ System.out.println("Matches: " + updatedPolicy.getMatches());
+ System.out.println("UpdateType: " + updatedPolicy.getUpdateType());
+ // Checking the Name is correct or not.
+ try {
+ PolicyEngine policyEngine = new PolicyEngine("config.properties");
+ @SuppressWarnings("deprecation")
+ Collection<PolicyConfig> policyConfigs =
+ policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
+ for (PolicyConfig policyConfig : policyConfigs) {
+ if (policyConfig.getPolicyConfigStatus()
+ .equals(PolicyConfigStatus.CONFIG_RETRIEVED)) {
+ System.out.println("Policy Retrieved with this Name notified. ");
+ } else {
+ System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
+ }
+ // Also Test this case.
+ if (policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())) {
+ System.out.println("Policy Name is good. ");
+ } else {
+ System.err.println("\n\n Fail to check Name \n\n");
+ }
+ }
+ } catch (PolicyEngineException e) {
+ LOGGER.error("Exception Occured" + e);
+ } catch (PolicyConfigException e) {
+ LOGGER.error("Exception Occured" + e);
+ }
+ }
+ }
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java
index 42df545d2..0872c2387 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndTest.java
@@ -1,15 +1,17 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* PolicyEngineAPI
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,7 +25,6 @@ package org.onap.policy.std.test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;
@@ -73,11 +74,12 @@ public class ManualClientEndTest {
recvMsg = message;
conn.send("{\"removedPolicies\": [],\"loadedPolicies\":"
- + "[{\"policyName\": \"Test.Config_BRMS_Param_BrmsParamTestPa.1.xml\","
- + "\"versionNo\": \"1\",\"matches\": {\"ECOMPName\": \"DROOLS\","
- + "\"ONAPName\": \"DROOLS\",\"ConfigName\": \"BRMS_PARAM_RULE\","
- + "\"guard\": \"false\",\"TTLDate\": \"NA\",\"RiskLevel\": \"5\","
- + "\"RiskType\": \"default\"},\"updateType\": \"NEW\"}],\"notificationType\": \"UPDATE\"}");
+ + "[{\"policyName\": \"Test.Config_BRMS_Param_BrmsParamTestPa.1.xml\","
+ + "\"versionNo\": \"1\",\"matches\": {\"ECOMPName\": \"DROOLS\","
+ + "\"ONAPName\": \"DROOLS\",\"ConfigName\": \"BRMS_PARAM_RULE\","
+ + "\"guard\": \"false\",\"TTLDate\": \"NA\",\"RiskLevel\": \"5\","
+ + "\"RiskType\": \"default\"},\"updateType\": \"NEW\"}],"
+ + "\"notificationType\": \"UPDATE\"}");
}
@Override
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java
index d81ba3f98..f8af9c4f2 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,10 +24,8 @@ package org.onap.policy.std.test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
import java.util.LinkedList;
import java.util.List;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -35,73 +35,70 @@ import org.onap.policy.std.ManualClientEndUEB;
import org.onap.policy.std.StdPDPNotification;
/**
- * The class <code>ManualClientEndUEBTest</code> contains tests for the class <code>{@link ManualClientEndUEB}</code>.
+ * The class <code>ManualClientEndUEBTest</code> contains tests for the class
+ * <code>{@link ManualClientEndUEB}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class ManualClientEndUEBTest {
-
- String resultJson = "{'test':'testing'}";
- String json = "{\"test\":\"testing\"}";
- StdPDPNotification notification = new StdPDPNotification();
- ManualClientEndUEB mockManualClient = null;
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- String url = "http://test.com";
- List<String> uebURLList = new LinkedList<String>();
- uebURLList.add(url);
-
- }
- /**
- * Run the PDPNotification result(NotificationScheme) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testResult_1()
- throws Exception {
- NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
+ String resultJson = "{'test':'testing'}";
+ String json = "{\"test\":\"testing\"}";
+ StdPDPNotification notification = new StdPDPNotification();
+ ManualClientEndUEB mockManualClient = null;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ String url = "http://test.com";
+ List<String> uebURLList = new LinkedList<String>();
+ uebURLList.add(url);
+
+ }
+
+ /**
+ * Run the PDPNotification result(NotificationScheme) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testResult_1() throws Exception {
+ NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
- PDPNotification result = ManualClientEndUEB.result(scheme);
+ PDPNotification result = ManualClientEndUEB.result(scheme);
- assertNull(result);
- }
+ assertNull(result);
+ }
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(ManualClientEndUEBTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(ManualClientEndUEBTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java
index e3ea73563..83f5ef2df 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,14 +27,12 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -71,8 +71,7 @@ public class MatchStoreTest {
/**
* Perform pre-test initialization.
*
- * @throws Exception
- * if the initialization fails for some reason
+ * @throws Exception if the initialization fails for some reason
*/
@Before
public void setUp() throws Exception {
@@ -113,7 +112,8 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_ShouldRetrunEmptyLoadedRemovedPolicesIfNotMatchFoundInMatchStore() throws Exception {
+ public void testStoreMatch_ShouldRetrunEmptyLoadedRemovedPolicesIfNotMatchFoundInMatchStore()
+ throws Exception {
final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL);
MatchStore.storeMatch(newMatch);
@@ -129,11 +129,12 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_NotificationTypeRemoved_IfRemovedPolicyExistInOldNotification() throws Exception {
+ public void testStoreMatch_NotificationTypeRemoved_IfRemovedPolicyExistInOldNotification()
+ throws Exception {
final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL);
final StdRemovedPolicy removedPolicy = getRemovedPolicy(POLICY_VERSION, POLICY_NAME);
- final PDPNotification oldNotification = getPDPNotification(Arrays.asList(removedPolicy),
- Collections.emptySet());
+ final PDPNotification oldNotification =
+ getPDPNotification(Arrays.asList(removedPolicy), Collections.emptySet());
MatchStore.storeMatch(newMatch);
@@ -147,11 +148,13 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithEmptyMatches() throws Exception {
+ public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithEmptyMatches()
+ throws Exception {
final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, Collections.emptyMap());
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, Collections.emptyMap());
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -164,16 +167,18 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithMatches() throws Exception {
+ public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithMatches()
+ throws Exception {
final Map<String, String> attribute = getAttributesMap();
final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, attribute);
final Map<String, String> matches = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
matches.putAll(attribute);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -183,7 +188,8 @@ public class MatchStoreTest {
assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertFalse(actualLoadPolicies.isEmpty());
final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
@@ -192,14 +198,16 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithNullMatches() throws Exception {
+ public void testStoreMatch_NoticficationTypeUpdate_IfStdLoadPolicyExistsWithNullMatches()
+ throws Exception {
final Map<String, String> attribute = getAttributesMap();
final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, attribute);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, null);
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, null);
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -209,7 +217,8 @@ public class MatchStoreTest {
assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertFalse(actualLoadPolicies.isEmpty());
final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
@@ -220,12 +229,14 @@ public class MatchStoreTest {
@Test
public void testStoreMatch_NoticficationTypeNull_IfStdLoadPolicyExistsWithMatchesWithOutMatchingConfigAttribute()
throws Exception {
- final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
+ final Matches newMatch =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
final Map<String, String> matches = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -235,7 +246,8 @@ public class MatchStoreTest {
assertNull(actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertTrue(actualLoadPolicies.isEmpty());
}
@@ -248,9 +260,10 @@ public class MatchStoreTest {
final Map<String, String> matches = new HashMap<>();
matches.put(ONAP_NAME_VAL, ONAP_NAME_VAL);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -260,20 +273,24 @@ public class MatchStoreTest {
assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertFalse(actualLoadPolicies.isEmpty());
}
@Test
- public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches() throws Exception {
+ public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches()
+ throws Exception {
- final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
+ final Matches newMatch =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
final Map<String, String> matches = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
- final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
+ final PDPNotification oldNotification =
+ getPDPNotification(Collections.emptySet(), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -283,7 +300,8 @@ public class MatchStoreTest {
assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertFalse(actualLoadPolicies.isEmpty());
final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
@@ -292,18 +310,23 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches2() throws Exception {
+ public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches2()
+ throws Exception {
- final Matches firstObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
+ final Matches firstObj =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
final Map<String, String> firstPolicyObj = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
final Map<String, String> attributesMap = getAttributesMap();
final Matches secondObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, attributesMap);
- final Map<String, String> secondPolicyObj = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
+ final Map<String, String> secondPolicyObj =
+ getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
secondPolicyObj.putAll(attributesMap);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, firstPolicyObj);
- final StdLoadedPolicy secondStdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, secondPolicyObj);
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, firstPolicyObj);
+ final StdLoadedPolicy secondStdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, secondPolicyObj);
final PDPNotification oldNotification = getPDPNotification(Collections.emptySet(),
Arrays.asList(stdLoadedPolicy, secondStdLoadedPolicy));
@@ -316,7 +339,8 @@ public class MatchStoreTest {
assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
- final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ final Collection<LoadedPolicy> actualLoadPolicies =
+ actualPDPNotification.getLoadedPolicies();
assertFalse(actualLoadPolicies.isEmpty());
assertEquals(1, actualLoadPolicies.size());
}
@@ -325,13 +349,15 @@ public class MatchStoreTest {
public void testStoreMatch_NoticficationTypeBoth_IfOldNotificationContainRemovedAndLoadedPolicies()
throws Exception {
- final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
+ final Matches newMatch =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
final Map<String, String> matches = getPolicyMatches(ONAP_NAME_VAL, CONFIG_NAME_VAL);
final StdRemovedPolicy removedPolicy = getRemovedPolicy(POLICY_VERSION, POLICY_NAME);
- final StdLoadedPolicy stdLoadedPolicy = getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
- final PDPNotification oldNotification = getPDPNotification(Arrays.asList(removedPolicy),
- Arrays.asList(stdLoadedPolicy));
+ final StdLoadedPolicy stdLoadedPolicy =
+ getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME, matches);
+ final PDPNotification oldNotification =
+ getPDPNotification(Arrays.asList(removedPolicy), Arrays.asList(stdLoadedPolicy));
MatchStore.storeMatch(newMatch);
@@ -352,15 +378,17 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_MatchesObjectShouldbeAddOnceToMatchStoreAndNoDuplication() throws Exception {
- final String[] configNames = new String[] { CONFIG_NAME_VAL, CONFIG_NAME_VAL, "ConfigName1", CONFIG_NAME_VAL,
- "ConfigName1", null };
- final String[] onapNames = new String[] { ONAP_NAME_VAL, ONAP_NAME_VAL, "ONAPName1", "ONAPName1", ONAP_NAME_VAL,
- ONAP_NAME_VAL };
+ public void testStoreMatch_MatchesObjectShouldbeAddOnceToMatchStoreAndNoDuplication()
+ throws Exception {
+ final String[] configNames = new String[] {CONFIG_NAME_VAL, CONFIG_NAME_VAL, "ConfigName1",
+ CONFIG_NAME_VAL, "ConfigName1", null};
+ final String[] onapNames = new String[] {ONAP_NAME_VAL, ONAP_NAME_VAL, "ONAPName1",
+ "ONAPName1", ONAP_NAME_VAL, ONAP_NAME_VAL};
for (int i = 0; i < configNames.length; i++) {
- final Matches matches = getMatchesInstance(configNames[i], onapNames[i], getAttributesMap());
+ final Matches matches =
+ getMatchesInstance(configNames[i], onapNames[i], getAttributesMap());
MatchStore.storeMatch(matches);
MatchStore.storeMatch(matches);
}
@@ -372,8 +400,10 @@ public class MatchStoreTest {
@Test
public void testStoreMatch_MatchesObjectShouldBeAddedToMatchStore_ConfigAttrValuesAreDifferentThenExistingOne()
throws Exception {
- final Matches firstObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
- final Matches secondObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
+ final Matches firstObj =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
+ final Matches secondObj =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, Collections.emptyMap());
MatchStore.storeMatch(firstObj);
MatchStore.storeMatch(secondObj);
@@ -384,7 +414,8 @@ public class MatchStoreTest {
}
@Test
- public void testStoreMatch_MatchesObjectShouldBeAddedToMatchStore_ConfigAttrValuesNull() throws Exception {
+ public void testStoreMatch_MatchesObjectShouldBeAddedToMatchStore_ConfigAttrValuesNull()
+ throws Exception {
final Matches firstObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, null);
final Matches secondObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, null);
@@ -399,8 +430,10 @@ public class MatchStoreTest {
@Test
public void testStoreMatch_MatchesObjectShouldBeAddedToMatchStore_OnapNameIsDifferentThenExistingOne()
throws Exception {
- final Matches firstObj = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
- final Matches secondObj = getMatchesInstance(CONFIG_NAME_VAL, "ONAPName1", getAttributesMap());
+ final Matches firstObj =
+ getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL, getAttributesMap());
+ final Matches secondObj =
+ getMatchesInstance(CONFIG_NAME_VAL, "ONAPName1", getAttributesMap());
MatchStore.storeMatch(firstObj);
MatchStore.storeMatch(secondObj);
@@ -476,8 +509,7 @@ public class MatchStoreTest {
/**
* Perform post-test clean-up.
*
- * @throws Exception
- * if the clean-up fails for some reason
+ * @throws Exception if the clean-up fails for some reason
*/
@After
public void tearDown() throws Exception {
@@ -487,8 +519,7 @@ public class MatchStoreTest {
/**
* Launch the test.
*
- * @param args
- * the command line arguments
+ * @param args the command line arguments
*/
public static void main(final String[] args) {
new org.junit.runner.JUnitCore().run(MatchStoreTest.class);
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java
index a453736ec..cb5c40c60 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,324 +25,304 @@ package org.onap.policy.std.test;
import org.junit.*;
import org.onap.policy.std.NotificationStore;
import org.onap.policy.std.StdPDPNotification;
-
import static org.junit.Assert.*;
/**
- * The class <code>NotificationStoreTest</code> contains tests for the class <code>{@link NotificationStore}</code>.
+ * The class <code>NotificationStoreTest</code> contains tests for the class
+ * <code>{@link NotificationStore}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class NotificationStoreTest {
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_1()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_2()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_3()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_4()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_5()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_6()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_7()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_8()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_9()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_10()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_11()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_12()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_13()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_14()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_15()
- throws Exception {
- StdPDPNotification notification = new StdPDPNotification();
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Run the void recordNotification(StdPDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testRecordNotification_16()
- throws Exception {
- StdPDPNotification notification = null;
-
- NotificationStore.recordNotification(notification);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(NotificationStoreTest.class);
- }
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_1() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_2() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_3() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_4() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_5() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_6() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_7() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_8() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_9() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_10() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_11() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_12() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_13() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_14() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_15() throws Exception {
+ StdPDPNotification notification = new StdPDPNotification();
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void recordNotification(StdPDPNotification) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testRecordNotification_16() throws Exception {
+ StdPDPNotification notification = null;
+
+ NotificationStore.recordNotification(notification);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(NotificationStoreTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java
index c45a5aca7..0275fd2bb 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdLoadedPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,293 +24,277 @@ package org.onap.policy.std.test;
import java.util.Hashtable;
import java.util.Map;
-
import org.junit.*;
import org.onap.policy.api.UpdateType;
import org.onap.policy.std.StdLoadedPolicy;
-
import static org.junit.Assert.*;
/**
- * The class <code>StdLoadedPolicyTest</code> contains tests for the class <code>{@link StdLoadedPolicy}</code>.
+ * The class <code>StdLoadedPolicyTest</code> contains tests for the class
+ * <code>{@link StdLoadedPolicy}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class StdLoadedPolicyTest {
- /**
- * Run the StdLoadedPolicy() constructor test.
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testStdLoadedPolicy_1()
- throws Exception {
- StdLoadedPolicy result = new StdLoadedPolicy();
- assertNotNull(result);
- // add additional test code here
- }
-
- /**
- * Run the Map<String, String> getMatches() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetMatches_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getMatches();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_2()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName((String) null);
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals(null, result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_3()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the UpdateType getUpdateType() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetUpdateType_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- UpdateType result = fixture.getUpdateType();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("new", result.toString());
- assertEquals("NEW", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the String getVersionNo() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetVersionNo_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
-
- String result = fixture.getVersionNo();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the void setMatches(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetMatches_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
- Map<String, String> matches = new Hashtable<String, String>();
-
- fixture.setMatches(matches);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
- String policyName = "";
-
- fixture.setPolicyName(policyName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setUpdateType(UpdateType) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetUpdateType_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
- UpdateType updateType = UpdateType.NEW;
-
- fixture.setUpdateType(updateType);
-
- // add additional test code here
- }
-
- /**
- * Run the void setVersionNo(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetVersionNo_1()
- throws Exception {
- StdLoadedPolicy fixture = new StdLoadedPolicy();
- fixture.setPolicyName("");
- fixture.setVersionNo("");
- fixture.setUpdateType(UpdateType.NEW);
- fixture.setMatches(new Hashtable<String, String>());
- String versionNo = "";
-
- fixture.setVersionNo(versionNo);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdLoadedPolicyTest.class);
- }
+ /**
+ * Run the StdLoadedPolicy() constructor test.
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testStdLoadedPolicy_1() throws Exception {
+ StdLoadedPolicy result = new StdLoadedPolicy();
+ assertNotNull(result);
+ // add additional test code here
+ }
+
+ /**
+ * Run the Map<String, String> getMatches() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetMatches_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getMatches();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_2() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName((String) null);
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_3() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the UpdateType getUpdateType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetUpdateType_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ UpdateType result = fixture.getUpdateType();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("new", result.toString());
+ assertEquals("NEW", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String getVersionNo() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetVersionNo_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+
+ String result = fixture.getVersionNo();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the void setMatches(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetMatches_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+ Map<String, String> matches = new Hashtable<String, String>();
+
+ fixture.setMatches(matches);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyName_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+ String policyName = "";
+
+ fixture.setPolicyName(policyName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setUpdateType(UpdateType) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetUpdateType_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+ UpdateType updateType = UpdateType.NEW;
+
+ fixture.setUpdateType(updateType);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setVersionNo(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetVersionNo_1() throws Exception {
+ StdLoadedPolicy fixture = new StdLoadedPolicy();
+ fixture.setPolicyName("");
+ fixture.setVersionNo("");
+ fixture.setUpdateType(UpdateType.NEW);
+ fixture.setMatches(new Hashtable<String, String>());
+ String versionNo = "";
+
+ fixture.setVersionNo(versionNo);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdLoadedPolicyTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java
index 23b570e9a..ecfd77c25 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPDPNotificationTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,7 +25,6 @@ package org.onap.policy.std.test;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
-
import org.junit.*;
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationType;
@@ -31,282 +32,267 @@ import org.onap.policy.api.RemovedPolicy;
import org.onap.policy.std.StdLoadedPolicy;
import org.onap.policy.std.StdPDPNotification;
import org.onap.policy.std.StdRemovedPolicy;
-
import static org.junit.Assert.*;
/**
- * The class <code>StdPDPNotificationTest</code> contains tests for the class <code>{@link StdPDPNotification}</code>.
+ * The class <code>StdPDPNotificationTest</code> contains tests for the class
+ * <code>{@link StdPDPNotification}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class StdPDPNotificationTest {
- /**
- * Run the StdPDPNotification() constructor test.
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStdPDPNotification_1()
- throws Exception {
- StdPDPNotification result = new StdPDPNotification();
- assertNotNull(result);
- // add additional test code here
- }
-
- /**
- * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetLoadedPolicies_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetLoadedPolicies_2()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetLoadedPolicies_3()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(null);
-
- Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
-
- // add additional test code here
- assertEquals(Collections.EMPTY_LIST, result);
- }
-
- /**
- * Run the NotificationType getNotificationType() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetNotificationType_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- NotificationType result = fixture.getNotificationType();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("both", result.toString());
- assertEquals("BOTH", result.name());
- assertEquals(2, result.ordinal());
- }
-
- /**
- * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetRemovedPolicies_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetRemovedPolicies_2()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetRemovedPolicies_3()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(null);
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
-
- Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
-
- // add additional test code here
- assertEquals(Collections.EMPTY_LIST, result);
- }
-
- /**
- * Run the void setNotificationType(NotificationType) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetNotificationType_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
- NotificationType notificationType = NotificationType.BOTH;
-
- fixture.setNotificationType(notificationType);
-
- // add additional test code here
- }
-
- /**
- * Run the void setRemovedPolicies(Collection<StdRemovedPolicy>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetRemovedPolicies_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
- Collection<StdRemovedPolicy> removedPolicies = new LinkedList<StdRemovedPolicy>();
-
- fixture.setRemovedPolicies(removedPolicies);
-
- // add additional test code here
- }
-
- /**
- * Run the void setUpdatedPolicies(Collection<StdLoadedPolicy>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetUpdatedPolicies_1()
- throws Exception {
- StdPDPNotification fixture = new StdPDPNotification();
- fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
- fixture.setNotificationType(NotificationType.BOTH);
- fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
- Collection<StdLoadedPolicy> updatedPolicies = new LinkedList<StdLoadedPolicy>();
-
- fixture.setLoadedPolicies(updatedPolicies);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdPDPNotificationTest.class);
- }
+ /**
+ * Run the StdPDPNotification() constructor test.
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testStdPDPNotification_1() throws Exception {
+ StdPDPNotification result = new StdPDPNotification();
+ assertNotNull(result);
+ // add additional test code here
+ }
+
+ /**
+ * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetLoadedPolicies_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetLoadedPolicies_2() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetLoadedPolicies_3() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(null);
+
+ Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
+
+ // add additional test code here
+ assertEquals(Collections.EMPTY_LIST, result);
+ }
+
+ /**
+ * Run the NotificationType getNotificationType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetNotificationType_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ NotificationType result = fixture.getNotificationType();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("both", result.toString());
+ assertEquals("BOTH", result.name());
+ assertEquals(2, result.ordinal());
+ }
+
+ /**
+ * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetRemovedPolicies_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetRemovedPolicies_2() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetRemovedPolicies_3() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(null);
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+
+ Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
+
+ // add additional test code here
+ assertEquals(Collections.EMPTY_LIST, result);
+ }
+
+ /**
+ * Run the void setNotificationType(NotificationType) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetNotificationType_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+ NotificationType notificationType = NotificationType.BOTH;
+
+ fixture.setNotificationType(notificationType);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRemovedPolicies(Collection<StdRemovedPolicy>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetRemovedPolicies_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+ Collection<StdRemovedPolicy> removedPolicies = new LinkedList<StdRemovedPolicy>();
+
+ fixture.setRemovedPolicies(removedPolicies);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setUpdatedPolicies(Collection<StdLoadedPolicy>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetUpdatedPolicies_1() throws Exception {
+ StdPDPNotification fixture = new StdPDPNotification();
+ fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
+ fixture.setNotificationType(NotificationType.BOTH);
+ fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
+ Collection<StdLoadedPolicy> updatedPolicies = new LinkedList<StdLoadedPolicy>();
+
+ fixture.setLoadedPolicies(updatedPolicies);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdPDPNotificationTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java
index 5ce53d133..72dda97c4 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyChangeResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,145 +24,136 @@ package org.onap.policy.std.test;
import org.junit.*;
import org.onap.policy.std.StdPolicyChangeResponse;
-
import static org.junit.Assert.*;
/**
- * The class <code>StdPolicyChangeResponseTest</code> contains tests for the class <code>{@link StdPolicyChangeResponse}</code>.
+ * The class <code>StdPolicyChangeResponseTest</code> contains tests for the class
+ * <code>{@link StdPolicyChangeResponse}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class StdPolicyChangeResponseTest {
- /**
- * Run the StdPolicyChangeResponse() constructor test.
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testStdPolicyChangeResponse_1()
- throws Exception {
- StdPolicyChangeResponse result = new StdPolicyChangeResponse();
- assertNotNull(result);
- // add additional test code here
- }
-
- /**
- * Run the int getResponseCode() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetResponseCode_1()
- throws Exception {
- StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
- fixture.setResponseMessage("");
- fixture.setResponseCode(1);
-
- int result = fixture.getResponseCode();
-
- // add additional test code here
- assertEquals(1, result);
- }
-
- /**
- * Run the String getResponseMessage() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetResponseMessage_1()
- throws Exception {
- StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
- fixture.setResponseMessage("");
- fixture.setResponseCode(1);
-
- String result = fixture.getResponseMessage();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the void setResponseCode(int) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetResponseCode_1()
- throws Exception {
- StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
- fixture.setResponseMessage("");
- fixture.setResponseCode(1);
- int responseCode = 1;
-
- fixture.setResponseCode(responseCode);
-
- // add additional test code here
- }
-
- /**
- * Run the void setResponseMessage(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetResponseMessage_1()
- throws Exception {
- StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
- fixture.setResponseMessage("");
- fixture.setResponseCode(1);
- String responseMessage = "";
-
- fixture.setResponseMessage(responseMessage);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdPolicyChangeResponseTest.class);
- }
+ /**
+ * Run the StdPolicyChangeResponse() constructor test.
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testStdPolicyChangeResponse_1() throws Exception {
+ StdPolicyChangeResponse result = new StdPolicyChangeResponse();
+ assertNotNull(result);
+ // add additional test code here
+ }
+
+ /**
+ * Run the int getResponseCode() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetResponseCode_1() throws Exception {
+ StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
+ fixture.setResponseMessage("");
+ fixture.setResponseCode(1);
+
+ int result = fixture.getResponseCode();
+
+ // add additional test code here
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the String getResponseMessage() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetResponseMessage_1() throws Exception {
+ StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
+ fixture.setResponseMessage("");
+ fixture.setResponseCode(1);
+
+ String result = fixture.getResponseMessage();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the void setResponseCode(int) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetResponseCode_1() throws Exception {
+ StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
+ fixture.setResponseMessage("");
+ fixture.setResponseCode(1);
+ int responseCode = 1;
+
+ fixture.setResponseCode(responseCode);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setResponseMessage(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetResponseMessage_1() throws Exception {
+ StdPolicyChangeResponse fixture = new StdPolicyChangeResponse();
+ fixture.setResponseMessage("");
+ fixture.setResponseCode(1);
+ String responseMessage = "";
+
+ fixture.setResponseMessage(responseMessage);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdPolicyChangeResponseTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java
index 11179aece..9c30a5131 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,327 +24,312 @@ package org.onap.policy.std.test;
import java.util.Hashtable;
import java.util.Map;
-
import org.junit.*;
import org.onap.policy.api.PolicyResponseStatus;
import org.onap.policy.std.StdPolicyResponse;
-
import static org.junit.Assert.*;
/**
- * The class <code>StdPolicyResponseTest</code> contains tests for the class <code>{@link StdPolicyResponse}</code>.
+ * The class <code>StdPolicyResponseTest</code> contains tests for the class
+ * <code>{@link StdPolicyResponse}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class StdPolicyResponseTest {
- /**
- * Run the Map<String, String> getActionAdvised() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetActionAdvised_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getActionAdvised();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Map<String, String> getActionTaken() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetActionTaken_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getActionTaken();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the String getPolicyResponseMessage() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyResponseMessage_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyResponseMessage();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the PolicyResponseStatus getPolicyResponseStatus() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyResponseStatus_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- PolicyResponseStatus result = fixture.getPolicyResponseStatus();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("action_advised", result.toString());
- assertEquals("ACTION_ADVISED", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the Map<String, String> getRequestAttributes() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetRequestAttributes_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getRequestAttributes();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the void setActionAdvised(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetActionAdvised_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> actionAdvised = new Hashtable<String, String>();
-
- fixture.setActionAdvised(actionAdvised);
-
- // add additional test code here
- }
-
- /**
- * Run the void setActionTaken(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetActionTaken_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> actionTaken = new Hashtable<String, String>();
-
- fixture.setActionTaken(actionTaken);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseMessage(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseMessage_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyResponseMessage = "";
-
- fixture.setPolicyResponseMessage(policyResponseMessage);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseStatus_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
-
- fixture.setPolicyResponseStatus(policyResponseStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseStatus_2()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyResponseMessage = "";
- PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
-
- fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setRequestAttributes(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetRequestAttributes_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> requestAttributes = new Hashtable<String, String>();
-
- fixture.setRequestAttributes(requestAttributes);
-
- // add additional test code here
- }
-
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- StdPolicyResponse fixture = new StdPolicyResponse();
- fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.toString();
-
- // add additional test code here
- assertEquals("PolicyResponse [ policyResponseStatus=action_advised, policyResponseMessage=, ]", result);
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdPolicyResponseTest.class);
- }
+ /**
+ * Run the Map<String, String> getActionAdvised() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetActionAdvised_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getActionAdvised();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Map<String, String> getActionTaken() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetActionTaken_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getActionTaken();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the String getPolicyResponseMessage() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyResponseMessage_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyResponseMessage();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the PolicyResponseStatus getPolicyResponseStatus() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyResponseStatus_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ PolicyResponseStatus result = fixture.getPolicyResponseStatus();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("action_advised", result.toString());
+ assertEquals("ACTION_ADVISED", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the Map<String, String> getRequestAttributes() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetRequestAttributes_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getRequestAttributes();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the void setActionAdvised(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetActionAdvised_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> actionAdvised = new Hashtable<String, String>();
+
+ fixture.setActionAdvised(actionAdvised);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setActionTaken(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetActionTaken_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> actionTaken = new Hashtable<String, String>();
+
+ fixture.setActionTaken(actionTaken);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseMessage(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseMessage_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyResponseMessage = "";
+
+ fixture.setPolicyResponseMessage(policyResponseMessage);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseStatus_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
+
+ fixture.setPolicyResponseStatus(policyResponseStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseStatus_2() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyResponseMessage = "";
+ PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
+
+ fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRequestAttributes(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetRequestAttributes_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> requestAttributes = new Hashtable<String, String>();
+
+ fixture.setRequestAttributes(requestAttributes);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the String toString() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testToString_1() throws Exception {
+ StdPolicyResponse fixture = new StdPolicyResponse();
+ fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals(
+ "PolicyResponse [ policyResponseStatus=action_advised, policyResponseMessage=, ]",
+ result);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdPolicyResponseTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java
index 2482c3015..14f418c74 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdRemovedPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,185 +24,174 @@ package org.onap.policy.std.test;
import org.junit.*;
import org.onap.policy.std.StdRemovedPolicy;
-
import static org.junit.Assert.*;
/**
- * The class <code>StdRemovedPolicyTest</code> contains tests for the class <code>{@link StdRemovedPolicy}</code>.
+ * The class <code>StdRemovedPolicyTest</code> contains tests for the class
+ * <code>{@link StdRemovedPolicy}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class StdRemovedPolicyTest {
- /**
- * Run the StdRemovedPolicy() constructor test.
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testStdRemovedPolicy_1()
- throws Exception {
- StdRemovedPolicy result = new StdRemovedPolicy();
- assertNotNull(result);
- // add additional test code here
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName("");
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_2()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName((String) null);
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals(null, result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_3()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName("");
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getVersionNo() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetVersionNo_1()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName("");
-
- String result = fixture.getVersionNo();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName("");
- String policyName = "";
-
- fixture.setPolicyName(policyName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setVersionNo(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetVersionNo_1()
- throws Exception {
- StdRemovedPolicy fixture = new StdRemovedPolicy();
- fixture.setVersionNo("");
- fixture.setPolicyName("");
- String versionNo = "";
-
- fixture.setVersionNo(versionNo);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdRemovedPolicyTest.class);
- }
+ /**
+ * Run the StdRemovedPolicy() constructor test.
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testStdRemovedPolicy_1() throws Exception {
+ StdRemovedPolicy result = new StdRemovedPolicy();
+ assertNotNull(result);
+ // add additional test code here
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName("");
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_2() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName((String) null);
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_3() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName("");
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getVersionNo() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetVersionNo_1() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName("");
+
+ String result = fixture.getVersionNo();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the void setPolicyName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyName_1() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName("");
+ String policyName = "";
+
+ fixture.setPolicyName(policyName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setVersionNo(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetVersionNo_1() throws Exception {
+ StdRemovedPolicy fixture = new StdRemovedPolicy();
+ fixture.setVersionNo("");
+ fixture.setPolicyName("");
+ String versionNo = "";
+
+ fixture.setVersionNo(versionNo);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdRemovedPolicyTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java
index b72d2568d..85d9c027f 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdStatusTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,18 +25,14 @@ package org.onap.policy.std.test;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
-
import javax.json.JsonObject;
-
import org.junit.*;
import org.onap.policy.api.PolicyConfigStatus;
import org.onap.policy.api.PolicyDecision;
import org.onap.policy.api.PolicyResponseStatus;
import org.onap.policy.api.PolicyType;
import org.onap.policy.std.StdStatus;
-
import static org.junit.Assert.*;
-
import org.w3c.dom.Document;
/**
@@ -44,1390 +42,1425 @@ import org.w3c.dom.Document;
* @version $Revision: 1.0 $
*/
public class StdStatusTest {
- /**
- * Run the Map<String, String> getActionAdvised() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetActionAdvised_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getActionAdvised();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Map<String, String> getActionTaken() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetActionTaken_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getActionTaken();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Map<String, String> getMatchingConditions() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetMatchingConditions_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getMatchingConditions();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the String getPolicyConfigMessage() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyConfigMessage_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyConfigMessage();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the PolicyConfigStatus getPolicyConfigStatus() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyConfigStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- PolicyConfigStatus result = fixture.getPolicyConfigStatus();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("not_found", result.toString());
- assertEquals("CONFIG_NOT_FOUND", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the PolicyDecision getPolicyDecision() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyDecision_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- PolicyDecision result = fixture.getDecision();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("deny", result.toString());
- assertEquals("DENY", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_2()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName((String) null);
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals(null, result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_3()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyResponseMessage() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyResponseMessage_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyResponseMessage();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the PolicyResponseStatus getPolicyResponseStatus() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyResponseStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- PolicyResponseStatus result = fixture.getPolicyResponseStatus();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("action_advised", result.toString());
- assertEquals("ACTION_ADVISED", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the String getPolicyVersion() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyVersion_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.getPolicyVersion();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the Map<String, String> getRequestAttributes() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetRequestAttributes_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getRequestAttributes();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Map<String, String> getResponseAttributes() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetResponseAttributes_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Map<String, String> result = fixture.getResponseAttributes();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the PolicyType getType() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetType_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- PolicyType result = fixture.getType();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("json", result.toString());
- assertEquals("JSON", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the void setActionAdvised(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetActionAdvised_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> actionAdvised = new Hashtable<String, String>();
-
- fixture.setActionAdvised(actionAdvised);
-
- // add additional test code here
- }
-
- /**
- * Run the void setActionTaken(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetActionTaken_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> actionTaken = new Hashtable<String, String>();
-
- fixture.setActionTaken(actionTaken);
-
- // add additional test code here
- }
-
- /**
- * Run the void setConfigStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetConfigStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String configStatus = "";
-
- fixture.setConfigStatus(configStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setDocument(Document) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetDocument_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Document document = null;
-
- fixture.setDocument(document);
-
- // add additional test code here
- }
-
- /**
- * Run the void setJsonObject(JsonObject) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetJsonObject_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- JsonObject jsonObject = null;
-
- fixture.setJsonObject(jsonObject);
-
- // add additional test code here
- }
-
- /**
- * Run the void setMatchingConditions(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetMatchingConditions_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> matchingConditions = new Hashtable<String, String>();
-
- fixture.setMatchingConditions(matchingConditions);
-
- // add additional test code here
- }
-
- /**
- * Run the void setOther(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetOther_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String other = "";
-
- fixture.setOther(other);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyConfigStatus(PolicyConfigStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyConfigStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
-
- fixture.setPolicyConfigStatus(policyConfigStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyConfigStatus(String,PolicyConfigStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyConfigStatus_2()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String configStatus = "";
- PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
-
- fixture.setPolicyConfigStatus(configStatus, policyConfigStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyDecision(PolicyDecision) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyDecision_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- PolicyDecision policyDecision = PolicyDecision.DENY;
-
- fixture.setDecision(policyDecision);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyName = "";
-
- fixture.setPolicyName(policyName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseMessage(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseMessage_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyResponseMessage = "";
-
- fixture.setPolicyResponseMessage(policyResponseMessage);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
-
- fixture.setPolicyResponseStatus(policyResponseStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyResponseStatus_2()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyResponseMessage = "";
- PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
-
- fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyType(PolicyType) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyType_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- PolicyType policyType = PolicyType.JSON;
-
- fixture.setPolicyType(policyType);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyVersion(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyVersion_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String policyVersion = "";
-
- fixture.setPolicyVersion(policyVersion);
-
- // add additional test code here
- }
-
- /**
- * Run the void setProperties(Properties) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetProperties_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Properties properties = new Properties();
-
- fixture.setProperties(properties);
-
- // add additional test code here
- }
-
- /**
- * Run the void setRequestAttributes(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetRequestAttributes_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> requestAttributes = new Hashtable<String, String>();
-
- fixture.setRequestAttributes(requestAttributes);
-
- // add additional test code here
- }
-
- /**
- * Run the void setResposneAttributes(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetResposneAttributes_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- Map<String, String> responseAttributes = new Hashtable<String, String>();
-
- fixture.setResposneAttributes(responseAttributes);
-
- // add additional test code here
- }
-
- /**
- * Run the void setStatus(String,PolicyResponseStatus,PolicyConfigStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetStatus_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
- String message = "";
- PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
- PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
-
- fixture.setStatus(message, policyResponseStatus, policyConfigStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the JsonObject toJSON() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToJSON_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- JsonObject result = fixture.toJSON();
-
- // add additional test code here
- assertEquals(null, result);
- }
-
- /**
- * Run the String toOther() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToOther_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- String result = fixture.toOther();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the Properties toProperties() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToProperties_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Properties result = fixture.toProperties();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the Document toXML() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToXML_1()
- throws Exception {
- StdStatus fixture = new StdStatus();
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setPolicyName("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setResposneAttributes(new Hashtable<String, String>());
- fixture.setMatchingConditions(new Hashtable<String, String>());
- fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED, PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setJsonObject((JsonObject) null);
- fixture.setDocument((Document) null);
- fixture.setProperties(new Properties());
- fixture.setRequestAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setActionAdvised(new Hashtable<String, String>());
- fixture.setOther("");
- fixture.setDecision(PolicyDecision.DENY);
- fixture.setDetails("");
- fixture.setActionTaken(new Hashtable<String, String>());
-
- Document result = fixture.toXML();
-
- // add additional test code here
- assertEquals(null, result);
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdStatusTest.class);
- }
+ /**
+ * Run the Map<String, String> getActionAdvised() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetActionAdvised_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getActionAdvised();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Map<String, String> getActionTaken() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetActionTaken_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getActionTaken();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Map<String, String> getMatchingConditions() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetMatchingConditions_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getMatchingConditions();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the String getPolicyConfigMessage() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyConfigMessage_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyConfigMessage();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the PolicyConfigStatus getPolicyConfigStatus() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyConfigStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ PolicyConfigStatus result = fixture.getPolicyConfigStatus();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("not_found", result.toString());
+ assertEquals("CONFIG_NOT_FOUND", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the PolicyDecision getPolicyDecision() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyDecision_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ PolicyDecision result = fixture.getDecision();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("deny", result.toString());
+ assertEquals("DENY", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_2() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName((String) null);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_3() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyResponseMessage() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyResponseMessage_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyResponseMessage();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the PolicyResponseStatus getPolicyResponseStatus() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyResponseStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ PolicyResponseStatus result = fixture.getPolicyResponseStatus();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("action_advised", result.toString());
+ assertEquals("ACTION_ADVISED", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String getPolicyVersion() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyVersion_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.getPolicyVersion();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the Map<String, String> getRequestAttributes() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetRequestAttributes_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getRequestAttributes();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Map<String, String> getResponseAttributes() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetResponseAttributes_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Map<String, String> result = fixture.getResponseAttributes();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the PolicyType getType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetType_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ PolicyType result = fixture.getType();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("json", result.toString());
+ assertEquals("JSON", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the void setActionAdvised(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetActionAdvised_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> actionAdvised = new Hashtable<String, String>();
+
+ fixture.setActionAdvised(actionAdvised);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setActionTaken(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetActionTaken_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> actionTaken = new Hashtable<String, String>();
+
+ fixture.setActionTaken(actionTaken);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setConfigStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetConfigStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String configStatus = "";
+
+ fixture.setConfigStatus(configStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setDocument(Document) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetDocument_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Document document = null;
+
+ fixture.setDocument(document);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setJsonObject(JsonObject) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetJsonObject_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ JsonObject jsonObject = null;
+
+ fixture.setJsonObject(jsonObject);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setMatchingConditions(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetMatchingConditions_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> matchingConditions = new Hashtable<String, String>();
+
+ fixture.setMatchingConditions(matchingConditions);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setOther(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetOther_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String other = "";
+
+ fixture.setOther(other);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyConfigStatus(PolicyConfigStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyConfigStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
+
+ fixture.setPolicyConfigStatus(policyConfigStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyConfigStatus(String,PolicyConfigStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyConfigStatus_2() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String configStatus = "";
+ PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
+
+ fixture.setPolicyConfigStatus(configStatus, policyConfigStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyDecision(PolicyDecision) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyDecision_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ PolicyDecision policyDecision = PolicyDecision.DENY;
+
+ fixture.setDecision(policyDecision);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyName_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyName = "";
+
+ fixture.setPolicyName(policyName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseMessage(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseMessage_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyResponseMessage = "";
+
+ fixture.setPolicyResponseMessage(policyResponseMessage);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
+
+ fixture.setPolicyResponseStatus(policyResponseStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyResponseStatus_2() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyResponseMessage = "";
+ PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
+
+ fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyType(PolicyType) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyType_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ PolicyType policyType = PolicyType.JSON;
+
+ fixture.setPolicyType(policyType);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyVersion(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyVersion_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String policyVersion = "";
+
+ fixture.setPolicyVersion(policyVersion);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setProperties(Properties) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetProperties_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Properties properties = new Properties();
+
+ fixture.setProperties(properties);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRequestAttributes(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetRequestAttributes_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> requestAttributes = new Hashtable<String, String>();
+
+ fixture.setRequestAttributes(requestAttributes);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setResposneAttributes(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetResposneAttributes_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ Map<String, String> responseAttributes = new Hashtable<String, String>();
+
+ fixture.setResposneAttributes(responseAttributes);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setStatus(String,PolicyResponseStatus,PolicyConfigStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetStatus_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+ String message = "";
+ PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
+ PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
+
+ fixture.setStatus(message, policyResponseStatus, policyConfigStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the JsonObject toJSON() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testToJSON_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ JsonObject result = fixture.toJSON();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String toOther() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testToOther_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ String result = fixture.toOther();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the Properties toProperties() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testToProperties_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Properties result = fixture.toProperties();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the Document toXML() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testToXML_1() throws Exception {
+ StdStatus fixture = new StdStatus();
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setPolicyName("");
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setResposneAttributes(new Hashtable<String, String>());
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setStatus("", PolicyResponseStatus.ACTION_ADVISED,
+ PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setDocument((Document) null);
+ fixture.setProperties(new Properties());
+ fixture.setRequestAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion("");
+ fixture.setActionAdvised(new Hashtable<String, String>());
+ fixture.setOther("");
+ fixture.setDecision(PolicyDecision.DENY);
+ fixture.setDetails("");
+ fixture.setActionTaken(new Hashtable<String, String>());
+
+ Document result = fixture.toXML();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(StdStatusTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/utils/PolicyConstantsTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/utils/PolicyConstantsTest.java
index d2f6002cc..8af73a529 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/utils/PolicyConstantsTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/utils/PolicyConstantsTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -27,19 +29,23 @@ import java.lang.reflect.Modifier;
import org.junit.Test;
public class PolicyConstantsTest {
- @Test
- public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
- Constructor<PolicyCommonConfigConstants> constructor = PolicyCommonConfigConstants.class.getDeclaredConstructor();
- assertTrue(Modifier.isPrivate(constructor.getModifiers()));
- constructor.setAccessible(true);
- constructor.newInstance();
- }
+ @Test
+ public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException, InstantiationException {
+ Constructor<PolicyCommonConfigConstants> constructor =
+ PolicyCommonConfigConstants.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
- @Test
- public void testConstructorIsPrivate2() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
- Constructor<PolicyConfigConstants> constructor = PolicyConfigConstants.class.getDeclaredConstructor();
- assertTrue(Modifier.isPrivate(constructor.getModifiers()));
- constructor.setAccessible(true);
- constructor.newInstance();
- }
+ @Test
+ public void testConstructorIsPrivate2() throws NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException, InstantiationException {
+ Constructor<PolicyConfigConstants> constructor =
+ PolicyConfigConstants.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIPolicyConfigResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIPolicyConfigResponseTest.java
index 6e5959d08..a3f690838 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIPolicyConfigResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIPolicyConfigResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -27,49 +29,49 @@ import org.onap.policy.api.PolicyConfigStatus;
import org.onap.policy.api.PolicyConfigType;
import org.onap.policy.api.PolicyType;
import org.onap.policy.models.APIPolicyConfigResponse;
-import junit.framework.TestCase;
+import junit.framework.TestCase;
public class APIPolicyConfigResponseTest extends TestCase {
- private final String testKey = "testKey";
- private final String testValue = "testValue";
- private final PolicyType testType = PolicyType.JSON;
- private final PolicyConfigStatus testStatus = PolicyConfigStatus.CONFIG_RETRIEVED;
- private final PolicyConfigType testConfigType = PolicyConfigType.BRMS_PARAM;
-
- @Test
- public final void testSetAndGet() {
- APIPolicyConfigResponse response = new APIPolicyConfigResponse();
- response.setConfig(testValue);
- assertEquals(response.getConfig(), testValue);
-
- response.setType(testType);
- assertEquals(response.getType(), testType);
-
- response.setPolicyConfigStatus(testStatus);
- assertEquals(response.getPolicyConfigStatus(), testStatus);
-
- response.setPolicyConfigMessage(testValue);
- assertEquals(response.getPolicyConfigMessage(), testValue);
-
- response.setPolicyName(testValue);
- assertEquals(response.getPolicyName(), testValue);
-
- response.setPolicyType(testConfigType);
- assertEquals(response.getPolicyType(), testConfigType);
-
- response.setPolicyVersion(testValue);
- assertEquals(response.getPolicyVersion(), testValue);
-
- Map<String, String> testMap = new HashMap<String, String>();
- testMap.put(testKey, testValue);
-
- response.setMatchingConditions(testMap);
- assertEquals(response.getMatchingConditions(), testMap);
-
- response.setProperty(testMap);
- assertEquals(response.getProperty(), testMap);
-
- response.setResponseAttributes(testMap);
- assertEquals(response.getResponseAttributes(), testMap);
- }
+ private final String testKey = "testKey";
+ private final String testValue = "testValue";
+ private final PolicyType testType = PolicyType.JSON;
+ private final PolicyConfigStatus testStatus = PolicyConfigStatus.CONFIG_RETRIEVED;
+ private final PolicyConfigType testConfigType = PolicyConfigType.BRMS_PARAM;
+
+ @Test
+ public final void testSetAndGet() {
+ APIPolicyConfigResponse response = new APIPolicyConfigResponse();
+ response.setConfig(testValue);
+ assertEquals(response.getConfig(), testValue);
+
+ response.setType(testType);
+ assertEquals(response.getType(), testType);
+
+ response.setPolicyConfigStatus(testStatus);
+ assertEquals(response.getPolicyConfigStatus(), testStatus);
+
+ response.setPolicyConfigMessage(testValue);
+ assertEquals(response.getPolicyConfigMessage(), testValue);
+
+ response.setPolicyName(testValue);
+ assertEquals(response.getPolicyName(), testValue);
+
+ response.setPolicyType(testConfigType);
+ assertEquals(response.getPolicyType(), testConfigType);
+
+ response.setPolicyVersion(testValue);
+ assertEquals(response.getPolicyVersion(), testValue);
+
+ Map<String, String> testMap = new HashMap<String, String>();
+ testMap.put(testKey, testValue);
+
+ response.setMatchingConditions(testMap);
+ assertEquals(response.getMatchingConditions(), testMap);
+
+ response.setProperty(testMap);
+ assertEquals(response.getProperty(), testMap);
+
+ response.setResponseAttributes(testMap);
+ assertEquals(response.getResponseAttributes(), testMap);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java
index ae971b405..e5d3a4a11 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ActionPolicyApiTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,7 +25,6 @@ package org.onap.policy.test;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -36,204 +37,205 @@ import org.onap.policy.api.PolicyParameters;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.std.StdPolicyChangeResponse;
-
-import junit.framework.TestCase;
+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
- public 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<String, String> configAttributes = new HashMap<String, String>();
+
+ 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
+ public 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<String, String> configAttributes = new HashMap<String, String>();
configAttributes.put("test", "testing");
-
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+
+ Map<AttributeType, Map<String, String>> attributes =
+ new HashMap<AttributeType, Map<String, String>>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
-
+
policyParameters.setActionPerformer("PEP");
policyParameters.setActionAttribute("testing");
policyParameters.setRequestID(UUID.randomUUID());
- }
-
- public 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());
- }
-
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public final void testCreatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.createPolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ @Test
+ public final void testUpdatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.updatePolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyName() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullActionAttributes() {
+ response.setResponseMessage("PE300 - Data Issue: No Action Attribute given.");
+ policyParameters.setActionAttribute(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullActionPerformer() {
+ response.setResponseMessage("PE300 - Data Issue: No Action Performer given.");
+ policyParameters.setActionPerformer(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyInvalidActionPerformer() {
+ response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given.");
+ policyParameters.setActionPerformer("testfail");
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyName() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullActionAttributes() {
+ response.setResponseMessage("PE300 - Data Issue: No Action Attribute given.");
+ policyParameters.setActionAttribute(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullActionPerformer() {
+ response.setResponseMessage("PE300 - Data Issue: No Action Performer given.");
+ policyParameters.setActionPerformer(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyInvalidActionPerformer() {
+ response.setResponseMessage("PE300 - Data Issue: Invalid Action Performer given.");
+ policyParameters.setActionPerformer("testfail");
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java
index d817deff3..17d2f37b7 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/AttributeTypeTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,69 +24,63 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.AttributeType;
-
import static org.junit.Assert.*;
/**
- * The class <code>AttributeTypeTest</code> contains tests for the class <code>{@link AttributeType}</code>.
+ * The class <code>AttributeTypeTest</code> contains tests for the class
+ * <code>{@link AttributeType}</code>.
*
* @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;
+ /**
+ * 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);
- String result = fixture.toString();
+ AttributeType type = AttributeType.create("dictionary");
+ assertEquals(AttributeType.DICTIONARY, type);
- // add additional test code here
- assertEquals("matching", result);
-
- AttributeType type = AttributeType.create("dictionary");
- assertEquals(AttributeType.DICTIONARY, type);
-
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- AttributeType.create("foobar");
- }
+ }
- /**
- * 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
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ AttributeType.create("foobar");
+ }
- /**
- * 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
- }
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java
index b5fb75c42..0caa9f3d4 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigBasePolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,7 +25,6 @@ package org.onap.policy.test;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.api.AttributeType;
@@ -36,290 +37,296 @@ import org.onap.policy.api.PolicyType;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.std.StdPolicyChangeResponse;
-
-import junit.framework.TestCase;
+import junit.framework.TestCase;
/**
* The class <code>ConfigBasePolicyTest</code> contains tests for the class
* {@link <code>PolicyEngine</code>}
*
- * @pattern JUnit Test Case
- * *
+ * @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()
- */
- public 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
+ 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()
+ */
+ public void setUp() throws Exception {
+ try {
+ policyEngine = new PolicyEngine("Test/config_pass.properties");
+ } catch (PolicyEngineException e) {
+ logger.error(e.getMessage());
+ fail("PolicyEngine Instantiation Error" + e);
+ }
+ logger.info("Loaded.. PolicyEngine");
+
+ mockPolicyEngine = Mockito.mock(PolicyEngine.class);
+
+ policyParameters.setPolicyConfigType(PolicyConfigType.Base); // required
+ policyParameters.setPolicyName("test.junitTest"); // required
policyParameters.setOnapName("test");
policyParameters.setConfigName("testBase");
policyParameters.setConfigBodyType(PolicyType.OTHER);
policyParameters.setConfigBody("testing");
- policyParameters.setPolicyDescription("testing"); //optional
- //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
-
- //Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ 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<String, String> configAttributes = new HashMap<String, String>();
configAttributes.put("test", "testing");
-
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+
+ Map<AttributeType, Map<String, String>> attributes =
+ new HashMap<AttributeType, Map<String, String>>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
policyParameters.setRequestID(UUID.randomUUID());
- }
-
- /**
- * Perform post-test clean up
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- // Add additional tear down code here
- }
-
- /**
- * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test
- */
- public void testCreatePolicy() {
- response.setResponseMessage("success");
- PolicyChangeResponse result = null;
- try {
-
- Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
- result = mockPolicyEngine.createPolicy(policyParameters);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- /**
- * Run the String createConfigPolicy() method test
- */
- @SuppressWarnings("deprecation")
- @Test
- public void testCreateConfigPolicy() {
- String response = "success";
- String result = null;
- try {
-
- Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response);
- result = mockPolicyEngine.createConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- /**
- * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test
- */
- public void testUpdatePolicy() {
- response.setResponseMessage("success");
- PolicyChangeResponse result = null;
- try {
-
- Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
- result = mockPolicyEngine.updatePolicy(policyParameters);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- /**
- * Run the String updateConfigPolicy() method test
- */
- @SuppressWarnings("deprecation")
- @Test
- public void testUpdateConfigPolicy() {
- String response = "success";
- String result = null;
- try {
-
- Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null)).thenReturn(response);
- result = mockPolicyEngine.updateConfigPolicy("testPolicy","test","test","testConfig",null,"OTHER","test","test",null, null, null, null, null);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- @Test
- public final void testCreatePolicyNullPolicyName() {
- response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
- policyParameters.setPolicyName(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullPolicyScope() {
- response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
- policyParameters.setPolicyName("test");
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullOnapName() {
- response.setResponseMessage("PE300 - Data Issue: No ONAP Name given.");
- policyParameters.setOnapName(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullPolicyConfigName() {
- response.setResponseMessage("PE300 - Data Issue: No Config Name given.");
- policyParameters.setConfigName(null);;
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullPolicyConfigBodyType() {
- response.setResponseMessage("PE300 - Data Issue: No Config Body Type given.");
- policyParameters.setConfigBodyType(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullPolicyConfigBody() {
- response.setResponseMessage("PE300 - Data Issue: No Config Body given.");
- policyParameters.setConfigBody(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyName() {
- response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
- policyParameters.setPolicyName(null);
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyScope() {
- response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
- policyParameters.setPolicyName("test");
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullOnapName() {
- response.setResponseMessage("PE300 - Data Issue: No ONAP Name given.");
- policyParameters.setOnapName(null);
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyConfigName() {
- response.setResponseMessage("PE300 - Data Issue: No Config Name given.");
- policyParameters.setConfigName(null);;
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyConfigBodyType() {
- response.setResponseMessage("PE300 - Data Issue: No Config Body Type given.");
- policyParameters.setConfigBodyType(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyConfigBody() {
- response.setResponseMessage("PE300 - Data Issue: No Config Body given.");
- policyParameters.setConfigBody(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- //assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-} \ No newline at end of file
+ }
+
+ /**
+ * Perform post-test clean up
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ // Add additional tear down code here
+ }
+
+ /**
+ * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test
+ */
+ public void testCreatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.createPolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the String createConfigPolicy() method test
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testCreateConfigPolicy() {
+ String response = "success";
+ String result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.createConfigPolicy("testPolicy", "test", "test",
+ "testConfig", null, "OTHER", "test", "test", null, null, null, null, null))
+ .thenReturn(response);
+ result = mockPolicyEngine.createConfigPolicy("testPolicy", "test", "test", "testConfig",
+ null, "OTHER", "test", "test", null, null, null, null, null);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test
+ */
+ public void testUpdatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.updatePolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the String updateConfigPolicy() method test
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testUpdateConfigPolicy() {
+ String response = "success";
+ String result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.updateConfigPolicy("testPolicy", "test", "test",
+ "testConfig", null, "OTHER", "test", "test", null, null, null, null, null))
+ .thenReturn(response);
+ result = mockPolicyEngine.updateConfigPolicy("testPolicy", "test", "test", "testConfig",
+ null, "OTHER", "test", "test", null, null, null, null, null);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyName() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullOnapName() {
+ response.setResponseMessage("PE300 - Data Issue: No ONAP Name given.");
+ policyParameters.setOnapName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyConfigName() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Name given.");
+ policyParameters.setConfigName(null);;
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyConfigBodyType() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Body Type given.");
+ policyParameters.setConfigBodyType(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyConfigBody() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Body given.");
+ policyParameters.setConfigBody(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyName() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Name given.");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE300 - Data Issue: No Policy Scope given.");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullOnapName() {
+ response.setResponseMessage("PE300 - Data Issue: No ONAP Name given.");
+ policyParameters.setOnapName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyConfigName() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Name given.");
+ policyParameters.setConfigName(null);;
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyConfigBodyType() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Body Type given.");
+ policyParameters.setConfigBodyType(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyConfigBody() {
+ response.setResponseMessage("PE300 - Data Issue: No Config Body given.");
+ policyParameters.setConfigBody(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ // assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java
index c50b3de47..bb12adc32 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigFirewallPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,11 +24,9 @@ package org.onap.policy.test;
import java.io.StringReader;
import java.util.UUID;
-
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
-
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.api.PolicyChangeResponse;
@@ -37,218 +37,240 @@ import org.onap.policy.api.PolicyParameters;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.std.StdPolicyChangeResponse;
-
-import junit.framework.TestCase;
+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()
- */
- public 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}]}";
-
+ 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()
+ */
+ public 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.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();
- }
-
+ json = jsonReader.readObject();
+ }
+
return json;
}
- /**
- * Perform post-test clean up
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- public 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());
- }
+
+ /**
+ * Perform post-test clean up
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ // Add additional tear down code here
+ }
+
+ /**
+ * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test
+ */
+ public void testCreatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.createPolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the String createConfigFirewallPolicy() method test
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testCreateConfigFirewallPolicy() {
+ String response = "success";
+ String result = null;
+ JsonObject jsonObj = buildJSON(json);
+ try {
+
+ Mockito.when(mockPolicyEngine.createConfigFirewallPolicy("testPolicy", jsonObj, "test",
+ null, null, null, null, null)).thenReturn(response);
+ result = mockPolicyEngine.createConfigFirewallPolicy("testPolicy", jsonObj, "test",
+ null, null, null, null, null);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test
+ */
+ public void testUpdatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.updatePolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the String updateConfigFirewallPolicy() method test
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testUpdateConfigFirewallPolicy() {
+ String response = "success";
+ String result = null;
+ JsonObject jsonObj = buildJSON(json);
+ try {
+
+ Mockito.when(mockPolicyEngine.updateConfigFirewallPolicy("testPolicy", jsonObj, "test",
+ null, null, null, null, null)).thenReturn(response);
+ result = mockPolicyEngine.updateConfigFirewallPolicy("testPolicy", jsonObj, "test",
+ null, null, null, null, null);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyConfigBody() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setConfigBody(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyConfigBody() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setConfigBody(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java
index 91025f5c0..993796290 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ConfigRequestParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,340 +25,338 @@ package org.onap.policy.test;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
-
import org.junit.*;
import org.onap.policy.api.ConfigRequestParameters;
-
import static org.junit.Assert.*;
/**
- * The class <code>ConfigRequestParametersTest</code> contains tests for the class <code>{@link ConfigRequestParameters}</code>.
+ * The class <code>ConfigRequestParametersTest</code> contains tests for the class
+ * <code>{@link ConfigRequestParameters}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class ConfigRequestParametersTest {
- /**
- * Run the ConfigRequestParameters() constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testConfigRequestParameters_1()
- throws Exception {
-
- ConfigRequestParameters result = new ConfigRequestParameters();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getPolicyName());
- assertEquals(null, result.getConfigName());
- assertEquals(null, result.getConfigAttributes());
- assertEquals(null, result.getRequestID());
- assertEquals(null, result.getOnapName());
- assertEquals(Boolean.FALSE, result.getUnique());
- }
-
- /**
- * Run the ConfigRequestParameters(String,String,String,Map<String,String>,Boolean,UUID) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testConfigRequestParameters_2()
- throws Exception {
- String policyName = "";
- String onapComponentName = "";
- String configName = "";
- Map<String, String> configAttributes = new Hashtable<String, String>();
- Boolean unique = new Boolean(true);
- UUID requestID = UUID.randomUUID();
-
- ConfigRequestParameters result = createConfigRequest(policyName, onapComponentName, configName, configAttributes, unique, requestID);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("", result.getPolicyName());
- assertEquals("", result.getConfigName());
- assertEquals("", result.getOnapName());
- assertEquals(Boolean.TRUE, result.getUnique());
- }
-
- /**
- * Run the Map<String, String> 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<String, String>(), new Boolean(true), UUID.randomUUID());
-
- Map<String, String> 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<String, String>(), new Boolean(true), UUID.randomUUID());
-
- String result = fixture.getConfigName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getOnapName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetOnapName_1()
- throws Exception {
- ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
-
- String result = fixture.getOnapName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), 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<String, String>(), 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<String, String>(), 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<String, String>(), new Boolean(true), UUID.randomUUID());
- Boolean unique = new Boolean(true);
-
- fixture.makeUnique(unique);
-
- // add additional test code here
- }
-
- /**
- * Run the void setConfigAttributes(Map<String,String>) 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<String, String>(), new Boolean(true), UUID.randomUUID());
- Map<String, String> configAttributes = new Hashtable<String, String>();
-
- 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<String, String>(), new Boolean(true), UUID.randomUUID());
- String configName = "";
-
- fixture.setConfigName(configName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setOnapName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetOnapName_1()
- throws Exception {
- ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
- String onapComponentName = "";
-
- fixture.setOnapName(onapComponentName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), 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<String, String>(), new Boolean(true), UUID.randomUUID());
- UUID requestID = UUID.randomUUID();
-
- fixture.setRequestID(requestID);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(ConfigRequestParametersTest.class);
- }
-
- private ConfigRequestParameters createConfigRequest(String policyName, String onapComponentName, String configName, Map<String,String> configAttributes, Boolean unique, UUID requestID){
- ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
- configRequestParameters.setRequestID(requestID);
- configRequestParameters.setPolicyName(policyName);
- configRequestParameters.setOnapName(onapComponentName);
- configRequestParameters.setConfigName(configName);
- configRequestParameters.setConfigAttributes(configAttributes);
- configRequestParameters.makeUnique(unique);
- return configRequestParameters;
- }
+ /**
+ * Run the ConfigRequestParameters() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testConfigRequestParameters_1() throws Exception {
+
+ ConfigRequestParameters result = new ConfigRequestParameters();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getPolicyName());
+ assertEquals(null, result.getConfigName());
+ assertEquals(null, result.getConfigAttributes());
+ assertEquals(null, result.getRequestID());
+ assertEquals(null, result.getOnapName());
+ assertEquals(Boolean.FALSE, result.getUnique());
+ }
+
+ /**
+ * Run the ConfigRequestParameters(String,String,String,Map<String,String>,Boolean,UUID)
+ * constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testConfigRequestParameters_2() throws Exception {
+ String policyName = "";
+ String onapComponentName = "";
+ String configName = "";
+ Map<String, String> configAttributes = new Hashtable<String, String>();
+ Boolean unique = new Boolean(true);
+ UUID requestID = UUID.randomUUID();
+
+ ConfigRequestParameters result = createConfigRequest(policyName, onapComponentName,
+ configName, configAttributes, unique, requestID);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("", result.getPolicyName());
+ assertEquals("", result.getConfigName());
+ assertEquals("", result.getOnapName());
+ assertEquals(Boolean.TRUE, result.getUnique());
+ }
+
+ /**
+ * Run the Map<String, String> 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<String, String>(), new Boolean(true), UUID.randomUUID());
+
+ Map<String, String> 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<String, String>(), new Boolean(true), UUID.randomUUID());
+
+ String result = fixture.getConfigName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getOnapName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetOnapName_1() throws Exception {
+ ConfigRequestParameters fixture = createConfigRequest("", "", "",
+ new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
+
+ String result = fixture.getOnapName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ ConfigRequestParameters fixture = createConfigRequest("", "", "",
+ new Hashtable<String, String>(), 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<String, String>(), 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<String, String>(), 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<String, String>(), new Boolean(true), UUID.randomUUID());
+ Boolean unique = new Boolean(true);
+
+ fixture.makeUnique(unique);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setConfigAttributes(Map<String,String>) 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<String, String>(), new Boolean(true), UUID.randomUUID());
+ Map<String, String> configAttributes = new Hashtable<String, String>();
+
+ 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<String, String>(), new Boolean(true), UUID.randomUUID());
+ String configName = "";
+
+ fixture.setConfigName(configName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setOnapName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetOnapName_1() throws Exception {
+ ConfigRequestParameters fixture = createConfigRequest("", "", "",
+ new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
+ String onapComponentName = "";
+
+ fixture.setOnapName(onapComponentName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyName_1() throws Exception {
+ ConfigRequestParameters fixture = createConfigRequest("", "", "",
+ new Hashtable<String, String>(), 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<String, String>(), new Boolean(true), UUID.randomUUID());
+ UUID requestID = UUID.randomUUID();
+
+ fixture.setRequestID(requestID);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(ConfigRequestParametersTest.class);
+ }
+
+ private ConfigRequestParameters createConfigRequest(String policyName, String onapComponentName,
+ String configName, Map<String, String> configAttributes, Boolean unique,
+ UUID requestID) {
+ ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
+ configRequestParameters.setRequestID(requestID);
+ configRequestParameters.setPolicyName(policyName);
+ configRequestParameters.setOnapName(onapComponentName);
+ configRequestParameters.setConfigName(configName);
+ configRequestParameters.setConfigAttributes(configAttributes);
+ configRequestParameters.makeUnique(unique);
+ return configRequestParameters;
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java
index 7c9eb3e10..c6dd0d7a7 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionPolicyApiTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,7 +25,6 @@ package org.onap.policy.test;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.api.AttributeType;
@@ -35,185 +36,175 @@ import org.onap.policy.api.PolicyParameters;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.std.StdPolicyChangeResponse;
-
import junit.framework.TestCase;
/**
* The class <code>DecisionPolicyApiTest</code> contains tests for the class
* {@link <code>PolicyEngine</code>}
*
- * @pattern JUnit Test Case
- * *
+ * @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()
- */
- public 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
+ 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()
+ */
+ public void setUp() throws Exception {
+ try {
+ policyEngine = new PolicyEngine("Test/config_pass.properties");
+ } catch (PolicyEngineException e) {
+ logger.error(e.getMessage());
+ fail("PolicyEngine Instantiation Error" + e);
+ }
+ logger.info("Loaded.. PolicyEngine");
+
+ mockPolicyEngine = Mockito.mock(PolicyEngine.class);
+
+ policyParameters.setPolicyClass(PolicyClass.Decision); // required
+ policyParameters.setPolicyName("test.junitTest"); // required
policyParameters.setOnapName("test");
- policyParameters.setPolicyDescription("testing"); //optional
- //policyParameters.setPolicyScope("test"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
-
- //Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ policyParameters.setPolicyDescription("testing"); // optional
+
+ // Set the Component Attributes... These are Optional
+ Map<String, String> configAttributes = new HashMap<String, String>();
configAttributes.put("test", "testing");
-
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+
+ Map<AttributeType, Map<String, String>> attributes =
+ new HashMap<AttributeType, Map<String, String>>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
- //Set the settings... These are Optional
-/* Map<String, String> settingsMap = new HashMap<String, String>();
- settingsMap.put("server", "5");
-
- Map<AttributeType, Map<String,String>> settings = new HashMap<AttributeType, Map<String, String>>();
- settings.put(AttributeType.SETTINGS, settingsMap);
- policyParameters.setSettings(settings);*/
-
policyParameters.setRequestID(UUID.randomUUID());
- }
-
- /**
- * Perform post-test clean up
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- // Add additional tear down code here
- }
-
- /**
- * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test
- */
- public void testCreatePolicy() {
- response.setResponseMessage("success");
- PolicyChangeResponse result = null;
- try {
-
- Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
- result = mockPolicyEngine.createPolicy(policyParameters);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- /**
- * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test
- */
- public void testUpdatePolicy() {
- response.setResponseMessage("success");
- PolicyChangeResponse result = null;
- try {
-
- Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
- result = mockPolicyEngine.updatePolicy(policyParameters);
-
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- assertEquals(result, response);
- }
-
- @Test
- public final void testCreatePolicyNullPolicyName() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setPolicyName(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullPolicyScope() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setPolicyName("test");
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testCreatePolicyNullOnapName() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setOnapName(null);
- try{
- result = policyEngine.createPolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyName() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setPolicyName(null);
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullPolicyScope() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setPolicyName("test");
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
-
- @Test
- public final void testUpdatePolicyNullOnapName() {
- response.setResponseMessage("PE500 - Process Flow Issue: :500:");
- policyParameters.setOnapName(null);
- try{
- result = policyEngine.updatePolicy(policyParameters);
- } catch (Exception e){
- logger.warn(e.getMessage());
- }
- assertEquals(result.getResponseMessage(), response.getResponseMessage());
- }
+ }
+
+ /**
+ * Perform post-test clean up
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ // Add additional tear down code here
+ }
+
+ /**
+ * Run the PolicyChangeResponse createPolicy(PolicyParameters) method test
+ */
+ public void testCreatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.createPolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.createPolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the PolicyChangeResponse updatePolicy(PolicyParameters) method test
+ */
+ public void testUpdatePolicy() {
+ response.setResponseMessage("success");
+ PolicyChangeResponse result = null;
+ try {
+
+ Mockito.when(mockPolicyEngine.updatePolicy(policyParameters)).thenReturn(response);
+ result = mockPolicyEngine.updatePolicy(policyParameters);
+
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result, response);
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testCreatePolicyNullOnapName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setOnapName(null);
+ try {
+ result = policyEngine.createPolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullPolicyScope() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setPolicyName("test");
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
+
+ @Test
+ public final void testUpdatePolicyNullOnapName() {
+ response.setResponseMessage("PE500 - Process Flow Issue: :500:");
+ policyParameters.setOnapName(null);
+ try {
+ result = policyEngine.updatePolicy(policyParameters);
+ } catch (Exception e) {
+ logger.warn(e.getMessage());
+ }
+ assertEquals(result.getResponseMessage(), response.getResponseMessage());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java
index a29bb1314..41d376944 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DecisionRequestParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,210 +25,205 @@ package org.onap.policy.test;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
-
import org.junit.*;
import org.onap.policy.api.DecisionRequestParameters;
-
import static org.junit.Assert.*;
/**
- * The class <code>DecisionRequestParametersTest</code> contains tests for the class <code>{@link DecisionRequestParameters}</code>.
+ * The class <code>DecisionRequestParametersTest</code> contains tests for the class
+ * <code>{@link DecisionRequestParameters}</code>.
*
* @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.getOnapName());
- assertEquals(null, result.getDecisionAttributes());
- assertEquals(null, result.getRequestID());
- }
-
- /**
- * Run the DecisionRequestParameters(String,Map<String,String>,UUID) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testDecisionRequestParameters_2()
- throws Exception {
- String onapComponentName = "";
- Map<String, String> decisionAttributes = new Hashtable<String, String>();
- UUID requestID = UUID.randomUUID();
-
- DecisionRequestParameters result = new DecisionRequestParameters(onapComponentName, decisionAttributes, requestID);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("", result.getOnapName());
- }
-
- /**
- * Run the Map<String, String> 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<String, String>(), UUID.randomUUID());
-
- Map<String, String> result = fixture.getDecisionAttributes();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the String getONAPComponentName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetONAPComponentName_1()
- throws Exception {
- DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable<String, String>(), UUID.randomUUID());
-
- String result = fixture.getOnapName();
-
- // 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<String, String>(), 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<String,String>) 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<String, String>(), UUID.randomUUID());
- Map<String, String> decisionAttributes = new Hashtable<String, String>();
-
- fixture.setDecisionAttributes(decisionAttributes);
-
- // add additional test code here
- }
-
- /**
- * Run the void setONAPComponentName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetONAPComponentName_1()
- throws Exception {
- DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable<String, String>(), UUID.randomUUID());
- String onapComponentName = "";
-
- fixture.setOnapName(onapComponentName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setRequestID(UUID) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetRequestID_1()
- throws Exception {
- DecisionRequestParameters fixture = new DecisionRequestParameters("", new Hashtable<String, String>(), 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);
- }
+ /**
+ * 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.getOnapName());
+ assertEquals(null, result.getDecisionAttributes());
+ assertEquals(null, result.getRequestID());
+ }
+
+ /**
+ * Run the DecisionRequestParameters(String,Map<String,String>,UUID) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testDecisionRequestParameters_2() throws Exception {
+ String onapComponentName = "";
+ Map<String, String> decisionAttributes = new Hashtable<String, String>();
+ UUID requestID = UUID.randomUUID();
+
+ DecisionRequestParameters result =
+ new DecisionRequestParameters(onapComponentName, decisionAttributes, requestID);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("", result.getOnapName());
+ }
+
+ /**
+ * Run the Map<String, String> 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<String, String>(), UUID.randomUUID());
+
+ Map<String, String> result = fixture.getDecisionAttributes();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the String getONAPComponentName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetONAPComponentName_1() throws Exception {
+ DecisionRequestParameters fixture = new DecisionRequestParameters("",
+ new Hashtable<String, String>(), UUID.randomUUID());
+
+ String result = fixture.getOnapName();
+
+ // 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<String, String>(),
+ 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<String,String>) 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<String, String>(), UUID.randomUUID());
+ Map<String, String> decisionAttributes = new Hashtable<String, String>();
+
+ fixture.setDecisionAttributes(decisionAttributes);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setONAPComponentName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetONAPComponentName_1() throws Exception {
+ DecisionRequestParameters fixture = new DecisionRequestParameters("",
+ new Hashtable<String, String>(), UUID.randomUUID());
+ String onapComponentName = "";
+
+ fixture.setOnapName(onapComponentName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRequestID(UUID) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetRequestID_1() throws Exception {
+ DecisionRequestParameters fixture = new DecisionRequestParameters("",
+ new Hashtable<String, String>(), UUID.randomUUID());
+ UUID requestID = UUID.randomUUID();
+
+ fixture.setRequestID(requestID);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(DecisionRequestParametersTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryParametersTest.java
index 63e1d7c5a..1c946543e 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,32 +22,30 @@
package org.onap.policy.test;
import static org.junit.Assert.*;
-
import java.util.UUID;
-
import org.junit.Test;
import org.onap.policy.api.DictionaryParameters;
import org.onap.policy.api.DictionaryType;
public class DictionaryParametersTest {
- @Test
- public void test() {
- DictionaryParameters params = new DictionaryParameters();
-
- params.setDictionary("dictionary");
- assertEquals("dictionary", params.getDictionary());
-
- UUID uuid = UUID.randomUUID();
- params.setRequestID(uuid);
- assertEquals(uuid, params.getRequestID());
-
- params.setDictionaryJson("{}");
- assertEquals("{}", params.getDictionaryJson());
-
- params.setDictionaryType(DictionaryType.BRMS);
- assertEquals(DictionaryType.BRMS, params.getDictionaryType());
-
- }
+ @Test
+ public void test() {
+ DictionaryParameters params = new DictionaryParameters();
+
+ params.setDictionary("dictionary");
+ assertEquals("dictionary", params.getDictionary());
+
+ UUID uuid = UUID.randomUUID();
+ params.setRequestID(uuid);
+ assertEquals(uuid, params.getRequestID());
+
+ params.setDictionaryJson("{}");
+ assertEquals("{}", params.getDictionaryJson());
+
+ params.setDictionaryType(DictionaryType.BRMS);
+ assertEquals(DictionaryType.BRMS, params.getDictionaryType());
+
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java
index 4fecea8c2..9efbaeb1f 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/EventRequestParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -23,171 +25,164 @@ package org.onap.policy.test;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
-
import org.junit.*;
import org.onap.policy.api.EventRequestParameters;
-
import static org.junit.Assert.*;
/**
- * The class <code>EventRequestParametersTest</code> contains tests for the class <code>{@link EventRequestParameters}</code>.
+ * The class <code>EventRequestParametersTest</code> contains tests for the class
+ * <code>{@link EventRequestParameters}</code>.
*
* @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<String,String>,UUID) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testEventRequestParameters_2()
- throws Exception {
- Map<String, String> eventAttributes = new Hashtable<String, String>();
- UUID requestID = UUID.randomUUID();
-
- EventRequestParameters result = new EventRequestParameters(eventAttributes, requestID);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the Map<String, String> 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<String, String>(), UUID.randomUUID());
-
- Map<String, String> 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<String, String>(), 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<String,String>) 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<String, String>(), UUID.randomUUID());
- Map<String, String> eventAttributes = new Hashtable<String, String>();
-
- 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<String, String>(), 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);
- }
+ /**
+ * 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<String,String>,UUID) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testEventRequestParameters_2() throws Exception {
+ Map<String, String> eventAttributes = new Hashtable<String, String>();
+ UUID requestID = UUID.randomUUID();
+
+ EventRequestParameters result = new EventRequestParameters(eventAttributes, requestID);
+
+ // add additional test code here
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Map<String, String> 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<String, String>(), UUID.randomUUID());
+
+ Map<String, String> 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<String, String>(),
+ 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<String,String>) 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<String, String>(), UUID.randomUUID());
+ Map<String, String> eventAttributes = new Hashtable<String, String>();
+
+ 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<String, String>(), UUID.randomUUID());
+ UUID requestID = UUID.randomUUID();
+
+ fixture.setRequestID(requestID);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(EventRequestParametersTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java
index 07af71eaf..aa59c1e93 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigByPolicyNameTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,7 +23,6 @@
package org.onap.policy.test;
import java.util.Collection;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.api.PolicyConfig;
@@ -30,34 +31,34 @@ import org.onap.policy.api.PolicyEngine;
import org.onap.policy.api.PolicyEngineException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-
-import junit.framework.TestCase;
+import junit.framework.TestCase;
public class GetConfigByPolicyNameTest extends TestCase {
- private PolicyEngine policyEngine = null;
- private String policyName = null;
- private Collection<PolicyConfig> 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);
- }
+ private PolicyEngine policyEngine = null;
+ private String policyName = null;
+ private Collection<PolicyConfig> policyConfig = null;
+ private static final Logger logger = FlexLogger.getLogger(GetConfigByPolicyNameTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ policyEngine = new PolicyEngine("Test/config_pass.properties");
+ } catch (PolicyEngineException e) {
+ logger.error(e.getMessage());
+ fail("PolicyEngine Instantiation Error" + e);
+ }
+ logger.info("Loaded.. PolicyEngine");
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigPolicyNameNotValid() {
+ policyName = null;
+ try {
+ policyConfig = policyEngine.getConfigByPolicyName(policyName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java
index f70a16a98..9ec649318 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringMapTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -24,11 +26,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.api.PolicyConfig;
@@ -38,222 +38,228 @@ import org.onap.policy.api.PolicyEngine;
import org.onap.policy.api.PolicyEngineException;
import org.onap.policy.api.PolicyType;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.common.logging.flexlogger.Logger;
public class GetConfigStringStringMapTest {
- private PolicyEngine policyEngine = null;
- private String onapComponentName = null;
- private String configName = null;
- private Map<String,String> configAttributes = new HashMap<String,String>();
- private Collection<PolicyConfig> 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");
- }
+ private PolicyEngine policyEngine = null;
+ private String onapComponentName = null;
+ private String configName = null;
+ private Map<String, String> configAttributes = new HashMap<String, String>();
+ private Collection<PolicyConfig> policyConfig = null;
+ private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringMapTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ policyEngine = new PolicyEngine("Test/config_pass.properties");
+ } catch (PolicyEngineException e) {
+ logger.error(e.getMessage());
+ fail("PolicyEngine Instantiation Error" + e);
+ }
+ logger.info("Loaded.. PolicyEngine");
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringMapFail() {
+ onapComponentName = null;
+ configName = null;
+ configAttributes = null;
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringMapFail1() {
+ onapComponentName = null;
+ configName = "testFail";
+ configAttributes.put("TestValue", "Fail");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringMapFail2() {
+ onapComponentName = "TestFail";
+ configName = null;
+ configAttributes.put("TestValue", "Fail");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringMapFail3() {
+ onapComponentName = "TestFail";
+ configName = "configFail";
+ configAttributes = null;
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringMapfail4() {
+ onapComponentName = "TestFail";
+ configName = "configFail";
+ configAttributes.put("", "");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringMapNotValid() {
+ onapComponentName = "TestFail";
+ configName = "configFail";
+ configAttributes.put("Action:com.test.fail", "Value");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertNull(policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringMapValidJSON() {
+ onapComponentName = "JSON";
+ configName = "JSONconfig";
+ configAttributes.put("Resource.com:test:resource:json", "Test");
+ configAttributes.put("Action.com:test:action:json", "TestJSON");
+ configAttributes.put("Subject.com:test:subject:json", "TestSubject");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.JSON, policyConfig.getType());
+ assertNotNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringMapValidXML() {
+ onapComponentName = "XML";
+ configName = "XMLconfig";
+ configAttributes.put("Resource.com:test:resource:json", "Test");
+ configAttributes.put("Action.com:test:action:json", "TestJSON");
+ configAttributes.put("Subject.com:test:subject:json", "TestSubject");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.XML, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNotNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringMapValidProperties() {
+ onapComponentName = "Properties";
+ configName = "PropConfig";
+ configAttributes.put("Resource.com:test:resource:json", "Test");
+ configAttributes.put("Action.com:test:action:json", "TestJSON");
+ configAttributes.put("Subject.com:test:subject:json", "TestSubject");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.PROPERTIES, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNotNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringMapFail() {
- onapComponentName = null;
- configName = null;
- configAttributes = null;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringMapFail1() {
- onapComponentName = null;
- configName = "testFail";
- configAttributes.put("TestValue", "Fail");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringMapFail2() {
- onapComponentName = "TestFail";
- configName = null;
- configAttributes.put("TestValue", "Fail");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringMapFail3() {
- onapComponentName = "TestFail";
- configName = "configFail";
- configAttributes= null;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringMapfail4() {
- onapComponentName = "TestFail";
- configName = "configFail";
- configAttributes.put("", "");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringMapNotValid() {
- onapComponentName = "TestFail";
- configName = "configFail";
- configAttributes.put("Action:com.test.fail", "Value");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertNull(policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringMapValidJSON() {
- onapComponentName = "JSON";
- configName = "JSONconfig";
- configAttributes.put("Resource.com:test:resource:json", "Test");
- configAttributes.put("Action.com:test:action:json", "TestJSON");
- configAttributes.put("Subject.com:test:subject:json", "TestSubject");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.JSON,policyConfig.getType());
- assertNotNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringMapValidXML() {
- onapComponentName = "XML";
- configName = "XMLconfig";
- configAttributes.put("Resource.com:test:resource:json", "Test");
- configAttributes.put("Action.com:test:action:json", "TestJSON");
- configAttributes.put("Subject.com:test:subject:json", "TestSubject");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.XML,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNotNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringMapValidProperties() {
- onapComponentName = "Properties";
- configName = "PropConfig" ;
- configAttributes.put("Resource.com:test:resource:json", "Test");
- configAttributes.put("Action.com:test:action:json", "TestJSON");
- configAttributes.put("Subject.com:test:subject:json", "TestSubject");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.PROPERTIES,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNotNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringMapValidOther() {
- onapComponentName = "Other";
- configName = "OtherConfig" ;
- configAttributes.put("Resource.com:test:resource:json", "Test");
- configAttributes.put("Action.com:test:action:json", "TestJSON");
- configAttributes.put("Subject.com:test:subject:json", "TestSubject");
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.OTHER,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNotNull(policyConfig.toOther());
- }
- }
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringMapValidOther() {
+ onapComponentName = "Other";
+ configName = "OtherConfig";
+ configAttributes.put("Resource.com:test:resource:json", "Test");
+ configAttributes.put("Action.com:test:action:json", "TestJSON");
+ configAttributes.put("Subject.com:test:subject:json", "TestSubject");
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.OTHER, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNotNull(policyConfig.toOther());
+ }
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java
index 0a6db2dd4..0f3493b68 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringStringTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -24,9 +26,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-
import java.util.Collection;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.api.PolicyConfig;
@@ -36,178 +36,183 @@ import org.onap.policy.api.PolicyEngine;
import org.onap.policy.api.PolicyEngineException;
import org.onap.policy.api.PolicyType;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.common.logging.flexlogger.Logger;
public class GetConfigStringStringTest {
-
- private PolicyEngine policyEngine = null;
- private String onapComponentName = null;
- private String configName = null;
- private Collection<PolicyConfig> policyConfig = null;
- private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringTest.class);
- @Before
- public void setUp() {
- try {
- policyEngine = new PolicyEngine("Test/config_pass.properties");
- } catch (PolicyEngineException e) {
- logger.error(e.getMessage());
- fail("PolicyEngine Instantiation Error" + e);
- }
- logger.info("Loaded.. PolicyEngine");
- }
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringFail() {
- onapComponentName = null;
- configName = null;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringFail1() {
- onapComponentName = null;
- configName = "";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testGetConfigStringStringFail2() {
- onapComponentName = "";
- configName = null;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringNotvalid() {
- onapComponentName = "fail";
- configName = "fail";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertNull(policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringValidJSON() {
- onapComponentName = "JSON";
- configName = "JSONconfig";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.JSON,policyConfig.getType());
- assertNotNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringValidXML() {
- onapComponentName = "XML";
- configName = "XMLconfig";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.XML,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNotNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringValidProperties() {
- onapComponentName = "Properties";
- configName = "PropConfig" ;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.PROPERTIES,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNotNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringStringValidOther() {
- onapComponentName = "Other";
- configName = "OtherConfig" ;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName, configName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.OTHER,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNotNull(policyConfig.toOther());
- }
- }
+ private PolicyEngine policyEngine = null;
+ private String onapComponentName = null;
+ private String configName = null;
+ private Collection<PolicyConfig> policyConfig = null;
+ private static final Logger logger = FlexLogger.getLogger(GetConfigStringStringTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ policyEngine = new PolicyEngine("Test/config_pass.properties");
+ } catch (PolicyEngineException e) {
+ logger.error(e.getMessage());
+ fail("PolicyEngine Instantiation Error" + e);
+ }
+ logger.info("Loaded.. PolicyEngine");
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringFail() {
+ onapComponentName = null;
+ configName = null;
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringFail1() {
+ onapComponentName = null;
+ configName = "";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testGetConfigStringStringFail2() {
+ onapComponentName = "";
+ configName = null;
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringNotvalid() {
+ onapComponentName = "fail";
+ configName = "fail";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertNull(policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringValidJSON() {
+ onapComponentName = "JSON";
+ configName = "JSONconfig";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.JSON, policyConfig.getType());
+ assertNotNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringValidXML() {
+ onapComponentName = "XML";
+ configName = "XMLconfig";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.XML, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNotNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringValidProperties() {
+ onapComponentName = "Properties";
+ configName = "PropConfig";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.PROPERTIES, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNotNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNull(policyConfig.toOther());
+ }
+ }
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringStringValidOther() {
+ onapComponentName = "Other";
+ configName = "OtherConfig";
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName, configName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyConfig policyConfig : this.policyConfig) {
+ logger.info(policyConfig.getPolicyConfigMessage() + " , "
+ + policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, policyConfig.getPolicyConfigStatus());
+ assertNotNull(policyConfig.getPolicyConfigMessage());
+ assertEquals(PolicyType.OTHER, policyConfig.getType());
+ assertNull(policyConfig.toJSON());
+ assertNull(policyConfig.toProperties());
+ assertNull(policyConfig.toXML());
+ assertNotNull(policyConfig.toOther());
+ }
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java
index f87a59c09..16d8e8991 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/GetConfigStringTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,7 +23,6 @@
package org.onap.policy.test;
import java.util.Collection;
-
import org.junit.Before;
import org.onap.policy.api.PolicyConfig;
import org.onap.policy.api.PolicyConfigException;
@@ -29,142 +30,35 @@ import org.onap.policy.api.PolicyEngine;
import org.onap.policy.api.PolicyEngineException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
+import junit.framework.TestCase;
+
+public class GetConfigStringTest extends TestCase {
+
+ private PolicyEngine policyEngine = null;
+ private String onapComponentName = null;
+ private Collection<PolicyConfig> policyConfig = null;
+ private static final Logger logger = FlexLogger.getLogger(GetConfigStringTest.class);
-import junit.framework.TestCase;
+ @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");
+ }
-public class GetConfigStringTest extends TestCase{
-
- private PolicyEngine policyEngine = null;
- private String onapComponentName = null;
- private Collection<PolicyConfig> policyConfig = null;
- private static final Logger logger = FlexLogger.getLogger(GetConfigStringTest.class);
- @Before
- public void setUp() {
- try {
- policyEngine = new PolicyEngine("Test/config_pass.properties");
- } catch (PolicyEngineException e) {
- logger.error(e.getMessage());
- fail("PolicyEngine Instantiation Error" + e);
- }
- logger.info("Loaded.. PolicyEngine");
- }
-
- //@Test
- @SuppressWarnings("deprecation")
- public void testGetConfigStringFail() {
- onapComponentName = null;
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- /*@Test
- public void testGetConfigStringNotvalid() {
- onapComponentName = "fail";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertNull(policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
- */
-
- /*@Test
- public void testGetConfigStringValidJSON() {
- onapComponentName = "JSON";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.JSON,policyConfig.getType());
- assertNotNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
- */
- /*@Test
- public void testGetConfigStringValidXML() {
- onapComponentName = "XML";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.XML,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNotNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
- */
- /*@Test
- public void testGetConfigStringValidProperties() {
- onapComponentName = "Properties";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.PROPERTIES,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNotNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNull(policyConfig.toOther());
- }
- }
- */
- /*@Test
- public void testGetConfigStringValidOther() {
- onapComponentName = "Other";
- try {
- policyConfig = policyEngine.getConfig(onapComponentName);
- } catch (PolicyConfigException e) {
- logger.warn(e.getMessage());
- }
- for(PolicyConfig policyConfig : this.policyConfig){
- logger.info(policyConfig.getPolicyConfigMessage() + " , " +policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig);
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED,policyConfig.getPolicyConfigStatus());
- assertNotNull(policyConfig.getPolicyConfigMessage());
- assertEquals(PolicyType.OTHER,policyConfig.getType());
- assertNull(policyConfig.toJSON());
- assertNull(policyConfig.toProperties());
- assertNull(policyConfig.toXML());
- assertNotNull(policyConfig.toOther());
- }
- }
- */
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testGetConfigStringFail() {
+ onapComponentName = null;
+ try {
+ policyConfig = policyEngine.getConfig(onapComponentName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java
index be3e9c39b..8bb613c32 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/ImportParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,382 +24,365 @@ package org.onap.policy.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.UUID;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.api.ImportParameters;
/**
- * The class <code>ImportParametersTest</code> contains tests for the class <code>{@link ImportParameters}</code>.
+ * The class <code>ImportParametersTest</code> contains tests for the class
+ * <code>{@link ImportParameters}</code>.
*
* @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);
- }
+ /**
+ * Run the String getDescription() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetDescription_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ String result = fixture.getDescription();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getFilePath() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetFilePath_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ String result = fixture.getFilePath();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the UUID getRequestID() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetRequestID_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.fromString("731dca0a-fe99-456c-8ad2-87cff8437b2f"));
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ UUID result = fixture.getRequestID();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("731dca0a-fe99-456c-8ad2-87cff8437b2f", result.toString());
+ assertEquals(4, result.version());
+ assertEquals(2, result.variant());
+ assertEquals(-8443537024073106641L, result.getLeastSignificantBits());
+ assertEquals(8295008237256263020L, result.getMostSignificantBits());
+ }
+
+ /**
+ * Run the String getServiceName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetServiceName_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ String result = fixture.getServiceName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the ImportParameters.IMPORT_TYPE getServiceType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetServiceType_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ ImportParameters.IMPORT_TYPE result = fixture.getServiceType();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("MICROSERVICE", result.name());
+ assertEquals("MICROSERVICE", result.toString());
+ assertEquals(0, result.ordinal());
+ }
+
+ /**
+ * Run the String getVersion() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetVersion_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+
+ String result = fixture.getVersion();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the void setDescription(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetDescription_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ String description = "";
+
+ fixture.setDescription(description);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setFilePath(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetFilePath_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ String filePath = "";
+
+ fixture.setFilePath(filePath);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setImportParameters(String,String,UUID,String,IMPORT_TYPE,String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetImportParameters_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ String serviceName = "";
+ String description = "";
+ UUID requestID = UUID.randomUUID();
+ String filePath = "";
+ ImportParameters.IMPORT_TYPE importType = ImportParameters.IMPORT_TYPE.MICROSERVICE;
+ String version = "";
+
+ fixture.setImportParameters(serviceName, description, requestID, filePath, importType,
+ version);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRequestID(UUID) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetRequestID_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ UUID requestID = UUID.randomUUID();
+
+ fixture.setRequestID(requestID);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setServiceName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetServiceName_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ String serviceName = "";
+
+ fixture.setServiceName(serviceName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setServiceType(IMPORT_TYPE) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetServiceType_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ ImportParameters.IMPORT_TYPE enumImportType = ImportParameters.IMPORT_TYPE.MICROSERVICE;
+
+ fixture.setServiceType(enumImportType);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setVersion(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetVersion_1() throws Exception {
+ ImportParameters fixture = new ImportParameters();
+ fixture.setFilePath("");
+ fixture.setVersion("");
+ fixture.setServiceType(ImportParameters.IMPORT_TYPE.MICROSERVICE);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setDescription("");
+ fixture.setServiceName("");
+ String version = "";
+
+ fixture.setVersion(version);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(ImportParametersTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java
index 1cc9de8df..7ebefb52a 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/LoadedPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.LoadedPolicy;
/**
- * The class <code>LoadedPolicyTest</code> contains tests for the class <code>{@link LoadedPolicy}</code>.
+ * The class <code>LoadedPolicyTest</code> contains tests for the class
+ * <code>{@link LoadedPolicy}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(LoadedPolicyTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/MetricsRequestParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/MetricsRequestParametersTest.java
index 19d7933fc..771c51a31 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/MetricsRequestParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/MetricsRequestParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,20 +22,18 @@
package org.onap.policy.test;
import static org.junit.Assert.*;
-
import java.util.UUID;
-
import org.junit.Test;
import org.onap.policy.api.MetricsRequestParameters;
public class MetricsRequestParametersTest {
- @Test
- public void test() {
- MetricsRequestParameters p = new MetricsRequestParameters();
-
- p.setRequestID(UUID.randomUUID());
- assertNotNull(p.getRequestID());
- }
+ @Test
+ public void test() {
+ MetricsRequestParameters p = new MetricsRequestParameters();
+
+ p.setRequestID(UUID.randomUUID());
+ assertNotNull(p.getRequestID());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java
index 4b996ce35..22ad1fdb6 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationHandlerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.NotificationHandler;
/**
- * The class <code>NotificationHandlerTest</code> contains tests for the class <code>{@link NotificationHandler}</code>.
+ * The class <code>NotificationHandlerTest</code> contains tests for the class
+ * <code>{@link NotificationHandler}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(NotificationHandlerTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java
index 3274cf3ac..83f2f258c 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationSchemeTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,70 +24,65 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.NotificationScheme;
-
import static org.junit.Assert.*;
/**
- * The class <code>NotificationSchemeTest</code> contains tests for the class <code>{@link NotificationScheme}</code>.
+ * The class <code>NotificationSchemeTest</code> contains tests for the class
+ * <code>{@link NotificationScheme}</code>.
*
* @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;
+ /**
+ * 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();
+ String result = fixture.toString();
- // add additional test code here
- assertEquals("auto_all_notifications", result);
- }
+ // 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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(NotificationSchemeTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java
index 53ef086e2..c23b7789f 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/NotificationTypeTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,70 +24,65 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.NotificationType;
-
import static org.junit.Assert.*;
/**
- * The class <code>NotificationTypeTest</code> contains tests for the class <code>{@link NotificationType}</code>.
+ * The class <code>NotificationTypeTest</code> contains tests for the class
+ * <code>{@link NotificationType}</code>.
*
* @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;
+ /**
+ * 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();
+ String result = fixture.toString();
- // add additional test code here
- assertEquals("both", result);
- }
+ // 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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(NotificationTypeTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java
index 50d0aa324..28d45d101 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PDPNotificationTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.PDPNotification;
/**
- * The class <code>PDPNotificationTest</code> contains tests for the class <code>{@link PDPNotification}</code>.
+ * The class <code>PDPNotificationTest</code> contains tests for the class
+ * <code>{@link PDPNotification}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PDPNotificationTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java
index e8fd6346a..c5e47b6c8 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyChangeResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.PolicyChangeResponse;
/**
- * The class <code>PolicyChangeResponseTest</code> contains tests for the class <code>{@link PolicyChangeResponse}</code>.
+ * The class <code>PolicyChangeResponseTest</code> contains tests for the class
+ * <code>{@link PolicyChangeResponse}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyChangeResponseTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java
index 60b11b5c4..44cd3de2e 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigExceptionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,162 +24,155 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.PolicyConfigException;
-
import static org.junit.Assert.*;
/**
- * The class <code>PolicyConfigExceptionTest</code> contains tests for the class <code>{@link PolicyConfigException}</code>.
+ * The class <code>PolicyConfigExceptionTest</code> contains tests for the class
+ * <code>{@link PolicyConfigException}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class PolicyConfigExceptionTest {
- /**
- * Run the PolicyConfigException() constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyConfigException_1()
- throws Exception {
-
- PolicyConfigException result = new PolicyConfigException();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyConfigException", result.toString());
- assertEquals(null, result.getLocalizedMessage());
- assertEquals(null, result.getMessage());
- }
-
- /**
- * Run the PolicyConfigException(String) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyConfigException_2()
- throws Exception {
- String message = "";
-
- PolicyConfigException result = new PolicyConfigException(message);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyConfigException(Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyConfigException_3()
- throws Exception {
- Throwable cause = new Throwable();
-
- PolicyConfigException result = new PolicyConfigException(cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyConfigException: java.lang.Throwable", result.toString());
- assertEquals("java.lang.Throwable", result.getLocalizedMessage());
- assertEquals("java.lang.Throwable", result.getMessage());
- }
-
- /**
- * Run the PolicyConfigException(String,Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyConfigException_4()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
-
- PolicyConfigException result = new PolicyConfigException(message, cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyConfigException(String,Throwable,boolean,boolean) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyConfigException_5()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
- boolean enableSuppression = true;
- boolean writableStackTrace = true;
-
- PolicyConfigException result = new PolicyConfigException(message, cause, enableSuppression, writableStackTrace);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyConfigExceptionTest.class);
- }
+ /**
+ * Run the PolicyConfigException() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyConfigException_1() throws Exception {
+
+ PolicyConfigException result = new PolicyConfigException();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyConfigException", result.toString());
+ assertEquals(null, result.getLocalizedMessage());
+ assertEquals(null, result.getMessage());
+ }
+
+ /**
+ * Run the PolicyConfigException(String) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyConfigException_2() throws Exception {
+ String message = "";
+
+ PolicyConfigException result = new PolicyConfigException(message);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyConfigException(Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyConfigException_3() throws Exception {
+ Throwable cause = new Throwable();
+
+ PolicyConfigException result = new PolicyConfigException(cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyConfigException: java.lang.Throwable",
+ result.toString());
+ assertEquals("java.lang.Throwable", result.getLocalizedMessage());
+ assertEquals("java.lang.Throwable", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyConfigException(String,Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyConfigException_4() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+
+ PolicyConfigException result = new PolicyConfigException(message, cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyConfigException(String,Throwable,boolean,boolean) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyConfigException_5() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+ boolean enableSuppression = true;
+ boolean writableStackTrace = true;
+
+ PolicyConfigException result =
+ new PolicyConfigException(message, cause, enableSuppression, writableStackTrace);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyConfigException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyConfigExceptionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java
index 0aa4fbbfa..423c9d6f4 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.PolicyConfig;
/**
- * The class <code>PolicyConfigTest</code> contains tests for the class <code>{@link PolicyConfig}</code>.
+ * The class <code>PolicyConfigTest</code> contains tests for the class
+ * <code>{@link PolicyConfig}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyConfigTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java
index 2d838aa08..6d8633486 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigTypeTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,76 +24,73 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.PolicyConfigType;
-
import static org.junit.Assert.*;
/**
- * The class <code>PolicyConfigTypeTest</code> contains tests for the class <code>{@link PolicyConfigType}</code>.
+ * The class <code>PolicyConfigTypeTest</code> contains tests for the class
+ * <code>{@link PolicyConfigType}</code>.
*
* @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;
+ /**
+ * 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);
- String result = fixture.toString();
+ assertEquals(PolicyConfigType.MicroService,
+ PolicyConfigType.create(PolicyConfigType.MicroService.name()));
+ }
- // add additional test code here
- assertEquals("BRMS_Param", result);
-
- assertEquals(PolicyConfigType.MicroService, PolicyConfigType.create(PolicyConfigType.MicroService.name()));
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyConfigType.create("foobar");
+ }
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- PolicyConfigType.create("foobar");
- }
- /**
- * 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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyConfigTypeTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java
index f0ee88151..8e719ac94 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionExceptionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,162 +24,155 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.PolicyDecisionException;
-
import static org.junit.Assert.*;
/**
- * The class <code>PolicyDecisionExceptionTest</code> contains tests for the class <code>{@link PolicyDecisionException}</code>.
+ * The class <code>PolicyDecisionExceptionTest</code> contains tests for the class
+ * <code>{@link PolicyDecisionException}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class PolicyDecisionExceptionTest {
- /**
- * Run the PolicyDecisionException() constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyDecisionException_1()
- throws Exception {
-
- PolicyDecisionException result = new PolicyDecisionException();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyDecisionException", result.toString());
- assertEquals(null, result.getLocalizedMessage());
- assertEquals(null, result.getMessage());
- }
-
- /**
- * Run the PolicyDecisionException(String) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyDecisionException_2()
- throws Exception {
- String message = "";
-
- PolicyDecisionException result = new PolicyDecisionException(message);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyDecisionException(Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyDecisionException_3()
- throws Exception {
- Throwable cause = new Throwable();
-
- PolicyDecisionException result = new PolicyDecisionException(cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyDecisionException: java.lang.Throwable", result.toString());
- assertEquals("java.lang.Throwable", result.getLocalizedMessage());
- assertEquals("java.lang.Throwable", result.getMessage());
- }
-
- /**
- * Run the PolicyDecisionException(String,Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyDecisionException_4()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
-
- PolicyDecisionException result = new PolicyDecisionException(message, cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyDecisionException(String,Throwable,boolean,boolean) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyDecisionException_5()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
- boolean enableSuppression = true;
- boolean writableStackTrace = true;
-
- PolicyDecisionException result = new PolicyDecisionException(message, cause, enableSuppression, writableStackTrace);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyDecisionExceptionTest.class);
- }
+ /**
+ * Run the PolicyDecisionException() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyDecisionException_1() throws Exception {
+
+ PolicyDecisionException result = new PolicyDecisionException();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyDecisionException", result.toString());
+ assertEquals(null, result.getLocalizedMessage());
+ assertEquals(null, result.getMessage());
+ }
+
+ /**
+ * Run the PolicyDecisionException(String) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyDecisionException_2() throws Exception {
+ String message = "";
+
+ PolicyDecisionException result = new PolicyDecisionException(message);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyDecisionException(Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyDecisionException_3() throws Exception {
+ Throwable cause = new Throwable();
+
+ PolicyDecisionException result = new PolicyDecisionException(cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyDecisionException: java.lang.Throwable",
+ result.toString());
+ assertEquals("java.lang.Throwable", result.getLocalizedMessage());
+ assertEquals("java.lang.Throwable", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyDecisionException(String,Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyDecisionException_4() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+
+ PolicyDecisionException result = new PolicyDecisionException(message, cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyDecisionException(String,Throwable,boolean,boolean) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyDecisionException_5() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+ boolean enableSuppression = true;
+ boolean writableStackTrace = true;
+
+ PolicyDecisionException result =
+ new PolicyDecisionException(message, cause, enableSuppression, writableStackTrace);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyDecisionException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyDecisionExceptionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java
index 58c45b97c..3d10badec 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineExceptionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,162 +24,155 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.PolicyEngineException;
-
import static org.junit.Assert.*;
/**
- * The class <code>PolicyEngineExceptionTest</code> contains tests for the class <code>{@link PolicyEngineException}</code>.
+ * The class <code>PolicyEngineExceptionTest</code> contains tests for the class
+ * <code>{@link PolicyEngineException}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class PolicyEngineExceptionTest {
- /**
- * Run the PolicyEngineException() constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testPolicyEngineException_1()
- throws Exception {
-
- PolicyEngineException result = new PolicyEngineException();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyEngineException", result.toString());
- assertEquals(null, result.getLocalizedMessage());
- assertEquals(null, result.getMessage());
- }
-
- /**
- * Run the PolicyEngineException(String) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testPolicyEngineException_2()
- throws Exception {
- String message = "";
-
- PolicyEngineException result = new PolicyEngineException(message);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyEngineException(Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testPolicyEngineException_3()
- throws Exception {
- Throwable cause = new Throwable();
-
- PolicyEngineException result = new PolicyEngineException(cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEngineException: java.lang.Throwable", result.toString());
- assertEquals("java.lang.Throwable", result.getLocalizedMessage());
- assertEquals("java.lang.Throwable", result.getMessage());
- }
-
- /**
- * Run the PolicyEngineException(String,Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testPolicyEngineException_4()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
-
- PolicyEngineException result = new PolicyEngineException(message, cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyEngineException(String,Throwable,boolean,boolean) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testPolicyEngineException_5()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
- boolean enableSuppression = true;
- boolean writableStackTrace = true;
-
- PolicyEngineException result = new PolicyEngineException(message, cause, enableSuppression, writableStackTrace);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyEngineExceptionTest.class);
- }
+ /**
+ * Run the PolicyEngineException() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testPolicyEngineException_1() throws Exception {
+
+ PolicyEngineException result = new PolicyEngineException();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyEngineException", result.toString());
+ assertEquals(null, result.getLocalizedMessage());
+ assertEquals(null, result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEngineException(String) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testPolicyEngineException_2() throws Exception {
+ String message = "";
+
+ PolicyEngineException result = new PolicyEngineException(message);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEngineException(Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testPolicyEngineException_3() throws Exception {
+ Throwable cause = new Throwable();
+
+ PolicyEngineException result = new PolicyEngineException(cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEngineException: java.lang.Throwable",
+ result.toString());
+ assertEquals("java.lang.Throwable", result.getLocalizedMessage());
+ assertEquals("java.lang.Throwable", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEngineException(String,Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testPolicyEngineException_4() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+
+ PolicyEngineException result = new PolicyEngineException(message, cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEngineException(String,Throwable,boolean,boolean) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testPolicyEngineException_5() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+ boolean enableSuppression = true;
+ boolean writableStackTrace = true;
+
+ PolicyEngineException result =
+ new PolicyEngineException(message, cause, enableSuppression, writableStackTrace);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEngineException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyEngineExceptionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java
index 2adf3b0bf..9367e68ff 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEngineInterfaceTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -26,11 +28,9 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
-
import org.mockito.Mockito;
import org.onap.policy.api.AttributeType;
import org.onap.policy.api.ConfigRequestParameters;
@@ -60,12 +60,11 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.std.StdPDPNotification;
import org.onap.policy.std.StdPolicyChangeResponse;
import org.onap.policy.std.StdPolicyResponse;
-
import junit.framework.TestCase;
/**
- * The class <code>PolicyEngineInterfaceTest</code> contains tests for the
- * class {@link <code>PolicyEngine</code>}
+ * The class <code>PolicyEngineInterfaceTest</code> contains tests for the class
+ * {@link <code>PolicyEngine</code>}
*
* @pattern JUnit Test Case
*
@@ -76,595 +75,635 @@ import junit.framework.TestCase;
*/
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> 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()
- */
- public 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()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- // Add additional tear down code here
- }
-
- /**
- * Run the Collection<PolicyConfig> 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<PolicyConfig> getConfig(String) method test
- */
- @SuppressWarnings("deprecation")
- public void testGetConfig() {
- String onapName = null;
-
- try{
- policyConfig = policyEngine.getConfig(onapName);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- public void testGetConfig2() {
- String onapName = null;
-
- try{
- policyConfig = policyEngine.getConfig(onapName,requestID);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
-
- @SuppressWarnings("deprecation")
- public void testGetConfig3() {
- String onapName = null;
- String configName = null;
-
- try{
- policyConfig = policyEngine.getConfig(onapName,configName,requestID);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- public void testGetConfig4() {
- String onapName = null;
- String configName = null;
- Map<String,String> configAttributes = null;
-
- try{
- policyConfig = policyEngine.getConfig(onapName,configName,configAttributes);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- @SuppressWarnings("deprecation")
- public void testGetConfig5() {
- String onapName = null;
- String configName = null;
- Map<String,String> configAttributes = null;
-
- try{
- policyConfig = policyEngine.getConfig(onapName,configName,configAttributes,requestID);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
- public void testGetConfig6() {
- ConfigRequestParameters parameters = new ConfigRequestParameters();
-
- try{
- policyConfig = policyEngine.getConfig(parameters);
- } catch (PolicyConfigException e){
- logger.warn(e.getMessage());
- }
- assertNull(policyConfig);
- }
-
-
- /**
- * Run the Collection<PolicyResponse> sendEvent(Map<String,String>) method
- * test
- */
- @SuppressWarnings("deprecation")
- public void testSendEvent()
- {
- Collection<PolicyResponse> result = null;
- Collection<StdPolicyResponse> response = null;
- Map<String,String> 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<PolicyResponse> result = null;
- Collection<StdPolicyResponse> response = null;
- Map<String,String> 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<PolicyResponse> result = null;
- Collection<StdPolicyResponse> 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<String,String>) method
- * test
- */
- @SuppressWarnings("deprecation")
- public void testGetDecision()
- {
- String onapComponentName = null;
- Map<String,String> decisionAttributes = null;
-
- DecisionResponse result = null;
-
- try {
- Mockito.when(mockPolicyEngine.getDecision(onapComponentName,decisionAttributes)).thenReturn(null);
- result = mockPolicyEngine.getDecision(onapComponentName,decisionAttributes);
- } catch (PolicyDecisionException e) {
- logger.error("Exception Occured"+e);
- }
-
- assertEquals(result,null);
- }
-
- @SuppressWarnings("deprecation")
- public void testGetDecision2()
- {
- String onapComponentName = null;
- Map<String,String> decisionAttributes = null;
-
- DecisionResponse result = null;
-
- try {
- Mockito.when(mockPolicyEngine.getDecision(onapComponentName,decisionAttributes,requestID)).thenReturn(null);
- result = mockPolicyEngine.getDecision(onapComponentName,decisionAttributes);
- } catch (PolicyDecisionException e) {
- logger.error("Exception Occured"+e);
- }
-
- assertEquals(result,null);
- }
-
- public void testGetDecision3()
- {
- DecisionRequestParameters parameters = new DecisionRequestParameters();
- DecisionResponse result = null;
-
- try {
- Mockito.when(mockPolicyEngine.getDecision(parameters)).thenReturn(null);
- result = mockPolicyEngine.getDecision(parameters);
- } catch (PolicyDecisionException e) {
- logger.error("Exception Occured"+e);
- }
-
- assertEquals(result,null);
- }
-
- /**
- * Run the void setNotification(NotificationScheme, NotificationHandler)
- * method test
- */
- public void testSetNotification() {
- // add test code here
-
- NotificationScheme scheme = null;
- NotificationHandler handler = null;
-
- Mockito.doNothing().when(mockPolicyEngine).setNotification(scheme, handler);
- mockPolicyEngine.setNotification(scheme, handler);
- //assertTrue(true);
- }
-
- /**
- * Run the void clearNotification() method test
- */
- public void testClearNotification() {
- // add test code here
-
- Mockito.doNothing().when(mockPolicyEngine).clearNotification();
- mockPolicyEngine.clearNotification();
- //assertTrue(true);
- }
-
- /**
- * Run the void setScheme(NotificationScheme) method test
- */
- public void testSetScheme() {
- NotificationScheme scheme = null;
-
- Mockito.doNothing().when(mockPolicyEngine).setScheme(scheme);
- mockPolicyEngine.setScheme(scheme);
- //assertTrue(true);
- }
-
- /**
- * Run the PDPNotification getNotification() method test
- */
- public void testGetNotification() {
- PDPNotification result = null;
- StdPDPNotification response = null;
- Mockito.when(mockPolicyEngine.getNotification()).thenReturn(response);
- result = mockPolicyEngine.getNotification();
-
- assertEquals(result,response);
- }
-
- /**
- * Run the String createConfigPolicy(String, String, String, String,
- * Map<String,String>, String, 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, 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<String, String> configAttributes = new HashMap<String, String>();
+ private static final Logger logger = FlexLogger.getLogger(PolicyEngineInterfaceTest.class);
+
+ private PolicyEngine policyEngine = null;
+ private PolicyEngine mockPolicyEngine = null;
+ private Collection<PolicyConfig> 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()
+ */
+ public 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()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ // Add additional tear down code here
+ }
+
+ /**
+ * Run the Collection<PolicyConfig> 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<PolicyConfig> getConfig(String) method test
+ */
+ @SuppressWarnings("deprecation")
+ public void testGetConfig() {
+ String onapName = null;
+
+ try {
+ policyConfig = policyEngine.getConfig(onapName);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testGetConfig2() {
+ String onapName = null;
+
+ try {
+ policyConfig = policyEngine.getConfig(onapName, requestID);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+
+ @SuppressWarnings("deprecation")
+ public void testGetConfig3() {
+ String onapName = null;
+ String configName = null;
+
+ try {
+ policyConfig = policyEngine.getConfig(onapName, configName, requestID);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testGetConfig4() {
+ String onapName = null;
+ String configName = null;
+ Map<String, String> configAttributes = null;
+
+ try {
+ policyConfig = policyEngine.getConfig(onapName, configName, configAttributes);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testGetConfig5() {
+ String onapName = null;
+ String configName = null;
+ Map<String, String> configAttributes = null;
+
+ try {
+ policyConfig =
+ policyEngine.getConfig(onapName, configName, configAttributes, requestID);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+ public void testGetConfig6() {
+ ConfigRequestParameters parameters = new ConfigRequestParameters();
+
+ try {
+ policyConfig = policyEngine.getConfig(parameters);
+ } catch (PolicyConfigException e) {
+ logger.warn(e.getMessage());
+ }
+ assertNull(policyConfig);
+ }
+
+
+ /**
+ * Run the Collection<PolicyResponse> sendEvent(Map<String,String>) method test
+ */
+ @SuppressWarnings("deprecation")
+ public void testSendEvent() {
+ Collection<PolicyResponse> result = null;
+ Collection<StdPolicyResponse> response = null;
+ Map<String, String> 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<PolicyResponse> result = null;
+ Collection<StdPolicyResponse> response = null;
+ Map<String, String> 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<PolicyResponse> result = null;
+ Collection<StdPolicyResponse> 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<String,String>) method test
+ */
+ @SuppressWarnings("deprecation")
+ public void testGetDecision() {
+ String onapComponentName = null;
+ Map<String, String> decisionAttributes = null;
+
+ DecisionResponse result = null;
+
+ try {
+ Mockito.when(mockPolicyEngine.getDecision(onapComponentName, decisionAttributes))
+ .thenReturn(null);
+ result = mockPolicyEngine.getDecision(onapComponentName, decisionAttributes);
+ } catch (PolicyDecisionException e) {
+ logger.error("Exception Occured" + e);
+ }
+
+ assertEquals(result, null);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testGetDecision2() {
+ String onapComponentName = null;
+ Map<String, String> decisionAttributes = null;
+
+ DecisionResponse result = null;
+
+ try {
+ Mockito.when(
+ mockPolicyEngine.getDecision(onapComponentName, decisionAttributes, requestID))
+ .thenReturn(null);
+ result = mockPolicyEngine.getDecision(onapComponentName, decisionAttributes);
+ } catch (PolicyDecisionException e) {
+ logger.error("Exception Occured" + e);
+ }
+
+ assertEquals(result, null);
+ }
+
+ public void testGetDecision3() {
+ DecisionRequestParameters parameters = new DecisionRequestParameters();
+ DecisionResponse result = null;
+
+ try {
+ Mockito.when(mockPolicyEngine.getDecision(parameters)).thenReturn(null);
+ result = mockPolicyEngine.getDecision(parameters);
+ } catch (PolicyDecisionException e) {
+ logger.error("Exception Occured" + e);
+ }
+
+ assertEquals(result, null);
+ }
+
+ /**
+ * Run the void setNotification(NotificationScheme, NotificationHandler) method test
+ */
+ public void testSetNotification() {
+ // add test code here
+
+ NotificationScheme scheme = null;
+ NotificationHandler handler = null;
+
+ Mockito.doNothing().when(mockPolicyEngine).setNotification(scheme, handler);
+ mockPolicyEngine.setNotification(scheme, handler);
+ // assertTrue(true);
+ }
+
+ /**
+ * Run the void clearNotification() method test
+ */
+ public void testClearNotification() {
+ // add test code here
+
+ Mockito.doNothing().when(mockPolicyEngine).clearNotification();
+ mockPolicyEngine.clearNotification();
+ // assertTrue(true);
+ }
+
+ /**
+ * Run the void setScheme(NotificationScheme) method test
+ */
+ public void testSetScheme() {
+ NotificationScheme scheme = null;
+
+ Mockito.doNothing().when(mockPolicyEngine).setScheme(scheme);
+ mockPolicyEngine.setScheme(scheme);
+ // assertTrue(true);
+ }
+
+ /**
+ * Run the PDPNotification getNotification() method test
+ */
+ public void testGetNotification() {
+ PDPNotification result = null;
+ StdPDPNotification response = null;
+ Mockito.when(mockPolicyEngine.getNotification()).thenReturn(response);
+ result = mockPolicyEngine.getNotification();
+
+ assertEquals(result, response);
+ }
+
+ /**
+ * Run the String createConfigPolicy(String, String, String, String, Map<String,String>, String,
+ * 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,
+ * 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<String, String> configAttributes = new HashMap<String, String>();
configAttributes.put("test", "testing");
-
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+
+ Map<AttributeType, Map<String, String>> attributes =
+ new HashMap<AttributeType, Map<String, String>>();
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<String, String> configAttributes = new HashMap<String, String>();
+
+ 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<String, String> configAttributes = new HashMap<String, String>();
configAttributes.put("test", "testing");
-
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+
+ Map<AttributeType, Map<String, String>> attributes =
+ new HashMap<AttributeType, Map<String, String>>();
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");
+
+ 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);
- }
-
+ 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();
- }
-
+ json = jsonReader.readObject();
+ }
return json;
}
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java
index 6f7573352..a78df1aa7 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyEventExceptionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,162 +24,155 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.PolicyEventException;
-
import static org.junit.Assert.*;
/**
- * The class <code>PolicyEventExceptionTest</code> contains tests for the class <code>{@link PolicyEventException}</code>.
+ * The class <code>PolicyEventExceptionTest</code> contains tests for the class
+ * <code>{@link PolicyEventException}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class PolicyEventExceptionTest {
- /**
- * Run the PolicyEventException() constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyEventException_1()
- throws Exception {
-
- PolicyEventException result = new PolicyEventException();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyEventException", result.toString());
- assertEquals(null, result.getLocalizedMessage());
- assertEquals(null, result.getMessage());
- }
-
- /**
- * Run the PolicyEventException(String) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyEventException_2()
- throws Exception {
- String message = "";
-
- PolicyEventException result = new PolicyEventException(message);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyEventException(Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyEventException_3()
- throws Exception {
- Throwable cause = new Throwable();
-
- PolicyEventException result = new PolicyEventException(cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEventException: java.lang.Throwable", result.toString());
- assertEquals("java.lang.Throwable", result.getLocalizedMessage());
- assertEquals("java.lang.Throwable", result.getMessage());
- }
-
- /**
- * Run the PolicyEventException(String,Throwable) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyEventException_4()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
-
- PolicyEventException result = new PolicyEventException(message, cause);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Run the PolicyEventException(String,Throwable,boolean,boolean) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testPolicyEventException_5()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
- boolean enableSuppression = true;
- boolean writableStackTrace = true;
-
- PolicyEventException result = new PolicyEventException(message, cause, enableSuppression, writableStackTrace);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyEventExceptionTest.class);
- }
+ /**
+ * Run the PolicyEventException() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyEventException_1() throws Exception {
+
+ PolicyEventException result = new PolicyEventException();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyEventException", result.toString());
+ assertEquals(null, result.getLocalizedMessage());
+ assertEquals(null, result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEventException(String) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyEventException_2() throws Exception {
+ String message = "";
+
+ PolicyEventException result = new PolicyEventException(message);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEventException(Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyEventException_3() throws Exception {
+ Throwable cause = new Throwable();
+
+ PolicyEventException result = new PolicyEventException(cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEventException: java.lang.Throwable",
+ result.toString());
+ assertEquals("java.lang.Throwable", result.getLocalizedMessage());
+ assertEquals("java.lang.Throwable", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEventException(String,Throwable) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyEventException_4() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+
+ PolicyEventException result = new PolicyEventException(message, cause);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Run the PolicyEventException(String,Throwable,boolean,boolean) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPolicyEventException_5() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+ boolean enableSuppression = true;
+ boolean writableStackTrace = true;
+
+ PolicyEventException result =
+ new PolicyEventException(message, cause, enableSuppression, writableStackTrace);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyEventException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyEventExceptionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyExceptionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyExceptionTest.java
index f925edbfa..f85572c61 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyExceptionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyExceptionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,72 +23,69 @@ package org.onap.policy.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
import org.onap.policy.api.PolicyException;
public class PolicyExceptionTest {
- @Test
- public void test1() {
- PolicyException result = new PolicyException();
- // add additional test code here
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyException", result.toString());
- assertEquals(null, result.getLocalizedMessage());
- assertEquals(null, result.getMessage());
- }
+ @Test
+ public void test1() {
+ PolicyException result = new PolicyException();
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyException", result.toString());
+ assertEquals(null, result.getLocalizedMessage());
+ assertEquals(null, result.getMessage());
+ }
+
+ @Test
+ public void test2() {
+ String message = "message";
+ PolicyException result = new PolicyException(message);
+ assertNotNull(result);
+ assertEquals(null, result.getCause());
+ assertEquals("org.onap.policy.api.PolicyException: " + message, result.toString());
+ assertEquals(message, result.getLocalizedMessage());
+ assertEquals(message, result.getMessage());
- @Test
- public void test2() {
- String message = "message";
- PolicyException result = new PolicyException(message);
- assertNotNull(result);
- assertEquals(null, result.getCause());
- assertEquals("org.onap.policy.api.PolicyException: " + message, result.toString());
- assertEquals(message, result.getLocalizedMessage());
- assertEquals(message, result.getMessage());
-
- }
+ }
- @Test
- public void test3() {
- Throwable cause = new Throwable();
- PolicyException result = new PolicyException(cause);
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyException: java.lang.Throwable", result.toString());
- assertEquals("java.lang.Throwable", result.getLocalizedMessage());
- assertEquals("java.lang.Throwable", result.getMessage());
- }
+ @Test
+ public void test3() {
+ Throwable cause = new Throwable();
+ PolicyException result = new PolicyException(cause);
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyException: java.lang.Throwable", result.toString());
+ assertEquals("java.lang.Throwable", result.getLocalizedMessage());
+ assertEquals("java.lang.Throwable", result.getMessage());
+ }
- @Test
- public void test4() {
- String message = "";
- Throwable cause = new Throwable();
- PolicyException result = new PolicyException(message, cause);
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
-
- @Test
- public void test5()
- throws Exception {
- String message = "";
- Throwable cause = new Throwable();
- boolean enableSuppression = true;
- boolean writableStackTrace = true;
+ @Test
+ public void test4() {
+ String message = "";
+ Throwable cause = new Throwable();
+ PolicyException result = new PolicyException(message, cause);
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
- PolicyException result = new PolicyException(message, cause, enableSuppression, writableStackTrace);
+ @Test
+ public void test5() throws Exception {
+ String message = "";
+ Throwable cause = new Throwable();
+ boolean enableSuppression = true;
+ boolean writableStackTrace = true;
- // add additional test code here
- assertNotNull(result);
- assertEquals("org.onap.policy.api.PolicyException: ", result.toString());
- assertEquals("", result.getLocalizedMessage());
- assertEquals("", result.getMessage());
- }
+ PolicyException result =
+ new PolicyException(message, cause, enableSuppression, writableStackTrace);
-
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("org.onap.policy.api.PolicyException: ", result.toString());
+ assertEquals("", result.getLocalizedMessage());
+ assertEquals("", result.getMessage());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java
index b0a71d375..93035435a 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.PolicyResponse;
/**
- * The class <code>PolicyResponseTest</code> contains tests for the class <code>{@link PolicyResponse}</code>.
+ * The class <code>PolicyResponseTest</code> contains tests for the class
+ * <code>{@link PolicyResponse}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyResponseTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java
index 832589757..c4356fd4c 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PushPolicyParametersTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -21,249 +23,236 @@
package org.onap.policy.test;
import java.util.UUID;
-
import org.junit.*;
import org.onap.policy.api.PushPolicyParameters;
-
import static org.junit.Assert.*;
/**
- * The class <code>PushPolicyParametersTest</code> contains tests for the class <code>{@link PushPolicyParameters}</code>.
+ * The class <code>PushPolicyParametersTest</code> contains tests for the class
+ * <code>{@link PushPolicyParameters}</code>.
*
* @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);
- }
+ /**
+ * Run the PushPolicyParameters() constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPushPolicyParameters_1() throws Exception {
+
+ PushPolicyParameters result = new PushPolicyParameters();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(null, result.getPolicyName());
+ assertEquals(null, result.getRequestID());
+ assertEquals(null, result.getPolicyType());
+ assertEquals(null, result.getPdpGroup());
+ }
+
+ /**
+ * Run the PushPolicyParameters(String,String,String,UUID) constructor test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testPushPolicyParameters_2() throws Exception {
+ String policyName = "";
+ String policyType = "";
+ String pdpGroup = "";
+ UUID requestID = UUID.randomUUID();
+
+ PushPolicyParameters result =
+ new PushPolicyParameters(policyName, policyType, pdpGroup, requestID);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("", result.getPolicyName());
+ assertEquals("", result.getPolicyType());
+ assertEquals("", result.getPdpGroup());
+ }
+
+ /**
+ * Run the String getPdpGroup() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPdpGroup_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+
+ String result = fixture.getPdpGroup();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+
+ String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyType() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyType_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+
+ String result = fixture.getPolicyType();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the UUID getRequestID() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetRequestID() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "",
+ UUID.fromString("d1dbaac1-0944-4f07-9ce7-733c697537ea"));
+
+ UUID result = fixture.getRequestID();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("d1dbaac1-0944-4f07-9ce7-733c697537ea", result.toString());
+ assertEquals(4, result.version());
+ assertEquals(2, result.variant());
+ assertEquals(-7140611980868110358L, result.getLeastSignificantBits());
+ assertEquals(-3324876153822097657L, result.getMostSignificantBits());
+ }
+
+ /**
+ * Run the void setPdpGroup(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPdpGroup_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+ String pdpGroup = "";
+
+ fixture.setPdpGroup(pdpGroup);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyName(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyName_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+ String policyName = "";
+
+ fixture.setPolicyName(policyName);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyType(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetPolicyType_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+ String policyType = "";
+
+ fixture.setPolicyType(policyType);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setRequestID(UUID) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetRequestID_1() throws Exception {
+ PushPolicyParameters fixture = new PushPolicyParameters("", "", "", UUID.randomUUID());
+ UUID requestID = UUID.randomUUID();
+
+ fixture.setRequestID(requestID);
+
+ // add additional test code here
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(PushPolicyParametersTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java
index 6a53cbfb1..b57a157ec 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RemovedPolicyTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,48 +27,45 @@ import org.junit.Before;
import org.onap.policy.api.RemovedPolicy;
/**
- * The class <code>RemovedPolicyTest</code> contains tests for the class <code>{@link RemovedPolicy}</code>.
+ * The class <code>RemovedPolicyTest</code> contains tests for the class
+ * <code>{@link RemovedPolicy}</code>.
*
* @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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(RemovedPolicyTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java
index 560ca463f..46f4dd1e8 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/SendEventTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -24,11 +26,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Before;
import org.onap.policy.api.PolicyEngine;
import org.onap.policy.api.PolicyEngineException;
@@ -36,120 +36,115 @@ import org.onap.policy.api.PolicyEventException;
import org.onap.policy.api.PolicyResponse;
import org.onap.policy.api.PolicyResponseStatus;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.common.logging.flexlogger.Logger;
public class SendEventTest {
-
- private PolicyEngine policyEngine = null;
- private Map<String,String> eventAttributes = new HashMap<String,String>();
- private Collection<PolicyResponse> 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());
- }
- }
+ private PolicyEngine policyEngine = null;
+ private Map<String, String> eventAttributes = new HashMap<String, String>();
+ private Collection<PolicyResponse> 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);
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testSendEventNotValid() {
+ eventAttributes.put("Action.fail", "Value");
+ try {
+ policyResponse = policyEngine.sendEvent(eventAttributes);
+ } catch (PolicyEventException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyResponse policyResponse : this.policyResponse) {
+ logger.info(policyResponse.getPolicyResponseMessage() + " , "
+ + policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse);
+ assertEquals(PolicyResponseStatus.NO_ACTION_REQUIRED,
+ policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse.getPolicyResponseMessage());
+ assertNotNull(policyResponse.getRequestAttributes());
+ assertNull(policyResponse.getActionTaken());
+ assertNull(policyResponse.getActionAdvised());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testSendEventActionAdvised() {
+ eventAttributes.put("Key", "Value");
+ eventAttributes.put("cpu", "80");
+ try {
+ policyResponse = policyEngine.sendEvent(eventAttributes);
+ } catch (PolicyEventException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyResponse policyResponse : this.policyResponse) {
+ logger.info(policyResponse.getPolicyResponseMessage() + " , "
+ + policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse);
+ assertEquals(PolicyResponseStatus.ACTION_ADVISED,
+ policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse.getPolicyResponseMessage());
+ assertNotNull(policyResponse.getRequestAttributes());
+ assertNull(policyResponse.getActionTaken());
+ assertNotNull(policyResponse.getActionAdvised());
+ }
+ }
+
+ // @Test
+ @SuppressWarnings("deprecation")
+ public void testSendEventActionTaken() {
+ eventAttributes.put("Key", "Value");
+ eventAttributes.put("cpu", "91");
+ try {
+ policyResponse = policyEngine.sendEvent(eventAttributes);
+ } catch (PolicyEventException e) {
+ logger.warn(e.getMessage());
+ }
+ for (PolicyResponse policyResponse : this.policyResponse) {
+ logger.info(policyResponse.getPolicyResponseMessage() + " , "
+ + policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse);
+ assertEquals(PolicyResponseStatus.ACTION_TAKEN,
+ policyResponse.getPolicyResponseStatus());
+ assertNotNull(policyResponse.getPolicyResponseMessage());
+ assertNotNull(policyResponse.getRequestAttributes());
+ assertNotNull(policyResponse.getActionTaken());
+ assertNull(policyResponse.getActionAdvised());
+ }
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDecisionResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDecisionResponseTest.java
index 0808c6b3a..615373704 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDecisionResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDecisionResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,20 +22,19 @@
package org.onap.policy.test;
import static org.junit.Assert.*;
-
import org.junit.Test;
import org.onap.policy.api.PolicyDecision;
import org.onap.policy.std.StdDecisionResponse;
public class StdDecisionResponseTest {
- @Test
- public void test() {
- StdDecisionResponse r = new StdDecisionResponse();
- r.setDecision(PolicyDecision.DENY);
- assertEquals(PolicyDecision.DENY, r.getDecision());
- r.setDetails("details");
- assertEquals("details", r.getDetails());
- }
+ @Test
+ public void test() {
+ StdDecisionResponse r = new StdDecisionResponse();
+ r.setDecision(PolicyDecision.DENY);
+ assertEquals(PolicyDecision.DENY, r.getDecision());
+ r.setDetails("details");
+ assertEquals("details", r.getDetails());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDictionaryResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDictionaryResponseTest.java
index fc0b9f97c..3c7025553 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDictionaryResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdDictionaryResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,25 +22,23 @@
package org.onap.policy.test;
import static org.junit.Assert.*;
-
import java.util.Collections;
-
import org.junit.Test;
import org.onap.policy.std.StdDictionaryResponse;
public class StdDictionaryResponseTest {
- @Test
- public void test() {
- StdDictionaryResponse r = new StdDictionaryResponse();
- r.setResponseCode(0);
- assertEquals(0, r.getResponseCode());
- r.setResponseMessage("msg");
- assertEquals("msg", r.getResponseMessage());
- r.setDictionaryData(Collections.emptyMap());
- assertEquals(0, r.getDictionaryData().size());
- r.setDictionaryJson(null);
- assertNull(r.getDictionaryJson());
- }
+ @Test
+ public void test() {
+ StdDictionaryResponse r = new StdDictionaryResponse();
+ r.setResponseCode(0);
+ assertEquals(0, r.getResponseCode());
+ r.setResponseMessage("msg");
+ assertEquals("msg", r.getResponseMessage());
+ r.setDictionaryData(Collections.emptyMap());
+ assertEquals(0, r.getDictionaryData().size());
+ r.setDictionaryJson(null);
+ assertNull(r.getDictionaryJson());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdMetricsResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdMetricsResponseTest.java
index a17fb06c2..15e04a14b 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdMetricsResponseTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/StdMetricsResponseTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -20,25 +22,24 @@
package org.onap.policy.test;
import static org.junit.Assert.*;
-
import org.junit.Test;
import org.onap.policy.std.StdMetricsResponse;
public class StdMetricsResponseTest {
- @Test
- public void test() {
- StdMetricsResponse r = new StdMetricsResponse();
- r.setMetricsTotal(0);
- assertEquals(0, r.getMetricsTotal());
- r.setPapMetrics(0);
- assertEquals(0, r.getPapMetrics());
- r.setPdpMetrics(0);
- assertEquals(0, r.getPdpMetrics());
- r.setResponseCode(0);
- assertEquals(0, r.getResponseCode());
- r.setResponseMessage("msg");
- assertEquals("msg", r.getResponseMessage());
- }
+ @Test
+ public void test() {
+ StdMetricsResponse r = new StdMetricsResponse();
+ r.setMetricsTotal(0);
+ assertEquals(0, r.getMetricsTotal());
+ r.setPapMetrics(0);
+ assertEquals(0, r.getPapMetrics());
+ r.setPdpMetrics(0);
+ assertEquals(0, r.getPdpMetrics());
+ r.setResponseCode(0);
+ assertEquals(0, r.getResponseCode());
+ r.setResponseMessage("msg");
+ assertEquals("msg", r.getResponseMessage());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java
index 87687f0ab..c1dbea4c0 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/TestRunner.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -25,25 +27,28 @@ 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());
- }
+ public static void main(String[] args) {
+ Result result = JUnitCore.runClasses(PolicyEngineTest.class);
+ for (Failure failure : result.getFailures()) {
+ System.out.println("Failed Test: " + failure.toString());
+ }
+ Result results = null;
+ if (result.wasSuccessful()) {
+ System.out.println("API Methods are being Tested.. ");
+ results = JUnitCore.runClasses(GetConfigByPolicyNameTest.class,
+ GetConfigStringTest.class, GetConfigStringStringTest.class,
+ GetConfigStringStringMapTest.class, SendEventTest.class);
+ for (Failure failure : results.getFailures()) {
+ System.out.println("Failed Test: " + failure.toString());
+ }
+ System.out.println("Test Results.. ");
+ System.out.println("Stats: \nRun Time: " + (results.getRunTime() + result.getRunTime())
+ + "\nTotal Tests:" + results.getRunCount() + result.getRunCount()
+ + "\nFailures: " + results.getFailureCount() + result.getFailureCount());
+ System.exit(1);
+ }
+ System.out.println("Test Failed..");
+ System.out.println("Stats: \nRun Time: " + result.getRunTime() + "\nTests:"
+ + result.getRunCount() + "\nFailures: " + result.getFailureCount());
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java
index 500d6c1c5..1194930fd 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/UpdateTypeTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,70 +24,65 @@ package org.onap.policy.test;
import org.junit.*;
import org.onap.policy.api.UpdateType;
-
import static org.junit.Assert.*;
/**
- * The class <code>UpdateTypeTest</code> contains tests for the class <code>{@link UpdateType}</code>.
+ * The class <code>UpdateTypeTest</code> contains tests for the class
+ * <code>{@link UpdateType}</code>.
*
* @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;
+ /**
+ * 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();
+ String result = fixture.toString();
- // add additional test code here
- assertEquals("new", result);
- }
+ // 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 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
- }
+ /**
+ * 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);
- }
+ /**
+ * 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);
+ }
}