summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-02-15 17:19:30 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-15 17:19:30 +0000
commit9655c9a9f8f20418a7735c72f3479f5b9a9859ba (patch)
treeff439113901cfbc9c96df3b88ed1f3adcc998fa4
parent49657344fb0d436f97af38e71d31a6f8ddbc28bf (diff)
parent2ae7194f9b915e42bba68537eec9426baa5ae456 (diff)
Merge "Reformat PolicyEngineAPI test cases"
-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
54 files changed, 8651 insertions, 8746 deletions
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);
+ }
}