aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-REST/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-REST/src/test/java')
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java122
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java16
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java270
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java10
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java396
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java454
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java36
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java50
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java740
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java516
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java152
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java280
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java226
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java108
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java448
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java354
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java80
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java298
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java346
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java314
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java86
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java190
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java82
23 files changed, 2787 insertions, 2787 deletions
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
index 9b4cc3ffb..5b8513823 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
@@ -47,65 +47,65 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletConfig;
public class XACMLRestTest extends Mockito{
- private static Log logger = LogFactory.getLog(XACMLRestTest.class);
-
- private List<String> headers = new ArrayList<>();
-
- private HttpServletRequest httpServletRequest;
- private HttpServletResponse httpServletResponse;
- private ServletOutputStream mockOutput;
- private ServletConfig servletConfig;
-
-
- @Before
- public void setUp(){
- httpServletRequest = Mockito.mock(HttpServletRequest.class);
- Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
- Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
- Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
-
- mockOutput = Mockito.mock(ServletOutputStream.class);
-
- httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
-
- try {
- Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput);
- } catch (IOException e) {
- fail();
- }
-
- servletConfig = Mockito.mock(MockServletConfig.class);
- Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
- Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties");
-
- System.setProperty("xacml.properties", "xacml.pdp.properties");
- System.setProperty("xacml.rest.pdp.config", "config_testing");
- System.setProperty("xacml.rest.pep.idfile", "testclient.properties");
- System.setProperty("xacml.rest.pdp.webapps", "/webapps");
- System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml");
- System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml");
- System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml");
- System.setProperty("xacml.rest.pdp.register", "false");
- }
-
- @Test
- public void testXacmlInit(){
- logger.info("XACMLRestTest - testInit");
- try {
- XACMLRest.xacmlInit(servletConfig);
- Logger.getRootLogger().setLevel(Level.DEBUG);
- XACMLRest.dumpRequest(httpServletRequest);
- XACMLRest.loadXacmlProperties(null, null);
- } catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
- Constructor<XACMLRestProperties> constructor = XACMLRestProperties.class.getDeclaredConstructor();
- assertTrue(Modifier.isPrivate(constructor.getModifiers()));
- constructor.setAccessible(true);
- constructor.newInstance();
- }
+ private static Log logger = LogFactory.getLog(XACMLRestTest.class);
+
+ private List<String> headers = new ArrayList<>();
+
+ private HttpServletRequest httpServletRequest;
+ private HttpServletResponse httpServletResponse;
+ private ServletOutputStream mockOutput;
+ private ServletConfig servletConfig;
+
+
+ @Before
+ public void setUp(){
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
+ Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
+ Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
+
+ mockOutput = Mockito.mock(ServletOutputStream.class);
+
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+
+ try {
+ Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput);
+ } catch (IOException e) {
+ fail();
+ }
+
+ servletConfig = Mockito.mock(MockServletConfig.class);
+ Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
+ Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties");
+
+ System.setProperty("xacml.properties", "xacml.pdp.properties");
+ System.setProperty("xacml.rest.pdp.config", "config_testing");
+ System.setProperty("xacml.rest.pep.idfile", "testclient.properties");
+ System.setProperty("xacml.rest.pdp.webapps", "/webapps");
+ System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml");
+ System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml");
+ System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml");
+ System.setProperty("xacml.rest.pdp.register", "false");
+ }
+
+ @Test
+ public void testXacmlInit(){
+ logger.info("XACMLRestTest - testInit");
+ try {
+ XACMLRest.xacmlInit(servletConfig);
+ Logger.getRootLogger().setLevel(Level.DEBUG);
+ XACMLRest.dumpRequest(httpServletRequest);
+ XACMLRest.loadXacmlProperties(null, null);
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ Constructor<XACMLRestProperties> constructor = XACMLRestProperties.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
} \ No newline at end of file
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java
index eb4784e29..b40b81778 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java
@@ -27,12 +27,12 @@ import org.junit.Test;
public class AutoPushTabAdapterTest {
- @Test
- public void testAutoPushTabAdapter(){
- AutoPushTabAdapter adapter = new AutoPushTabAdapter();
- adapter.setPdpDatas(new ArrayList<>());
- assertTrue(adapter.getPdpDatas() != null);
- adapter.setPolicyDatas(new ArrayList<>());
- assertTrue(adapter.getPolicyDatas() != null);
- }
+ @Test
+ public void testAutoPushTabAdapter(){
+ AutoPushTabAdapter adapter = new AutoPushTabAdapter();
+ adapter.setPdpDatas(new ArrayList<>());
+ assertTrue(adapter.getPdpDatas() != null);
+ adapter.setPolicyDatas(new ArrayList<>());
+ assertTrue(adapter.getPolicyDatas() != null);
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
index 085dde1b6..33efb19ed 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
@@ -30,139 +30,139 @@ import org.junit.Test;
public class ClosedLoopPolicyAdaptersTest {
- @Test
- public void testClosedLoopFaultTrapDatas(){
- List<Object> trap = new ArrayList<>();
- trap.add("Test");
- ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas();
- closedLoopTrapData.setTrap1(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0)));
- closedLoopTrapData.setTrap2(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0)));
- closedLoopTrapData.setTrap3(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0)));
- closedLoopTrapData.setTrap4(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0)));
- closedLoopTrapData.setTrap5(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0)));
- closedLoopTrapData.setTrap6(trap);
- assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0)));
-
- }
-
- @Test
- public void testClosedLoopFaultBody(){
- ClosedLoopFaultBody faultBody = new ClosedLoopFaultBody();
- faultBody.setTrinity(true);
- assertTrue(faultBody.isTrinity());
- faultBody.setvUSP(true);
- assertTrue(faultBody.isvUSP());
- faultBody.setMcr(true);
- assertTrue(faultBody.isMcr());
- faultBody.setGamma(true);
- assertTrue(faultBody.isGamma());
- faultBody.setvDNS(true);
- assertTrue(faultBody.isvDNS());
- faultBody.setVnfType("Test");
- assertTrue("Test".equals(faultBody.getVnfType()));
- faultBody.setvServices("Test");
- assertTrue("Test".equals(faultBody.getvServices()));
- faultBody.setONAPname("Test");
- assertTrue("Test".equals(faultBody.getONAPname()));
- faultBody.setClosedLoopPolicyStatus("Active");
- assertTrue("Active".equals(faultBody.getClosedLoopPolicyStatus()));
-
- ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures();
- triggerSignatures.setSignatures("Test");
- triggerSignatures.setTimeWindow(1);
- triggerSignatures.setTrapMaxAge(2);
- assertTrue("Test".equals(triggerSignatures.getSignatures()));
- assertTrue(1 == triggerSignatures.getTimeWindow());
- assertTrue(2 == triggerSignatures.getTrapMaxAge());
-
- faultBody.setTriggerSignatures(triggerSignatures);
- assertTrue(faultBody.getTriggerSignatures()!=null);
- faultBody.setActions("Test");
- assertTrue("Test".equals(faultBody.getActions()));
- faultBody.setTimeInterval(1);
- assertTrue(1 == faultBody.getTimeInterval());
- faultBody.setTimeOutvPRO(2);
- assertTrue(2 == faultBody.getTimeOutvPRO());
- faultBody.setTimeOutRuby(3);
- assertTrue(3 == faultBody.getTimeOutRuby());
- faultBody.setRetrys(4);
- assertTrue(4 == faultBody.getRetrys());
- faultBody.setAgingWindow(5);
- assertTrue(5 == faultBody.getAgingWindow());
- faultBody.setGeoLink("Test");
- assertTrue("Test".equals(faultBody.getGeoLink()));
- faultBody.setEmailAddress("test@test.com");
- assertTrue("test@test.com".equals(faultBody.getEmailAddress()));
- faultBody.setVerificationSignatures(triggerSignatures);
- assertTrue(faultBody.getVerificationSignatures()!=null);
-
- faultBody.setConditions(ClosedLoopPolicyConditions.SEND);
- assertTrue(ClosedLoopPolicyConditions.SEND.equals(faultBody.getConditions()));
-
- faultBody.setConditions(ClosedLoopPolicyConditions.NOTSEND);
- assertTrue(ClosedLoopPolicyConditions.NOTSEND.equals(faultBody.getConditions()));
-
- ClosedLoopFaultTriggerUISignatures uiSignatures = new ClosedLoopFaultTriggerUISignatures();
- uiSignatures.setConnectSignatures("Test");
- uiSignatures.setSignatures("Test");
- assertTrue("Test".equals(uiSignatures.getConnectSignatures()));
- assertTrue("Test".equals(uiSignatures.getSignatures()));
-
- faultBody.setTriggerSignaturesUsedForUI(uiSignatures);
- assertTrue(faultBody.getTriggerSignaturesUsedForUI()!=null);
- faultBody.setVerificationSignaturesUsedForUI(uiSignatures);
- assertTrue(faultBody.getVerificationSignaturesUsedForUI()!=null);
- faultBody.setTriggerTimeWindowUsedForUI(1);
- assertTrue(1 == faultBody.getTriggerTimeWindowUsedForUI());
- faultBody.setVerificationTimeWindowUsedForUI(2);
- assertTrue(2 == faultBody.getVerificationTimeWindowUsedForUI());
- faultBody.setPepName("Test");
- assertTrue("Test".equals(faultBody.getPepName()));
- faultBody.setPepAction("Test");
- assertTrue("Test".equals(faultBody.getPepAction()));
- faultBody.setTemplateVersion("1802");
- assertTrue("1802".equals(faultBody.getTemplateVersion()));
- faultBody.setTrapMaxAge(3);
- assertTrue(3 == faultBody.getTrapMaxAge());
- }
-
- @Test
- public void testClosedLoopPMBody(){
- ClosedLoopPMBody pmBody = new ClosedLoopPMBody();
- pmBody.setTrinity(true);
- assertTrue(pmBody.isTrinity());
- pmBody.setvUSP(true);
- assertTrue(pmBody.isvUSP());
- pmBody.setMcr(true);
- assertTrue(pmBody.isMcr());
- pmBody.setGamma(true);
- assertTrue(pmBody.isGamma());
- pmBody.setvDNS(true);
- assertTrue(pmBody.isvDNS());
- pmBody.setvServices("Test");
- assertTrue("Test".equals(pmBody.getvServices()));
- pmBody.setONAPname("Test");
- assertTrue("Test".equals(pmBody.getONAPname()));
- pmBody.setEmailAddress("test@test.com");
- assertTrue("test@test.com".equals(pmBody.getEmailAddress()));
- pmBody.setServiceTypePolicyName("Test");
- assertTrue("Test".equals(pmBody.getServiceTypePolicyName()));
- pmBody.setTemplateVersion("1802");
- assertTrue("1802".equals(pmBody.getTemplateVersion()));
- pmBody.setAttributes(new HashMap<String, String>());
- assertTrue(pmBody.getAttributes() != null);
- pmBody.setGeoLink("Test");
- assertTrue("Test".equals(pmBody.getGeoLink()));
- }
-
- @Test
- public void testClosedLoopPolicyStatus() {
- assertEquals(ClosedLoopPolicyStatus.ACTIVE.toString(), "active");
- assertEquals(ClosedLoopPolicyStatus.INACTIVE.toString(), "inactive");
- }
+ @Test
+ public void testClosedLoopFaultTrapDatas(){
+ List<Object> trap = new ArrayList<>();
+ trap.add("Test");
+ ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas();
+ closedLoopTrapData.setTrap1(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0)));
+ closedLoopTrapData.setTrap2(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0)));
+ closedLoopTrapData.setTrap3(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0)));
+ closedLoopTrapData.setTrap4(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0)));
+ closedLoopTrapData.setTrap5(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0)));
+ closedLoopTrapData.setTrap6(trap);
+ assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0)));
+
+ }
+
+ @Test
+ public void testClosedLoopFaultBody(){
+ ClosedLoopFaultBody faultBody = new ClosedLoopFaultBody();
+ faultBody.setTrinity(true);
+ assertTrue(faultBody.isTrinity());
+ faultBody.setvUSP(true);
+ assertTrue(faultBody.isvUSP());
+ faultBody.setMcr(true);
+ assertTrue(faultBody.isMcr());
+ faultBody.setGamma(true);
+ assertTrue(faultBody.isGamma());
+ faultBody.setvDNS(true);
+ assertTrue(faultBody.isvDNS());
+ faultBody.setVnfType("Test");
+ assertTrue("Test".equals(faultBody.getVnfType()));
+ faultBody.setvServices("Test");
+ assertTrue("Test".equals(faultBody.getvServices()));
+ faultBody.setONAPname("Test");
+ assertTrue("Test".equals(faultBody.getONAPname()));
+ faultBody.setClosedLoopPolicyStatus("Active");
+ assertTrue("Active".equals(faultBody.getClosedLoopPolicyStatus()));
+
+ ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures();
+ triggerSignatures.setSignatures("Test");
+ triggerSignatures.setTimeWindow(1);
+ triggerSignatures.setTrapMaxAge(2);
+ assertTrue("Test".equals(triggerSignatures.getSignatures()));
+ assertTrue(1 == triggerSignatures.getTimeWindow());
+ assertTrue(2 == triggerSignatures.getTrapMaxAge());
+
+ faultBody.setTriggerSignatures(triggerSignatures);
+ assertTrue(faultBody.getTriggerSignatures()!=null);
+ faultBody.setActions("Test");
+ assertTrue("Test".equals(faultBody.getActions()));
+ faultBody.setTimeInterval(1);
+ assertTrue(1 == faultBody.getTimeInterval());
+ faultBody.setTimeOutvPRO(2);
+ assertTrue(2 == faultBody.getTimeOutvPRO());
+ faultBody.setTimeOutRuby(3);
+ assertTrue(3 == faultBody.getTimeOutRuby());
+ faultBody.setRetrys(4);
+ assertTrue(4 == faultBody.getRetrys());
+ faultBody.setAgingWindow(5);
+ assertTrue(5 == faultBody.getAgingWindow());
+ faultBody.setGeoLink("Test");
+ assertTrue("Test".equals(faultBody.getGeoLink()));
+ faultBody.setEmailAddress("test@test.com");
+ assertTrue("test@test.com".equals(faultBody.getEmailAddress()));
+ faultBody.setVerificationSignatures(triggerSignatures);
+ assertTrue(faultBody.getVerificationSignatures()!=null);
+
+ faultBody.setConditions(ClosedLoopPolicyConditions.SEND);
+ assertTrue(ClosedLoopPolicyConditions.SEND.equals(faultBody.getConditions()));
+
+ faultBody.setConditions(ClosedLoopPolicyConditions.NOTSEND);
+ assertTrue(ClosedLoopPolicyConditions.NOTSEND.equals(faultBody.getConditions()));
+
+ ClosedLoopFaultTriggerUISignatures uiSignatures = new ClosedLoopFaultTriggerUISignatures();
+ uiSignatures.setConnectSignatures("Test");
+ uiSignatures.setSignatures("Test");
+ assertTrue("Test".equals(uiSignatures.getConnectSignatures()));
+ assertTrue("Test".equals(uiSignatures.getSignatures()));
+
+ faultBody.setTriggerSignaturesUsedForUI(uiSignatures);
+ assertTrue(faultBody.getTriggerSignaturesUsedForUI()!=null);
+ faultBody.setVerificationSignaturesUsedForUI(uiSignatures);
+ assertTrue(faultBody.getVerificationSignaturesUsedForUI()!=null);
+ faultBody.setTriggerTimeWindowUsedForUI(1);
+ assertTrue(1 == faultBody.getTriggerTimeWindowUsedForUI());
+ faultBody.setVerificationTimeWindowUsedForUI(2);
+ assertTrue(2 == faultBody.getVerificationTimeWindowUsedForUI());
+ faultBody.setPepName("Test");
+ assertTrue("Test".equals(faultBody.getPepName()));
+ faultBody.setPepAction("Test");
+ assertTrue("Test".equals(faultBody.getPepAction()));
+ faultBody.setTemplateVersion("1802");
+ assertTrue("1802".equals(faultBody.getTemplateVersion()));
+ faultBody.setTrapMaxAge(3);
+ assertTrue(3 == faultBody.getTrapMaxAge());
+ }
+
+ @Test
+ public void testClosedLoopPMBody(){
+ ClosedLoopPMBody pmBody = new ClosedLoopPMBody();
+ pmBody.setTrinity(true);
+ assertTrue(pmBody.isTrinity());
+ pmBody.setvUSP(true);
+ assertTrue(pmBody.isvUSP());
+ pmBody.setMcr(true);
+ assertTrue(pmBody.isMcr());
+ pmBody.setGamma(true);
+ assertTrue(pmBody.isGamma());
+ pmBody.setvDNS(true);
+ assertTrue(pmBody.isvDNS());
+ pmBody.setvServices("Test");
+ assertTrue("Test".equals(pmBody.getvServices()));
+ pmBody.setONAPname("Test");
+ assertTrue("Test".equals(pmBody.getONAPname()));
+ pmBody.setEmailAddress("test@test.com");
+ assertTrue("test@test.com".equals(pmBody.getEmailAddress()));
+ pmBody.setServiceTypePolicyName("Test");
+ assertTrue("Test".equals(pmBody.getServiceTypePolicyName()));
+ pmBody.setTemplateVersion("1802");
+ assertTrue("1802".equals(pmBody.getTemplateVersion()));
+ pmBody.setAttributes(new HashMap<String, String>());
+ assertTrue(pmBody.getAttributes() != null);
+ pmBody.setGeoLink("Test");
+ assertTrue("Test".equals(pmBody.getGeoLink()));
+ }
+
+ @Test
+ public void testClosedLoopPolicyStatus() {
+ assertEquals(ClosedLoopPolicyStatus.ACTIVE.toString(), "active");
+ assertEquals(ClosedLoopPolicyStatus.INACTIVE.toString(), "inactive");
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java
index 129f7237b..40421887f 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java
@@ -24,9 +24,9 @@ import org.junit.Test;
public class DeletePolicyConditionTest {
- @Test
- public void testDeletePolicyCondition(){
- assertEquals(DeletePolicyCondition.ONE.toString(), "Are you sure you want to delete Current Version of policy");
- assertEquals(DeletePolicyCondition.ALL.toString(), "Are you sure you want to delete All Versions of policy");
- }
+ @Test
+ public void testDeletePolicyCondition(){
+ assertEquals(DeletePolicyCondition.ONE.toString(), "Are you sure you want to delete Current Version of policy");
+ assertEquals(DeletePolicyCondition.ALL.toString(), "Are you sure you want to delete All Versions of policy");
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java
index 729efa6d6..3ede40c7c 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java
@@ -28,203 +28,203 @@ import org.junit.Test;
public class FirewallPolicyAdaptersTest {
- @Test
- public void AddressGroupJSON(){
- AddressGroupJson groupJSON = new AddressGroupJson();
- groupJSON.setName("Test");
- assertTrue("Test".equals(groupJSON.getName()));
- groupJSON.setDescription("Test");
- assertTrue("Test".equals(groupJSON.getDescription()));
-
- AddressMembersJson membersJSON = new AddressMembersJson();
- membersJSON.setType("Test");
- assertTrue("Test".equals(membersJSON.getType()));
- membersJSON.setName("Test");
- assertTrue("Test".equals(membersJSON.getName()));
-
- groupJSON.setMembers(null);
- assertTrue(groupJSON.getMembers() != null);
- }
-
- @Test
- public void testAddressMembers(){
- AddressMembers members = new AddressMembers();
- members.setName("Test");
- assertTrue("Test".equals(members.getName()));
- members.setType("Test");
- assertTrue("Test".equals(members.getType()));
- members.setValue("Test");
- assertTrue("Test".equals(members.getValue()));
-
- PrefixIPList prefixList = new PrefixIPList();
- prefixList.setName("Test");
- assertTrue("Test".equals(prefixList.getName()));
- prefixList.setDescription("Test");
- assertTrue("Test".equals(prefixList.getDescription()));
- prefixList.setMembers(null);
- assertTrue(prefixList.getMembers() != null);
- }
-
- @Test
- public void testAddressJSON(){
- AddressJson addressJSON = new AddressJson();
- addressJSON.setName("Test");
- assertTrue("Test".equals(addressJSON.getName()));
- addressJSON.setType("Test");
- assertTrue("Test".equals(addressJSON.getType()));
- }
-
-
- @Test
- public void testGridData(){
- GridData data = new GridData();
- data.setAttributes(new ArrayList<>());
- data.setAppProtocols(new ArrayList<>());
- data.setTransportProtocols(new ArrayList<>());
- assertTrue(data.getAttributes() != null);
- assertTrue(data.getAppProtocols() != null);
- assertTrue(data.getTransportProtocols() != null);
- }
-
- @Test
- public void testTermCollector(){
-
- TermCollector termCollector = new TermCollector();
- termCollector.setServiceTypeId("Test");
- assertTrue("Test".equals(termCollector.getServiceTypeId()));
- termCollector.setConfigName("Test");
- assertTrue("Test".equals(termCollector.getConfigName()));
-
- DeployNowJson deployNowJson = new DeployNowJson();
- deployNowJson.setDeployNow(true);
- assertTrue(deployNowJson.getDeployNow());
-
- termCollector.setDeploymentOption(deployNowJson);
- assertTrue(termCollector.getDeploymentOption() != null);
- termCollector.setSecurityZoneId("Test");
- assertTrue("Test".equals(termCollector.getSecurityZoneId()));
- termCollector.setVendorServiceId("Test");
- assertTrue("Test".equals(termCollector.getVendorServiceId()));
-
- IdMap idMap = new IdMap();
- idMap.setAstraId("Test");
- idMap.setVendorId("Test");
- assertTrue("Test".equals(idMap.getAstraId()));
- assertTrue("Test".equals(idMap.getVendorId()));
-
- List<IdMap> idMapList = new ArrayList<>();
- idMapList.add(idMap);
-
- VendorSpecificData vendorData = new VendorSpecificData();
- vendorData.setIdMap(idMapList);
- assertTrue(vendorData.getIdMap() != null);
- termCollector.setVendorSpecificData(vendorData);
- assertTrue(termCollector.getVendorSpecificData()!=null);
-
- termCollector.setServiceGroups(null);
- assertTrue(termCollector.getServiceGroups()!=null);
- termCollector.setAddressGroups(null);
- assertTrue(termCollector.getAddressGroups()!=null);
-
- Term term = new Term();
- term.setPosition("Test");
- assertTrue("Test".equals(term.getPosition()));
- term.setRuleName("Test");
- assertTrue("Test".equals(term.getRuleName()));
- term.setFromZones(null);
- assertTrue(term.getFromZones() != null);
- term.setToZones(null);
- assertTrue(term.getToZones() != null);
- term.setNegateSource(true);
- assertTrue(term.getNegateSource());
- term.setNegateDestination(true);
- assertTrue(term.getNegateDestination());
- term.setSourceList(null);
- assertTrue(term.getSourceList() != null);
- term.setDestinationList(null);
- assertTrue(term.getDestinationList() != null);
- term.setSourceServices(null);
- assertTrue(term.getSourceServices() != null);
- term.setDestServices(null);
- assertTrue(term.getDestServices() != null);
- term.setAction("Test");
- assertTrue("Test".equals(term.getAction()));
- term.setDescription("Test");
- assertTrue("Test".equals(term.getDescription()));
- term.setEnabled(true);
- assertTrue(term.getEnabled());
- term.setLog(true);
- assertTrue(term.getLog());
-
- termCollector.setFirewallRuleList(null);
- assertTrue(termCollector.getFirewallRuleList()!=null);
-
- Tags tags = new Tags();
- tags.setRuleName("Test");
- assertTrue("Test".equals(tags.getRuleName()));
-
- TagDefines tagDefines = new TagDefines();
- tagDefines.setKey("Test");
- assertTrue("Test".equals(tagDefines.getKey()));
- tagDefines.setValue("Test");
- assertTrue("Test".equals(tagDefines.getValue()));
- tags.setTags(new ArrayList<>());
- assertTrue(tags.getTags()!=null);
- tags.setTagPickerName("Test");
- assertTrue("Test".equals(tags.getTagPickerName()));
- tags.setNetworkRole("Test");
- assertTrue("Test".equals(tags.getNetworkRole()));
- List<Tags> ruleToTag = new ArrayList<>();
- ruleToTag.add(tags);
-
- termCollector.setRuleToTag(ruleToTag);
- assertTrue(termCollector.getRuleToTag()!=null);
- }
-
- @Test
- public void testServiceGroupJson(){
- ServiceGroupJson serviceGroup = new ServiceGroupJson();
- serviceGroup.setName("Test");
- assertTrue("Test".equals(serviceGroup.getName()));
- serviceGroup.setDescription("Test");
- assertTrue("Test".equals(serviceGroup.getDescription()));
- serviceGroup.setMembers(new ArrayList<>());
- assertTrue(serviceGroup.getMembers()!=null);
- }
-
- @Test
- public void testServiceListJson(){
- ServiceListJson serviceGroup = new ServiceListJson();
- serviceGroup.setName("Test");
- assertTrue("Test".equals(serviceGroup.getName()));
- serviceGroup.setDescription("Test");
- assertTrue("Test".equals(serviceGroup.getDescription()));
- serviceGroup.setType("Test");
- assertTrue("Test".equals(serviceGroup.getType()));
- serviceGroup.setTransportProtocol("Test");
- assertTrue("Test".equals(serviceGroup.getTransportProtocol()));
- serviceGroup.setAppProtocol("Test");
- assertTrue("Test".equals(serviceGroup.getAppProtocol()));
- serviceGroup.setPorts("Test");
- assertTrue("Test".equals(serviceGroup.getPorts()));
- }
-
- @Test
- public void testServiceMembers(){
- ServiceMembers serviceGroup = new ServiceMembers();
- serviceGroup.setName("Test");
- assertTrue("Test".equals(serviceGroup.getName()));
- serviceGroup.setType("Test");
- assertTrue("Test".equals(serviceGroup.getType()));
- }
-
- @Test
- public void testServiceJson(){
- ServicesJson serviceGroup = new ServicesJson();
- serviceGroup.setName("Test");
- assertTrue("Test".equals(serviceGroup.getName()));
- serviceGroup.setType("Test");
- assertTrue("Test".equals(serviceGroup.getType()));
- }
+ @Test
+ public void AddressGroupJSON(){
+ AddressGroupJson groupJSON = new AddressGroupJson();
+ groupJSON.setName("Test");
+ assertTrue("Test".equals(groupJSON.getName()));
+ groupJSON.setDescription("Test");
+ assertTrue("Test".equals(groupJSON.getDescription()));
+
+ AddressMembersJson membersJSON = new AddressMembersJson();
+ membersJSON.setType("Test");
+ assertTrue("Test".equals(membersJSON.getType()));
+ membersJSON.setName("Test");
+ assertTrue("Test".equals(membersJSON.getName()));
+
+ groupJSON.setMembers(null);
+ assertTrue(groupJSON.getMembers() != null);
+ }
+
+ @Test
+ public void testAddressMembers(){
+ AddressMembers members = new AddressMembers();
+ members.setName("Test");
+ assertTrue("Test".equals(members.getName()));
+ members.setType("Test");
+ assertTrue("Test".equals(members.getType()));
+ members.setValue("Test");
+ assertTrue("Test".equals(members.getValue()));
+
+ PrefixIPList prefixList = new PrefixIPList();
+ prefixList.setName("Test");
+ assertTrue("Test".equals(prefixList.getName()));
+ prefixList.setDescription("Test");
+ assertTrue("Test".equals(prefixList.getDescription()));
+ prefixList.setMembers(null);
+ assertTrue(prefixList.getMembers() != null);
+ }
+
+ @Test
+ public void testAddressJSON(){
+ AddressJson addressJSON = new AddressJson();
+ addressJSON.setName("Test");
+ assertTrue("Test".equals(addressJSON.getName()));
+ addressJSON.setType("Test");
+ assertTrue("Test".equals(addressJSON.getType()));
+ }
+
+
+ @Test
+ public void testGridData(){
+ GridData data = new GridData();
+ data.setAttributes(new ArrayList<>());
+ data.setAppProtocols(new ArrayList<>());
+ data.setTransportProtocols(new ArrayList<>());
+ assertTrue(data.getAttributes() != null);
+ assertTrue(data.getAppProtocols() != null);
+ assertTrue(data.getTransportProtocols() != null);
+ }
+
+ @Test
+ public void testTermCollector(){
+
+ TermCollector termCollector = new TermCollector();
+ termCollector.setServiceTypeId("Test");
+ assertTrue("Test".equals(termCollector.getServiceTypeId()));
+ termCollector.setConfigName("Test");
+ assertTrue("Test".equals(termCollector.getConfigName()));
+
+ DeployNowJson deployNowJson = new DeployNowJson();
+ deployNowJson.setDeployNow(true);
+ assertTrue(deployNowJson.getDeployNow());
+
+ termCollector.setDeploymentOption(deployNowJson);
+ assertTrue(termCollector.getDeploymentOption() != null);
+ termCollector.setSecurityZoneId("Test");
+ assertTrue("Test".equals(termCollector.getSecurityZoneId()));
+ termCollector.setVendorServiceId("Test");
+ assertTrue("Test".equals(termCollector.getVendorServiceId()));
+
+ IdMap idMap = new IdMap();
+ idMap.setAstraId("Test");
+ idMap.setVendorId("Test");
+ assertTrue("Test".equals(idMap.getAstraId()));
+ assertTrue("Test".equals(idMap.getVendorId()));
+
+ List<IdMap> idMapList = new ArrayList<>();
+ idMapList.add(idMap);
+
+ VendorSpecificData vendorData = new VendorSpecificData();
+ vendorData.setIdMap(idMapList);
+ assertTrue(vendorData.getIdMap() != null);
+ termCollector.setVendorSpecificData(vendorData);
+ assertTrue(termCollector.getVendorSpecificData()!=null);
+
+ termCollector.setServiceGroups(null);
+ assertTrue(termCollector.getServiceGroups()!=null);
+ termCollector.setAddressGroups(null);
+ assertTrue(termCollector.getAddressGroups()!=null);
+
+ Term term = new Term();
+ term.setPosition("Test");
+ assertTrue("Test".equals(term.getPosition()));
+ term.setRuleName("Test");
+ assertTrue("Test".equals(term.getRuleName()));
+ term.setFromZones(null);
+ assertTrue(term.getFromZones() != null);
+ term.setToZones(null);
+ assertTrue(term.getToZones() != null);
+ term.setNegateSource(true);
+ assertTrue(term.getNegateSource());
+ term.setNegateDestination(true);
+ assertTrue(term.getNegateDestination());
+ term.setSourceList(null);
+ assertTrue(term.getSourceList() != null);
+ term.setDestinationList(null);
+ assertTrue(term.getDestinationList() != null);
+ term.setSourceServices(null);
+ assertTrue(term.getSourceServices() != null);
+ term.setDestServices(null);
+ assertTrue(term.getDestServices() != null);
+ term.setAction("Test");
+ assertTrue("Test".equals(term.getAction()));
+ term.setDescription("Test");
+ assertTrue("Test".equals(term.getDescription()));
+ term.setEnabled(true);
+ assertTrue(term.getEnabled());
+ term.setLog(true);
+ assertTrue(term.getLog());
+
+ termCollector.setFirewallRuleList(null);
+ assertTrue(termCollector.getFirewallRuleList()!=null);
+
+ Tags tags = new Tags();
+ tags.setRuleName("Test");
+ assertTrue("Test".equals(tags.getRuleName()));
+
+ TagDefines tagDefines = new TagDefines();
+ tagDefines.setKey("Test");
+ assertTrue("Test".equals(tagDefines.getKey()));
+ tagDefines.setValue("Test");
+ assertTrue("Test".equals(tagDefines.getValue()));
+ tags.setTags(new ArrayList<>());
+ assertTrue(tags.getTags()!=null);
+ tags.setTagPickerName("Test");
+ assertTrue("Test".equals(tags.getTagPickerName()));
+ tags.setNetworkRole("Test");
+ assertTrue("Test".equals(tags.getNetworkRole()));
+ List<Tags> ruleToTag = new ArrayList<>();
+ ruleToTag.add(tags);
+
+ termCollector.setRuleToTag(ruleToTag);
+ assertTrue(termCollector.getRuleToTag()!=null);
+ }
+
+ @Test
+ public void testServiceGroupJson(){
+ ServiceGroupJson serviceGroup = new ServiceGroupJson();
+ serviceGroup.setName("Test");
+ assertTrue("Test".equals(serviceGroup.getName()));
+ serviceGroup.setDescription("Test");
+ assertTrue("Test".equals(serviceGroup.getDescription()));
+ serviceGroup.setMembers(new ArrayList<>());
+ assertTrue(serviceGroup.getMembers()!=null);
+ }
+
+ @Test
+ public void testServiceListJson(){
+ ServiceListJson serviceGroup = new ServiceListJson();
+ serviceGroup.setName("Test");
+ assertTrue("Test".equals(serviceGroup.getName()));
+ serviceGroup.setDescription("Test");
+ assertTrue("Test".equals(serviceGroup.getDescription()));
+ serviceGroup.setType("Test");
+ assertTrue("Test".equals(serviceGroup.getType()));
+ serviceGroup.setTransportProtocol("Test");
+ assertTrue("Test".equals(serviceGroup.getTransportProtocol()));
+ serviceGroup.setAppProtocol("Test");
+ assertTrue("Test".equals(serviceGroup.getAppProtocol()));
+ serviceGroup.setPorts("Test");
+ assertTrue("Test".equals(serviceGroup.getPorts()));
+ }
+
+ @Test
+ public void testServiceMembers(){
+ ServiceMembers serviceGroup = new ServiceMembers();
+ serviceGroup.setName("Test");
+ assertTrue("Test".equals(serviceGroup.getName()));
+ serviceGroup.setType("Test");
+ assertTrue("Test".equals(serviceGroup.getType()));
+ }
+
+ @Test
+ public void testServiceJson(){
+ ServicesJson serviceGroup = new ServicesJson();
+ serviceGroup.setName("Test");
+ assertTrue("Test".equals(serviceGroup.getName()));
+ serviceGroup.setType("Test");
+ assertTrue("Test".equals(serviceGroup.getType()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java
index 43567674e..971614359 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java
@@ -30,231 +30,231 @@ import org.onap.policy.rest.jpa.OnapName;
public class PolicyRestAdapterTest {
- @Test
- public void testPolicyExportAdapter(){
- PolicyExportAdapter adapter = new PolicyExportAdapter();
- adapter.setPolicyDatas(new ArrayList<>());
- assertTrue(adapter.getPolicyDatas() != null);
- }
-
- @Test
- public void testPolicyRestAdapter(){
- PolicyRestAdapter adapter = new PolicyRestAdapter();
- adapter.setData(new Object());
- assertTrue(adapter.getData() != null);
- adapter.setPolicyName("com.Config_test.1.xml");
- assertTrue("com.Config_test.1.xml".equals(adapter.getPolicyName()));
- adapter.setConfigBodyData("Test");
- assertTrue("Test".equals(adapter.getConfigBodyData()));
- adapter.setConfigType("Config_PM");
- assertTrue("Config_PM".equals(adapter.getConfigType()));
- adapter.setPolicyID("Test");
- assertTrue("Test".equals(adapter.getPolicyID()));
- adapter.setPolicyType("Config");
- assertTrue("Config".equals(adapter.getPolicyType()));
- adapter.setComboPolicyType("Test");
- assertTrue("Test".equals(adapter.getComboPolicyType()));
- adapter.setConfigPolicyType("Test");
- assertTrue("Test".equals(adapter.getConfigPolicyType()));
- adapter.setPolicyDescription("Test");
- assertTrue("Test".equals(adapter.getPolicyDescription()));
- adapter.setOnapName("Test");
- assertTrue("Test".equals(adapter.getOnapName()));
- adapter.setConfigName("Test");
- assertTrue("Test".equals(adapter.getConfigName()));
- adapter.setRuleID("Test");
- assertTrue("Test".equals(adapter.getRuleID()));
- adapter.setParentPath("config/webapps");
- assertTrue("config/webapps".equals(adapter.getParentPath()));
- adapter.setValidData(true);
- assertTrue(adapter.isValidData());
- adapter.setAdminNotification("TestNotification");
- assertTrue("TestNotification".equals(adapter.getAdminNotification()));
- adapter.setEditPolicy(true);
- assertTrue(adapter.isEditPolicy());
- adapter.setViewPolicy(true);
- assertTrue(adapter.isViewPolicy());
- adapter.setDraft(true);
- assertTrue(adapter.isDraft());
- adapter.setPolicyData("Test Policy");
- assertTrue("Test Policy".equals(adapter.getPolicyData()));
- adapter.setGitPath("config/webapps");
- assertTrue("config/webapps".equals(adapter.getGitPath()));
- adapter.setReadOnly(true);
- assertTrue(adapter.isReadOnly());
- adapter.setConfigName("Test");
- assertTrue("Test".equals(adapter.getConfigName()));
- adapter.setConfigUrl("Test");
- assertTrue("Test".equals(adapter.getConfigUrl()));
- adapter.setFinalPolicyPath("config/webapps");
- assertTrue("config/webapps".equals(adapter.getFinalPolicyPath()));
- adapter.setVersion("1");
- assertTrue("1".equals(adapter.getVersion()));
- adapter.setJsonBody("Test");
- assertTrue("Test".equals(adapter.getJsonBody()));
- adapter.setApiflag("API");
- assertTrue("API".equals(adapter.getApiflag()));
- adapter.setPrevJsonBody("Test");
- assertTrue("Test".equals(adapter.getPrevJsonBody()));
- adapter.setHighestVersion(1);
- assertTrue(1 == adapter.getHighestVersion());
- adapter.setPolicyExists(true);
- assertTrue(adapter.getPolicyExists());
- adapter.setOldPolicyFileName("Config_oldtest.1.xml");
- assertTrue("Config_oldtest.1.xml".equals(adapter.getOldPolicyFileName()));
- adapter.setDomainDir("Test");
- assertTrue("Test".equals(adapter.getDomainDir()));
- adapter.setUserId("Test");
- assertTrue("Test".equals(adapter.getUserId()));
- adapter.setNewFileName("Test");
- assertTrue("Test".equals(adapter.getNewFileName()));
- adapter.setClWarning("Test");
- assertTrue("Test".equals(adapter.getClWarning()));
- adapter.setNewCLName("Test");
- assertTrue("Test".equals(adapter.getNewCLName()));
- adapter.setExistingCLName("Test");
- assertTrue("Test".equals(adapter.getExistingCLName()));
- adapter.setOnapNameField(new OnapName());
- assertTrue(adapter.getOnapNameField()!=null);
- adapter.setJsonBodyData(new Object());
- assertTrue(adapter.getJsonBodyData()!=null);
- adapter.setDirPath("Test");
- assertTrue("Test".equals(adapter.getDirPath()));
- adapter.setConfigBodyPath("Test");
- assertTrue("Test".equals(adapter.getConfigBodyPath()));
- adapter.setAttributes(new ArrayList<>());
- assertTrue(adapter.getAttributes()!=null);
- adapter.setSettings(new ArrayList<>());
- assertTrue(adapter.getSettings()!=null);
- adapter.setRuleAlgorithmschoices(new ArrayList<>());
- assertTrue(adapter.getRuleAlgorithmschoices()!=null);
- adapter.setServiceTypePolicyName(new HashMap<>());
- assertTrue(adapter.getServiceTypePolicyName()!=null);
- adapter.setVerticaMetrics(new HashMap<>());
- assertTrue(adapter.getVerticaMetrics()!=null);
- adapter.setDescription(new LinkedHashMap<>());
- assertTrue(adapter.getVerticaMetrics()!=null);
- adapter.setAttributeFields(new LinkedHashMap<>());
- assertTrue(adapter.getAttributeFields()!=null);
- adapter.setClearTimeOut("Test");
- assertTrue("Test".equals(adapter.getClearTimeOut()));
- adapter.setTrapMaxAge("Test");
- assertTrue("Test".equals(adapter.getTrapMaxAge()));
- adapter.setVerificationclearTimeOut("Test");
- assertTrue("Test".equals(adapter.getVerificationclearTimeOut()));
- adapter.setDynamicLayoutMap(new HashMap<>());
- assertTrue(adapter.getDynamicLayoutMap()!=null);
- adapter.setTrapDatas(new ClosedLoopFaultTrapDatas());
- assertTrue(adapter.getTrapDatas()!=null);
- adapter.setFaultDatas(new ClosedLoopFaultTrapDatas());
- assertTrue(adapter.getFaultDatas()!=null);
- adapter.setFwPolicyType("Test");
- assertTrue("Test".equals(adapter.getFwPolicyType()));
- adapter.setFwattributes(new ArrayList<>());
- assertTrue(adapter.getFwattributes()!=null);
- adapter.setParentForChild("Test");
- assertTrue("Test".equals(adapter.getParentForChild()));
- adapter.setSecurityZone("Test");
- assertTrue("Test".equals(adapter.getSecurityZone()));
- adapter.setRuleCombiningAlgId("Test");
- assertTrue("Test".equals(adapter.getRuleCombiningAlgId()));
- adapter.setDynamicFieldConfigAttributes(new HashMap<>());
- assertTrue(adapter.getDynamicFieldConfigAttributes()!=null);
- adapter.setDynamicSettingsMap(new HashMap<>());
- assertTrue(adapter.getDynamicSettingsMap()!=null);
- adapter.setDropDownMap(new HashMap<>());
- assertTrue(adapter.getDropDownMap()!=null);
- adapter.setActionPerformer("Test");
- assertTrue("Test".equals(adapter.getActionPerformer()));
- adapter.setActionAttribute("Test");
- assertTrue("Test".equals(adapter.getActionAttribute()));
- adapter.setDynamicRuleAlgorithmLabels(new ArrayList<>());
- assertTrue(adapter.getDynamicRuleAlgorithmLabels()!=null);
- adapter.setDynamicRuleAlgorithmCombo(new ArrayList<>());
- assertTrue(adapter.getDynamicRuleAlgorithmCombo()!=null);
- adapter.setDynamicRuleAlgorithmField1(new ArrayList<>());
- assertTrue(adapter.getDynamicRuleAlgorithmField1()!=null);
- adapter.setDynamicRuleAlgorithmField2(new ArrayList<>());
- assertTrue(adapter.getDynamicRuleAlgorithmField2()!=null);
- adapter.setDynamicVariableList(new ArrayList<>());
- assertTrue(adapter.getDynamicVariableList()!=null);
- adapter.setDataTypeList(new ArrayList<>());
- assertTrue(adapter.getDataTypeList()!=null);
- adapter.setActionAttributeValue("Test");
- assertTrue("Test".equals(adapter.getActionAttributeValue()));
- adapter.setRuleProvider("Test");
- assertTrue("Test".equals(adapter.getRuleProvider()));
- adapter.setActionBody("Test");
- assertTrue("Test".equals(adapter.getActionBody()));
- adapter.setActionDictHeader("Test");
- assertTrue("Test".equals(adapter.getActionDictHeader()));
- adapter.setActionDictType("Test");
- assertTrue("Test".equals(adapter.getActionDictType()));
- adapter.setActionDictUrl("Test");
- assertTrue("Test".equals(adapter.getActionDictUrl()));
- adapter.setActionDictMethod("Test");
- assertTrue("Test".equals(adapter.getActionDictMethod()));
- adapter.setYamlparams(new YAMLParams());
- assertTrue(adapter.getYamlparams()!=null);
- adapter.setRainyday(new RainyDayParams());
- assertTrue(adapter.getRainyday()!=null);
- adapter.setRainydayMap(new HashMap<>());
- assertTrue(adapter.getRainydayMap()!=null);
- adapter.setErrorCodeList(new ArrayList<>());
- assertTrue(adapter.getErrorCodeList()!=null);
- adapter.setTreatmentList(new ArrayList<>());
- assertTrue(adapter.getTreatmentList()!=null);
- adapter.setServiceType("Test");
- assertTrue("Test".equals(adapter.getServiceType()));
- adapter.setUuid("Test");
- assertTrue("Test".equals(adapter.getUuid()));
- adapter.setLocation("Test");
- assertTrue("Test".equals(adapter.getLocation()));
- adapter.setPriority("Test");
- assertTrue("Test".equals(adapter.getPriority()));
- adapter.setMsLocation("Test");
- assertTrue("Test".equals(adapter.getMsLocation()));
- adapter.setPolicyJSON("Test");
- assertTrue("Test".equals(adapter.getPolicyJSON()));
- adapter.setRuleName("Test");
- assertTrue("Test".equals(adapter.getRuleName()));
- adapter.setBrmsParamBody(new HashMap<>());
- assertTrue(adapter.getBrmsParamBody()!=null);
- adapter.setBrmsController("Test");
- assertTrue("Test".equals(adapter.getBrmsController()));
- adapter.setBrmsDependency(new ArrayList<>());
- assertTrue(adapter.getBrmsDependency()!=null);
- adapter.setRuleData(new LinkedHashMap<>());
- assertTrue(adapter.getRuleData()!=null);
- adapter.setRuleListData(new LinkedHashMap<>());
- assertTrue(adapter.getRuleListData()!=null);
- adapter.setDrlRuleAndUIParams(new LinkedHashMap<>());
- assertTrue(adapter.getDrlRuleAndUIParams()!=null);
- adapter.setPolicyScope("Test");
- assertTrue("Test".equals(adapter.getPolicyScope()));
- adapter.setProviderComboBox("Test");
- assertTrue("Test".equals(adapter.getProviderComboBox()));
- adapter.setRiskType("Test");
- assertTrue("Test".equals(adapter.getRiskType()));
- adapter.setRiskLevel("Test");
- assertTrue("Test".equals(adapter.getRiskLevel()));
- adapter.setGuard("Test");
- assertTrue("Test".equals(adapter.getGuard()));
- adapter.setTtlDate("Test");
- assertTrue("Test".equals(adapter.getTtlDate()));
- adapter.setMatching(new LinkedHashMap<>());
- assertTrue(adapter.getMatching()!=null);
- adapter.setTriggerSignatures(new ArrayList<>());
- assertTrue(adapter.getTriggerSignatures()!=null);
- adapter.setSymptomSignatures(new ArrayList<>());
- assertTrue(adapter.getSymptomSignatures()!=null);
- adapter.setLogicalConnector("Test");
- assertTrue("Test".equals(adapter.getLogicalConnector()));
- adapter.setPolicyStatus("Test");
- assertTrue("Test".equals(adapter.getPolicyStatus()));
- adapter.setGocServerScope("Test");
- assertTrue("Test".equals(adapter.getGocServerScope()));
- adapter.setSupressionType("Test");
- assertTrue("Test".equals(adapter.getSupressionType()));
- }
+ @Test
+ public void testPolicyExportAdapter(){
+ PolicyExportAdapter adapter = new PolicyExportAdapter();
+ adapter.setPolicyDatas(new ArrayList<>());
+ assertTrue(adapter.getPolicyDatas() != null);
+ }
+
+ @Test
+ public void testPolicyRestAdapter(){
+ PolicyRestAdapter adapter = new PolicyRestAdapter();
+ adapter.setData(new Object());
+ assertTrue(adapter.getData() != null);
+ adapter.setPolicyName("com.Config_test.1.xml");
+ assertTrue("com.Config_test.1.xml".equals(adapter.getPolicyName()));
+ adapter.setConfigBodyData("Test");
+ assertTrue("Test".equals(adapter.getConfigBodyData()));
+ adapter.setConfigType("Config_PM");
+ assertTrue("Config_PM".equals(adapter.getConfigType()));
+ adapter.setPolicyID("Test");
+ assertTrue("Test".equals(adapter.getPolicyID()));
+ adapter.setPolicyType("Config");
+ assertTrue("Config".equals(adapter.getPolicyType()));
+ adapter.setComboPolicyType("Test");
+ assertTrue("Test".equals(adapter.getComboPolicyType()));
+ adapter.setConfigPolicyType("Test");
+ assertTrue("Test".equals(adapter.getConfigPolicyType()));
+ adapter.setPolicyDescription("Test");
+ assertTrue("Test".equals(adapter.getPolicyDescription()));
+ adapter.setOnapName("Test");
+ assertTrue("Test".equals(adapter.getOnapName()));
+ adapter.setConfigName("Test");
+ assertTrue("Test".equals(adapter.getConfigName()));
+ adapter.setRuleID("Test");
+ assertTrue("Test".equals(adapter.getRuleID()));
+ adapter.setParentPath("config/webapps");
+ assertTrue("config/webapps".equals(adapter.getParentPath()));
+ adapter.setValidData(true);
+ assertTrue(adapter.isValidData());
+ adapter.setAdminNotification("TestNotification");
+ assertTrue("TestNotification".equals(adapter.getAdminNotification()));
+ adapter.setEditPolicy(true);
+ assertTrue(adapter.isEditPolicy());
+ adapter.setViewPolicy(true);
+ assertTrue(adapter.isViewPolicy());
+ adapter.setDraft(true);
+ assertTrue(adapter.isDraft());
+ adapter.setPolicyData("Test Policy");
+ assertTrue("Test Policy".equals(adapter.getPolicyData()));
+ adapter.setGitPath("config/webapps");
+ assertTrue("config/webapps".equals(adapter.getGitPath()));
+ adapter.setReadOnly(true);
+ assertTrue(adapter.isReadOnly());
+ adapter.setConfigName("Test");
+ assertTrue("Test".equals(adapter.getConfigName()));
+ adapter.setConfigUrl("Test");
+ assertTrue("Test".equals(adapter.getConfigUrl()));
+ adapter.setFinalPolicyPath("config/webapps");
+ assertTrue("config/webapps".equals(adapter.getFinalPolicyPath()));
+ adapter.setVersion("1");
+ assertTrue("1".equals(adapter.getVersion()));
+ adapter.setJsonBody("Test");
+ assertTrue("Test".equals(adapter.getJsonBody()));
+ adapter.setApiflag("API");
+ assertTrue("API".equals(adapter.getApiflag()));
+ adapter.setPrevJsonBody("Test");
+ assertTrue("Test".equals(adapter.getPrevJsonBody()));
+ adapter.setHighestVersion(1);
+ assertTrue(1 == adapter.getHighestVersion());
+ adapter.setPolicyExists(true);
+ assertTrue(adapter.getPolicyExists());
+ adapter.setOldPolicyFileName("Config_oldtest.1.xml");
+ assertTrue("Config_oldtest.1.xml".equals(adapter.getOldPolicyFileName()));
+ adapter.setDomainDir("Test");
+ assertTrue("Test".equals(adapter.getDomainDir()));
+ adapter.setUserId("Test");
+ assertTrue("Test".equals(adapter.getUserId()));
+ adapter.setNewFileName("Test");
+ assertTrue("Test".equals(adapter.getNewFileName()));
+ adapter.setClWarning("Test");
+ assertTrue("Test".equals(adapter.getClWarning()));
+ adapter.setNewCLName("Test");
+ assertTrue("Test".equals(adapter.getNewCLName()));
+ adapter.setExistingCLName("Test");
+ assertTrue("Test".equals(adapter.getExistingCLName()));
+ adapter.setOnapNameField(new OnapName());
+ assertTrue(adapter.getOnapNameField()!=null);
+ adapter.setJsonBodyData(new Object());
+ assertTrue(adapter.getJsonBodyData()!=null);
+ adapter.setDirPath("Test");
+ assertTrue("Test".equals(adapter.getDirPath()));
+ adapter.setConfigBodyPath("Test");
+ assertTrue("Test".equals(adapter.getConfigBodyPath()));
+ adapter.setAttributes(new ArrayList<>());
+ assertTrue(adapter.getAttributes()!=null);
+ adapter.setSettings(new ArrayList<>());
+ assertTrue(adapter.getSettings()!=null);
+ adapter.setRuleAlgorithmschoices(new ArrayList<>());
+ assertTrue(adapter.getRuleAlgorithmschoices()!=null);
+ adapter.setServiceTypePolicyName(new HashMap<>());
+ assertTrue(adapter.getServiceTypePolicyName()!=null);
+ adapter.setVerticaMetrics(new HashMap<>());
+ assertTrue(adapter.getVerticaMetrics()!=null);
+ adapter.setDescription(new LinkedHashMap<>());
+ assertTrue(adapter.getVerticaMetrics()!=null);
+ adapter.setAttributeFields(new LinkedHashMap<>());
+ assertTrue(adapter.getAttributeFields()!=null);
+ adapter.setClearTimeOut("Test");
+ assertTrue("Test".equals(adapter.getClearTimeOut()));
+ adapter.setTrapMaxAge("Test");
+ assertTrue("Test".equals(adapter.getTrapMaxAge()));
+ adapter.setVerificationclearTimeOut("Test");
+ assertTrue("Test".equals(adapter.getVerificationclearTimeOut()));
+ adapter.setDynamicLayoutMap(new HashMap<>());
+ assertTrue(adapter.getDynamicLayoutMap()!=null);
+ adapter.setTrapDatas(new ClosedLoopFaultTrapDatas());
+ assertTrue(adapter.getTrapDatas()!=null);
+ adapter.setFaultDatas(new ClosedLoopFaultTrapDatas());
+ assertTrue(adapter.getFaultDatas()!=null);
+ adapter.setFwPolicyType("Test");
+ assertTrue("Test".equals(adapter.getFwPolicyType()));
+ adapter.setFwattributes(new ArrayList<>());
+ assertTrue(adapter.getFwattributes()!=null);
+ adapter.setParentForChild("Test");
+ assertTrue("Test".equals(adapter.getParentForChild()));
+ adapter.setSecurityZone("Test");
+ assertTrue("Test".equals(adapter.getSecurityZone()));
+ adapter.setRuleCombiningAlgId("Test");
+ assertTrue("Test".equals(adapter.getRuleCombiningAlgId()));
+ adapter.setDynamicFieldConfigAttributes(new HashMap<>());
+ assertTrue(adapter.getDynamicFieldConfigAttributes()!=null);
+ adapter.setDynamicSettingsMap(new HashMap<>());
+ assertTrue(adapter.getDynamicSettingsMap()!=null);
+ adapter.setDropDownMap(new HashMap<>());
+ assertTrue(adapter.getDropDownMap()!=null);
+ adapter.setActionPerformer("Test");
+ assertTrue("Test".equals(adapter.getActionPerformer()));
+ adapter.setActionAttribute("Test");
+ assertTrue("Test".equals(adapter.getActionAttribute()));
+ adapter.setDynamicRuleAlgorithmLabels(new ArrayList<>());
+ assertTrue(adapter.getDynamicRuleAlgorithmLabels()!=null);
+ adapter.setDynamicRuleAlgorithmCombo(new ArrayList<>());
+ assertTrue(adapter.getDynamicRuleAlgorithmCombo()!=null);
+ adapter.setDynamicRuleAlgorithmField1(new ArrayList<>());
+ assertTrue(adapter.getDynamicRuleAlgorithmField1()!=null);
+ adapter.setDynamicRuleAlgorithmField2(new ArrayList<>());
+ assertTrue(adapter.getDynamicRuleAlgorithmField2()!=null);
+ adapter.setDynamicVariableList(new ArrayList<>());
+ assertTrue(adapter.getDynamicVariableList()!=null);
+ adapter.setDataTypeList(new ArrayList<>());
+ assertTrue(adapter.getDataTypeList()!=null);
+ adapter.setActionAttributeValue("Test");
+ assertTrue("Test".equals(adapter.getActionAttributeValue()));
+ adapter.setRuleProvider("Test");
+ assertTrue("Test".equals(adapter.getRuleProvider()));
+ adapter.setActionBody("Test");
+ assertTrue("Test".equals(adapter.getActionBody()));
+ adapter.setActionDictHeader("Test");
+ assertTrue("Test".equals(adapter.getActionDictHeader()));
+ adapter.setActionDictType("Test");
+ assertTrue("Test".equals(adapter.getActionDictType()));
+ adapter.setActionDictUrl("Test");
+ assertTrue("Test".equals(adapter.getActionDictUrl()));
+ adapter.setActionDictMethod("Test");
+ assertTrue("Test".equals(adapter.getActionDictMethod()));
+ adapter.setYamlparams(new YAMLParams());
+ assertTrue(adapter.getYamlparams()!=null);
+ adapter.setRainyday(new RainyDayParams());
+ assertTrue(adapter.getRainyday()!=null);
+ adapter.setRainydayMap(new HashMap<>());
+ assertTrue(adapter.getRainydayMap()!=null);
+ adapter.setErrorCodeList(new ArrayList<>());
+ assertTrue(adapter.getErrorCodeList()!=null);
+ adapter.setTreatmentList(new ArrayList<>());
+ assertTrue(adapter.getTreatmentList()!=null);
+ adapter.setServiceType("Test");
+ assertTrue("Test".equals(adapter.getServiceType()));
+ adapter.setUuid("Test");
+ assertTrue("Test".equals(adapter.getUuid()));
+ adapter.setLocation("Test");
+ assertTrue("Test".equals(adapter.getLocation()));
+ adapter.setPriority("Test");
+ assertTrue("Test".equals(adapter.getPriority()));
+ adapter.setMsLocation("Test");
+ assertTrue("Test".equals(adapter.getMsLocation()));
+ adapter.setPolicyJSON("Test");
+ assertTrue("Test".equals(adapter.getPolicyJSON()));
+ adapter.setRuleName("Test");
+ assertTrue("Test".equals(adapter.getRuleName()));
+ adapter.setBrmsParamBody(new HashMap<>());
+ assertTrue(adapter.getBrmsParamBody()!=null);
+ adapter.setBrmsController("Test");
+ assertTrue("Test".equals(adapter.getBrmsController()));
+ adapter.setBrmsDependency(new ArrayList<>());
+ assertTrue(adapter.getBrmsDependency()!=null);
+ adapter.setRuleData(new LinkedHashMap<>());
+ assertTrue(adapter.getRuleData()!=null);
+ adapter.setRuleListData(new LinkedHashMap<>());
+ assertTrue(adapter.getRuleListData()!=null);
+ adapter.setDrlRuleAndUIParams(new LinkedHashMap<>());
+ assertTrue(adapter.getDrlRuleAndUIParams()!=null);
+ adapter.setPolicyScope("Test");
+ assertTrue("Test".equals(adapter.getPolicyScope()));
+ adapter.setProviderComboBox("Test");
+ assertTrue("Test".equals(adapter.getProviderComboBox()));
+ adapter.setRiskType("Test");
+ assertTrue("Test".equals(adapter.getRiskType()));
+ adapter.setRiskLevel("Test");
+ assertTrue("Test".equals(adapter.getRiskLevel()));
+ adapter.setGuard("Test");
+ assertTrue("Test".equals(adapter.getGuard()));
+ adapter.setTtlDate("Test");
+ assertTrue("Test".equals(adapter.getTtlDate()));
+ adapter.setMatching(new LinkedHashMap<>());
+ assertTrue(adapter.getMatching()!=null);
+ adapter.setTriggerSignatures(new ArrayList<>());
+ assertTrue(adapter.getTriggerSignatures()!=null);
+ adapter.setSymptomSignatures(new ArrayList<>());
+ assertTrue(adapter.getSymptomSignatures()!=null);
+ adapter.setLogicalConnector("Test");
+ assertTrue("Test".equals(adapter.getLogicalConnector()));
+ adapter.setPolicyStatus("Test");
+ assertTrue("Test".equals(adapter.getPolicyStatus()));
+ adapter.setGocServerScope("Test");
+ assertTrue("Test".equals(adapter.getGocServerScope()));
+ adapter.setSupressionType("Test");
+ assertTrue("Test".equals(adapter.getSupressionType()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java
index 521eafdf9..210c5cd08 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java
@@ -27,22 +27,22 @@ import org.junit.Test;
public class RainyDayParamsTest {
- @Test
- public void testRainyDayParams(){
- RainyDayParams params = new RainyDayParams();
- params.setServiceType("Test");
- assertTrue("Test".equals(params.getServiceType()));
- params.setVnfType("Test");
- assertTrue("Test".equals(params.getVnfType()));
- params.setBbid("Test");
- assertTrue("Test".equals(params.getBbid()));
- params.setWorkstep("Test");
- assertTrue("Test".equals(params.getWorkstep()));
- params.setTreatmentTableChoices(new ArrayList<>());
- assertTrue(params.getTreatmentTableChoices() != null);
- params.setErrorcode(new ArrayList<>());
- assertTrue(params.getErrorcode() != null);
- params.setTreatment(new ArrayList<>());
- assertTrue(params.getTreatment() != null);
- }
+ @Test
+ public void testRainyDayParams(){
+ RainyDayParams params = new RainyDayParams();
+ params.setServiceType("Test");
+ assertTrue("Test".equals(params.getServiceType()));
+ params.setVnfType("Test");
+ assertTrue("Test".equals(params.getVnfType()));
+ params.setBbid("Test");
+ assertTrue("Test".equals(params.getBbid()));
+ params.setWorkstep("Test");
+ assertTrue("Test".equals(params.getWorkstep()));
+ params.setTreatmentTableChoices(new ArrayList<>());
+ assertTrue(params.getTreatmentTableChoices() != null);
+ params.setErrorcode(new ArrayList<>());
+ assertTrue(params.getErrorcode() != null);
+ params.setTreatment(new ArrayList<>());
+ assertTrue(params.getTreatment() != null);
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java
index 007141f41..ea8839e19 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java
@@ -26,30 +26,30 @@ import java.util.ArrayList;
import org.junit.Test;
public class YAMLParamsTest {
-
- @Test
- public void testYAMLParams(){
- YAMLParams yamlParams = new YAMLParams();
- yamlParams.setActor("Test");
- assertTrue("Test".equals(yamlParams.getActor()));
- yamlParams.setRecipe("Test");
- assertTrue("Test".equals(yamlParams.getRecipe()));
- yamlParams.setClname("Test");
- assertTrue("Test".equals(yamlParams.getClname()));
- yamlParams.setGuardActiveEnd("Test");
- assertTrue("Test".equals(yamlParams.getGuardActiveEnd()));
- yamlParams.setGuardActiveStart("Test");
- assertTrue("Test".equals(yamlParams.getGuardActiveStart()));
- yamlParams.setLimit("Test");
- assertTrue("Test".equals(yamlParams.getLimit()));
- yamlParams.setBlackList(new ArrayList<>());
- assertTrue(yamlParams.getBlackList() != null);
- yamlParams.setTargets(new ArrayList<>());
- assertTrue(yamlParams.getTargets() != null);
- yamlParams.setTimeUnits("Test");
- assertTrue("Test".equals(yamlParams.getTimeUnits()));
- yamlParams.setTimeWindow("Test");
- assertTrue("Test".equals(yamlParams.getTimeWindow()));
- }
+
+ @Test
+ public void testYAMLParams(){
+ YAMLParams yamlParams = new YAMLParams();
+ yamlParams.setActor("Test");
+ assertTrue("Test".equals(yamlParams.getActor()));
+ yamlParams.setRecipe("Test");
+ assertTrue("Test".equals(yamlParams.getRecipe()));
+ yamlParams.setClname("Test");
+ assertTrue("Test".equals(yamlParams.getClname()));
+ yamlParams.setGuardActiveEnd("Test");
+ assertTrue("Test".equals(yamlParams.getGuardActiveEnd()));
+ yamlParams.setGuardActiveStart("Test");
+ assertTrue("Test".equals(yamlParams.getGuardActiveStart()));
+ yamlParams.setLimit("Test");
+ assertTrue("Test".equals(yamlParams.getLimit()));
+ yamlParams.setBlackList(new ArrayList<>());
+ assertTrue(yamlParams.getBlackList() != null);
+ yamlParams.setTargets(new ArrayList<>());
+ assertTrue(yamlParams.getTargets() != null);
+ yamlParams.setTimeUnits("Test");
+ assertTrue("Test".equals(yamlParams.getTimeUnits()));
+ yamlParams.setTimeWindow("Test");
+ assertTrue("Test".equals(yamlParams.getTimeWindow()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java
index 7467d4dfe..f5d968b14 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java
@@ -53,389 +53,389 @@ import org.springframework.test.annotation.Rollback;
public class PolicyValidationDaoImplTest {
- private static Logger logger = FlexLogger.getLogger(PolicyValidationDaoImplTest.class);
-
- SessionFactory sessionFactory;
- Server server;
- PolicyValidationDaoImpl commonClassDao;
-
- @Before
- public void setUp() throws Exception{
- try{
- BasicDataSource dataSource = new BasicDataSource();
- dataSource.setDriverClassName("org.h2.Driver");
- // In-memory DB for testing
- dataSource.setUrl("jdbc:h2:mem:test");
- dataSource.setUsername("sa");
- dataSource.setPassword("");
- LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
- sessionBuilder.scanPackages("org.onap.*", "com.*");
-
- Properties properties = new Properties();
- properties.put("hibernate.show_sql", "false");
- properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
- properties.put("hibernate.hbm2ddl.auto", "drop");
- properties.put("hibernate.hbm2ddl.auto", "create");
-
- sessionBuilder.addProperties(properties);
- sessionFactory = sessionBuilder.buildSessionFactory();
-
- // Set up dao with SessionFactory
- commonClassDao = new PolicyValidationDaoImpl();
- PolicyValidationDaoImpl.setSessionfactory(sessionFactory);
- //PolicyController.setLogTableLimit("1");
- //HibernateSession.setSession(sessionFactory);
- SystemLogDB data1 = new SystemLogDB();
- data1.setDate(new Date());
- data1.setLogtype("INFO");
- data1.setRemote("Test");
- data1.setSystem("Test");
- data1.setType("Test");
- SystemLogDB data2 = new SystemLogDB();
- data2.setDate(new Date());
- data2.setLogtype("error");
- data2.setRemote("Test");
- data2.setSystem("Test");
- data2.setType("Test");
- //HibernateSession.getSession().save(data1);
- //HibernateSession.getSession().save(data2);
-
- // Create TCP server for troubleshooting
- server = Server.createTcpServer("-tcpAllowOthers").start();
- System.out.println("URL: jdbc:h2:" + server.getURL() + "/mem:test");
-
- }catch(Exception e){
- System.err.println(e);
- fail();
- }
- }
-
- @Test
- @Transactional
+ private static Logger logger = FlexLogger.getLogger(PolicyValidationDaoImplTest.class);
+
+ SessionFactory sessionFactory;
+ Server server;
+ PolicyValidationDaoImpl commonClassDao;
+
+ @Before
+ public void setUp() throws Exception{
+ try{
+ BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName("org.h2.Driver");
+ // In-memory DB for testing
+ dataSource.setUrl("jdbc:h2:mem:test");
+ dataSource.setUsername("sa");
+ dataSource.setPassword("");
+ LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
+ sessionBuilder.scanPackages("org.onap.*", "com.*");
+
+ Properties properties = new Properties();
+ properties.put("hibernate.show_sql", "false");
+ properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
+ properties.put("hibernate.hbm2ddl.auto", "drop");
+ properties.put("hibernate.hbm2ddl.auto", "create");
+
+ sessionBuilder.addProperties(properties);
+ sessionFactory = sessionBuilder.buildSessionFactory();
+
+ // Set up dao with SessionFactory
+ commonClassDao = new PolicyValidationDaoImpl();
+ PolicyValidationDaoImpl.setSessionfactory(sessionFactory);
+ //PolicyController.setLogTableLimit("1");
+ //HibernateSession.setSession(sessionFactory);
+ SystemLogDB data1 = new SystemLogDB();
+ data1.setDate(new Date());
+ data1.setLogtype("INFO");
+ data1.setRemote("Test");
+ data1.setSystem("Test");
+ data1.setType("Test");
+ SystemLogDB data2 = new SystemLogDB();
+ data2.setDate(new Date());
+ data2.setLogtype("error");
+ data2.setRemote("Test");
+ data2.setSystem("Test");
+ data2.setType("Test");
+ //HibernateSession.getSession().save(data1);
+ //HibernateSession.getSession().save(data2);
+
+ // Create TCP server for troubleshooting
+ server = Server.createTcpServer("-tcpAllowOthers").start();
+ System.out.println("URL: jdbc:h2:" + server.getURL() + "/mem:test");
+
+ }catch(Exception e){
+ System.err.println(e);
+ fail();
+ }
+ }
+
+ @Test
+ @Transactional
@Rollback(true)
- public void testDB(){
- try{
- // Add data
- UserInfo userinfo = new UserInfo();
- userinfo.setUserLoginId("Test");
- userinfo.setUserName("Test");
- commonClassDao.save(userinfo);
- OnapName onapName = new OnapName();
- onapName.setOnapName("Test");
- onapName.setUserCreatedBy(userinfo);
- onapName.setUserModifiedBy(userinfo);
- onapName.setModifiedDate(new Date());
- commonClassDao.save(onapName);
-
-
- List<Object> list = commonClassDao.getData(OnapName.class);
- assertTrue(list.size() == 1);
- logger.debug(list.size());
- logger.debug(list.get(0));
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @Test
- @Transactional
+ public void testDB(){
+ try{
+ // Add data
+ UserInfo userinfo = new UserInfo();
+ userinfo.setUserLoginId("Test");
+ userinfo.setUserName("Test");
+ commonClassDao.save(userinfo);
+ OnapName onapName = new OnapName();
+ onapName.setOnapName("Test");
+ onapName.setUserCreatedBy(userinfo);
+ onapName.setUserModifiedBy(userinfo);
+ onapName.setModifiedDate(new Date());
+ commonClassDao.save(onapName);
+
+
+ List<Object> list = commonClassDao.getData(OnapName.class);
+ assertTrue(list.size() == 1);
+ logger.debug(list.size());
+ logger.debug(list.get(0));
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @Test
+ @Transactional
@Rollback(true)
- public void testUser(){
- try{
- // Add data
- UserInfo userinfo = new UserInfo();
- String loginId_userName = "Test";
- userinfo.setUserLoginId(loginId_userName);
- userinfo.setUserName(loginId_userName);
- commonClassDao.save(userinfo);
+ public void testUser(){
+ try{
+ // Add data
+ UserInfo userinfo = new UserInfo();
+ String loginId_userName = "Test";
+ userinfo.setUserLoginId(loginId_userName);
+ userinfo.setUserName(loginId_userName);
+ commonClassDao.save(userinfo);
- List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings());
+ List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings());
- assertEquals(1, dataCur.size());
- UserInfo cur = (UserInfo) dataCur.get(0);
- assertEquals(loginId_userName, cur.getUserLoginId());
- assertEquals(loginId_userName, cur.getUserName());
+ assertEquals(1, dataCur.size());
+ UserInfo cur = (UserInfo) dataCur.get(0);
+ assertEquals(loginId_userName, cur.getUserLoginId());
+ assertEquals(loginId_userName, cur.getUserName());
- assertFalse(dataCur.isEmpty());
+ assertFalse(dataCur.isEmpty());
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
- @Test
- @Transactional
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_DashboardController(){
- try{
- // Add data
- PolicyEntity pe = new PolicyEntity();
- String name = "TestPolicy";
- pe.setPolicyName(name);
- pe.setPolicyData("dummyData");
- pe.prePersist();
- pe.setScope("dummyScope");
- pe.setDescription("descr");
- pe.setDeleted(false);
- pe.setCreatedBy("Test");
- commonClassDao.save(pe);
-
- List<Object> dataCur = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings());
-
- assertTrue(1 == dataCur.size());
- assertTrue( dataCur.get(0) instanceof PolicyEntity);
- assertEquals( name, ((PolicyEntity)dataCur.get(0)).getPolicyName());
- assertEquals( pe, ((PolicyEntity)dataCur.get(0)));
-
-
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @Test
- @Transactional
+ public void getDataByQuery_DashboardController(){
+ try{
+ // Add data
+ PolicyEntity pe = new PolicyEntity();
+ String name = "TestPolicy";
+ pe.setPolicyName(name);
+ pe.setPolicyData("dummyData");
+ pe.prePersist();
+ pe.setScope("dummyScope");
+ pe.setDescription("descr");
+ pe.setDeleted(false);
+ pe.setCreatedBy("Test");
+ commonClassDao.save(pe);
+
+ List<Object> dataCur = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings());
+
+ assertTrue(1 == dataCur.size());
+ assertTrue( dataCur.get(0) instanceof PolicyEntity);
+ assertEquals( name, ((PolicyEntity)dataCur.get(0)).getPolicyName());
+ assertEquals( pe, ((PolicyEntity)dataCur.get(0)));
+
+
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_AutoPushController(){
- try{
- // Add data
- PolicyVersion pv = new PolicyVersion();
- pv.setActiveVersion(2);
- pv.setPolicyName("myPname");
- pv.prePersist();
- pv.setCreatedBy("Test");
- pv.setModifiedBy("Test");
-
- PolicyVersion pv2 = new PolicyVersion();
- pv2.setActiveVersion(1);
- pv2.setPolicyName("test");
- pv2.prePersist();
- pv2.setCreatedBy("Test");
- pv2.setModifiedBy("Test");
-
- commonClassDao.save(pv);
- commonClassDao.save(pv2);
-
- String scope = "my";
- scope += "%";
- String query = "From PolicyVersion where policy_name like :scope and id > 0";
- SimpleBindings params = new SimpleBindings();
- params.put("scope", scope);
- List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
-
-
- assertTrue(1 == dataCur.size());
- assertEquals(pv, (PolicyVersion) dataCur.get(0));
-
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @Test
- @Transactional
+ public void getDataByQuery_AutoPushController(){
+ try{
+ // Add data
+ PolicyVersion pv = new PolicyVersion();
+ pv.setActiveVersion(2);
+ pv.setPolicyName("myPname");
+ pv.prePersist();
+ pv.setCreatedBy("Test");
+ pv.setModifiedBy("Test");
+
+ PolicyVersion pv2 = new PolicyVersion();
+ pv2.setActiveVersion(1);
+ pv2.setPolicyName("test");
+ pv2.prePersist();
+ pv2.setCreatedBy("Test");
+ pv2.setModifiedBy("Test");
+
+ commonClassDao.save(pv);
+ commonClassDao.save(pv2);
+
+ String scope = "my";
+ scope += "%";
+ String query = "From PolicyVersion where policy_name like :scope and id > 0";
+ SimpleBindings params = new SimpleBindings();
+ params.put("scope", scope);
+ List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
+
+
+ assertTrue(1 == dataCur.size());
+ assertEquals(pv, (PolicyVersion) dataCur.get(0));
+
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_PolicyNotificationMail(){
- try{
- // Add data
- WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
- String policyFileName = "banana";
- watch.setLoginIds("Test");
- watch.setPolicyName("bananaWatch");
- commonClassDao.save(watch);
-
- if(policyFileName.contains("/")){
- policyFileName = policyFileName.substring(0, policyFileName.indexOf("/"));
- policyFileName = policyFileName.replace("/", File.separator);
- }
- if(policyFileName.contains("\\")){
- policyFileName = policyFileName.substring(0, policyFileName.indexOf("\\"));
- policyFileName = policyFileName.replace("\\", "\\\\");
- }
-
-
- // Current Implementation
- policyFileName += "%";
- String query = "from WatchPolicyNotificationTable where policyName like:policyFileName";
- SimpleBindings params = new SimpleBindings();
- params.put("policyFileName", policyFileName);
- List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
-
- // Assertions
- assertTrue(dataCur.size() == 1);
- assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
- assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0));
-
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
-
- @Test
- @Transactional
+ public void getDataByQuery_PolicyNotificationMail(){
+ try{
+ // Add data
+ WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
+ String policyFileName = "banana";
+ watch.setLoginIds("Test");
+ watch.setPolicyName("bananaWatch");
+ commonClassDao.save(watch);
+
+ if(policyFileName.contains("/")){
+ policyFileName = policyFileName.substring(0, policyFileName.indexOf("/"));
+ policyFileName = policyFileName.replace("/", File.separator);
+ }
+ if(policyFileName.contains("\\")){
+ policyFileName = policyFileName.substring(0, policyFileName.indexOf("\\"));
+ policyFileName = policyFileName.replace("\\", "\\\\");
+ }
+
+
+ // Current Implementation
+ policyFileName += "%";
+ String query = "from WatchPolicyNotificationTable where policyName like:policyFileName";
+ SimpleBindings params = new SimpleBindings();
+ params.put("policyFileName", policyFileName);
+ List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
+
+ // Assertions
+ assertTrue(dataCur.size() == 1);
+ assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
+ assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0));
+
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_PolicyController(){
- try{
- // Add data
- PolicyEntity pe = new PolicyEntity();
- String name = "actionDummy";
- pe.setPolicyName(name);
- pe.setPolicyData("dummyData");
- pe.prePersist();
- pe.setScope("dummyScope");
- pe.setDescription("descr");
- pe.setDeleted(false);
- pe.setCreatedBy("Test");
- commonClassDao.save(pe);
-
- String dbCheckName = "dummyScope:action";
- String[] splitDBCheckName = dbCheckName.split(":");
-
-
- // Current Implementation
- String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
- SimpleBindings params = new SimpleBindings();
- params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
- params.put("splitDBCheckName0", splitDBCheckName[0]);
- List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
-
- // Assertions
- assertTrue(dataCur.size() == 1);
- assertTrue(dataCur.get(0) instanceof PolicyEntity);
- assertEquals(pe, (PolicyEntity) dataCur.get(0));
-
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @Test
- @Transactional
+ public void getDataByQuery_PolicyController(){
+ try{
+ // Add data
+ PolicyEntity pe = new PolicyEntity();
+ String name = "actionDummy";
+ pe.setPolicyName(name);
+ pe.setPolicyData("dummyData");
+ pe.prePersist();
+ pe.setScope("dummyScope");
+ pe.setDescription("descr");
+ pe.setDeleted(false);
+ pe.setCreatedBy("Test");
+ commonClassDao.save(pe);
+
+ String dbCheckName = "dummyScope:action";
+ String[] splitDBCheckName = dbCheckName.split(":");
+
+
+ // Current Implementation
+ String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
+ SimpleBindings params = new SimpleBindings();
+ params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
+ params.put("splitDBCheckName0", splitDBCheckName[0]);
+ List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
+
+ // Assertions
+ assertTrue(dataCur.size() == 1);
+ assertTrue(dataCur.get(0) instanceof PolicyEntity);
+ assertEquals(pe, (PolicyEntity) dataCur.get(0));
+
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_PolicyNotificationController(){
- try{
- // Add data
- WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
- String finalName = "banana"; // Policy File Name
- String userId = "Test";
- watch.setLoginIds(userId);
- watch.setPolicyName(finalName);
- commonClassDao.save(watch);
-
-
- // Current Implementation
- String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
- SimpleBindings params = new SimpleBindings();
- params.put("finalName", finalName);
- params.put("userId", userId);
- List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
-
- // Assertions
- assertTrue(dataCur.size() == 1);
- assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
- assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0) );
-
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
-
- /* Test for SQL Injection Protection
- */
-
- @Test
- @Transactional
+ public void getDataByQuery_PolicyNotificationController(){
+ try{
+ // Add data
+ WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
+ String finalName = "banana"; // Policy File Name
+ String userId = "Test";
+ watch.setLoginIds(userId);
+ watch.setPolicyName(finalName);
+ commonClassDao.save(watch);
+
+
+ // Current Implementation
+ String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
+ SimpleBindings params = new SimpleBindings();
+ params.put("finalName", finalName);
+ params.put("userId", userId);
+ List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
+
+ // Assertions
+ assertTrue(dataCur.size() == 1);
+ assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
+ assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0) );
+
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+
+ /* Test for SQL Injection Protection
+ */
+
+ @Test
+ @Transactional
@Rollback(true)
- public void getDataByQuery_PolicyNotificationController_Injection(){
- try{
- // Add data
- WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
- String userId = "Test";
- watch.setLoginIds(userId);
- watch.setPolicyName("banana");
- commonClassDao.save(watch);
-
- WatchPolicyNotificationTable watch2 = new WatchPolicyNotificationTable();
- watch2.setLoginIds(userId);
- watch2.setPolicyName("banana2");
- commonClassDao.save(watch2);
-
- // SQL Injection attempt
- String finalName = "banana' OR '1'='1";
-
-
- // Current Implementation
- String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
- SimpleBindings params = new SimpleBindings();
- params.put("finalName", finalName);
- params.put("userId", userId);
- List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
-
- // Assertions
- assertTrue(dataCur.size() <= 1);
-
- if(dataCur.size() >= 1){
- assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
- assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0)));
- assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0)));
- }
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @Test
- public void testCommonClassDaoImplMethods(){
- try{
- UserInfo userInfo = new UserInfo();
- userInfo.setUserLoginId("TestID");
- userInfo.setUserName("Test");
- commonClassDao.save(userInfo);
- List<Object> data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test");
- assertTrue(data.size() == 1);
- UserInfo userInfoUpdate = (UserInfo) data.get(0);
- userInfoUpdate.setUserName("Test1");
- commonClassDao.update(userInfoUpdate);
- List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId");
- assertTrue(data1.size() == 1);
- UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1");
- assertTrue("TestID".equals(data2.getUserLoginId()));
- List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class);
- assertTrue(data3.size() == 1);
- PolicyRoles roles = new PolicyRoles();
- roles.setRole("admin");
- roles.setLoginId(userInfo);
- roles.setScope("test");
- commonClassDao.save(roles);
- List<PolicyRoles> roles1 = commonClassDao.getUserRoles();
- assertTrue(roles1.size() == 1);
- List<String> multipleData = new ArrayList<>();
- multipleData.add("TestID:Test1");
- List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData);
- assertTrue(data4.size() == 1);
- commonClassDao.delete(data2);
- }catch(Exception e){
- logger.debug("Exception Occured"+e);
- fail();
- }
- }
-
- @After
- public void deleteDB(){
- sessionFactory.close();
- server.stop();
-
- }
+ public void getDataByQuery_PolicyNotificationController_Injection(){
+ try{
+ // Add data
+ WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
+ String userId = "Test";
+ watch.setLoginIds(userId);
+ watch.setPolicyName("banana");
+ commonClassDao.save(watch);
+
+ WatchPolicyNotificationTable watch2 = new WatchPolicyNotificationTable();
+ watch2.setLoginIds(userId);
+ watch2.setPolicyName("banana2");
+ commonClassDao.save(watch2);
+
+ // SQL Injection attempt
+ String finalName = "banana' OR '1'='1";
+
+
+ // Current Implementation
+ String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
+ SimpleBindings params = new SimpleBindings();
+ params.put("finalName", finalName);
+ params.put("userId", userId);
+ List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
+
+ // Assertions
+ assertTrue(dataCur.size() <= 1);
+
+ if(dataCur.size() >= 1){
+ assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable);
+ assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0)));
+ assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0)));
+ }
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @Test
+ public void testCommonClassDaoImplMethods(){
+ try{
+ UserInfo userInfo = new UserInfo();
+ userInfo.setUserLoginId("TestID");
+ userInfo.setUserName("Test");
+ commonClassDao.save(userInfo);
+ List<Object> data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test");
+ assertTrue(data.size() == 1);
+ UserInfo userInfoUpdate = (UserInfo) data.get(0);
+ userInfoUpdate.setUserName("Test1");
+ commonClassDao.update(userInfoUpdate);
+ List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId");
+ assertTrue(data1.size() == 1);
+ UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1");
+ assertTrue("TestID".equals(data2.getUserLoginId()));
+ List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class);
+ assertTrue(data3.size() == 1);
+ PolicyRoles roles = new PolicyRoles();
+ roles.setRole("admin");
+ roles.setLoginId(userInfo);
+ roles.setScope("test");
+ commonClassDao.save(roles);
+ List<PolicyRoles> roles1 = commonClassDao.getUserRoles();
+ assertTrue(roles1.size() == 1);
+ List<String> multipleData = new ArrayList<>();
+ multipleData.add("TestID:Test1");
+ List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData);
+ assertTrue(data4.size() == 1);
+ commonClassDao.delete(data2);
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+ @After
+ public void deleteDB(){
+ sessionFactory.close();
+ server.stop();
+
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java
index 61f44bdbf..580b3e35d 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java
@@ -32,262 +32,262 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class ActionDictionaryJPATest {
- private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testActionDictionary(){
- ActionPolicyDict data = new ActionPolicyDict();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setAttributeName("Test");
- assertTrue("Test".equals(data.getAttributeName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setBody("Test");
- assertTrue("Test".equals(data.getBody()));
- data.setHeader("Test");
- assertTrue("Test".equals(data.getHeader()));
- data.setMethod("GET");
- assertTrue("GET".equals(data.getMethod()));
- data.setType("JSON");
- assertTrue("JSON".equals(data.getType()));
- data.setUrl("http://test.com");
- assertTrue("http://test.com".equals(data.getUrl()));
- data.prePersist();
- data.preUpdate();
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testFunctionArgument(){
- FunctionArgument data = new FunctionArgument();
- data.setArgIndex(1);
- assertTrue(1 == data.getArgIndex());
- data.setDatatypeBean(new Datatype());
- assertTrue(data.getDatatypeBean()!=null);
- data.setFunctionDefinition(new FunctionDefinition());
- assertTrue(data.getFunctionDefinition()!=null);
- data.setId(1);
- assertTrue(1 == data.getId());
- data.isBag();
- data.toString();
- data.setIsBag(1);
- assertTrue(1 == data.getIsBag());
- new FunctionArgument(data);
- }
-
- @Test
- public void testFunctionDefinition(){
- FunctionDefinition data = new FunctionDefinition();
- data.setArgLb(1);
- assertTrue(1 == data.getArgLb());
- data.setArgUb(1);
- assertTrue(1 == data.getArgUb());
- data.setDatatypeBean(new Datatype());
- assertTrue(data.getDatatypeBean()!=null);
- data.setFunctionArguments(new ArrayList<>());
- assertTrue(data.getFunctionArguments()!=null);
- data.setHigherOrderArg_LB(1);
- assertTrue(1 == data.getHigherOrderArg_LB());
- data.setHigherOrderArg_UB(1);
- assertTrue(1 == data.getHigherOrderArg_UB());
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setIsBagReturn(1);
- assertTrue(1 == data.getIsBagReturn());
- data.setIsHigherOrder(1);
- assertTrue(1 == data.getIsHigherOrder());
- data.setShortname("Test");
- assertTrue("Test".equals(data.getShortname()));
- data.setXacmlid("Test");
- assertTrue("Test".equals(data.getXacmlid()));
- data.toString();
- data.isBagReturn();
- data.isHigherOrder();
- data.addFunctionArgument(new FunctionArgument());
- data.removeFunctionArgument(new FunctionArgument());
- }
-
- @Test
- public void testCategory(){
- Category data = new Category();
- new Category(null);
- data.setAttributes(new HashSet<>());
- data.addAttribute(new Attribute());
- data.removeAttribute(new Attribute());
- data.isStandard();
- data.isCustom();
- Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject");
- data.getIdentifer();
- data.toString();
- assertTrue(data.getAttributes()!=null);
- data.setGrouping("Test");
- assertTrue("Test".equals(data.getGrouping()));
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setShortName("Test");
- assertTrue("Test".equals(data.getShortName()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- }
-
- @Test
- public void testConstraintType(){
- ConstraintType data = new ConstraintType();
- new ConstraintType("Test", "Test");
- ConstraintType.getRangeTypes();
- data.setAttributes(new HashSet<>());
- assertTrue(data.getAttributes()!=null);
- data.setConstraintType("Test");
- assertTrue("Test".equals(data.getConstraintType()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setId(1);
- assertTrue(1 == data.getId());
- }
-
- @Test
- public void testConstraintValue(){
- ConstraintValue data = new ConstraintValue();
- data.clone();
- new ConstraintValue(new ConstraintValue());
- new ConstraintValue("Test","Test");
- data.setAttribute(new Attribute());
- assertTrue(data.getAttribute()!=null);
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setProperty("Test");
- assertTrue("Test".equals(data.getProperty()));
- data.setValue("Test");
- assertTrue("Test".equals(data.getValue()));
- }
-
- @Test
- public void testObadvice(){
- Obadvice data = new Obadvice();
- new Obadvice();
- new Obadvice("Test", "Test");
- data.clone();
- data.addObadviceExpression(new ObadviceExpression());
- data.removeObadviceExpression(new ObadviceExpression());
- data.removeAllExpressions();
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setFulfillOn("Test");
- assertTrue("Test".equals(data.getFulfillOn()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setObadviceExpressions(new HashSet<>());
- assertTrue(data.getObadviceExpressions()!=null);
- data.setType("Test");
- assertTrue("Test".equals(data.getType()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- }
-
- @Test
- public void testObadviceExpression(){
- ObadviceExpression data = new ObadviceExpression();
- data.clone();
- data.setAttribute(new Attribute());
- assertTrue(data.getAttribute()!=null);
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setObadvice(new Obadvice());
- assertTrue(data.getObadvice()!=null);
- data.setType("Test");
- assertTrue("Test".equals(data.getType()));
- }
-
- @Test
- public void testRuleAlgorithms(){
- RuleAlgorithms data = new RuleAlgorithms();
- data.isCustom();
- data.isStandard();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setShortName("Test");
- assertTrue("Test".equals(data.getShortName()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- data.toString();
- }
-
- @Test
- public void testAttributeAssignment(){
- AttributeAssignment data = new AttributeAssignment();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setAttributeId(1);
- assertTrue(1 == data.getAttributeId());
- data.setExpression("Test");
- assertTrue("Test".equals(data.getExpression()));
- }
-
- @Test
- public void testDatatype(){
- Datatype data = new Datatype();
- new Datatype(null);
- new Datatype(1, new Datatype());
- data.setArguments(new HashSet<>());
- assertTrue(data.getArguments()!=null);
- data.setAttributes(new HashSet<>());
- assertTrue(data.getAttributes()!=null);
- data.setFunctions(new HashSet<>());
- assertTrue(data.getFunctions()!=null);
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setShortName("Test");
- assertTrue("Test".equals(data.getShortName()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- data.addArgument(new FunctionArgument());
- data.addAttribute(new Attribute());
- data.addFunction(new FunctionDefinition());
- data.removeArgument(new FunctionArgument());
- data.removeAttribute(new Attribute());
- data.removeAttribute(new FunctionDefinition());
- assertTrue(data.getIdentifer()!=null);
- assertTrue(data.getIdentiferByShortName()!=null);
- data.setIsStandard(Datatype.STANDARD);
- assertTrue(data.isStandard());
- data.setIsStandard(Datatype.CUSTOM);
- assertTrue(data.isCustom());
- }
-
- @Test
- public void testPolicyAlgorithms(){
- PolicyAlgorithms data = new PolicyAlgorithms();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setShortName("Test");
- assertTrue("Test".equals(data.getShortName()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- data.setIsStandard(PolicyAlgorithms.STANDARD);
- assertTrue(data.isStandard());
- }
+ private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testActionDictionary(){
+ ActionPolicyDict data = new ActionPolicyDict();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setAttributeName("Test");
+ assertTrue("Test".equals(data.getAttributeName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setBody("Test");
+ assertTrue("Test".equals(data.getBody()));
+ data.setHeader("Test");
+ assertTrue("Test".equals(data.getHeader()));
+ data.setMethod("GET");
+ assertTrue("GET".equals(data.getMethod()));
+ data.setType("JSON");
+ assertTrue("JSON".equals(data.getType()));
+ data.setUrl("http://test.com");
+ assertTrue("http://test.com".equals(data.getUrl()));
+ data.prePersist();
+ data.preUpdate();
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testFunctionArgument(){
+ FunctionArgument data = new FunctionArgument();
+ data.setArgIndex(1);
+ assertTrue(1 == data.getArgIndex());
+ data.setDatatypeBean(new Datatype());
+ assertTrue(data.getDatatypeBean()!=null);
+ data.setFunctionDefinition(new FunctionDefinition());
+ assertTrue(data.getFunctionDefinition()!=null);
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.isBag();
+ data.toString();
+ data.setIsBag(1);
+ assertTrue(1 == data.getIsBag());
+ new FunctionArgument(data);
+ }
+
+ @Test
+ public void testFunctionDefinition(){
+ FunctionDefinition data = new FunctionDefinition();
+ data.setArgLb(1);
+ assertTrue(1 == data.getArgLb());
+ data.setArgUb(1);
+ assertTrue(1 == data.getArgUb());
+ data.setDatatypeBean(new Datatype());
+ assertTrue(data.getDatatypeBean()!=null);
+ data.setFunctionArguments(new ArrayList<>());
+ assertTrue(data.getFunctionArguments()!=null);
+ data.setHigherOrderArg_LB(1);
+ assertTrue(1 == data.getHigherOrderArg_LB());
+ data.setHigherOrderArg_UB(1);
+ assertTrue(1 == data.getHigherOrderArg_UB());
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setIsBagReturn(1);
+ assertTrue(1 == data.getIsBagReturn());
+ data.setIsHigherOrder(1);
+ assertTrue(1 == data.getIsHigherOrder());
+ data.setShortname("Test");
+ assertTrue("Test".equals(data.getShortname()));
+ data.setXacmlid("Test");
+ assertTrue("Test".equals(data.getXacmlid()));
+ data.toString();
+ data.isBagReturn();
+ data.isHigherOrder();
+ data.addFunctionArgument(new FunctionArgument());
+ data.removeFunctionArgument(new FunctionArgument());
+ }
+
+ @Test
+ public void testCategory(){
+ Category data = new Category();
+ new Category(null);
+ data.setAttributes(new HashSet<>());
+ data.addAttribute(new Attribute());
+ data.removeAttribute(new Attribute());
+ data.isStandard();
+ data.isCustom();
+ Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject");
+ data.getIdentifer();
+ data.toString();
+ assertTrue(data.getAttributes()!=null);
+ data.setGrouping("Test");
+ assertTrue("Test".equals(data.getGrouping()));
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setShortName("Test");
+ assertTrue("Test".equals(data.getShortName()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ }
+
+ @Test
+ public void testConstraintType(){
+ ConstraintType data = new ConstraintType();
+ new ConstraintType("Test", "Test");
+ ConstraintType.getRangeTypes();
+ data.setAttributes(new HashSet<>());
+ assertTrue(data.getAttributes()!=null);
+ data.setConstraintType("Test");
+ assertTrue("Test".equals(data.getConstraintType()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ }
+
+ @Test
+ public void testConstraintValue(){
+ ConstraintValue data = new ConstraintValue();
+ data.clone();
+ new ConstraintValue(new ConstraintValue());
+ new ConstraintValue("Test","Test");
+ data.setAttribute(new Attribute());
+ assertTrue(data.getAttribute()!=null);
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setProperty("Test");
+ assertTrue("Test".equals(data.getProperty()));
+ data.setValue("Test");
+ assertTrue("Test".equals(data.getValue()));
+ }
+
+ @Test
+ public void testObadvice(){
+ Obadvice data = new Obadvice();
+ new Obadvice();
+ new Obadvice("Test", "Test");
+ data.clone();
+ data.addObadviceExpression(new ObadviceExpression());
+ data.removeObadviceExpression(new ObadviceExpression());
+ data.removeAllExpressions();
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setFulfillOn("Test");
+ assertTrue("Test".equals(data.getFulfillOn()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setObadviceExpressions(new HashSet<>());
+ assertTrue(data.getObadviceExpressions()!=null);
+ data.setType("Test");
+ assertTrue("Test".equals(data.getType()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ }
+
+ @Test
+ public void testObadviceExpression(){
+ ObadviceExpression data = new ObadviceExpression();
+ data.clone();
+ data.setAttribute(new Attribute());
+ assertTrue(data.getAttribute()!=null);
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setObadvice(new Obadvice());
+ assertTrue(data.getObadvice()!=null);
+ data.setType("Test");
+ assertTrue("Test".equals(data.getType()));
+ }
+
+ @Test
+ public void testRuleAlgorithms(){
+ RuleAlgorithms data = new RuleAlgorithms();
+ data.isCustom();
+ data.isStandard();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setShortName("Test");
+ assertTrue("Test".equals(data.getShortName()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ data.toString();
+ }
+
+ @Test
+ public void testAttributeAssignment(){
+ AttributeAssignment data = new AttributeAssignment();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setAttributeId(1);
+ assertTrue(1 == data.getAttributeId());
+ data.setExpression("Test");
+ assertTrue("Test".equals(data.getExpression()));
+ }
+
+ @Test
+ public void testDatatype(){
+ Datatype data = new Datatype();
+ new Datatype(null);
+ new Datatype(1, new Datatype());
+ data.setArguments(new HashSet<>());
+ assertTrue(data.getArguments()!=null);
+ data.setAttributes(new HashSet<>());
+ assertTrue(data.getAttributes()!=null);
+ data.setFunctions(new HashSet<>());
+ assertTrue(data.getFunctions()!=null);
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setShortName("Test");
+ assertTrue("Test".equals(data.getShortName()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ data.addArgument(new FunctionArgument());
+ data.addAttribute(new Attribute());
+ data.addFunction(new FunctionDefinition());
+ data.removeArgument(new FunctionArgument());
+ data.removeAttribute(new Attribute());
+ data.removeAttribute(new FunctionDefinition());
+ assertTrue(data.getIdentifer()!=null);
+ assertTrue(data.getIdentiferByShortName()!=null);
+ data.setIsStandard(Datatype.STANDARD);
+ assertTrue(data.isStandard());
+ data.setIsStandard(Datatype.CUSTOM);
+ assertTrue(data.isCustom());
+ }
+
+ @Test
+ public void testPolicyAlgorithms(){
+ PolicyAlgorithms data = new PolicyAlgorithms();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setShortName("Test");
+ assertTrue("Test".equals(data.getShortName()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ data.setIsStandard(PolicyAlgorithms.STANDARD);
+ assertTrue(data.isStandard());
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java
index 72c1b7dcd..9012cca28 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java
@@ -30,80 +30,80 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class BRMSDictionaryJPATest {
- private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testBRMSParamTemplate(){
- BRMSParamTemplate data = new BRMSParamTemplate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setRule("Test");
- assertTrue("Test".equals(data.getRule()));
- data.setRuleName("Test");
- assertTrue("Test".equals(data.getRuleName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- }
-
- @Test
- public void testBRMSController(){
- BRMSController data = new BRMSController();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setController("Test");
- assertTrue("Test".equals(data.getController()));
- data.setControllerName("Test");
- assertTrue("Test".equals(data.getControllerName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testBRMSDependency(){
- BRMSDependency data = new BRMSDependency();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setDependency("Test");
- assertTrue("Test".equals(data.getDependency()));
- data.setDependencyName("Test");
- assertTrue("Test".equals(data.getDependencyName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
+ private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testBRMSParamTemplate(){
+ BRMSParamTemplate data = new BRMSParamTemplate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setRule("Test");
+ assertTrue("Test".equals(data.getRule()));
+ data.setRuleName("Test");
+ assertTrue("Test".equals(data.getRuleName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ }
+
+ @Test
+ public void testBRMSController(){
+ BRMSController data = new BRMSController();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setController("Test");
+ assertTrue("Test".equals(data.getController()));
+ data.setControllerName("Test");
+ assertTrue("Test".equals(data.getControllerName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testBRMSDependency(){
+ BRMSDependency data = new BRMSDependency();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setDependency("Test");
+ assertTrue("Test".equals(data.getDependency()));
+ data.setDependencyName("Test");
+ assertTrue("Test".equals(data.getDependencyName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java
index aa93aacd6..2274855e1 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java
@@ -29,144 +29,144 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
public class ClosedLoopPolicyDictionaryJPATest {
-
- private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testVSCLAction(){
- VSCLAction data = new VSCLAction();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setVsclaction("Test");
- assertTrue("Test".equals(data.getVsclaction()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
-
- @Test
- public void testVNFType(){
- VNFType data = new VNFType();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setVnftype("Test");
- assertTrue("Test".equals(data.getVnftype()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
-
- @Test
- public void testPEPOptions(){
- PEPOptions data = new PEPOptions();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setPepName("Test");
- assertTrue("Test".equals(data.getPepName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
-
- @Test
- public void testVarbindDictionary(){
- VarbindDictionary data = new VarbindDictionary();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setVarbindName("Test");
- assertTrue("Test".equals(data.getVarbindName()));
- data.setVarbindDescription("Test");
- assertTrue("Test".equals(data.getVarbindDescription()));
- data.setVarbindOID("Test");
- assertTrue("Test".equals(data.getVarbindOID()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
-
- @Test
- public void testClosedLoopD2Services(){
- ClosedLoopD2Services data = new ClosedLoopD2Services();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setServiceName("Test");
- assertTrue("Test".equals(data.getServiceName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
-
- @Test
- public void testClosedLoopSite(){
- ClosedLoopSite data = new ClosedLoopSite();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setSiteName("Test");
- assertTrue("Test".equals(data.getSiteName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- }
+
+ private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testVSCLAction(){
+ VSCLAction data = new VSCLAction();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setVsclaction("Test");
+ assertTrue("Test".equals(data.getVsclaction()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
+
+ @Test
+ public void testVNFType(){
+ VNFType data = new VNFType();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setVnftype("Test");
+ assertTrue("Test".equals(data.getVnftype()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
+
+ @Test
+ public void testPEPOptions(){
+ PEPOptions data = new PEPOptions();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setPepName("Test");
+ assertTrue("Test".equals(data.getPepName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
+
+ @Test
+ public void testVarbindDictionary(){
+ VarbindDictionary data = new VarbindDictionary();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setVarbindName("Test");
+ assertTrue("Test".equals(data.getVarbindName()));
+ data.setVarbindDescription("Test");
+ assertTrue("Test".equals(data.getVarbindDescription()));
+ data.setVarbindOID("Test");
+ assertTrue("Test".equals(data.getVarbindOID()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
+
+ @Test
+ public void testClosedLoopD2Services(){
+ ClosedLoopD2Services data = new ClosedLoopD2Services();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setServiceName("Test");
+ assertTrue("Test".equals(data.getServiceName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
+
+ @Test
+ public void testClosedLoopSite(){
+ ClosedLoopSite data = new ClosedLoopSite();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setSiteName("Test");
+ assertTrue("Test".equals(data.getSiteName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!= null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!= null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!= null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!= null);
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java
index afe090503..230844a64 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java
@@ -30,117 +30,117 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
public class CommonDictionaryJPATest {
-
- private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testAttribute(){
- Attribute data = new Attribute();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setCategoryBean(new Category());
- assertTrue(data.getCategoryBean()!=null);
- data.setConstraintType(new ConstraintType());
- assertTrue(data.getConstraintType()!=null);
- data.setConstraintValues(new HashSet<>());
- assertTrue(data.getConstraintValues()!=null);
- data.addConstraintValue(new ConstraintValue());
- data.removeConstraintValue(new ConstraintValue());
- data.removeAllConstraintValues();
- data.preUpdate();
- data.prePersist();
- new Attribute("Test");
- new Attribute(new Attribute());
- data.setAttributeValue("Test");
- assertTrue("Test".equals(data.getAttributeValue()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- data.setDatatypeBean(new Datatype());
- assertTrue(data.getDatatypeBean()!=null);
- data.setIsDesignator(true);
- assertTrue(data.isDesignator());
- data.setIssuer("Test");
- assertTrue("Test".equals(data.getIssuer()));
- data.setMustBePresent(true);
- assertTrue(data.isMustBePresent());
- data.setPriority("Test");
- assertTrue("Test".equals(data.getPriority()));
- data.setSelectorPath("Test");
- assertTrue("Test".equals(data.getSelectorPath()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testOnapName(){
- OnapName data = new OnapName();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setOnapName("Test");
- assertTrue("Test".equals(data.getOnapName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testRiskType(){
- RiskType data = new RiskType();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setRiskName("Test");
- assertTrue("Test".equals(data.getRiskName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testSafePolicyWarning(){
- SafePolicyWarning data = new SafePolicyWarning();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setMessage("Test");
- assertTrue("Test".equals(data.getMessage()));
- data.setRiskType("Test");
- assertTrue("Test".equals(data.getRiskType()));
- }
+
+ private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testAttribute(){
+ Attribute data = new Attribute();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setCategoryBean(new Category());
+ assertTrue(data.getCategoryBean()!=null);
+ data.setConstraintType(new ConstraintType());
+ assertTrue(data.getConstraintType()!=null);
+ data.setConstraintValues(new HashSet<>());
+ assertTrue(data.getConstraintValues()!=null);
+ data.addConstraintValue(new ConstraintValue());
+ data.removeConstraintValue(new ConstraintValue());
+ data.removeAllConstraintValues();
+ data.preUpdate();
+ data.prePersist();
+ new Attribute("Test");
+ new Attribute(new Attribute());
+ data.setAttributeValue("Test");
+ assertTrue("Test".equals(data.getAttributeValue()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ data.setDatatypeBean(new Datatype());
+ assertTrue(data.getDatatypeBean()!=null);
+ data.setIsDesignator(true);
+ assertTrue(data.isDesignator());
+ data.setIssuer("Test");
+ assertTrue("Test".equals(data.getIssuer()));
+ data.setMustBePresent(true);
+ assertTrue(data.isMustBePresent());
+ data.setPriority("Test");
+ assertTrue("Test".equals(data.getPriority()));
+ data.setSelectorPath("Test");
+ assertTrue("Test".equals(data.getSelectorPath()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testOnapName(){
+ OnapName data = new OnapName();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setOnapName("Test");
+ assertTrue("Test".equals(data.getOnapName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testRiskType(){
+ RiskType data = new RiskType();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setRiskName("Test");
+ assertTrue("Test".equals(data.getRiskName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testSafePolicyWarning(){
+ SafePolicyWarning data = new SafePolicyWarning();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setMessage("Test");
+ assertTrue("Test".equals(data.getMessage()));
+ data.setRiskType("Test");
+ assertTrue("Test".equals(data.getRiskType()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java
index 0a221b0a2..b1fc69903 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java
@@ -30,58 +30,58 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class DecisionDictionaryJPATest {
- private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testDecisionSettings(){
- DecisionSettings data = new DecisionSettings();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.preUpdate();
- data.prePersist();
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setXacmlId("Test");
- assertTrue("Test".equals(data.getXacmlId()));
- data.setDatatypeBean(new Datatype());
- assertTrue(data.getDatatypeBean()!=null);
- data.setIssuer("Test");
- assertTrue("Test".equals(data.getIssuer()));
- data.setMustBePresent(true);
- assertTrue(data.isMustBePresent());
- data.setPriority("Test");
- assertTrue("Test".equals(data.getPriority()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testRainyDayTreatments(){
- RainyDayTreatments data = new RainyDayTreatments();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setBbid("Test");
- assertTrue("Test".equals(data.getBbid()));
- data.setWorkstep("Test");
- assertTrue("Test".equals(data.getWorkstep()));
- data.setTreatments("Test");
- assertTrue("Test".equals(data.getTreatments()));
- }
-
+ private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testDecisionSettings(){
+ DecisionSettings data = new DecisionSettings();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.preUpdate();
+ data.prePersist();
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setXacmlId("Test");
+ assertTrue("Test".equals(data.getXacmlId()));
+ data.setDatatypeBean(new Datatype());
+ assertTrue(data.getDatatypeBean()!=null);
+ data.setIssuer("Test");
+ assertTrue("Test".equals(data.getIssuer()));
+ data.setMustBePresent(true);
+ assertTrue(data.isMustBePresent());
+ data.setPriority("Test");
+ assertTrue("Test".equals(data.getPriority()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testRainyDayTreatments(){
+ RainyDayTreatments data = new RainyDayTreatments();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setBbid("Test");
+ assertTrue("Test".equals(data.getBbid()));
+ data.setWorkstep("Test");
+ assertTrue("Test".equals(data.getWorkstep()));
+ data.setTreatments("Test");
+ assertTrue("Test".equals(data.getTreatments()));
+ }
+
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java
index bec9fe042..b3b23e429 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java
@@ -30,228 +30,228 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class FWDictionaryJPATest {
- private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testActionList(){
- ActionList data = new ActionList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setActionName("Test");
- assertTrue("Test".equals(data.getActionName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testPortList(){
- PortList data = new PortList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setPortName("Test");
- assertTrue("Test".equals(data.getPortName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testProtocolList(){
- ProtocolList data = new ProtocolList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setProtocolName("Test");
- assertTrue("Test".equals(data.getProtocolName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testSecurityZone(){
- SecurityZone data = new SecurityZone();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setZoneName("Test");
- assertTrue("Test".equals(data.getZoneName()));
- data.setZoneValue("Test");
- assertTrue("Test".equals(data.getZoneValue()));
- }
-
- @Test
- public void testZone(){
- Zone data = new Zone();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setZoneName("Test");
- assertTrue("Test".equals(data.getZoneName()));
- data.setZoneValue("Test");
- assertTrue("Test".equals(data.getZoneValue()));
- }
-
- @Test
- public void testAddressGroup(){
- AddressGroup data = new AddressGroup();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setServiceList("Test");
- assertTrue("Test".equals(data.getPrefixList()));
- data.setGroupName("Test");
- assertTrue("Test".equals(data.getGroupName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testPrefixList(){
- PrefixList data = new PrefixList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setPrefixListName("Test");
- assertTrue("Test".equals(data.getPrefixListName()));
- data.setPrefixListValue("Test");
- assertTrue("Test".equals(data.getPrefixListValue()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testFWDictionaryList(){
- FirewallDictionaryList data = new FirewallDictionaryList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setParentItemName("Test");
- assertTrue("Test".equals(data.getParentItemName()));
- data.setAddressList("Test");
- assertTrue("Test".equals(data.getAddressList()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setServiceList("Test");
- assertTrue("Test".equals(data.getServiceList()));
- }
-
- @Test
- public void testFWTag(){
- FWTag data = new FWTag();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setFwTagName("Test");
- assertTrue("Test".equals(data.getFwTagName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setTagValues("Test");
- assertTrue("Test".equals(data.getTagValues()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testFWTagPicker(){
- FWTagPicker data = new FWTagPicker();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setTagPickerName("Test");
- assertTrue("Test".equals(data.getTagPickerName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setNetworkRole("Test");
- assertTrue("Test".equals(data.getNetworkRole()));
- data.setTagValues("Test");
- assertTrue("Test".equals(data.getTagValues()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testServiceList(){
- ServiceList data = new ServiceList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setServiceName("Test");
- assertTrue("Test".equals(data.getServiceName()));
- data.setServiceDescription("Test");
- assertTrue("Test".equals(data.getServiceDescription()));
- data.setServiceType("Test");
- assertTrue("Test".equals(data.getServiceType()));
- data.setServiceTransProtocol("Test");
- assertTrue("Test".equals(data.getServiceTransProtocol()));
- data.setServiceAppProtocol("Test");
- assertTrue("Test".equals(data.getServiceAppProtocol()));
- data.setServicePorts("Test");
- assertTrue("Test".equals(data.getServicePorts()));
- }
-
- @Test
- public void testTermList(){
- TermList data = new TermList();
- data.preUpdate();
- data.prePersist();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setTermName("Test");
- assertTrue("Test".equals(data.getTermName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getTermDescription()));
- data.setFromZones("Test");
- assertTrue("Test".equals(data.getFromZone()));
- data.setToZones("Test");
- assertTrue("Test".equals(data.getToZone()));
- data.setSrcIPList("Test");
- assertTrue("Test".equals(data.getSrcIPList()));
- data.setDestIPList("Test");
- assertTrue("Test".equals(data.getDestIPList()));
- data.setProtocolList("Test");
- assertTrue("Test".equals(data.getProtocolList()));
- data.setPortList("Test");
- assertTrue("Test".equals(data.getPortList()));
- data.setSrcPortList("Test");
- assertTrue("Test".equals(data.getSrcPortList()));
- data.setDestPortList("Test");
- assertTrue("Test".equals(data.getDestPortList()));
- data.setAction("Test");
- assertTrue("Test".equals(data.getAction()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testGroupServiceList(){
- GroupServiceList data = new GroupServiceList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setGroupName("Test");
- assertTrue("Test".equals(data.getGroupName()));
- data.setServiceList("Test");
- assertTrue("Test".equals(data.getServiceList()));
- }
+ private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testActionList(){
+ ActionList data = new ActionList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setActionName("Test");
+ assertTrue("Test".equals(data.getActionName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testPortList(){
+ PortList data = new PortList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setPortName("Test");
+ assertTrue("Test".equals(data.getPortName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testProtocolList(){
+ ProtocolList data = new ProtocolList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setProtocolName("Test");
+ assertTrue("Test".equals(data.getProtocolName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testSecurityZone(){
+ SecurityZone data = new SecurityZone();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setZoneName("Test");
+ assertTrue("Test".equals(data.getZoneName()));
+ data.setZoneValue("Test");
+ assertTrue("Test".equals(data.getZoneValue()));
+ }
+
+ @Test
+ public void testZone(){
+ Zone data = new Zone();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setZoneName("Test");
+ assertTrue("Test".equals(data.getZoneName()));
+ data.setZoneValue("Test");
+ assertTrue("Test".equals(data.getZoneValue()));
+ }
+
+ @Test
+ public void testAddressGroup(){
+ AddressGroup data = new AddressGroup();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setServiceList("Test");
+ assertTrue("Test".equals(data.getPrefixList()));
+ data.setGroupName("Test");
+ assertTrue("Test".equals(data.getGroupName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testPrefixList(){
+ PrefixList data = new PrefixList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setPrefixListName("Test");
+ assertTrue("Test".equals(data.getPrefixListName()));
+ data.setPrefixListValue("Test");
+ assertTrue("Test".equals(data.getPrefixListValue()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testFWDictionaryList(){
+ FirewallDictionaryList data = new FirewallDictionaryList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setParentItemName("Test");
+ assertTrue("Test".equals(data.getParentItemName()));
+ data.setAddressList("Test");
+ assertTrue("Test".equals(data.getAddressList()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setServiceList("Test");
+ assertTrue("Test".equals(data.getServiceList()));
+ }
+
+ @Test
+ public void testFWTag(){
+ FWTag data = new FWTag();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setFwTagName("Test");
+ assertTrue("Test".equals(data.getFwTagName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setTagValues("Test");
+ assertTrue("Test".equals(data.getTagValues()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testFWTagPicker(){
+ FWTagPicker data = new FWTagPicker();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setTagPickerName("Test");
+ assertTrue("Test".equals(data.getTagPickerName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setNetworkRole("Test");
+ assertTrue("Test".equals(data.getNetworkRole()));
+ data.setTagValues("Test");
+ assertTrue("Test".equals(data.getTagValues()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testServiceList(){
+ ServiceList data = new ServiceList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setServiceName("Test");
+ assertTrue("Test".equals(data.getServiceName()));
+ data.setServiceDescription("Test");
+ assertTrue("Test".equals(data.getServiceDescription()));
+ data.setServiceType("Test");
+ assertTrue("Test".equals(data.getServiceType()));
+ data.setServiceTransProtocol("Test");
+ assertTrue("Test".equals(data.getServiceTransProtocol()));
+ data.setServiceAppProtocol("Test");
+ assertTrue("Test".equals(data.getServiceAppProtocol()));
+ data.setServicePorts("Test");
+ assertTrue("Test".equals(data.getServicePorts()));
+ }
+
+ @Test
+ public void testTermList(){
+ TermList data = new TermList();
+ data.preUpdate();
+ data.prePersist();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setTermName("Test");
+ assertTrue("Test".equals(data.getTermName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getTermDescription()));
+ data.setFromZones("Test");
+ assertTrue("Test".equals(data.getFromZone()));
+ data.setToZones("Test");
+ assertTrue("Test".equals(data.getToZone()));
+ data.setSrcIPList("Test");
+ assertTrue("Test".equals(data.getSrcIPList()));
+ data.setDestIPList("Test");
+ assertTrue("Test".equals(data.getDestIPList()));
+ data.setProtocolList("Test");
+ assertTrue("Test".equals(data.getProtocolList()));
+ data.setPortList("Test");
+ assertTrue("Test".equals(data.getPortList()));
+ data.setSrcPortList("Test");
+ assertTrue("Test".equals(data.getSrcPortList()));
+ data.setDestPortList("Test");
+ assertTrue("Test".equals(data.getDestPortList()));
+ data.setAction("Test");
+ assertTrue("Test".equals(data.getAction()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testGroupServiceList(){
+ GroupServiceList data = new GroupServiceList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setGroupName("Test");
+ assertTrue("Test".equals(data.getGroupName()));
+ data.setServiceList("Test");
+ assertTrue("Test".equals(data.getServiceList()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java
index eba1c4003..548e3fc84 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java
@@ -28,181 +28,181 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class MicroServiceDictionaryJPATest {
- private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testDCAEUsers(){
- DCAEUsers data = new DCAEUsers();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testDCAEuuid(){
- DCAEuuid data = new DCAEuuid();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
- @Test
- public void testMSConfigName(){
- MicroServiceConfigName data = new MicroServiceConfigName();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testMSConfigLocation(){
- MicroServiceLocation data = new MicroServiceLocation();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testMSModels(){
- MicroServiceModels data = new MicroServiceModels();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setModelName("Test");
- assertTrue("Test".equals(data.getModelName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setDependency("Test");
- assertTrue("Test".equals(data.getDependency()));
- data.setEnumValues("Test");
- assertTrue("Test".equals(data.getEnumValues()));
- data.setAnnotation("Test");
- assertTrue("Test".equals(data.getAnnotation()));
- data.setAttributes("Test");
- assertTrue("Test".equals(data.getAttributes()));
- data.setRef_attributes("Test");
- assertTrue("Test".equals(data.getRef_attributes()));
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setSub_attributes("Test");
- assertTrue("Test".equals(data.getSub_attributes()));
- data.setVersion("Test");
- assertTrue("Test".equals(data.getVersion()));
- }
-
- @Test
- public void testMSAttributeDictionary(){
- MicroServiceAttribute data = new MicroServiceAttribute();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setValue("Test");
- assertTrue("Test".equals(data.getValue()));
- data.setModelName("Test");
- assertTrue("Test".equals(data.getModelName()));
- }
-
- @Test
- public void testPolicyScopeService(){
- PolicyScopeService data = new PolicyScopeService();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testPolicyScopeResource(){
- PolicyScopeResource data = new PolicyScopeResource();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testPolicyScopeType(){
- PolicyScopeType data = new PolicyScopeType();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testPolicyScopeClosedLoop(){
- PolicyScopeClosedLoop data = new PolicyScopeClosedLoop();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescriptionValue("Test");
- assertTrue("Test".equals(data.getDescriptionValue()));
- }
-
- @Test
- public void testPolicyScopeGroupPolicyScopeList(){
- GroupPolicyScopeList data = new GroupPolicyScopeList();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setGroupName("Test");
- assertTrue("Test".equals(data.getGroupName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setGroupList("Test");
- assertTrue("Test".equals(data.getGroupList()));
- }
-
- @Test
- public void testClosedLoops(){
- ClosedLoops data = new ClosedLoops();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setClosedLoopControlName("Test");
- assertTrue("Test".equals(data.getClosedLoopControlName()));
- data.setAlarmConditions("Test");
- assertTrue("Test".equals(data.getAlarmConditions()));
- data.setYaml("Test");
- assertTrue("Test".equals(data.getYaml()));
- }
-
- @Test
- public void testVMType(){
- VMType data = new VMType();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- }
-
+ private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testDCAEUsers(){
+ DCAEUsers data = new DCAEUsers();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testDCAEuuid(){
+ DCAEuuid data = new DCAEuuid();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
+ @Test
+ public void testMSConfigName(){
+ MicroServiceConfigName data = new MicroServiceConfigName();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testMSConfigLocation(){
+ MicroServiceLocation data = new MicroServiceLocation();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testMSModels(){
+ MicroServiceModels data = new MicroServiceModels();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setModelName("Test");
+ assertTrue("Test".equals(data.getModelName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setDependency("Test");
+ assertTrue("Test".equals(data.getDependency()));
+ data.setEnumValues("Test");
+ assertTrue("Test".equals(data.getEnumValues()));
+ data.setAnnotation("Test");
+ assertTrue("Test".equals(data.getAnnotation()));
+ data.setAttributes("Test");
+ assertTrue("Test".equals(data.getAttributes()));
+ data.setRef_attributes("Test");
+ assertTrue("Test".equals(data.getRef_attributes()));
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setSub_attributes("Test");
+ assertTrue("Test".equals(data.getSub_attributes()));
+ data.setVersion("Test");
+ assertTrue("Test".equals(data.getVersion()));
+ }
+
+ @Test
+ public void testMSAttributeDictionary(){
+ MicroServiceAttribute data = new MicroServiceAttribute();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setValue("Test");
+ assertTrue("Test".equals(data.getValue()));
+ data.setModelName("Test");
+ assertTrue("Test".equals(data.getModelName()));
+ }
+
+ @Test
+ public void testPolicyScopeService(){
+ PolicyScopeService data = new PolicyScopeService();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testPolicyScopeResource(){
+ PolicyScopeResource data = new PolicyScopeResource();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testPolicyScopeType(){
+ PolicyScopeType data = new PolicyScopeType();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testPolicyScopeClosedLoop(){
+ PolicyScopeClosedLoop data = new PolicyScopeClosedLoop();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescriptionValue("Test");
+ assertTrue("Test".equals(data.getDescriptionValue()));
+ }
+
+ @Test
+ public void testPolicyScopeGroupPolicyScopeList(){
+ GroupPolicyScopeList data = new GroupPolicyScopeList();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setGroupName("Test");
+ assertTrue("Test".equals(data.getGroupName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setGroupList("Test");
+ assertTrue("Test".equals(data.getGroupList()));
+ }
+
+ @Test
+ public void testClosedLoops(){
+ ClosedLoops data = new ClosedLoops();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setClosedLoopControlName("Test");
+ assertTrue("Test".equals(data.getClosedLoopControlName()));
+ data.setAlarmConditions("Test");
+ assertTrue("Test".equals(data.getAlarmConditions()));
+ data.setYaml("Test");
+ assertTrue("Test".equals(data.getYaml()));
+ }
+
+ @Test
+ public void testVMType(){
+ VMType data = new VMType();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ }
+
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java
index cd7360ca2..243cb5106 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java
@@ -28,44 +28,44 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class OptimizationModelsJPATest {
- private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testMSModels(){
- OptimizationModels data = new OptimizationModels();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setModelName("Test");
- assertTrue("Test".equals(data.getModelName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setDependency("Test");
- assertTrue("Test".equals(data.getDependency()));
- data.setEnumValues("Test");
- assertTrue("Test".equals(data.getEnumValues()));
- data.setAnnotation("Test");
- assertTrue("Test".equals(data.getAnnotation()));
- data.setAttributes("Test");
- assertTrue("Test".equals(data.getAttributes()));
- data.setRefattributes("Test");
- assertTrue("Test".equals(data.getRefattributes()));
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setSubattributes("Test");
- assertTrue("Test".equals(data.getSubattributes()));
- data.setVersion("Test");
- assertTrue("Test".equals(data.getVersion()));
- }
-
-
+ private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testMSModels(){
+ OptimizationModels data = new OptimizationModels();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setModelName("Test");
+ assertTrue("Test".equals(data.getModelName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setDependency("Test");
+ assertTrue("Test".equals(data.getDependency()));
+ data.setEnumValues("Test");
+ assertTrue("Test".equals(data.getEnumValues()));
+ data.setAnnotation("Test");
+ assertTrue("Test".equals(data.getAnnotation()));
+ data.setAttributes("Test");
+ assertTrue("Test".equals(data.getAttributes()));
+ data.setRefattributes("Test");
+ assertTrue("Test".equals(data.getRefattributes()));
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setSubattributes("Test");
+ assertTrue("Test".equals(data.getSubattributes()));
+ data.setVersion("Test");
+ assertTrue("Test".equals(data.getVersion()));
+ }
+
+
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java
index d114a18c1..7421d79c9 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java
@@ -31,153 +31,153 @@ import com.att.research.xacml.api.pip.PIPException;
public class PIPJPATest {
- @Test
- public void testPIPConfigParam(){
- PIPConfigParam data = new PIPConfigParam();
- new PIPConfigParam("test");
- new PIPConfigParam(new PIPConfigParam());
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setParamName("Test");
- assertTrue("Test".equals(data.getParamName()));
- data.setParamValue("Test");
- assertTrue("Test".equals(data.getParamValue()));
- data.setParamDefault("Test");
- assertTrue("Test".equals(data.getParamDefault()));
- data.setPipconfiguration(new PIPConfiguration());
- assertTrue(data.getPipconfiguration()!=null);
- data.setRequired(true);
- assertTrue(data.isRequired());
- data.toString();
- }
-
- @Test
- public void testPIPResolverParam(){
- PIPResolverParam data = new PIPResolverParam();
- new PIPResolverParam("test");
- new PIPResolverParam(new PIPResolverParam());
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setParamName("Test");
- assertTrue("Test".equals(data.getParamName()));
- data.setParamValue("Test");
- assertTrue("Test".equals(data.getParamValue()));
- data.setParamDefault("Test");
- assertTrue("Test".equals(data.getParamDefault()));
- data.setPipresolver(new PIPResolver());
- assertTrue(data.getPipresolver()!=null);
- data.setRequired(true);
- assertTrue(data.isRequired());
- data.toString();
- }
-
- @Test
- public void testPIPType(){
- PIPType data = new PIPType();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setType("Test");
- assertTrue("Test".equals(data.getType()));
- data.setPipconfigurations(new HashSet<>());
- assertTrue(data.getPipconfigurations()!=null);
- data.addPipconfiguration(new PIPConfiguration());
- data.removePipconfiguration(new PIPConfiguration());
- data.setType("SQL");
- assertTrue(data.isSQL());
- data.setType("LDAP");
- assertTrue(data.isLDAP());
- data.setType("CSV");
- assertTrue(data.isCSV());
- data.setType("Hyper-CSV");
- assertTrue(data.isHyperCSV());
- data.setType("Custom");
- assertTrue(data.isCustom());
- }
-
- @Test
- public void testPIPResolver(){
- PIPResolver data = new PIPResolver();
- new PIPResolver(new PIPResolver());
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setIssuer("Test");
- assertTrue("Test".equals(data.getIssuer()));
- data.setClassname("Test");
- assertTrue("Test".equals(data.getClassname()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setPipconfiguration(new PIPConfiguration());
- assertTrue(data.getPipconfiguration()!=null);
- data.setPipresolverParams(new HashSet<>());
- assertTrue(data.getPipresolverParams()!=null);
- data.addPipresolverParam(new PIPResolverParam());
- data.removePipresolverParam(new PIPResolverParam());
- data.clearParams();
- data.getConfiguration("test");
- data.setReadOnly(true);
- assertTrue(data.isReadOnly());
- data.toString();
- Properties properties = new Properties();
- data.generateProperties(properties,"test");
- try {
- data.readProperties("test", properties);
- } catch (PIPException e) {
- fail();
- }
- }
-
- @Test
- public void testPIPConfiguration(){
- PIPConfiguration data = new PIPConfiguration();
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setIssuer("Test");
- assertTrue("Test".equals(data.getIssuer()));
- data.setClassname("Test");
- assertTrue("Test".equals(data.getClassname()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- try {
- data.readProperties("test", data.generateProperties("test"));
- } catch (PIPException e) {
- fail();
- }
- data.setPiptype(new PIPType());
- assertTrue(data.getPiptype()!=null);
- data.setPipresolvers(new HashSet<>());
- assertTrue(data.getPipresolvers()!=null);
- data.addPipresolver(new PIPResolver());
- data.removePipresolver(new PIPResolver());
- data.getConfiguration("test");
- data.setReadOnly(true);
- assertTrue(data.isReadOnly());
- data.setRequiresResolvers(true);
- assertTrue(data.requiresResolvers());
- data.toString();
- }
-
+ @Test
+ public void testPIPConfigParam(){
+ PIPConfigParam data = new PIPConfigParam();
+ new PIPConfigParam("test");
+ new PIPConfigParam(new PIPConfigParam());
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setParamName("Test");
+ assertTrue("Test".equals(data.getParamName()));
+ data.setParamValue("Test");
+ assertTrue("Test".equals(data.getParamValue()));
+ data.setParamDefault("Test");
+ assertTrue("Test".equals(data.getParamDefault()));
+ data.setPipconfiguration(new PIPConfiguration());
+ assertTrue(data.getPipconfiguration()!=null);
+ data.setRequired(true);
+ assertTrue(data.isRequired());
+ data.toString();
+ }
+
+ @Test
+ public void testPIPResolverParam(){
+ PIPResolverParam data = new PIPResolverParam();
+ new PIPResolverParam("test");
+ new PIPResolverParam(new PIPResolverParam());
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setParamName("Test");
+ assertTrue("Test".equals(data.getParamName()));
+ data.setParamValue("Test");
+ assertTrue("Test".equals(data.getParamValue()));
+ data.setParamDefault("Test");
+ assertTrue("Test".equals(data.getParamDefault()));
+ data.setPipresolver(new PIPResolver());
+ assertTrue(data.getPipresolver()!=null);
+ data.setRequired(true);
+ assertTrue(data.isRequired());
+ data.toString();
+ }
+
+ @Test
+ public void testPIPType(){
+ PIPType data = new PIPType();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setType("Test");
+ assertTrue("Test".equals(data.getType()));
+ data.setPipconfigurations(new HashSet<>());
+ assertTrue(data.getPipconfigurations()!=null);
+ data.addPipconfiguration(new PIPConfiguration());
+ data.removePipconfiguration(new PIPConfiguration());
+ data.setType("SQL");
+ assertTrue(data.isSQL());
+ data.setType("LDAP");
+ assertTrue(data.isLDAP());
+ data.setType("CSV");
+ assertTrue(data.isCSV());
+ data.setType("Hyper-CSV");
+ assertTrue(data.isHyperCSV());
+ data.setType("Custom");
+ assertTrue(data.isCustom());
+ }
+
+ @Test
+ public void testPIPResolver(){
+ PIPResolver data = new PIPResolver();
+ new PIPResolver(new PIPResolver());
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setIssuer("Test");
+ assertTrue("Test".equals(data.getIssuer()));
+ data.setClassname("Test");
+ assertTrue("Test".equals(data.getClassname()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setPipconfiguration(new PIPConfiguration());
+ assertTrue(data.getPipconfiguration()!=null);
+ data.setPipresolverParams(new HashSet<>());
+ assertTrue(data.getPipresolverParams()!=null);
+ data.addPipresolverParam(new PIPResolverParam());
+ data.removePipresolverParam(new PIPResolverParam());
+ data.clearParams();
+ data.getConfiguration("test");
+ data.setReadOnly(true);
+ assertTrue(data.isReadOnly());
+ data.toString();
+ Properties properties = new Properties();
+ data.generateProperties(properties,"test");
+ try {
+ data.readProperties("test", properties);
+ } catch (PIPException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void testPIPConfiguration(){
+ PIPConfiguration data = new PIPConfiguration();
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setIssuer("Test");
+ assertTrue("Test".equals(data.getIssuer()));
+ data.setClassname("Test");
+ assertTrue("Test".equals(data.getClassname()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ try {
+ data.readProperties("test", data.generateProperties("test"));
+ } catch (PIPException e) {
+ fail();
+ }
+ data.setPiptype(new PIPType());
+ assertTrue(data.getPiptype()!=null);
+ data.setPipresolvers(new HashSet<>());
+ assertTrue(data.getPipresolvers()!=null);
+ data.addPipresolver(new PIPResolver());
+ data.removePipresolver(new PIPResolver());
+ data.getConfiguration("test");
+ data.setReadOnly(true);
+ assertTrue(data.isReadOnly());
+ data.setRequiresResolvers(true);
+ assertTrue(data.requiresResolvers());
+ data.toString();
+ }
+
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java
index 25ea391ca..706471281 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java
@@ -30,177 +30,177 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class PolicyEntityJPATest {
- private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testPolicyGroupEntity(){
- PolicyGroupEntity data = new PolicyGroupEntity();
- data.setGroupKey(1);
- assertTrue(1 == data.getGroupKey());
- data.setPolicyid(1);
- assertTrue(1 == data.getPolicyid());
- }
-
- @Test
- public void testPolicyDBDaoEntity(){
- PolicyDBDaoEntity data = new PolicyDBDaoEntity();
- data.prePersist();
- data.preUpdate();
- data.setPolicyDBDaoUrl("Test");
- assertTrue("Test".equals(data.getPolicyDBDaoUrl()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.setUsername("Test");
- assertTrue("Test".equals(data.getUsername()));
- data.setPassword("Test");
- assertTrue("Test".equals(data.getPassword()));
- }
-
- @Test
- public void testDatabaseLockEntity(){
- DatabaseLockEntity data = new DatabaseLockEntity();
- data.setKey(1);
- assertTrue(1 == data.getKey());
- }
-
- @Test
- public void testPolicyEntity(){
- PolicyEntity data = new PolicyEntity();
- data.prePersist();
- data.preUpdate();
- data.setPolicyName("Test");
- assertTrue("Test".equals(data.getPolicyName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.setPolicyData("Test");
- assertTrue("Test".equals(data.getPolicyData()));
- data.setConfigurationData(new ConfigurationDataEntity());
- assertTrue(data.getConfigurationData()!=null);
- data.setActionBodyEntity(new ActionBodyEntity());
- assertTrue(data.getActionBodyEntity()!=null);
- data.setScope("Test");
- assertTrue("Test".equals(data.getScope()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setDeleted(true);
- assertTrue(data.isDeleted());
- data.equals(new PolicyEntity());
- data.hashCode();
- }
-
- @Test
- public void testActionBodyEntity(){
- ActionBodyEntity data = new ActionBodyEntity();
- data.prePersist();
- data.preUpdate();
- data.setActionBodyName("Test");
- assertTrue("Test".equals(data.getActionBodyName()));
- data.setActionBody("Test");
- assertTrue("Test".equals(data.getActionBody()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setModifiedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.setDeleted(true);
- assertTrue(data.isDeleted());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.equals(new ConfigurationDataEntity());
- data.hashCode();
- }
-
- @Test
- public void testConfigurationDataEntity(){
- ConfigurationDataEntity data = new ConfigurationDataEntity();
- data.prePersist();
- data.preUpdate();
- data.setConfigurationName("Test");
- assertTrue("Test".equals(data.getConfigurationName()));
- data.setConfigType("Test");
- assertTrue("Test".equals(data.getConfigType()));
- data.setConfigBody("Test");
- assertTrue("Test".equals(data.getConfigBody()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setModifiedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.setDeleted(true);
- assertTrue(data.isDeleted());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- data.equals(new ConfigurationDataEntity());
- data.hashCode();
- }
-
- @Test
- public void testPdpEntity(){
- PdpEntity data = new PdpEntity();
- data.prePersist();
- data.preUpdate();
- data.setPdpId("Test");
- assertTrue("Test".equals(data.getPdpId()));
- data.setPdpName("Test");
- assertTrue("Test".equals(data.getPdpName()));
- data.setGroup(new GroupEntity());
- assertTrue(data.getGroup()!=null);
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setJmxPort(1);
- assertTrue(1 == data.getJmxPort());
- data.setDeleted(true);
- assertTrue(data.isDeleted());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- }
-
- @Test
- public void testGroupEntity(){
- GroupEntity data = new GroupEntity();
- data.prePersist();
- data.preUpdate();
- data.setGroupId("Test");
- assertTrue("Test".equals(data.getGroupId()));
- data.setGroupName("Test");
- assertTrue("Test".equals(data.getgroupName()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setDefaultGroup(true);
- assertTrue(data.isDefaultGroup());
- data.setDeleted(true);
- assertTrue(data.isDeleted());
- assertTrue(data.getCreatedDate()!=null);
- assertTrue(data.getModifiedDate()!=null);
- }
+ private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testPolicyGroupEntity(){
+ PolicyGroupEntity data = new PolicyGroupEntity();
+ data.setGroupKey(1);
+ assertTrue(1 == data.getGroupKey());
+ data.setPolicyid(1);
+ assertTrue(1 == data.getPolicyid());
+ }
+
+ @Test
+ public void testPolicyDBDaoEntity(){
+ PolicyDBDaoEntity data = new PolicyDBDaoEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setPolicyDBDaoUrl("Test");
+ assertTrue("Test".equals(data.getPolicyDBDaoUrl()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUsername("Test");
+ assertTrue("Test".equals(data.getUsername()));
+ data.setPassword("Test");
+ assertTrue("Test".equals(data.getPassword()));
+ }
+
+ @Test
+ public void testDatabaseLockEntity(){
+ DatabaseLockEntity data = new DatabaseLockEntity();
+ data.setKey(1);
+ assertTrue(1 == data.getKey());
+ }
+
+ @Test
+ public void testPolicyEntity(){
+ PolicyEntity data = new PolicyEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setPolicyName("Test");
+ assertTrue("Test".equals(data.getPolicyName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.setPolicyData("Test");
+ assertTrue("Test".equals(data.getPolicyData()));
+ data.setConfigurationData(new ConfigurationDataEntity());
+ assertTrue(data.getConfigurationData()!=null);
+ data.setActionBodyEntity(new ActionBodyEntity());
+ assertTrue(data.getActionBodyEntity()!=null);
+ data.setScope("Test");
+ assertTrue("Test".equals(data.getScope()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setDeleted(true);
+ assertTrue(data.isDeleted());
+ data.equals(new PolicyEntity());
+ data.hashCode();
+ }
+
+ @Test
+ public void testActionBodyEntity(){
+ ActionBodyEntity data = new ActionBodyEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setActionBodyName("Test");
+ assertTrue("Test".equals(data.getActionBodyName()));
+ data.setActionBody("Test");
+ assertTrue("Test".equals(data.getActionBody()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setModifiedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.setDeleted(true);
+ assertTrue(data.isDeleted());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.equals(new ConfigurationDataEntity());
+ data.hashCode();
+ }
+
+ @Test
+ public void testConfigurationDataEntity(){
+ ConfigurationDataEntity data = new ConfigurationDataEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setConfigurationName("Test");
+ assertTrue("Test".equals(data.getConfigurationName()));
+ data.setConfigType("Test");
+ assertTrue("Test".equals(data.getConfigType()));
+ data.setConfigBody("Test");
+ assertTrue("Test".equals(data.getConfigBody()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setModifiedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.setDeleted(true);
+ assertTrue(data.isDeleted());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ data.equals(new ConfigurationDataEntity());
+ data.hashCode();
+ }
+
+ @Test
+ public void testPdpEntity(){
+ PdpEntity data = new PdpEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setPdpId("Test");
+ assertTrue("Test".equals(data.getPdpId()));
+ data.setPdpName("Test");
+ assertTrue("Test".equals(data.getPdpName()));
+ data.setGroup(new GroupEntity());
+ assertTrue(data.getGroup()!=null);
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setJmxPort(1);
+ assertTrue(1 == data.getJmxPort());
+ data.setDeleted(true);
+ assertTrue(data.isDeleted());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ }
+
+ @Test
+ public void testGroupEntity(){
+ GroupEntity data = new GroupEntity();
+ data.prePersist();
+ data.preUpdate();
+ data.setGroupId("Test");
+ assertTrue("Test".equals(data.getGroupId()));
+ data.setGroupName("Test");
+ assertTrue("Test".equals(data.getgroupName()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setDefaultGroup(true);
+ assertTrue(data.isDefaultGroup());
+ data.setDeleted(true);
+ assertTrue(data.isDeleted());
+ assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getModifiedDate()!=null);
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java
index 934c27ba6..3ada4dfca 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java
@@ -30,161 +30,161 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class PolicyUtilsJPATest {
- private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class);
- private UserInfo userInfo;
-
- @Before
- public void setUp() throws Exception {
- logger.info("setUp: Entering");
- userInfo = new UserInfo();
- userInfo.setUserLoginId("Test");
- userInfo.setUserName("Test");
- logger.info("setUp: exit");
- }
-
- @Test
- public void testWatchPolicyNotificationTable(){
- WatchPolicyNotificationTable data = new WatchPolicyNotificationTable();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setPolicyName("Test");
- assertTrue("Test".equals(data.getPolicyName()));
- data.setLoginIds("Test");
- assertTrue("Test".equals(data.getLoginIds()));
- data.equals(data);
- data.hashCode();
- }
-
- @Test
- public void testPolicyRoles(){
- PolicyRoles data = new PolicyRoles();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setScope("Test");
- assertTrue("Test".equals(data.getScope()));
- data.setRole("Test");
- assertTrue("Test".equals(data.getRole()));
- data.setLoginId(userInfo);
- assertTrue("Test".equals(data.getLoginId().getUserLoginId()));
- }
-
- @Test
- public void testPolicyVersion(){
- PolicyVersion data = new PolicyVersion();
- new PolicyVersion("Test", "Test");
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setActiveVersion(1);
- assertTrue(1 == data.getActiveVersion());
- data.setHigherVersion(1);
- assertTrue(1 == data.getHigherVersion());
- data.setPolicyName("Test");
- assertTrue("Test".equals(data.getPolicyName()));
- data.setCreatedBy("Test");
- assertTrue("Test".equals(data.getCreatedBy()));
- data.setModifiedBy("Test");
- assertTrue("Test".equals(data.getModifiedBy()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.equals(data);
- data.hashCode();
- }
-
- @Test
- public void testSystemLogDB(){
- SystemLogDB data = new SystemLogDB();
- new SystemLogDB(1, "","","","","");
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setType("Test");
- assertTrue("Test".equals(data.getType()));
- data.setSystem("Test");
- assertTrue("Test".equals(data.getSystem()));
- data.setRemote("Test");
- assertTrue("Test".equals(data.getRemote()));
- data.setLogtype("Test");
- assertTrue("Test".equals(data.getLogtype()));
- data.setDate(new Date());
- assertTrue(data.getDate()!=null);
- }
-
- @Test
- public void testRemoteCatalogValues(){
- RemoteCatalogValues data = new RemoteCatalogValues();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setValue("Test");
- assertTrue("Test".equals(data.getValue()));
- }
-
- @Test
- public void testPolicyScore(){
- PolicyScore data = new PolicyScore();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setPolicyName("Test");
- assertTrue("Test".equals(data.getPolicyName()));
- data.setVersionExtension("Test");
- assertTrue("Test".equals(data.getVersionExtension()));
- data.setPolicyScore("Test");
- assertTrue("Test".equals(data.getPolicyScore()));
- }
-
- @Test
- public void testPolicyEditorScopes(){
- PolicyEditorScopes data = new PolicyEditorScopes();
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setScopeName("Test");
- assertTrue("Test".equals(data.getScopeName()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testDescriptiveScope(){
- DescriptiveScope data = new DescriptiveScope();
- data.prePersist();
- data.preUpdate();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setScopeName("Test");
- assertTrue("Test".equals(data.getScopeName()));
- data.setSearch("Test");
- assertTrue("Test".equals(data.getSearch()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
- }
-
- @Test
- public void testGlobalRoleSettings(){
- GlobalRoleSettings data = new GlobalRoleSettings();
- new GlobalRoleSettings(true);
- data.setRole("Test");
- assertTrue("Test".equals(data.getRole()));
- data.setLockdown(true);
- assertTrue(data.isLockdown());
- }
+ private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class);
+ private UserInfo userInfo;
+
+ @Before
+ public void setUp() throws Exception {
+ logger.info("setUp: Entering");
+ userInfo = new UserInfo();
+ userInfo.setUserLoginId("Test");
+ userInfo.setUserName("Test");
+ logger.info("setUp: exit");
+ }
+
+ @Test
+ public void testWatchPolicyNotificationTable(){
+ WatchPolicyNotificationTable data = new WatchPolicyNotificationTable();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setPolicyName("Test");
+ assertTrue("Test".equals(data.getPolicyName()));
+ data.setLoginIds("Test");
+ assertTrue("Test".equals(data.getLoginIds()));
+ data.equals(data);
+ data.hashCode();
+ }
+
+ @Test
+ public void testPolicyRoles(){
+ PolicyRoles data = new PolicyRoles();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setScope("Test");
+ assertTrue("Test".equals(data.getScope()));
+ data.setRole("Test");
+ assertTrue("Test".equals(data.getRole()));
+ data.setLoginId(userInfo);
+ assertTrue("Test".equals(data.getLoginId().getUserLoginId()));
+ }
+
+ @Test
+ public void testPolicyVersion(){
+ PolicyVersion data = new PolicyVersion();
+ new PolicyVersion("Test", "Test");
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setActiveVersion(1);
+ assertTrue(1 == data.getActiveVersion());
+ data.setHigherVersion(1);
+ assertTrue(1 == data.getHigherVersion());
+ data.setPolicyName("Test");
+ assertTrue("Test".equals(data.getPolicyName()));
+ data.setCreatedBy("Test");
+ assertTrue("Test".equals(data.getCreatedBy()));
+ data.setModifiedBy("Test");
+ assertTrue("Test".equals(data.getModifiedBy()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.equals(data);
+ data.hashCode();
+ }
+
+ @Test
+ public void testSystemLogDB(){
+ SystemLogDB data = new SystemLogDB();
+ new SystemLogDB(1, "","","","","");
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setType("Test");
+ assertTrue("Test".equals(data.getType()));
+ data.setSystem("Test");
+ assertTrue("Test".equals(data.getSystem()));
+ data.setRemote("Test");
+ assertTrue("Test".equals(data.getRemote()));
+ data.setLogtype("Test");
+ assertTrue("Test".equals(data.getLogtype()));
+ data.setDate(new Date());
+ assertTrue(data.getDate()!=null);
+ }
+
+ @Test
+ public void testRemoteCatalogValues(){
+ RemoteCatalogValues data = new RemoteCatalogValues();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setValue("Test");
+ assertTrue("Test".equals(data.getValue()));
+ }
+
+ @Test
+ public void testPolicyScore(){
+ PolicyScore data = new PolicyScore();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setPolicyName("Test");
+ assertTrue("Test".equals(data.getPolicyName()));
+ data.setVersionExtension("Test");
+ assertTrue("Test".equals(data.getVersionExtension()));
+ data.setPolicyScore("Test");
+ assertTrue("Test".equals(data.getPolicyScore()));
+ }
+
+ @Test
+ public void testPolicyEditorScopes(){
+ PolicyEditorScopes data = new PolicyEditorScopes();
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setScopeName("Test");
+ assertTrue("Test".equals(data.getScopeName()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testDescriptiveScope(){
+ DescriptiveScope data = new DescriptiveScope();
+ data.prePersist();
+ data.preUpdate();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setScopeName("Test");
+ assertTrue("Test".equals(data.getScopeName()));
+ data.setSearch("Test");
+ assertTrue("Test".equals(data.getSearch()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate()!=null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate()!=null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy()!=null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy()!=null);
+ }
+
+ @Test
+ public void testGlobalRoleSettings(){
+ GlobalRoleSettings data = new GlobalRoleSettings();
+ new GlobalRoleSettings(true);
+ data.setRole("Test");
+ assertTrue("Test".equals(data.getRole()));
+ data.setLockdown(true);
+ assertTrue(data.isLockdown());
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java
index 85a11d4d5..1064b240d 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java
@@ -27,47 +27,47 @@ import org.junit.Test;
public class MSAttributeObjectTest {
- @Test
- public void testMSAttributeObject(){
- MSAttributeObject data = new MSAttributeObject();
- data.setClassName("Test");
- assertTrue("Test".equals(data.getClassName()));
- data.setRefAttribute(new HashMap<>());
- assertTrue(data.getRefAttribute()!=null);
- data.setAttribute(new HashMap<>());
- assertTrue(data.getAttribute()!=null);
- data.setEnumType(new HashMap<>());
- assertTrue(data.getEnumType()!=null);
- data.addAttribute("test", "test");
- data.addRefAttribute("test", "test");
- data.addAllAttribute(new HashMap<>());
- data.addAllRefAttribute(new HashMap<>());
- data.setSubClass(new HashMap<>());
- assertTrue(data.getSubClass()!=null);
- data.addAllSubClass(new HashMap<>());
- data.setDependency("Test");
- assertTrue("Test".equals(data.getDependency()));
- data.addSingleEnum("test", "test");
- data.setMatchingSet(new HashMap<>());
- assertTrue(data.getMatchingSet()!=null);
- data.addMatchingSet("test", "test");
- data.addMatchingSet(new HashMap<>());
- data.setPolicyTempalate(true);
- assertTrue(data.isPolicyTempalate());
- }
-
- @Test
- public void testMSAttributeValue(){
- MSAttributeValue data = new MSAttributeValue();
- data.setName("Test");
- assertTrue("Test".equals(data.getName()));
- data.setType("Test");
- assertTrue("Test".equals(data.getType()));
- data.setRequired(true);
- assertTrue(data.getRequired());
- data.setArrayValue(true);
- assertTrue(data.getArrayValue());
- data.setDefaultValue("Test");
- assertTrue("Test".equals(data.getDefaultValue()));
- }
+ @Test
+ public void testMSAttributeObject(){
+ MSAttributeObject data = new MSAttributeObject();
+ data.setClassName("Test");
+ assertTrue("Test".equals(data.getClassName()));
+ data.setRefAttribute(new HashMap<>());
+ assertTrue(data.getRefAttribute()!=null);
+ data.setAttribute(new HashMap<>());
+ assertTrue(data.getAttribute()!=null);
+ data.setEnumType(new HashMap<>());
+ assertTrue(data.getEnumType()!=null);
+ data.addAttribute("test", "test");
+ data.addRefAttribute("test", "test");
+ data.addAllAttribute(new HashMap<>());
+ data.addAllRefAttribute(new HashMap<>());
+ data.setSubClass(new HashMap<>());
+ assertTrue(data.getSubClass()!=null);
+ data.addAllSubClass(new HashMap<>());
+ data.setDependency("Test");
+ assertTrue("Test".equals(data.getDependency()));
+ data.addSingleEnum("test", "test");
+ data.setMatchingSet(new HashMap<>());
+ assertTrue(data.getMatchingSet()!=null);
+ data.addMatchingSet("test", "test");
+ data.addMatchingSet(new HashMap<>());
+ data.setPolicyTempalate(true);
+ assertTrue(data.isPolicyTempalate());
+ }
+
+ @Test
+ public void testMSAttributeValue(){
+ MSAttributeValue data = new MSAttributeValue();
+ data.setName("Test");
+ assertTrue("Test".equals(data.getName()));
+ data.setType("Test");
+ assertTrue("Test".equals(data.getType()));
+ data.setRequired(true);
+ assertTrue(data.getRequired());
+ data.setArrayValue(true);
+ assertTrue(data.getArrayValue());
+ data.setDefaultValue("Test");
+ assertTrue("Test".equals(data.getDefaultValue()));
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java
index 6a9c4c4ec..e06103fcb 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java
@@ -36,102 +36,102 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE;
public class MSModelUtilsTest {
- private static Logger logger = FlexLogger.getLogger(MSModelUtilsTest.class);
- @Test
- public void testMSModelUtils(){
- HashMap<String, MSAttributeObject> classMap = new HashMap<>();
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("DKaTVESPolicy-v1802.xmi").getFile());
- MSModelUtils utils = new MSModelUtils("http://org.onap", "http://org.onap.policy");
- Map<String, MSAttributeObject> tempMap = utils.processEpackage(file.getAbsolutePath().toString(), MODEL_TYPE.XMI);
- classMap.putAll(tempMap);
- MSAttributeObject mainClass = classMap.get("StandardDeviationThreshold");
- String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[]{"[", "]", " "}, new String[]{"", "", ""});
- List<String> dependency = new ArrayList<String>(Arrays.asList(dependTemp.split(",")));
- dependency = utils.getFullDependencyList(dependency, classMap);
- String subAttribute = utils.createSubAttributes(dependency, classMap, "StandardDeviationThreshold");
- assertTrue(subAttribute != null);
- }
-
-
- /**
- * Run the void stringBetweenDots(String, String) method test
- */
-
- @Test
- public void testStringBetweenDots() {
-
- //expect: uniqueKeys should contain a string value
- MSModelUtils controllerA = new MSModelUtils();
- String str = "testing\\.byCorrectWay\\.OfDATA";
- assertEquals(1, controllerA.stringBetweenDots(str));
-
- //expect: uniqueKeys should not contain a string value
- str = "testing\byWrongtWay.\\OfDATA";
- MSModelUtils controllerB = new MSModelUtils();
- assertEquals(0, controllerB.stringBetweenDots(str));
- }
-
- /**
- * Run the Map<String,String> load(String) method test
- */
-
- @Test
- public void testLoad() {
-
- boolean isLocalTesting = true;
- MSModelUtils controller = new MSModelUtils();
- String fileName = null;
- Map<String,String> result = null;
- try {
- ClassLoader classLoader = getClass().getClassLoader();
- fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath();
- } catch (Exception e1) {
- logger.error("Exception Occured while loading file"+e1);
- }
- if(isLocalTesting){
- try {
- result = controller.load(fileName);
- } catch (IOException e) {
- logger.error("testLoad", e);
- result = null;
- }catch(ParserException e){
- logger.error("testLoad", e);
- }
-
- assertTrue(result != null && !result.isEmpty());
- logger.debug("result : " + result);
- }
-
- logger.debug("testLoad: exit");
- }
-
- /**
- * Run the void parseTosca(String) method test
- */
-
- @Test
- public void testParseTosca() {
-
- logger.debug("testParseTosca: enter");
- boolean isLocalTesting = true;
- String fileName = null;
- try {
- ClassLoader classLoader = getClass().getClassLoader();
- fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath();
- } catch (Exception e1) {
- logger.error("Exception Occured while loading file"+e1);
- }
-
- MSModelUtils controller = new MSModelUtils();
+ private static Logger logger = FlexLogger.getLogger(MSModelUtilsTest.class);
+ @Test
+ public void testMSModelUtils(){
+ HashMap<String, MSAttributeObject> classMap = new HashMap<>();
+ ClassLoader classLoader = getClass().getClassLoader();
+ File file = new File(classLoader.getResource("DKaTVESPolicy-v1802.xmi").getFile());
+ MSModelUtils utils = new MSModelUtils("http://org.onap", "http://org.onap.policy");
+ Map<String, MSAttributeObject> tempMap = utils.processEpackage(file.getAbsolutePath().toString(), MODEL_TYPE.XMI);
+ classMap.putAll(tempMap);
+ MSAttributeObject mainClass = classMap.get("StandardDeviationThreshold");
+ String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[]{"[", "]", " "}, new String[]{"", "", ""});
+ List<String> dependency = new ArrayList<String>(Arrays.asList(dependTemp.split(",")));
+ dependency = utils.getFullDependencyList(dependency, classMap);
+ String subAttribute = utils.createSubAttributes(dependency, classMap, "StandardDeviationThreshold");
+ assertTrue(subAttribute != null);
+ }
+
+
+ /**
+ * Run the void stringBetweenDots(String, String) method test
+ */
+
+ @Test
+ public void testStringBetweenDots() {
+
+ //expect: uniqueKeys should contain a string value
+ MSModelUtils controllerA = new MSModelUtils();
+ String str = "testing\\.byCorrectWay\\.OfDATA";
+ assertEquals(1, controllerA.stringBetweenDots(str));
+
+ //expect: uniqueKeys should not contain a string value
+ str = "testing\byWrongtWay.\\OfDATA";
+ MSModelUtils controllerB = new MSModelUtils();
+ assertEquals(0, controllerB.stringBetweenDots(str));
+ }
+
+ /**
+ * Run the Map<String,String> load(String) method test
+ */
+
+ @Test
+ public void testLoad() {
+
+ boolean isLocalTesting = true;
+ MSModelUtils controller = new MSModelUtils();
+ String fileName = null;
+ Map<String,String> result = null;
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured while loading file"+e1);
+ }
+ if(isLocalTesting){
+ try {
+ result = controller.load(fileName);
+ } catch (IOException e) {
+ logger.error("testLoad", e);
+ result = null;
+ }catch(ParserException e){
+ logger.error("testLoad", e);
+ }
+
+ assertTrue(result != null && !result.isEmpty());
+ logger.debug("result : " + result);
+ }
+
+ logger.debug("testLoad: exit");
+ }
+
+ /**
+ * Run the void parseTosca(String) method test
+ */
+
+ @Test
+ public void testParseTosca() {
+
+ logger.debug("testParseTosca: enter");
+ boolean isLocalTesting = true;
+ String fileName = null;
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured while loading file"+e1);
+ }
+
+ MSModelUtils controller = new MSModelUtils();
if(isLocalTesting){
- try {
- controller.parseTosca(fileName);
- }catch (Exception e) {
- fail("parseTosca caused error: " + e);
- }
+ try {
+ controller.parseTosca(fileName);
+ }catch (Exception e) {
+ fail("parseTosca caused error: " + e);
+ }
}
- logger.debug("testParseTosca: exit");
- }
+ logger.debug("testParseTosca: exit");
+ }
} \ No newline at end of file
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java
index fb51c2871..6051db4c3 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java
@@ -31,50 +31,50 @@ import org.onap.policy.api.PolicyParameters;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
public class PolicyValidationTest {
-
- @Before
- public void setUp() throws Exception {
- }
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void microServicePolicyTests() throws Exception{
- PolicyValidation validation = new PolicyValidation();
- PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper();
- PolicyParameters policyParameters = new PolicyParameters();
-
- policyParameters.setPolicyConfigType(PolicyConfigType.MicroService);
- policyParameters.setPolicyName("Test.junitPolicy");
- policyParameters.setPolicyDescription("This is a sample Micro Service policy Create example");
- policyParameters.setOnapName("DCAE");
- policyParameters.setPriority("1");
- String MSjsonString = "{\"service\":\"TOSCA_namingJenny\",\"location\":\"Test DictMSLoc\",\"uuid\":\"testDict DCAEUIID\",\"policyName\":\"testModelValidation\",\"description\":\"test\",\"configName\":\"testDict MSConfName\",\"templateVersion\":\"1607\",\"version\":\"gw12181031\",\"priority\":\"5\",\"policyScope\":\"resource=ResourcetypeVenktest1,service=ServiceName1707,type=Name1707,closedLoopControlName=Retest_retest1\",\"riskType\":\"Test\",\"riskLevel\":\"3\",\"guard\":\"True\",\"content\":{\"police-instance-name\":\"testing\",\"naming-models\":[{\"naming-properties\":[{\"property-value\":\"test\",\"source-endpoint\":\"test\",\"property-name\":\"testPropertyname\",\"increment-sequence\":{\"scope\":\"VNF\",\"start-value\":\"1\",\"length\":\"3\",\"increment\":\"2\"},\"source-system\":\"TOSCA\"}],\"naming-type\":\"testNamingType\",\"naming-recipe\":\"testNamingRecipe\"}]}}";;
- policyParameters.setConfigBody(MSjsonString);
- policyParameters.setRequestID(UUID.randomUUID());
- SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
- Date date = dateformat3.parse("15/10/2016");
- policyParameters.setTtlDate(date);
- policyParameters.setGuard(true);
- policyParameters.setRiskLevel("5");
- policyParameters.setRiskType("TEST");
- policyParameters.setRequestID(UUID.randomUUID());
+ @Before
+ public void setUp() throws Exception {
+ }
-
- PolicyRestAdapter policyData = wrapper.populateRequestParameters(policyParameters);
- StringBuilder responseString = validation.validatePolicy(policyData);
-
- assertNotSame("success", responseString.toString());
+ @After
+ public void tearDown() throws Exception {
+ }
- }
+ @Test
+ public void microServicePolicyTests() throws Exception{
+ PolicyValidation validation = new PolicyValidation();
+ PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper();
+ PolicyParameters policyParameters = new PolicyParameters();
- @Test
- public final void testEmailValidation() {
- PolicyValidation validation = new PolicyValidation();
- String result = validation.emailValidation("testemail@test.com", "SUCCESS");
- assertEquals("success", result);
- }
+ policyParameters.setPolicyConfigType(PolicyConfigType.MicroService);
+ policyParameters.setPolicyName("Test.junitPolicy");
+ policyParameters.setPolicyDescription("This is a sample Micro Service policy Create example");
+ policyParameters.setOnapName("DCAE");
+ policyParameters.setPriority("1");
+ String MSjsonString = "{\"service\":\"TOSCA_namingJenny\",\"location\":\"Test DictMSLoc\",\"uuid\":\"testDict DCAEUIID\",\"policyName\":\"testModelValidation\",\"description\":\"test\",\"configName\":\"testDict MSConfName\",\"templateVersion\":\"1607\",\"version\":\"gw12181031\",\"priority\":\"5\",\"policyScope\":\"resource=ResourcetypeVenktest1,service=ServiceName1707,type=Name1707,closedLoopControlName=Retest_retest1\",\"riskType\":\"Test\",\"riskLevel\":\"3\",\"guard\":\"True\",\"content\":{\"police-instance-name\":\"testing\",\"naming-models\":[{\"naming-properties\":[{\"property-value\":\"test\",\"source-endpoint\":\"test\",\"property-name\":\"testPropertyname\",\"increment-sequence\":{\"scope\":\"VNF\",\"start-value\":\"1\",\"length\":\"3\",\"increment\":\"2\"},\"source-system\":\"TOSCA\"}],\"naming-type\":\"testNamingType\",\"naming-recipe\":\"testNamingRecipe\"}]}}";;
+ policyParameters.setConfigBody(MSjsonString);
+ policyParameters.setRequestID(UUID.randomUUID());
+ SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateformat3.parse("15/10/2016");
+ policyParameters.setTtlDate(date);
+ policyParameters.setGuard(true);
+ policyParameters.setRiskLevel("5");
+ policyParameters.setRiskType("TEST");
+ policyParameters.setRequestID(UUID.randomUUID());
+
+
+ PolicyRestAdapter policyData = wrapper.populateRequestParameters(policyParameters);
+ StringBuilder responseString = validation.validatePolicy(policyData);
+
+ assertNotSame("success", responseString.toString());
+
+ }
+
+ @Test
+ public final void testEmailValidation() {
+ PolicyValidation validation = new PolicyValidation();
+ String result = validation.emailValidation("testemail@test.com", "SUCCESS");
+ assertEquals("success", result);
+ }
}