summaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/test
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-02-20 15:44:50 +0000
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-02-20 16:40:08 +0000
commit5450bdbfb94fb5217617da6c41971fd26f7e81b5 (patch)
treece2229464356c633588edcb8a1988f46a6bf5757 /PolicyEngineAPI/src/test
parenta9710cb3b80c73c98d257c676ba6ecf9e30ef758 (diff)
JUnit test for policy/engine PolicyEngineAPI
Change-Id: I31991245bb5cc877722f7ce14530222a102d6472 Issue-ID: POLICY-606 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'PolicyEngineAPI/src/test')
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchStoreTest.java1174
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java369
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java505
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java1545
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/APIDictionaryResponseTest.java50
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java103
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java449
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryTypeTest.java35
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java107
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java171
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java98
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java278
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java114
-rw-r--r--PolicyEngineAPI/src/test/java/org/onap/policy/test/RuleProviderTest.java37
14 files changed, 2361 insertions, 2674 deletions
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 f5a86d17d..e3ea73563 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
@@ -20,745 +20,477 @@
package org.onap.policy.std.test;
+import static org.junit.Assert.assertEquals;
+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.Hashtable;
+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;
+import org.onap.policy.api.LoadedPolicy;
+import org.onap.policy.api.NotificationType;
import org.onap.policy.api.PDPNotification;
import org.onap.policy.std.MatchStore;
import org.onap.policy.std.Matches;
+import org.onap.policy.std.StdLoadedPolicy;
import org.onap.policy.std.StdPDPNotification;
+import org.onap.policy.std.StdRemovedPolicy;
/**
- * The class <code>MatchStoreTest</code> contains tests for the class <code>{@link MatchStore}</code>.
+ * The class <code>MatchStoreTest</code> contains tests for the class
+ * <code>{@link MatchStore}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class MatchStoreTest {
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_1()
- throws Exception {
- PDPNotification oldNotification = null;
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_2()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_3()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_4()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_5()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_6()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_7()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_8()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_9()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_10()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_11()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_12()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_13()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_14()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_15()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the PDPNotification checkMatch(PDPNotification) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testCheckMatch_16()
- throws Exception {
- PDPNotification oldNotification = new StdPDPNotification();
-
- PDPNotification result = MatchStore.checkMatch(oldNotification);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- assertNotNull(result);
- }
-
- /**
- * Run the HashSet<Matches> getMatchStore() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetMatchStore_1()
- throws Exception {
-
- Set<Matches> result = MatchStore.getMatchStore();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.ExceptionInInitializerError
- // at org.apache.log4j.Logger.getLogger(Logger.java:104)
- // at org.onap.policy.std.MatchStore.<clinit>(MatchStore.java:15)
- assertNotNull(result);
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_1()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_2()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_3()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_4()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_5()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_6()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_7()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_8()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_9()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_10()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_11()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_12()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_13()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_14()
- throws Exception {
- Matches newMatch = new Matches();
- newMatch.setConfigAttributes(new Hashtable<String, String>());
- newMatch.setConfigName("");
- newMatch.setOnapName("");
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_15()
- throws Exception {
- Matches newMatch = new Matches();
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Run the void storeMatch(Matches) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testStoreMatch_16()
- throws Exception {
- Matches newMatch = null;
-
- MatchStore.storeMatch(newMatch);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NoClassDefFoundError: Could not initialize class org.onap.policy.std.MatchStore
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(MatchStoreTest.class);
- }
+ private static final String ATTRIBUTE_DUMMY_VALUE = "Value";
+
+ private static final String ATTRIBUTE_DUMMY_KEY = "Key";
+
+ private static final String POLICY_NAME = "ONAP";
+
+ private static final String POLICY_VERSION = "1.0.0";
+
+ private static final String ONAP_NAME_VAL = "ONAPName";
+
+ private static final String CONFIG_NAME_VAL = "ConfigName";
+
+ private static final String EMPTY_STRING = "";
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ */
+ @Before
+ public void setUp() throws Exception {
+ MatchStore.getMatchStore().clear();
+ }
+
+ @Test
+ public void testCheckMatch_ShouldReturnNullWithNullPDPNotification() throws Exception {
+ final PDPNotification oldNotification = null;
+
+ final PDPNotification result = MatchStore.checkMatch(oldNotification);
+
+ assertNull(result);
+ }
+
+ @Test
+ public void testCheckMatch_ShouldReturnNullIfMatchStoreCacheIsEmpty() throws Exception {
+ final PDPNotification oldNotification = new StdPDPNotification();
+
+ final PDPNotification result = MatchStore.checkMatch(oldNotification);
+ assertNull(result);
+ }
+
+ @Test
+ public void testCheckMatch_ShouldNotReturnNullIfMatchStoreCacheIsNotEmpty() throws Exception {
+ final Matches newMatch = getMatchesInstance(EMPTY_STRING, EMPTY_STRING);
+ MatchStore.storeMatch(newMatch);
+ final PDPNotification oldNotification = new StdPDPNotification();
+
+ final PDPNotification result = MatchStore.checkMatch(oldNotification);
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testGetMatchStore_ShouldNotBeNullOnStartUP() throws Exception {
+ final Set<Matches> result = MatchStore.getMatchStore();
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testStoreMatch_ShouldRetrunEmptyLoadedRemovedPolicesIfNotMatchFoundInMatchStore() throws Exception {
+ final Matches newMatch = getMatchesInstance(CONFIG_NAME_VAL, ONAP_NAME_VAL);
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification oldNotification = new StdPDPNotification();
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertTrue(actualPDPNotification.getLoadedPolicies().isEmpty());
+ assertTrue(actualPDPNotification.getRemovedPolicies().isEmpty());
+ assertNull(actualPDPNotification.getNotificationType());
+ }
+
+ @Test
+ 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());
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.REMOVE, actualPDPNotification.getNotificationType());
+ assertFalse(actualPDPNotification.getRemovedPolicies().isEmpty());
+
+ }
+
+ @Test
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+ assertFalse(actualPDPNotification.getLoadedPolicies().isEmpty());
+ }
+
+ @Test
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertFalse(actualLoadPolicies.isEmpty());
+
+ final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
+ assertEquals(stdLoadedPolicy.getPolicyName(), loadedPolicy.getPolicyName());
+ assertEquals(stdLoadedPolicy.getVersionNo(), loadedPolicy.getVersionNo());
+ }
+
+ @Test
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertFalse(actualLoadPolicies.isEmpty());
+
+ final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
+ assertEquals(stdLoadedPolicy.getPolicyName(), loadedPolicy.getPolicyName());
+ assertEquals(stdLoadedPolicy.getVersionNo(), loadedPolicy.getVersionNo());
+ }
+
+ @Test
+ public void testStoreMatch_NoticficationTypeNull_IfStdLoadPolicyExistsWithMatchesWithOutMatchingConfigAttribute()
+ throws Exception {
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertNull(actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertTrue(actualLoadPolicies.isEmpty());
+
+ }
+
+ @Test
+ public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchesWithNullConStdLoadPolicyExistsWithMatches()
+ throws Exception {
+
+ final Matches newMatch = getMatchesInstance(null, ONAP_NAME_VAL, Collections.emptyMap());
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertFalse(actualLoadPolicies.isEmpty());
+
+ }
+
+ @Test
+ public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches() throws Exception {
+
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertFalse(actualLoadPolicies.isEmpty());
+
+ final LoadedPolicy loadedPolicy = actualLoadPolicies.iterator().next();
+ assertEquals(stdLoadedPolicy.getPolicyName(), loadedPolicy.getPolicyName());
+ assertEquals(stdLoadedPolicy.getVersionNo(), loadedPolicy.getVersionNo());
+ }
+
+ @Test
+ public void testStoreMatch_NoticficationTypeUpdate_IfMatchStoreContainMatchingMatches2() throws Exception {
+
+ 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);
+ secondPolicyObj.putAll(attributesMap);
+
+ 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));
+
+ MatchStore.storeMatch(firstObj);
+ MatchStore.storeMatch(secondObj);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.UPDATE, actualPDPNotification.getNotificationType());
+
+ final Collection<LoadedPolicy> actualLoadPolicies = actualPDPNotification.getLoadedPolicies();
+ assertFalse(actualLoadPolicies.isEmpty());
+ assertEquals(1, actualLoadPolicies.size());
+ }
+
+ @Test
+ public void testStoreMatch_NoticficationTypeBoth_IfOldNotificationContainRemovedAndLoadedPolicies()
+ throws Exception {
+
+ 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));
+
+ MatchStore.storeMatch(newMatch);
+
+ assertFalse(MatchStore.getMatchStore().isEmpty());
+
+ final PDPNotification actualPDPNotification = MatchStore.checkMatch(oldNotification);
+
+ assertEquals(NotificationType.BOTH, actualPDPNotification.getNotificationType());
+ assertFalse(actualPDPNotification.getRemovedPolicies().isEmpty());
+ assertFalse(actualPDPNotification.getLoadedPolicies().isEmpty());
+ }
+
+ private Map<String, String> getPolicyMatches(final String onapName, final String configName) {
+ final Map<String, String> matches = new HashMap<>();
+ matches.put(ONAP_NAME_VAL, onapName);
+ matches.put(CONFIG_NAME_VAL, configName);
+ return matches;
+ }
+
+ @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 };
+
+ for (int i = 0; i < configNames.length; i++) {
+
+ final Matches matches = getMatchesInstance(configNames[i], onapNames[i], getAttributesMap());
+ MatchStore.storeMatch(matches);
+ MatchStore.storeMatch(matches);
+ }
+
+ assertEquals(configNames.length - 1, MatchStore.getMatchStore().size());
+
+ }
+
+ @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());
+
+ MatchStore.storeMatch(firstObj);
+ MatchStore.storeMatch(secondObj);
+ MatchStore.storeMatch(firstObj);
+
+ assertEquals(2, MatchStore.getMatchStore().size());
+
+ }
+
+ @Test
+ 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);
+
+ MatchStore.storeMatch(firstObj);
+ MatchStore.storeMatch(secondObj);
+ MatchStore.storeMatch(firstObj);
+
+ assertEquals(1, MatchStore.getMatchStore().size());
+
+ }
+
+ @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());
+
+ MatchStore.storeMatch(firstObj);
+ MatchStore.storeMatch(secondObj);
+ MatchStore.storeMatch(firstObj);
+
+ assertEquals(2, MatchStore.getMatchStore().size());
+
+ }
+
+ private Map<String, String> getAttributesMap() {
+ final Map<String, String> attribute = new HashMap<>();
+ attribute.put(ATTRIBUTE_DUMMY_KEY, ATTRIBUTE_DUMMY_VALUE);
+ return attribute;
+ }
+
+ private Matches getMatchesInstance(final String configName, final String onapName) {
+ return getMatchesInstance(configName, onapName, null);
+ }
+
+ private Matches getMatchesInstance(final String configName, final String onapName,
+ final Map<String, String> configAttributes) {
+ final Matches matches = new Matches();
+ matches.setConfigName(configName);
+ matches.setOnapName(onapName);
+ matches.setConfigAttributes(configAttributes);
+ return matches;
+ }
+
+ private StdRemovedPolicy getRemovedPolicy(final String version, final String policyName) {
+ return new StdRemovedPolicy() {
+
+ @Override
+ public String getVersionNo() {
+ return version;
+ }
+
+ @Override
+ public String getPolicyName() {
+ return policyName;
+ }
+ };
+ }
+
+ private PDPNotification getPDPNotification(final Collection<StdRemovedPolicy> removedPolicies,
+ final Collection<StdLoadedPolicy> loadedPolicies) {
+ final StdPDPNotification oldNotification = new StdPDPNotification();
+ oldNotification.setLoadedPolicies(loadedPolicies);
+ oldNotification.setRemovedPolicies(removedPolicies);
+ return oldNotification;
+ }
+
+ private StdLoadedPolicy getStdLoadedPolicy(final String version, final String policyName,
+ final Map<String, String> matches) {
+ return new StdLoadedPolicy() {
+
+ @Override
+ public String getVersionNo() {
+ return version;
+ }
+
+ @Override
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @Override
+ public Map<String, String> getMatches() {
+ return matches;
+ }
+ };
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception
+ * if the clean-up fails for some reason
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @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/MatchesTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java
index f71d93cb8..3a76ff455 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/MatchesTest.java
@@ -20,197 +20,200 @@
package org.onap.policy.std.test;
-import java.util.Hashtable;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.onap.policy.std.Matches;
-import static org.junit.Assert.*;
-
/**
- * The class <code>MatchesTest</code> contains tests for the class <code>{@link Matches}</code>.
+ * The class <code>MatchesTest</code> contains tests for the class
+ * <code>{@link Matches}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class MatchesTest {
- /**
- * Run the Matches() constructor test.
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testMatches_1()
- throws Exception {
- Matches result = new Matches();
- assertNotNull(result);
- // add additional test code here
- }
-
- /**
- * Run the Map<String, String> getConfigAttributes() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetConfigAttributes_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
-
- 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:41 PM
- */
- @Test
- public void testGetConfigName_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
-
- String result = fixture.getConfigName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getOnapName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetOnapName_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
-
- String result = fixture.getOnapName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the void setConfigAttributes(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetConfigAttributes_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
- 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:41 PM
- */
- @Test
- public void testSetConfigName_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
- String configName = "";
-
- fixture.setConfigName(configName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setOnapName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetOnapName_1()
- throws Exception {
- Matches fixture = new Matches();
- fixture.setOnapName("");
- fixture.setConfigAttributes(new Hashtable<String, String>());
- fixture.setConfigName("");
- String onapName = "";
-
- fixture.setOnapName(onapName);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(MatchesTest.class);
- }
+ private static final String DUMMY_VAL = "SomethingElse";
+
+ private static final String CONFIG_NAME = "CONFIG_NAME";
+
+ private static final String ONAP_NAME = "ONAP_NAME";
+
+ @Test
+ public void testMatches_SetterGetterMethods() {
+ final Matches objUnderTest = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ final Map<String, String> result = objUnderTest.getConfigAttributes();
+
+ assertEquals(ONAP_NAME, objUnderTest.getOnapName());
+ assertEquals(CONFIG_NAME, objUnderTest.getConfigName());
+ assertEquals(0, result.size());
+ }
+
+ @Test
+ public void testMatches_EqualsMethod_SameObjectsAndSameHasCode() {
+ final Matches firstObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ assertEquals(firstObject, secondObject);
+ assertEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_differentConfigName_NotEqualsAndDifferentHashCode() {
+ final Matches firstObject = getMatches(ONAP_NAME, DUMMY_VAL, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_differentObjects_NotEquals() {
+ final String firstObject = new String();
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+ Assert.assertFalse(secondObject.equals(firstObject));
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_nullObject_NotEqualsAndDifferentHashCode() {
+ final String firstObject = null;
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ assertNotEquals(firstObject, secondObject);
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_NullConfigName_NotEqualsAndDifferentHashCode() {
+ final Matches firstObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, null, Collections.emptyMap());
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_differentOnapName_NotEqualsAndDifferentHashCode() throws Exception {
+ final Matches firstObject = getMatches(DUMMY_VAL, CONFIG_NAME, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_NullOnapName_NotEqualsAndDifferentHashCode() throws Exception {
+ final Matches firstObject = getMatches(null, CONFIG_NAME, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, Collections.emptyMap());
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_BothNullOnapName_Equals() throws Exception {
+ final Matches firstObject = getMatches(null, CONFIG_NAME, Collections.emptyMap());
+ final Matches secondObject = getMatches(null, CONFIG_NAME, Collections.emptyMap());
+
+ assertEquals(firstObject, secondObject);
+ assertEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_BothNullConfigName_Equals() throws Exception {
+ final Matches firstObject = getMatches(ONAP_NAME, null, Collections.emptyMap());
+ final Matches secondObject = getMatches(ONAP_NAME, null, Collections.emptyMap());
+
+ assertEquals(firstObject, secondObject);
+ assertEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_DifferentConfigAttr_NotEqualsAndDifferentHashCode() throws Exception {
+ final Map<String, String> firstMap = Collections.emptyMap();
+ final Map<String, String> secondMap = new HashMap<>();
+ secondMap.put("key", "value");
+
+ final Matches firstObject = getMatches(ONAP_NAME, CONFIG_NAME, firstMap);
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, secondMap);
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_NullConfigAttr_NotEqualsAndDifferentHashCode() throws Exception {
+ final Map<String, String> secondMap = new HashMap<>();
+ secondMap.put("key", "value");
+
+ final Matches firstObject = getMatches(ONAP_NAME, CONFIG_NAME, null);
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, secondMap);
+
+ assertNotEquals(firstObject, secondObject);
+ assertNotEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ @Test
+ public void testMatchesEqualsMethod_BothNullConfigAttr_Equals() throws Exception {
+
+ final Matches firstObject = getMatches(ONAP_NAME, CONFIG_NAME, null);
+ final Matches secondObject = getMatches(ONAP_NAME, CONFIG_NAME, null);
+
+ assertEquals(firstObject, secondObject);
+ assertEquals(firstObject.hashCode(), secondObject.hashCode());
+ }
+
+ private Matches getMatches(final String onapName, final String configName, final Map<String, String> attributes) {
+ final Matches objUnderTest = new Matches();
+ objUnderTest.setOnapName(onapName);
+ objUnderTest.setConfigName(configName);
+ objUnderTest.setConfigAttributes(attributes);
+ return objUnderTest;
+ }
+
+ /**
+ * 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(final String[] args) {
+ new org.junit.runner.JUnitCore().run(MatchesTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java
index fb42f98aa..d26a1b254 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationUnMarshalTest.java
@@ -20,237 +20,304 @@
package org.onap.policy.std.test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.onap.policy.api.UpdateType;
import org.onap.policy.std.NotificationUnMarshal;
+import org.onap.policy.std.StdLoadedPolicy;
import org.onap.policy.std.StdPDPNotification;
+import org.onap.policy.std.StdRemovedPolicy;
+
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
/**
- * The class <code>NotificationUnMarshalTest</code> contains tests for the class <code>{@link NotificationUnMarshal}</code>.
+ * The class <code>NotificationUnMarshalTest</code> contains tests for the class
+ * <code>{@link NotificationUnMarshal}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class NotificationUnMarshalTest {
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_1()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_2()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_3()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_4()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_5()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_6()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_7()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_8()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_9()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Run the StdPDPNotification notificationJSON(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
- public void testNotificationJSON_10()
- throws Exception {
- String json = "";
-
- StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
-
- // add additional test code here
- assertNotNull(result);
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(NotificationUnMarshalTest.class);
- }
+ private static final String EMPTY_STRING = "";
+
+ private static final String POLICY_NAME = "ONAP";
+
+ private static final String POLICY_VERSION = "1.0.0";
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test(expected = JsonMappingException.class)
+ public void testNotificationJSON_EmptyString_ShouldThrowException() throws Exception {
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(EMPTY_STRING);
+
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testNotificationJSON_StdPDPNotificationJsonStringWithEmptyLoadedAndRemovedPolicies_emptyLoadedPolices()
+ throws Exception {
+ final String json = getPDPNotificationAsJsonString(new StdPDPNotification());
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ assertNotNull(result);
+ assertTrue(result.getLoadedPolicies().isEmpty());
+ }
+
+ @Test
+ public void testNotificationJSON_StdPDPNotificationJsonStringWithEmptyLoadedpolicy_emptyLoadedPolices()
+ throws Exception {
+ final StdPDPNotification notification = getPDPNotification(
+ Arrays.asList(getRemovedPolicy(POLICY_VERSION, POLICY_NAME)), Collections.emptyList());
+ final String json = getPDPNotificationAsJsonString(notification);
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ assertNotNull(result);
+ assertTrue(result.getLoadedPolicies().isEmpty());
+ }
+
+ @Test
+ public void testNotificationJSON_validPDPNotificationJsonStringWithRemovedAndLoadedPolicies_UpdateTypeUpdateAndLoadedPolicyAdded()
+ throws Exception {
+ final List<StdRemovedPolicy> removedPolicies = Arrays.asList(getRemovedPolicy(POLICY_VERSION, POLICY_NAME));
+ final List<StdLoadedPolicy> loadedPolicies = Arrays.asList(getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME));
+ final StdPDPNotification notification = getPDPNotification(removedPolicies, loadedPolicies);
+
+ final String json = getPDPNotificationAsJsonString(notification);
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ assertNotNull(result);
+ assertFalse(result.getLoadedPolicies().isEmpty());
+
+ final StdLoadedPolicy actualPolicy = (StdLoadedPolicy) result.getLoadedPolicies().iterator().next();
+ assertEquals(POLICY_VERSION, actualPolicy.getVersionNo());
+ assertEquals(POLICY_NAME, actualPolicy.getPolicyName());
+ assertEquals(UpdateType.UPDATE, actualPolicy.getUpdateType());
+ }
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testNotificationJSON_validPDPNotificationJsonStringWithRemovedAndLoadedPolicies_UpdateTypeNewAndLoadedPolicyAdded()
+ throws Exception {
+ final List<StdRemovedPolicy> removedPolicies = Arrays.asList(getRemovedPolicy(POLICY_VERSION, "Something"));
+ final List<StdLoadedPolicy> loadedPolices = Arrays.asList(getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME));
+ final StdPDPNotification notification = getPDPNotification(removedPolicies, loadedPolices);
+
+ final String json = getPDPNotificationAsJsonString(notification);
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ assertNotNull(result);
+ assertFalse(result.getLoadedPolicies().isEmpty());
+
+ final StdLoadedPolicy actualPolicy = (StdLoadedPolicy) result.getLoadedPolicies().iterator().next();
+ assertEquals(POLICY_VERSION, actualPolicy.getVersionNo());
+ assertEquals(POLICY_NAME, actualPolicy.getPolicyName());
+ assertEquals(UpdateType.NEW, actualPolicy.getUpdateType());
+ }
+
+ @Test
+ public void testNotificationJSON_validPDPNotificationJsonStringLoadedPoliciesAndNullRemovedPolicies_UpdateTypeNewAndLoadedPolicyAdded()
+ throws Exception {
+ final List<StdLoadedPolicy> loadedPolices = Arrays.asList(getStdLoadedPolicy(POLICY_VERSION, POLICY_NAME));
+ final StdPDPNotification notification = getPDPNotification(null, loadedPolices);
+
+ final String json = getPDPNotificationAsJsonString(notification);
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ assertNotNull(result);
+ assertFalse(result.getLoadedPolicies().isEmpty());
+
+ final StdLoadedPolicy actualPolicy = (StdLoadedPolicy) result.getLoadedPolicies().iterator().next();
+ assertEquals(POLICY_VERSION, actualPolicy.getVersionNo());
+ assertEquals(POLICY_NAME, actualPolicy.getPolicyName());
+ assertEquals(UpdateType.NEW, actualPolicy.getUpdateType());
+ }
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
+ public void testNotificationJSON_7() throws Exception {
+ final String json = EMPTY_STRING;
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ // add additional test code here
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
+ public void testNotificationJSON_8() throws Exception {
+ final String json = EMPTY_STRING;
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ // add additional test code here
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
+ public void testNotificationJSON_9() throws Exception {
+ final String json = EMPTY_STRING;
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ // add additional test code here
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StdPDPNotification notificationJSON(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test(expected = com.fasterxml.jackson.databind.JsonMappingException.class)
+ public void testNotificationJSON_10() throws Exception {
+ final String json = EMPTY_STRING;
+
+ final StdPDPNotification result = NotificationUnMarshal.notificationJSON(json);
+
+ // add additional test code here
+ assertNotNull(result);
+ }
+
+ private String getPDPNotificationAsJsonString(final StdPDPNotification notification) {
+ final ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ return mapper.writeValueAsString(notification);
+ } catch (final Exception expection) {
+ throw new RuntimeException(expection);
+ }
+
+ }
+
+ private StdPDPNotification getPDPNotification(final Collection<StdRemovedPolicy> removedPolicies,
+ final Collection<StdLoadedPolicy> loadedPolicies) {
+ final StdPDPNotification oldNotification = new StdPDPNotification();
+ oldNotification.setLoadedPolicies(loadedPolicies);
+ oldNotification.setRemovedPolicies(removedPolicies);
+ return oldNotification;
+ }
+
+ private StdRemovedPolicy getRemovedPolicy(final String version, final String policyName) {
+ return new StdRemovedPolicy() {
+
+ @Override
+ public String getVersionNo() {
+ return version;
+ }
+
+ @Override
+ public String getPolicyName() {
+ return policyName;
+ }
+ };
+ }
+
+ private StdLoadedPolicy getStdLoadedPolicy(final String version, final String policyName) {
+ return new StdLoadedPolicy() {
+
+ @Override
+ public String getVersionNo() {
+ return version;
+ }
+
+ @Override
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @Override
+ public Map<String, String> getMatches() {
+ return Collections.emptyMap();
+ }
+ };
+ }
+
+ /**
+ * 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(final String[] args) {
+ new org.junit.runner.JUnitCore().run(NotificationUnMarshalTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java
index 736f51b57..e754a42aa 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/StdPolicyConfigTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.std.test;
+import java.util.Collections;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
@@ -28,6 +29,7 @@ import javax.json.JsonObject;
import org.junit.*;
import org.onap.policy.api.PolicyConfigStatus;
+import org.onap.policy.api.PolicyConfigType;
import org.onap.policy.api.PolicyType;
import org.onap.policy.std.StdPolicyConfig;
@@ -36,786 +38,775 @@ import static org.junit.Assert.*;
import org.w3c.dom.Document;
/**
- * The class <code>StdPolicyConfigTest</code> contains tests for the class <code>{@link StdPolicyConfig}</code>.
+ * The class <code>StdPolicyConfigTest</code> contains tests for the class
+ * <code>{@link StdPolicyConfig}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class StdPolicyConfigTest {
- /**
- * Run the Map<String, String> getMatchingConditions() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetMatchingConditions_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testGetPolicyConfigMessage_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testGetPolicyConfigStatus_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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 String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testGetPolicyName_2()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName((String) null);
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, 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:41 PM
- */
- @Test
- public void testGetPolicyName_3()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyVersion() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetPolicyVersion_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
-
- String result = fixture.getPolicyVersion();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the Map<String, String> getResponseAttributes() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetResponseAttributes_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testGetType_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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 setConfigStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetConfigStatus_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- String configStatus = "";
-
- fixture.setConfigStatus(configStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setConfigStatus(String,PolicyConfigStatus) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetConfigStatus_2()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- String configStatus = "";
- PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
-
- fixture.setConfigStatus(configStatus, policyConfigStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setDocument(Document) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetDocument_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetJsonObject_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetMatchingConditions_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetOther_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetPolicyConfigStatus_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
-
- fixture.setPolicyConfigStatus(policyConfigStatus);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- String policyName = "";
-
- fixture.setPolicyName(policyName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyType(PolicyType) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetPolicyType_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetPolicyVersion_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testSetProperties_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- Properties properties = new Properties();
-
- fixture.setProperties(properties);
-
- // add additional test code here
- }
-
- /**
- * Run the void setResponseAttributes(Map<String,String>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testSetResponseAttributes_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
- Map<String, String> responseAttributes = new Hashtable<String, String>();
-
- fixture.setResponseAttributes(responseAttributes);
-
- // add additional test code here
- }
-
- /**
- * Run the JsonObject toJSON() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToJSON_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testToOther_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Test
- public void testToProperties_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
-
- Properties result = fixture.toProperties();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(0, result.size());
- }
-
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("test");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(new Hashtable<String, String>());
-
- String result = fixture.toString();
-
- // add additional test code here
- assertEquals("PolicyConfig [ policyConfigStatus=not_found, policyConfigMessage=, policyName=test]", result);
- }
-
- /**
- * Run the Document toXML() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToXML_1()
- throws Exception {
- StdPolicyConfig fixture = new StdPolicyConfig();
- fixture.setConfigStatus("", PolicyConfigStatus.CONFIG_NOT_FOUND);
- fixture.setDocument((Document) null);
- fixture.setResponseAttributes(new Hashtable<String, String>());
- fixture.setPolicyVersion("");
- fixture.setOther("");
- fixture.setPolicyType(PolicyType.JSON);
- fixture.setPolicyName("");
- fixture.setProperties(new Properties());
- fixture.setJsonObject((JsonObject) null);
- fixture.setMatchingConditions(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:41 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StdPolicyConfigTest.class);
- }
+ private static final String POLICY_NAME = "PolicyName";
+
+ private static final String POLICY_NAME_WITH_XML_EXT = POLICY_NAME + ".1.xml";
+
+ private static final String EMPTY_STRING = "";
+
+ /**
+ * Run the Map<String, String> getMatchingConditions() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetMatchingConditions_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final 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:41 PM
+ */
+ @Test
+ public void testGetPolicyConfigMessage_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.getPolicyConfigMessage();
+
+ // add additional test code here
+ assertEquals(EMPTY_STRING, result);
+ }
+
+ /**
+ * Run the PolicyConfigStatus getPolicyConfigStatus() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetPolicyConfigStatus_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final PolicyConfigStatus result = fixture.getPolicyConfigStatus();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("not_found", result.toString());
+ assertEquals("CONFIG_NOT_FOUND", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetPolicyName_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(EMPTY_STRING, result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetPolicyName_2() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName((String) null);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String getPolicyName() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetPolicyName_3() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.getPolicyName();
+
+ // add additional test code here
+ assertEquals(EMPTY_STRING, result);
+ }
+
+ /**
+ * Run the String getPolicyVersion() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetPolicyVersion_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.getPolicyVersion();
+
+ // add additional test code here
+ assertEquals(EMPTY_STRING, result);
+ }
+
+ /**
+ * Run the Map<String, String> getResponseAttributes() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetResponseAttributes_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final 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:41 PM
+ */
+ @Test
+ public void testGetType_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final PolicyType result = fixture.getType();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("json", result.toString());
+ assertEquals("JSON", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the void setConfigStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetGetPolicyConfigType_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyType(PolicyConfigType.BRMS_RAW);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ fixture.setConfigStatus(EMPTY_STRING);
+
+ assertEquals(PolicyConfigType.BRMS_RAW, fixture.getPolicyType());
+
+ }
+
+ /**
+ * Run the void setConfigStatus(String,PolicyConfigStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetConfigStatus_2() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final String configStatus = EMPTY_STRING;
+ final PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
+
+ fixture.setConfigStatus(configStatus, policyConfigStatus);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setDocument(Document) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetDocument_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final Document document = null;
+
+ fixture.setDocument(document);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setJsonObject(JsonObject) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetJsonObject_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final 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:41 PM
+ */
+ @Test
+ public void testSetMatchingConditions_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final 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:41 PM
+ */
+ @Test
+ public void testSetOther_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final String other = EMPTY_STRING;
+
+ fixture.setOther(other);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setPolicyConfigStatus(PolicyConfigStatus) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetPolicyConfigStatus_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final PolicyConfigStatus policyConfigStatus = PolicyConfigStatus.CONFIG_NOT_FOUND;
+
+ fixture.setPolicyConfigStatus(policyConfigStatus);
+
+ assertEquals(policyConfigStatus, fixture.getPolicyConfigStatus());
+ }
+
+ @Test
+ public void testSetGetPolicyName_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(Collections.emptyMap());
+ fixture.setPolicyName(EMPTY_STRING);
+
+ assertEquals(EMPTY_STRING, fixture.getPolicyName());
+
+ }
+
+ @Test
+ public void testSetGetPolicyName_2() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(POLICY_NAME_WITH_XML_EXT);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(Collections.emptyMap());
+
+ assertEquals(POLICY_NAME, fixture.getPolicyName());
+
+ }
+
+ /**
+ * Run the void setPolicyType(PolicyType) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetPolicyType_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(Collections.emptyMap());
+ final PolicyType policyType = PolicyType.JSON;
+
+ fixture.setPolicyType(policyType);
+
+ assertEquals(policyType, fixture.getType());
+ }
+
+ /**
+ * Run the void setPolicyVersion(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetPolicyVersion_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+
+ assertEquals(EMPTY_STRING, fixture.getPolicyVersion());
+
+ }
+
+ /**
+ * Run the void setProperties(Properties) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetProperties_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(Collections.emptyMap());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(Collections.emptyMap());
+ final Properties properties = new Properties();
+
+ fixture.setProperties(properties);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the void setResponseAttributes(Map<String,String>) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testSetResponseAttributes_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+ final Map<String, String> responseAttributes = new Hashtable<String, String>();
+
+ fixture.setResponseAttributes(responseAttributes);
+
+ // add additional test code here
+ }
+
+ /**
+ * Run the JsonObject toJSON() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToJSON_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final JsonObject result = fixture.toJSON();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Run the String toOther() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToOther_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.toOther();
+
+ // add additional test code here
+ assertEquals(EMPTY_STRING, result);
+ }
+
+ /**
+ * Run the Properties toProperties() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToProperties_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final Properties result = fixture.toProperties();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
+
+ /**
+ * Run the String toString() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToString_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName("test");
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals("PolicyConfig [ policyConfigStatus=not_found, policyConfigMessage=, policyName=test]", result);
+ }
+
+ /**
+ * Run the Document toXML() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToXML_1() throws Exception {
+ final StdPolicyConfig fixture = new StdPolicyConfig();
+ fixture.setConfigStatus(EMPTY_STRING, PolicyConfigStatus.CONFIG_NOT_FOUND);
+ fixture.setDocument((Document) null);
+ fixture.setResponseAttributes(new Hashtable<String, String>());
+ fixture.setPolicyVersion(EMPTY_STRING);
+ fixture.setOther(EMPTY_STRING);
+ fixture.setPolicyType(PolicyType.JSON);
+ fixture.setPolicyName(EMPTY_STRING);
+ fixture.setProperties(new Properties());
+ fixture.setJsonObject((JsonObject) null);
+ fixture.setMatchingConditions(new Hashtable<String, String>());
+
+ final Document result = fixture.toXML();
+
+ // add additional test code here
+ assertEquals(null, result);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Before
+ public void setUp() throws Exception {
+ // add additional set up code here
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception
+ * if the clean-up fails for some reason
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Add additional tear down code here
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(StdPolicyConfigTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIDictionaryResponseTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIDictionaryResponseTest.java
new file mode 100644
index 000000000..44bf759dd
--- /dev/null
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/APIDictionaryResponseTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * APIDictionaryResponse
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.test;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.Response.Status;
+
+import org.junit.Test;
+import org.onap.policy.models.APIDictionaryResponse;
+
+public class APIDictionaryResponseTest {
+
+ private static final String JSON_STRING = "JSON_STRING";
+
+ private static final String DICTIONARY_DATA = "DICTIONARY_DATA";
+
+ @Test
+ public final void testSetAndGet() {
+ final APIDictionaryResponse objUnderTest = new APIDictionaryResponse();
+ objUnderTest.setDictionaryData(DICTIONARY_DATA);
+ objUnderTest.setDictionaryJson(JSON_STRING);
+ objUnderTest.setResponseCode(Status.BAD_GATEWAY.getStatusCode());
+ objUnderTest.setResponseMessage(Status.BAD_GATEWAY.toString());
+
+ assertEquals(DICTIONARY_DATA, objUnderTest.getDictionaryData());
+ assertEquals(JSON_STRING, objUnderTest.getDictionaryJson());
+ assertEquals(Status.BAD_GATEWAY.getStatusCode(), objUnderTest.getResponseCode());
+ assertEquals(Status.BAD_GATEWAY.toString(), objUnderTest.getResponseMessage());
+
+ }
+}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java
index d59a14658..7255f1c86 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyConditionTest.java
@@ -26,73 +26,58 @@ import org.onap.policy.api.DeletePolicyCondition;
import static org.junit.Assert.*;
/**
- * The class <code>DeletePolicyConditionTest</code> contains tests for the class <code>{@link DeletePolicyCondition}</code>.
+ * The class <code>DeletePolicyConditionTest</code> contains tests for the class
+ * <code>{@link DeletePolicyCondition}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class DeletePolicyConditionTest {
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- DeletePolicyCondition fixture = DeletePolicyCondition.ALL;
- String result = fixture.toString();
+ @Test
+ public void testToString_1() throws Exception {
+ final DeletePolicyCondition fixture = DeletePolicyCondition.ALL;
- // add additional test code here
- assertEquals("All Versions", result);
-
- assertEquals(DeletePolicyCondition.ALL, DeletePolicyCondition.create(DeletePolicyCondition.ALL.name()));
- }
+ final String result = fixture.toString();
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- DeletePolicyCondition.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
- }
+ // add additional test code here
+ assertEquals("All Versions", result);
- /**
- * 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
- }
+ assertEquals(DeletePolicyCondition.ALL, DeletePolicyCondition.create(DeletePolicyCondition.ALL.name()));
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(DeletePolicyConditionTest.class);
- }
+ @Test
+ public void testCreate_EnumName_DeletePolicyConditionEnum() {
+ for (final DeletePolicyCondition condition : DeletePolicyCondition.values()) {
+ final DeletePolicyCondition actualCondition = DeletePolicyCondition.create(condition.name());
+ assertEquals(condition, actualCondition);
+ assertEquals(condition.toString(), actualCondition.toString());
+ }
+ }
+
+ @Test
+ public void testCreate_StringValue_DeletePolicyConditionEnum() {
+ for (final DeletePolicyCondition condition : DeletePolicyCondition.values()) {
+ final DeletePolicyCondition actualCondition = DeletePolicyCondition.create(condition.toString());
+ assertEquals(condition, actualCondition);
+ }
+
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ DeletePolicyCondition.create("foobar");
+ }
+
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(DeletePolicyConditionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java
index 423b839f6..14e1360ce 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DeletePolicyParametersTest.java
@@ -29,286 +29,181 @@ import org.onap.policy.api.DeletePolicyParameters;
import static org.junit.Assert.*;
/**
- * The class <code>DeletePolicyParametersTest</code> contains tests for the class <code>{@link DeletePolicyParameters}</code>.
+ * The class <code>DeletePolicyParametersTest</code> contains tests for the
+ * class <code>{@link DeletePolicyParameters}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class DeletePolicyParametersTest {
- /**
- * Run the DeletePolicyCondition getDeleteCondition() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetDeleteCondition_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
-
- DeletePolicyCondition result = fixture.getDeleteCondition();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("All Versions", result.toString());
- assertEquals("ALL", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the String getPdpGroup() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPdpGroup_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
-
- String result = fixture.getPdpGroup();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyComponent() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyComponent_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
-
- String result = fixture.getPolicyComponent();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the String getPolicyName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetPolicyName_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
-
- String result = fixture.getPolicyName();
-
- // add additional test code here
- assertEquals("", result);
- }
-
- /**
- * Run the UUID getRequestID() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testGetRequestID_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d"));
- fixture.setPdpGroup("");
-
- UUID result = fixture.getRequestID();
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("482e90e2-2ad7-4265-9893-4cfe08ef1e3d", result.toString());
- assertEquals(4, result.version());
- assertEquals(2, result.variant());
- assertEquals(-7452528304412746179L, result.getLeastSignificantBits());
- assertEquals(5201253920715260517L, result.getMostSignificantBits());
- }
-
- /**
- * Run the void setDeleteCondition(DeletePolicyCondition) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetDeleteCondition_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
- DeletePolicyCondition deleteCondition = DeletePolicyCondition.ALL;
-
- fixture.setDeleteCondition(deleteCondition);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPdpGroup(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPdpGroup_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
- String pdpGroup = "";
-
- fixture.setPdpGroup(pdpGroup);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyComponent(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyComponent_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
- String policyComponent = "";
-
- fixture.setPolicyComponent(policyComponent);
-
- // add additional test code here
- }
-
- /**
- * Run the void setPolicyName(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetPolicyName_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
- String policyName = "";
-
- fixture.setPolicyName(policyName);
-
- // add additional test code here
- }
-
- /**
- * Run the void setRequestID(UUID) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testSetRequestID_1()
- throws Exception {
- DeletePolicyParameters fixture = new DeletePolicyParameters();
- fixture.setPolicyComponent("");
- fixture.setPolicyName("");
- fixture.setDeleteCondition(DeletePolicyCondition.ALL);
- fixture.setRequestID(UUID.randomUUID());
- fixture.setPdpGroup("");
- UUID requestID = UUID.randomUUID();
-
- fixture.setRequestID(requestID);
-
- // add additional test code here
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(DeletePolicyParametersTest.class);
- }
+ private static final String POLICY_TYPE = "POLICYTYPE";
+
+ private static final String PDP_GROUP = "PDPGROUP";
+
+ private static final String POLICY_NAME = "Apex";
+
+ private static final String POLICY_COMPONENT = "ApexComponent";
+
+ /**
+ * Run the DeletePolicyCondition getDeleteCondition() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetDeleteCondition_1() throws Exception {
+ final DeletePolicyParameters fixture = new DeletePolicyParameters();
+ fixture.setPolicyComponent("");
+ fixture.setPolicyName("");
+ fixture.setDeleteCondition(DeletePolicyCondition.ALL);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setPdpGroup("");
+
+ final DeletePolicyCondition result = fixture.getDeleteCondition();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("All Versions", result.toString());
+ assertEquals("ALL", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String getPdpGroup() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPdpGroup_1() throws Exception {
+ final DeletePolicyParameters fixture = new DeletePolicyParameters();
+ fixture.setPolicyComponent("");
+ fixture.setPolicyName("");
+ fixture.setDeleteCondition(DeletePolicyCondition.ALL);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setPdpGroup("");
+
+ final String result = fixture.getPdpGroup();
+
+ // add additional test code here
+ assertEquals("", result);
+ }
+
+ /**
+ * Run the String getPolicyComponent() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testGetPolicyComponent_1() throws Exception {
+ final DeletePolicyParameters fixture = new DeletePolicyParameters();
+ fixture.setPolicyComponent("");
+ fixture.setPolicyName("");
+ fixture.setDeleteCondition(DeletePolicyCondition.ALL);
+ fixture.setRequestID(UUID.randomUUID());
+ fixture.setPdpGroup("");
+
+ final String result = fixture.getPolicyComponent();
+
+ // 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 {
+ final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
+
+ final DeletePolicyParameters objUnderTest = new DeletePolicyParameters();
+ objUnderTest.setPolicyComponent(POLICY_COMPONENT);
+ objUnderTest.setPolicyName(POLICY_NAME);
+ objUnderTest.setDeleteCondition(DeletePolicyCondition.ALL);
+ objUnderTest.setRequestID(requestID);
+ objUnderTest.setPdpGroup(PDP_GROUP);
+ objUnderTest.setPolicyType(POLICY_TYPE);
+
+ final UUID result = objUnderTest.getRequestID();
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("482e90e2-2ad7-4265-9893-4cfe08ef1e3d", result.toString());
+ assertEquals(4, result.version());
+ assertEquals(2, result.variant());
+ assertEquals(-7452528304412746179L, result.getLeastSignificantBits());
+ assertEquals(5201253920715260517L, result.getMostSignificantBits());
+ }
+
+ /**
+ * Run the void setDeleteCondition(DeletePolicyCondition) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ @Test
+ public void testSetDeleteCondition_1() throws Exception {
+ final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
+
+ final DeletePolicyParameters objUnderTest = new DeletePolicyParameters();
+ objUnderTest.setPolicyComponent(POLICY_COMPONENT);
+ objUnderTest.setPolicyName(POLICY_NAME);
+ objUnderTest.setDeleteCondition(DeletePolicyCondition.ALL);
+ objUnderTest.setRequestID(requestID);
+ objUnderTest.setPdpGroup(PDP_GROUP);
+ objUnderTest.setPolicyType(POLICY_TYPE);
+
+ assertEquals(POLICY_COMPONENT, objUnderTest.getPolicyComponent());
+ assertEquals(POLICY_NAME, objUnderTest.getPolicyName());
+ assertEquals(POLICY_TYPE, objUnderTest.getPolicyType());
+ assertEquals(DeletePolicyCondition.ALL, objUnderTest.getDeleteCondition());
+ assertEquals(requestID, objUnderTest.getRequestID());
+ }
+
+ /**
+ * 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(final String[] args) {
+ new org.junit.runner.JUnitCore().run(DeletePolicyParametersTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryTypeTest.java
index bbab6d318..ca85f69c5 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/DictionaryTypeTest.java
@@ -19,27 +19,34 @@
*/
package org.onap.policy.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.onap.policy.api.DictionaryType;
public class DictionaryTypeTest {
- @Before
- public void setUp() throws Exception {
- }
+ @Test
+ public void testCreate_EnumName_DictionaryTypeEnum() {
+ for (final DictionaryType dictionaryType : DictionaryType.values()) {
+ final DictionaryType actualDictionaryType = DictionaryType.create(dictionaryType.name());
+ assertEquals(dictionaryType, actualDictionaryType);
+ assertEquals(dictionaryType.toString(), actualDictionaryType.toString());
+ }
+ }
- @After
- public void tearDown() throws Exception {
- }
+ @Test
+ public void testCreate_StringValue_DictionaryTypeEnum() {
+ for (final DictionaryType dictionaryType : DictionaryType.values()) {
+ final DictionaryType actualDictionaryType = DictionaryType.create(dictionaryType.toString());
+ assertEquals(dictionaryType, actualDictionaryType);
+ }
+ }
- @Test(expected = IllegalArgumentException.class)
- public void test() {
- assertEquals(DictionaryType.Action, DictionaryType.create(DictionaryType.Action.toString()));
- DictionaryType.create("foobar");
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void test() {
+ assertEquals(DictionaryType.Action, DictionaryType.create(DictionaryType.Action.toString()));
+ DictionaryType.create("foobar");
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
index b4aaa64d8..88b3bc8cb 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
@@ -20,78 +20,63 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyClass;
+import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.policy.api.PolicyClass;
/**
- * The class <code>PolicyClassTest</code> contains tests for the class <code>{@link PolicyClass}</code>.
+ * The class <code>PolicyClassTest</code> contains tests for the class
+ * <code>{@link PolicyClass}</code>.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class PolicyClassTest {
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToString_1() {
- PolicyClass fixture = PolicyClass.Action;
- String result = fixture.toString();
+ @Test
+ public void testToString_1() {
+ final PolicyClass fixture = PolicyClass.Action;
+
+ final String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals("Action", result);
+
+ assertEquals(PolicyClass.Decision, PolicyClass.create(PolicyClass.Decision.toString()));
+ }
- // add additional test code here
- assertEquals("Action", result);
-
- assertEquals(PolicyClass.Decision, PolicyClass.create(PolicyClass.Decision.toString()));
- }
+ @Test
+ public void testCreate_EnumName_PolicyClassEnum() {
+ for (final PolicyClass policyClass : PolicyClass.values()) {
+ final PolicyClass actualPolicyClass = PolicyClass.create(policyClass.name());
+ assertEquals(policyClass, actualPolicyClass);
+ assertEquals(policyClass.toString(), actualPolicyClass.toString());
+ }
+ }
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- PolicyClass.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
+ public void testCreate_StringValue_PolicyClassEnum() {
+ for (final PolicyClass policyClass : PolicyClass.values()) {
+ final PolicyClass actualPolicyClass = PolicyClass.create(policyClass.toString());
+ assertEquals(policyClass, actualPolicyClass);
+ }
+ }
- /**
- * 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
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyClass.create("foobar");
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyClassTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyClassTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java
index 49691724a..e7d82499f 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java
@@ -20,120 +20,95 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyConfigStatus;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.PolicyConfigStatus;
/**
- * The class <code>PolicyConfigStatusTest</code> contains tests for the class <code>{@link PolicyConfigStatus}</code>.
+ * The class <code>PolicyConfigStatusTest</code> contains tests for the class
+ * <code>{@link PolicyConfigStatus}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class PolicyConfigStatusTest {
- /**
- * Run the PolicyConfigStatus getStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetStatus_1()
- throws Exception {
- String configStatus = "";
-
- PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
+ /**
+ * Run the PolicyConfigStatus getStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetStatus_1() throws Exception {
+ final String configStatus = "";
- // add additional test code here
- assertNotNull(result);
- assertEquals("not_found", result.toString());
- assertEquals("CONFIG_NOT_FOUND", result.name());
- assertEquals(1, result.ordinal());
-
- assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, PolicyConfigStatus.create("retrieved"));
- }
+ final PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
- /**
- * Run the PolicyConfigStatus getStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetStatus_2()
- throws Exception {
- String configStatus = "retrieved";
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("not_found", result.toString());
+ assertEquals("CONFIG_NOT_FOUND", result.name());
+ assertEquals(1, result.ordinal());
- PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
+ assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, PolicyConfigStatus.create("retrieved"));
+ }
- // add additional test code here
- assertNotNull(result);
- assertEquals("retrieved", result.toString());
- assertEquals("CONFIG_RETRIEVED", result.name());
- assertEquals(0, result.ordinal());
- }
+ /**
+ * Run the PolicyConfigStatus getStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetStatus_2() throws Exception {
+ final String configStatus = "retrieved";
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- PolicyConfigStatus fixture = PolicyConfigStatus.CONFIG_NOT_FOUND;
+ final PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
- String result = fixture.toString();
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("retrieved", result.toString());
+ assertEquals("CONFIG_RETRIEVED", result.name());
+ assertEquals(0, result.ordinal());
+ }
- // add additional test code here
- assertEquals("not_found", result);
- }
+ @Test
+ public void testCreate_EnumName_PolicyConfigStatusEnum() {
+ for (final PolicyConfigStatus policyConfigStatus : PolicyConfigStatus.values()) {
+ final PolicyConfigStatus actualPolicyConfigStatus = PolicyConfigStatus.create(policyConfigStatus.name());
+ assertEquals(policyConfigStatus, actualPolicyConfigStatus);
+ assertEquals(policyConfigStatus.toString(), actualPolicyConfigStatus.toString());
+ }
+ }
- @Test(expected = IllegalArgumentException.class)
- public void testException () {
- PolicyConfigStatus.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
- }
+ @Test
+ public void testCreate_StringValue_PolicyClassEnum() {
+ for (final PolicyConfigStatus policyConfigStatus : PolicyConfigStatus.values()) {
+ final PolicyConfigStatus actualPolicyClass = PolicyConfigStatus.create(policyConfigStatus.toString());
+ assertEquals(policyConfigStatus, actualPolicyClass);
+ }
+ }
- /**
- * 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
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyConfigStatus.create("foobar");
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyConfigStatusTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyConfigStatusTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java
index a6391700f..a63094a7b 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyDecisionTest.java
@@ -20,79 +20,51 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyDecision;
+import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.policy.api.PolicyDecision;
/**
- * The class <code>PolicyDecisionTest</code> contains tests for the class <code>{@link PolicyDecision}</code>.
+ * The class <code>PolicyDecisionTest</code> contains tests for the class
+ * <code>{@link PolicyDecision}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class PolicyDecisionTest {
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- PolicyDecision fixture = PolicyDecision.DENY;
-
- String result = fixture.toString();
- // add additional test code here
- assertEquals("deny", result);
-
- assertEquals(PolicyDecision.PERMIT, PolicyDecision.create(PolicyDecision.PERMIT.name()));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- PolicyDecision.create("foobar");
- }
+ @Test
+ public void testCreate_EnumName_PolicyDecisionEnum() {
+ for (final PolicyDecision policyDecision : PolicyDecision.values()) {
+ final PolicyDecision actualPolicyDecision = PolicyDecision.create(policyDecision.name());
+ assertEquals(policyDecision, actualPolicyDecision);
+ assertEquals(policyDecision.toString(), actualPolicyDecision.toString());
+ }
+ }
- /**
- * 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
- }
+ @Test
+ public void testCreate_StringValue_PolicyDecisionEnum() {
+ for (final PolicyDecision policyDecision : PolicyDecision.values()) {
+ final PolicyDecision autalPolicyDecision = PolicyDecision.create(policyDecision.toString());
+ assertEquals(policyDecision, autalPolicyDecision);
+ }
+ }
- /**
- * 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
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyDecision.create("foobar");
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyDecisionTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyDecisionTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java
index 4803a8ece..587b19332 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyResponseStatusTest.java
@@ -20,142 +20,160 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyResponseStatus;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.PolicyResponseStatus;
/**
- * The class <code>PolicyResponseStatusTest</code> contains tests for the class <code>{@link PolicyResponseStatus}</code>.
+ * The class <code>PolicyResponseStatusTest</code> contains tests for the class
+ * <code>{@link PolicyResponseStatus}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class PolicyResponseStatusTest {
- /**
- * Run the PolicyResponseStatus getStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetStatus_1()
- throws Exception {
- String responseStatus = "";
-
- PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("no_action", result.toString());
- assertEquals("NO_ACTION_REQUIRED", result.name());
- assertEquals(0, result.ordinal());
- }
-
- /**
- * Run the PolicyResponseStatus getStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetStatus_2()
- throws Exception {
- String responseStatus = "action_advised";
-
- PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("action_advised", result.toString());
- assertEquals("ACTION_ADVISED", result.name());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the PolicyResponseStatus getStatus(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testGetStatus_3()
- throws Exception {
- String responseStatus = "action_taken";
-
- PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals("action_taken", result.toString());
- assertEquals("ACTION_TAKEN", result.name());
- assertEquals(2, result.ordinal());
- }
-
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED;
-
- String result = fixture.toString();
-
- // add additional test code here
- assertEquals("action_advised", result);
-
- assertEquals(PolicyResponseStatus.ACTION_ADVISED, PolicyResponseStatus.create("ACTION_ADVISED"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testTheRest() {
- PolicyResponseStatus.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 post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyResponseStatusTest.class);
- }
+ /**
+ * Run the PolicyResponseStatus getStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetStatus_1() throws Exception {
+ final String responseStatus = "";
+
+ final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("no_action", result.toString());
+ assertEquals("NO_ACTION_REQUIRED", result.name());
+ assertEquals(0, result.ordinal());
+ }
+
+ @Test
+ public void testCreate_EnumName_PolicyResponseStatusEnum() {
+ for (final PolicyResponseStatus policyResponseStatus : PolicyResponseStatus.values()) {
+ final PolicyResponseStatus actualPolicyResponseStatus = PolicyResponseStatus
+ .create(policyResponseStatus.name());
+ assertEquals(policyResponseStatus, actualPolicyResponseStatus);
+ assertEquals(policyResponseStatus.toString(), actualPolicyResponseStatus.toString());
+ }
+ }
+
+ @Test
+ public void testCreate_StringValue_PolicyResponseStatusEnum() {
+ for (final PolicyResponseStatus policyResponseStatus : PolicyResponseStatus.values()) {
+ final PolicyResponseStatus actualPolicyResponseStatus = PolicyResponseStatus
+ .create(policyResponseStatus.toString());
+ assertEquals(policyResponseStatus, actualPolicyResponseStatus);
+ }
+ }
+
+ /**
+ * Run the PolicyResponseStatus getStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetStatus_2() throws Exception {
+ final String responseStatus = "action_advised";
+
+ final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("action_advised", result.toString());
+ assertEquals("ACTION_ADVISED", result.name());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the PolicyResponseStatus getStatus(String) method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testGetStatus_3() throws Exception {
+ final String responseStatus = "action_taken";
+
+ final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
+
+ // add additional test code here
+ assertNotNull(result);
+ assertEquals("action_taken", result.toString());
+ assertEquals("ACTION_TAKEN", result.name());
+ assertEquals(2, result.ordinal());
+ }
+
+ /**
+ * Run the String toString() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToString_1() throws Exception {
+ final PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED;
+
+ final String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals("action_advised", result);
+
+ assertEquals(PolicyResponseStatus.ACTION_ADVISED, PolicyResponseStatus.create("ACTION_ADVISED"));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testTheRest() {
+ PolicyResponseStatus.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 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(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyResponseStatusTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java
index 267dd9771..49bdfe876 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java
@@ -20,79 +20,69 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyType;
+import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.policy.api.PolicyType;
/**
- * The class <code>PolicyTypeTest</code> contains tests for the class <code>{@link PolicyType}</code>.
+ * The class <code>PolicyTypeTest</code> contains tests for the class
+ * <code>{@link PolicyType}</code>.
*
* @generatedBy CodePro at 6/1/16 1:41 PM
* @version $Revision: 1.0 $
*/
public class PolicyTypeTest {
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- @Test
- public void testToString_1()
- throws Exception {
- PolicyType fixture = PolicyType.JSON;
+ /**
+ * Run the String toString() method test.
+ *
+ * @throws Exception
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ @Test
+ public void testToString_1() throws Exception {
+ final PolicyType fixture = PolicyType.JSON;
+
+ final String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals("json", result);
- String result = fixture.toString();
+ assertEquals(PolicyType.JSON, PolicyType.create("json"));
+ }
- // add additional test code here
- assertEquals("json", result);
-
- assertEquals(PolicyType.JSON, PolicyType.create("json"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- PolicyType.create("foobar");
- }
+ @Test
+ public void testCreate_EnumName_PolicyTypeEnum() {
+ for (final PolicyType policyType : PolicyType.values()) {
+ final PolicyType actualPolicyType = PolicyType.create(policyType.name());
+ assertEquals(policyType, actualPolicyType);
+ assertEquals(policyType.toString(), actualPolicyType.toString());
+ }
+ }
- /**
- * 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
- }
+ @Test
+ public void testCreate_StringValue_PolicyTypeEnum() {
+ for (final PolicyType policyType : PolicyType.values()) {
+ final PolicyType actualPolicyType = PolicyType.create(policyType.toString());
+ assertEquals(policyType, actualPolicyType);
+ }
+ }
- /**
- * 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
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyType.create("foobar");
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:41 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyTypeTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:41 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyTypeTest.class);
+ }
}
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/RuleProviderTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RuleProviderTest.java
index 23353232e..756997e78 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/RuleProviderTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/RuleProviderTest.java
@@ -19,21 +19,38 @@
*/
package org.onap.policy.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.policy.api.RuleProvider;
public class RuleProviderTest {
- @Test
- public void test() {
- assertEquals(RuleProvider.RAINY_DAY, RuleProvider.create(RuleProvider.RAINY_DAY.name()));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- RuleProvider.create("foobar");
- }
+ @Test
+ public void test() {
+ assertEquals(RuleProvider.RAINY_DAY, RuleProvider.create(RuleProvider.RAINY_DAY.name()));
+ }
+
+ @Test
+ public void testCreate_EnumName_RuleProviderEnum() {
+ for (final RuleProvider ruleProvider : RuleProvider.values()) {
+ final RuleProvider actualRuleProvider = RuleProvider.create(ruleProvider.name());
+ assertEquals(ruleProvider, actualRuleProvider);
+ assertEquals(ruleProvider.toString(), actualRuleProvider.toString());
+ }
+ }
+
+ @Test
+ public void testCreate_StringValue_RuleProviderEnum() {
+ for (final RuleProvider ruleProvider : RuleProvider.values()) {
+ final RuleProvider actualRuleProvider = RuleProvider.create(ruleProvider.toString());
+ assertEquals(ruleProvider, actualRuleProvider);
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ RuleProvider.create("foobar");
+ }
}