Merge "Reformat PolicyEngineAPI test cases"
authorJorge Hernandez <jorge.hernandez-herrero@att.com>
Fri, 15 Feb 2019 17:19:30 +0000 (17:19 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 15 Feb 2019 17:19:30 +0000 (17:19 +0000)
31 files changed:
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JPAUtilsTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/util/JsonMessageTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/api/XACMLErrorConstantsTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineFactoryTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupStatusTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPGroupTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPItemSetChangeNotifierTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPIPConfigTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPPolicyTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPStatusTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPDPTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pip/engines/OperationHistoryEngineTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/MetricsUtilTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyScannerTest.java
ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/XACMLPolicyWriterTest.java

index a04859b..b80eaed 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,13 +23,11 @@ package org.onap.policy.pap.xacml.rest.components;
 
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.when;
-
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,7 +35,6 @@ import org.mockito.Mockito;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.rest.adapter.PolicyRestAdapter;
-
 import com.att.research.xacml.util.XACMLProperties;
 
 
@@ -50,14 +49,14 @@ public class ActionPolicyTest {
     Map<String, String> attributeMap = new HashMap<>();
     ActionPolicy component = null;
 
-
     /**
      * @throws java.lang.Exception
      */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
-        System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
+        System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,
+                "src/test/resources/xacml.pap.properties");
 
         dynamicRuleAlgorithmLabels.add("test");
         dynamicRuleAlgorithmField1.add("testField1");
@@ -66,13 +65,14 @@ public class ActionPolicyTest {
 
         policyAdapter.setPolicyName("Test.Action_junitTest");
         policyAdapter.setPolicyDescription("test");
-        policyAdapter.setRuleCombiningAlgId("urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
+        policyAdapter.setRuleCombiningAlgId(
+                "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
         policyAdapter.setPolicyType("Action");
         policyAdapter.setEditPolicy(false);
         policyAdapter.setDomainDir("Test");
         policyAdapter.setNewFileName("Test.Action_junitTest.1.xml");
         policyAdapter.setHighestVersion(1);
-        policyAdapter.setPolicyID("urn:xacml:policy:id:"+UUID.randomUUID());
+        policyAdapter.setPolicyID("urn:xacml:policy:id:" + UUID.randomUUID());
 
         policyAdapter.setActionDictHeader("");
         policyAdapter.setActionDictType("REST");
@@ -98,31 +98,32 @@ public class ActionPolicyTest {
      * @throws java.lang.Exception
      */
     @After
-    public void tearDown() throws Exception {
-    }
+    public void tearDown() throws Exception {}
 
-/*     *//**
-     * Test method for {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#savePolicies()}.
+    /**
+     * Test method for
+     * {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#savePolicies()}.
      */
     @Test
     public void testSavePolicies() {
         ActionPolicy mockAction = Mockito.mock(component.getClass());
 
         Map<String, String> successMap = new HashMap<>();
-        
+
         successMap.put("success", "success");
 
         try {
             when(mockAction.savePolicies()).thenReturn(successMap);
             successMap = mockAction.savePolicies();
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
         }
-        assertEquals(successMap.get("success"),"success");
+        assertEquals(successMap.get("success"), "success");
     }
 
     /**
-     * Test method for {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#prepareToSave()}.
+     * Test method for
+     * {@link org.openecomp.policy.pap.xacml.rest.components.ActionPolicy#prepareToSave()}.
      */
     @Test
     public void testPrepareToSave() {
@@ -132,10 +133,8 @@ public class ActionPolicyTest {
         try {
             response = component.prepareToSave();
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
         }
         assertTrue(response);
-
     }
-
-}
\ No newline at end of file
+}
index a31d5a3..39586ba 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,38 +31,38 @@ import org.mockito.Mockito;
 import org.onap.policy.rest.dao.CommonClassDao;
 
 public class BRMSPolicyTest {
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
-  @Test
-  public void testConstructor1() {
-    CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate();
-    assertNotNull(template);
-  }
+    @Test
+    public void testConstructor1() {
+        CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate();
+        assertNotNull(template);
+    }
 
-  @Test
-  public void testConstructor2() {
-    CommonClassDao commonClassDao = null;
-    CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(commonClassDao);
-    assertNotNull(template);
-  }
+    @Test
+    public void testConstructor2() {
+        CommonClassDao commonClassDao = null;
+        CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(commonClassDao);
+        assertNotNull(template);
+    }
 
-  @Test
-  public void testReadFile() throws IOException {
-    String goodRule = "declare Params\nparam1 : int\nend\n";
-    String badRule = "declare Params\nparam1+ : int\nend\n";
-    assertEquals(CreateBRMSRuleTemplate.validateRuleParams(goodRule), true);
-    assertEquals(CreateBRMSRuleTemplate.validateRuleParams(badRule), false);
-  }
+    @Test
+    public void testReadFile() throws IOException {
+        String goodRule = "declare Params\nparam1 : int\nend\n";
+        String badRule = "declare Params\nparam1+ : int\nend\n";
+        assertEquals(CreateBRMSRuleTemplate.validateRuleParams(goodRule), true);
+        assertEquals(CreateBRMSRuleTemplate.validateRuleParams(badRule), false);
+    }
 
-  @Test
-  public void testAdd() {
-    CommonClassDao dao = Mockito.mock(CommonClassDao.class);
-    CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(dao);
-    String rule = "package foo\n";
-    String ruleName = "testName";
-    String description = "testDesc";
-    String userID = "testID";
-    assertEquals(1, template.addRule(rule, ruleName, description, userID).size());
-  }
+    @Test
+    public void testAdd() {
+        CommonClassDao dao = Mockito.mock(CommonClassDao.class);
+        CreateBRMSRuleTemplate template = new CreateBRMSRuleTemplate(dao);
+        String rule = "package foo\n";
+        String ruleName = "testName";
+        String description = "testDesc";
+        String userID = "testID";
+        assertEquals(1, template.addRule(rule, ruleName, description, userID).size());
+    }
 }
index 7910aed..1334f96 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,13 +24,10 @@ package org.onap.policy.pap.xacml.rest.controller;
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
 import java.io.BufferedReader;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
-
 import javax.servlet.http.HttpServletRequest;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -40,7 +39,8 @@ import org.onap.policy.rest.dao.CommonClassDao;
 import org.springframework.mock.web.MockHttpServletResponse;
 
 public class DecisionPolicyDictionaryControllerTest {
-    private static Logger logger = FlexLogger.getLogger(DecisionPolicyDictionaryControllerTest.class);
+    private static Logger logger =
+            FlexLogger.getLogger(DecisionPolicyDictionaryControllerTest.class);
     private static CommonClassDao commonClassDao;
     private String jsonString = null;
     private HttpServletRequest request = null;
@@ -51,21 +51,26 @@ public class DecisionPolicyDictionaryControllerTest {
         logger.info("setUp: Entering");
         commonClassDao = Mockito.mock(CommonClassDao.class);
         HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-        
-        jsonString = "{\"attributeDictionaryDatas\": {\"error\": \"\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                + " \"version\": \"\",\"createdBy\": \"someone\",      \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"   },"
-                + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                + "    \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                + "    \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                + "    \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+
+        jsonString =
+                "{\"attributeDictionaryDatas\": {\"error\": \"\",\"inprocess\": false,\"model\": "
+                        + "{\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
+                        + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+                        + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                        + "\"recursive\": false},"
+                        + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                        + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                        + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                        + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                        + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                        + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                        + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
 
         BufferedReader br = new BufferedReader(new StringReader(jsonString));
-        
-        //--- mock the getReader() call
-        when(request.getReader()).thenReturn(br);   
-        
+
+        // --- mock the getReader() call
+        when(request.getReader()).thenReturn(br);
+
         controller = new DecisionPolicyDictionaryController(commonClassDao);
         new DictionaryUtils(commonClassDao);
         DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
@@ -74,22 +79,22 @@ public class DecisionPolicyDictionaryControllerTest {
     }
 
     @After
-    public void tearDown() throws Exception {
-    }
+    public void tearDown() throws Exception {}
 
     @Test
     public void testGetSettingsDictionaryByNameEntityData() {
         logger.info("testGetSettingsDictionaryByNameEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getSettingsDictionaryByNameEntityData(request, response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("settingsDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
 
@@ -101,15 +106,16 @@ public class DecisionPolicyDictionaryControllerTest {
     public void testGetSettingsDictionaryEntityData() {
         logger.info("testGetSettingsDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getSettingsDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("settingsDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
 
@@ -121,21 +127,24 @@ public class DecisionPolicyDictionaryControllerTest {
     public void testSaveSettingsDictionary() {
         logger.info("testSaveSettingsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
-        
+
         try {
             // mock the getReader() call
-            jsonString = "{\"settingsDictionaryData\":{\"xacmlId\":\"testMMRestAPI1\",\"datatypeBean\":{\"shortName\":\"string\"},\"description\":\"test\",\"priority\":\"High\"}, \"userid\":\"test\"}";
+            jsonString = "{\"settingsDictionaryData\":{\"xacmlId\":\"testMMRestAPI1\","
+                    + "\"datatypeBean\": {\"shortName\":\"string\"},\"description\":\"test\","
+                    + "\"priority\":\"High\"}, \"userid\":\"test\"}";
 
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveSettingsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("settingsDictionaryDatas"));
 
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
 
@@ -147,130 +156,135 @@ public class DecisionPolicyDictionaryControllerTest {
     public void testRemoveSettingsDictionary() {
         logger.info("testRemoveSettingsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+                            + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                            + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\","
+                            + "\"subScopename\": \"\"},\"policy\": "
+                            + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeSettingsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("settingsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("settingsDictionaryDatas"));
 
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveSettingsDictionary: exit");
-
     }
 
     @Test
     public void testGetRainyDayDictionaryByNameEntityData() {
         logger.info("testGetRainyDayDictionaryByNameEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getRainyDayDictionaryByNameEntityData(request, response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("rainyDayDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
-
         logger.info("testGetRainyDayDictionaryByNameEntityData: exit");
-
     }
 
     @Test
     public void testGetRainyDayDictionaryEntityData() {
         logger.info("testGetRainyDayDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getRainyDayDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("rainyDayDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
-
         logger.info("testGetRainyDayDictionaryEntityData: exit");
-
     }
 
     @Test
     public void testSaveRainyDayDictionary() {
         logger.info("testSaveRainyDayDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
-        
+
         try {
             // mock the getReader() call
-            jsonString = "{\"rainyDayDictionaryData\":{\"bbid\":\"BB2\",\"workstep\":\"1\",\"userDataTypeValues\":[{\"$$hashKey\":\"object:233\",\"treatment\":\"test1\"},{\"$$hashKey\":\"object:239\",\"treatment\":\"test2\"}]},\"userid\":\"mm117s\"}";
+            jsonString =
+                    "{\"rainyDayDictionaryData\":{\"bbid\":\"BB2\",\"workstep\":\"1\",\"userDataTypeValues\""
+                            + ":[{\"$$hashKey\":\"object:233\",\"treatment\":\"test1\"},{\"$$hashKey\":\"object:239\","
+                            + "\"treatment\":\"test2\"}]},\"userid\":\"mm117s\"}";
 
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveRainyDayDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("rainyDayDictionaryDatas"));
 
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
-
         logger.info("testSaveRainyDayDictionary: exit");
-
     }
 
     @Test
     public void testRemoveRainyDayDictionary() {
         logger.info("testRemoveRainyDayDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": "
+                            + "\"someone\",\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeRainyDayDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("rainyDayDictionaryDatas"));
         } catch (Exception e) {
-            logger.error("Exception Occured"+e);
+            logger.error("Exception Occured" + e);
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveRainyDayDictionary: exit");
-
     }
-
-}
\ No newline at end of file
+}
index 2e9df25..213d774 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,15 +28,12 @@ import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
 import java.io.BufferedReader;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.servlet.http.HttpServletRequest;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -49,12 +48,11 @@ import org.onap.policy.rest.jpa.UserInfo;
 import org.springframework.mock.web.MockHttpServletResponse;
 
 /**
- * The class <code>MicroServiceDictionaryControllerTest</code> contains tests
- * for the class {@link <code>MicroServiceDictionaryController</code>}*
+ * The class <code>MicroServiceDictionaryControllerTest</code> contains tests for the class
+ * {@link <code>MicroServiceDictionaryController</code>}*
  *
- * All JUnits are designed to run in the local development environment
- * where they have write privileges and can execute time-sensitive
- * tasks.
+ * All JUnits are designed to run in the local development environment where they have write
+ * privileges and can execute time-sensitive tasks.
  */
 
 public class MicroServiceDictionaryControllerTest {
@@ -64,7 +62,7 @@ public class MicroServiceDictionaryControllerTest {
     private String jsonString = null;
     private HttpServletRequest request = null;
     private MicroServiceDictionaryController controller = null;
-     BufferedReader br = null;
+    BufferedReader br = null;
 
     @Before
     public void setUp() throws Exception {
@@ -73,64 +71,71 @@ public class MicroServiceDictionaryControllerTest {
         UserInfo userInfo = new UserInfo();
         userInfo.setUserLoginId("testUserId");
         userInfo.setUserName("John");
-        when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing")).thenReturn(userInfo);
-        
-        List<String>  listIds = new ArrayList<String>();
+        when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing"))
+                .thenReturn(userInfo);
+
+        List<String> listIds = new ArrayList<String>();
         listIds.add("Jack");
         when(commonClassDao.getDataByColumn(DCAEuuid.class, "name")).thenReturn(listIds);
-        
-        List<String>  microList = new ArrayList<String>();
+
+        List<String> microList = new ArrayList<String>();
         microList.add("MC-Model");
-        when(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name")).thenReturn(microList);
-        
-        List<Object>  listId = new ArrayList<Object>();
+        when(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name"))
+                .thenReturn(microList);
+
+        List<Object> listId = new ArrayList<Object>();
         listId.add("smith");
         when(commonClassDao.getData(DCAEuuid.class)).thenReturn(listId);
         MicroServiceModels microServiceModels = new MicroServiceModels();
-        
+
         doNothing().when(commonClassDao).delete(microServiceModels);
 
         MicroServiceDictionaryController.setCommonClassDao(commonClassDao);
 
         controller = new MicroServiceDictionaryController();
-       
+
         HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-        
-        jsonString = "{\"microServiceModelsDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                + " \"version\": \"\",\"createdBy\": \"someone\",      \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"   },"
-                + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                + "    \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                + "    \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                + "    \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
-    
+
+        jsonString =
+                "{\"microServiceModelsDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+                        + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+                        + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+                        + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                        + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                        + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                        + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                        + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                        + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                        + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                        + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+
         br = new BufferedReader(new StringReader(jsonString));
-        //--- mock the getReader() call
-        when(request.getReader()).thenReturn(br);   
+        // --- mock the getReader() call
+        when(request.getReader()).thenReturn(br);
         new DictionaryUtils(commonClassDao);
         DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
-        mock(DictionaryUtils.class);        
+        mock(DictionaryUtils.class);
         logger.info("setUp: exit");
     }
 
-
     @Test
     public void testSaveMicroServiceHeaderDefaultValues() {
         logger.info("testSaveMicroServiceHeaderDefaultValues: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"modelAttributeDictionaryData\": {\"onapName\": \"test\",  \"guard\": false,\"priority\": \"3\","
-                    + " \"riskType\": \"test\", \"riskLevel\": \"7\", \"modelName\": \"testname\"}}";
+            jsonString =
+                    "{\"modelAttributeDictionaryData\": {\"onapName\": \"test\",\"guard\": false,\"priority\": \"3\","
+                            + " \"riskType\": \"test\", \"riskLevel\": \"7\", \"modelName\": \"testname\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveMicroServiceHeaderDefaultValues(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -144,12 +149,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceHeaderDefaultsEntityDataByName() {
         logger.info("testGetMicroServiceHeaderDefaultsEntityDataByName: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceHeaderDefaultsEntityDataByName(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -162,12 +168,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceHeaderDefaultsEntityData() {
         logger.info("testGetMicroServiceHeaderDefaultsEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceHeaderDefaultsEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -180,24 +187,29 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveMicroServiceHeaderDefaults() {
         logger.info("testRemoveMicroServiceHeaderDefaults: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceHeaderDefaults(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceHeaderDefaultDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -212,12 +224,13 @@ public class MicroServiceDictionaryControllerTest {
 
         logger.info("testGetDCAEUUIDDictionaryByNameEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getDCAEUUIDDictionaryByNameEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -231,12 +244,13 @@ public class MicroServiceDictionaryControllerTest {
 
         logger.info("testGetDCAEUUIDDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getDCAEUUIDDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -249,29 +263,33 @@ public class MicroServiceDictionaryControllerTest {
     public void testSaveDCAEUUIDDictionary() {
         logger.info("testSaveDCAEUUIDDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"dcaeUUIDDictionaryData\": {\"modelName\": \"test\",       \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"dcaeUUIDDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+                            + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+                            + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
+                            + " \"version\": \"\",\"createdBy\": \"someone\",\"modifiedBy\": \"someone\","
+                            + "\"content\": \"\",\"recursive\": false},\"tempModel\": "
+                            + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveDCAEUUIDDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("dcaeUUIDDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testSaveDCAEUUIDDictionary: exit");
     }
 
@@ -279,29 +297,32 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveDCAEUUIDDictionary() {
         logger.info("testRemoveDCAEUUIDDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceConfigNameDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceConfigNameDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveDCAEUUIDDictionary: exit");
     }
 
@@ -309,12 +330,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceConfigNameByNameDictionaryEntityData() {
         logger.info("testGetMicroServiceConfigNameByNameDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceConfigNameByNameDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceConfigNameDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -327,12 +349,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceConfigNameDictionaryEntityData() {
         logger.info("testGetMicroServiceConfigNameByNameDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceConfigNameDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceConfigNameDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -345,29 +368,33 @@ public class MicroServiceDictionaryControllerTest {
     public void testSaveMicroServiceConfigNameDictionary() {
         logger.info("testSaveMicroServiceConfigNameDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"microServiceConfigNameDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"microServiceConfigNameDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+                            + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+                            + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+                            + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                            + "\"recursive\": false},\"tempModel\": {\"name\": \"testingdata\","
+                            + "\"subScopename\": \"\"},\"policy\": "
+                            + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveMicroServiceConfigNameDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceConfigNameDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testSaveMicroServiceConfigNameDictionary: exit");
     }
 
@@ -375,29 +402,32 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveMicroServiceConfigNameDictionary() {
         logger.info("testRemoveMicroServiceConfigNameDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceConfigNameDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceConfigNameDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceConfigNameDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveMicroServiceConfigNameDictionary: exit");
     }
 
@@ -406,12 +436,13 @@ public class MicroServiceDictionaryControllerTest {
 
         logger.info("testGetMicroServiceLocationByNameDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceLocationByNameDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceLocationDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -424,12 +455,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceLocationDictionaryEntityData() {
         logger.info("testGetMicroServiceLocationDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceLocationDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceLocationDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -442,24 +474,30 @@ public class MicroServiceDictionaryControllerTest {
     public void testSaveMicroServiceLocationDictionary() {
         logger.info("testSaveMicroServiceLocationDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"microServiceLocationDictionaryData\": {\"modelName\": \"test\",   \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"microServiceLocationDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+                            + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+                            + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\","
+                            + "\"version\": \"\",\"createdBy\": \"someone\",\"modifiedBy\": \"someone\","
+                            + "\"content\": \"\",\"recursive\": false},\"tempModel\": "
+                            + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveMicroServiceLocationDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceLocationDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -472,30 +510,32 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveMicroServiceLocationDictionary() {
         logger.info("testRemoveMicroServiceLocationDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},\"policy\": "
+                            + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
 
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceLocationDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceLocationDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceLocationDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveMicroServiceLocationDictionary: exit");
     }
 
@@ -503,12 +543,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceAttributeByNameDictionaryEntityData() {
         logger.info("testGetMicroServiceAttributeByNameDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceAttributeByNameDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceAttributeDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -521,12 +562,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceAttributeDictionaryEntityData() {
         logger.info("testGetMicroServiceAttributeDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceAttributeDictionaryEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceAttributeDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -539,29 +581,33 @@ public class MicroServiceDictionaryControllerTest {
     public void testSaveMicroServiceAttributeDictionary() {
         logger.info("testSaveMicroServiceAttributeDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"modelAttributeDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"modelAttributeDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,"
+                            + "\"model\": {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],"
+                            + "\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\","
+                            + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                            + "\"recursive\": false},\"tempModel\": "
+                            + "{\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.saveMicroServiceAttributeDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceAttributeDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testSaveMicroServiceAttributeDictionary: exit");
     }
 
@@ -569,24 +615,29 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveMicroServiceAttributeDictionary() {
         logger.info("testRemoveMicroServiceAttributeDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},\"tempModel\": "
+                            + "{\"name\": \"testingdata\",\"subScopename\": \"\"},\"policy\": "
+                            + "{\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceAttributeDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceAttributeDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceAttributeDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -599,12 +650,13 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceModelsDictionaryByNameEntityData() {
         logger.info("testGetMicroServiceModelsDictionaryByNameEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
 
         controller.getMicroServiceModelsDictionaryByNameEntityData(response);
 
         try {
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
             logger.info("response.getContentAsString(): " + response.getContentAsString());
         } catch (UnsupportedEncodingException e) {
             fail("Exception: " + e);
@@ -617,7 +669,7 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceModelsDictionaryByVersionEntityData() {
         logger.info("testGetMicroServiceModelsDictionaryByVersionEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
 
         BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -628,7 +680,8 @@ public class MicroServiceDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.getMicroServiceModelsDictionaryByVersionEntityData(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("No model name given"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("No model name given"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -641,7 +694,7 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceModelsDictionaryEntityData() {
         logger.info("testGetMicroServiceModelsDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
 
         BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -652,7 +705,8 @@ public class MicroServiceDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.getMicroServiceModelsDictionaryEntityData(response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -665,7 +719,7 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceModelsDictionaryEntityDataServiceVersion() {
         logger.info("testGetMicroServiceModelsDictionaryEntityDataServiceVersion: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
 
         BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -676,7 +730,8 @@ public class MicroServiceDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.getMicroServiceModelsDictionaryEntityDataServiceVersion(response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -689,7 +744,7 @@ public class MicroServiceDictionaryControllerTest {
     public void testGetMicroServiceModelsDictionaryClassEntityData() {
         logger.info("testGetMicroServiceModelsDictionaryClassEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         String msModelJson = "{\"microServiceModelsDictionaryData\":[\"modelName\"]}";
 
         BufferedReader br = new BufferedReader(new StringReader(msModelJson));
@@ -700,7 +755,8 @@ public class MicroServiceDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.getMicroServiceModelsDictionaryClassEntityData(response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryClassDatas"));
+            assertTrue(response.getContentAsString() != null && response.getContentAsString()
+                    .contains("microServiceModelsDictionaryClassDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -713,7 +769,7 @@ public class MicroServiceDictionaryControllerTest {
     public void testSaveMicroServiceModelsDictionary() {
         logger.info("testSaveMicroServiceModelsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
@@ -721,7 +777,8 @@ public class MicroServiceDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.saveMicroServiceModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -734,31 +791,33 @@ public class MicroServiceDictionaryControllerTest {
     public void testRemoveMicroServiceModelsDictionary() {
         logger.info("testRemoveMicroServiceModelsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
 
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeMicroServiceModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
-
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("microServiceModelsDictionaryDatas"));
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveMicroServiceModelsDictionary: exit");
     }
-
 }
index dd355d9..5e0b7ce 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,15 +26,12 @@ import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
 import java.io.BufferedReader;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.servlet.http.HttpServletRequest;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -55,7 +54,7 @@ public class OptimizationDictionaryControllerTest {
     private String jsonString = null;
     private HttpServletRequest request = null;
     private OptimizationDictionaryController controller = null;
-     BufferedReader br = null;
+    BufferedReader br = null;
 
     @Before
     public void setUp() throws Exception {
@@ -64,33 +63,39 @@ public class OptimizationDictionaryControllerTest {
         UserInfo userInfo = new UserInfo();
         userInfo.setUserLoginId("testUserId");
         userInfo.setUserName("John");
-        when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing")).thenReturn(userInfo);
-        
+        when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing"))
+                .thenReturn(userInfo);
+
         OptimizationModels optimziationModels = new OptimizationModels();
-        
+
         doNothing().when(commonClassDao).delete(optimziationModels);
 
-        OptimizationDictionaryController.setCommonClassDao(commonClassDao);    
+        OptimizationDictionaryController.setCommonClassDao(commonClassDao);
 
         controller = new OptimizationDictionaryController();
-       
+
         HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-        
-        jsonString = "{\"optimizationModelsDictionaryData\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                + " \"version\": \"\",\"createdBy\": \"someone\",      \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"   },"
-                + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                + "    \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                + "    \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                + "    \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
-    
+
+        jsonString =
+                "{\"optimizationModelsDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,\"model\":"
+                        + " {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
+                        + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", \"version\": \"\","
+                        + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\","
+                        + "\"recursive\": false},"
+                        + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                        + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                        + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                        + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                        + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                        + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                        + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+
         br = new BufferedReader(new StringReader(jsonString));
-        //--- mock the getReader() call
-        when(request.getReader()).thenReturn(br);   
+        // --- mock the getReader() call
+        when(request.getReader()).thenReturn(br);
         new DictionaryUtils(commonClassDao);
         DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
-        mock(DictionaryUtils.class);        
+        mock(DictionaryUtils.class);
         logger.info("setUp: exit");
     }
 
@@ -98,7 +103,7 @@ public class OptimizationDictionaryControllerTest {
     public void testGetOptimizationModelsDictionaryEntityData() {
         logger.info("testGetOptimizationModelsDictionaryEntityData: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         String modelJson = "{\"optimizationModelsDictionaryData\":[\"modelName\"]}";
 
         BufferedReader br = new BufferedReader(new StringReader(modelJson));
@@ -109,7 +114,8 @@ public class OptimizationDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.getOptimizationModelsDictionaryEntityData(response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -122,7 +128,7 @@ public class OptimizationDictionaryControllerTest {
     public void testSaveOptimizationModelsDictionary() {
         logger.info("testSaveOptimizationModelsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
@@ -130,7 +136,8 @@ public class OptimizationDictionaryControllerTest {
             when(request.getReader()).thenReturn(br);
             controller.saveOptimizationModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -143,31 +150,34 @@ public class OptimizationDictionaryControllerTest {
     public void testRemoveOptimizationModelsDictionary() {
         logger.info("testRemoveOptimizationModelsDictionary: Entering");
 
-        MockHttpServletResponse response =  new MockHttpServletResponse();
+        MockHttpServletResponse response = new MockHttpServletResponse();
         request = mock(HttpServletRequest.class);
 
         try {
             // mock the getReader() call
-            jsonString = "{\"data\": {\"modelName\": \"test\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
-                    + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
-                    + " \"version\": \"\",\"createdBy\": \"someone\",  \"modifiedBy\": \"someone\",    \"content\": \"\",\"recursive\": false},"
-                    + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"       },"
-                    + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
-                    + "        \"policyDescription\": \"testing input\", \"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
-                    + "        \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
-                    + "        \"policyJSON\": {\"pmTableName\": \"test\",     \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+            jsonString =
+                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\","
+                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                            + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
 
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeOptimizationModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
-            assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+            assertTrue(response.getContentAsString() != null
+                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
         }
-
         logger.info("testRemoveOptimizationModelsDictionary: exit");
     }
-
 }
index 6b58184..ca6860a 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,21 +26,21 @@ import static org.junit.Assert.assertNull;
 import org.junit.Test;
 
 public class DictionaryHandlerTest {
-  @Test
-  public void negTestHandler() {
-    // Set the system property temporarily
-    String systemKey = "dictionary.impl.className";
-    String oldProperty = System.getProperty(systemKey);
-    System.setProperty(systemKey, "foobar");
+    @Test
+    public void negTestHandler() {
+        // Set the system property temporarily
+        String systemKey = "dictionary.impl.className";
+        String oldProperty = System.getProperty(systemKey);
+        System.setProperty(systemKey, "foobar");
 
-    // Run negative test on instance
-    assertNull(DictionaryHandler.getInstance());
+        // Run negative test on instance
+        assertNull(DictionaryHandler.getInstance());
 
-    // Restore the original system property
-    if (oldProperty != null) {
-      System.setProperty(systemKey, oldProperty);
-    } else {
-      System.clearProperty(systemKey);
+        // Restore the original system property
+        if (oldProperty != null) {
+            System.setProperty(systemKey, oldProperty);
+        } else {
+            System.clearProperty(systemKey);
+        }
     }
-  }
 }
index 9b45c3b..81b5927 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -29,19 +31,19 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 public class JPAUtilsTest {
-  @Test(expected = IllegalAccessException.class)
-  public void testJPAUtils() throws IllegalAccessException {
-    // Setup test data
-    EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
-    EntityManager em = Mockito.mock(EntityManager.class);
-    Query query = Mockito.mock(Query.class);
-    Mockito.when(emf.createEntityManager()).thenReturn(em);
-    Mockito.when(em.createNamedQuery(Mockito.any())).thenReturn(query);
+    @Test(expected = IllegalAccessException.class)
+    public void testJPAUtils() throws IllegalAccessException {
+        // Setup test data
+        EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
+        EntityManager em = Mockito.mock(EntityManager.class);
+        Query query = Mockito.mock(Query.class);
+        Mockito.when(emf.createEntityManager()).thenReturn(em);
+        Mockito.when(em.createNamedQuery(Mockito.any())).thenReturn(query);
 
-    // Test lockdown
-    JPAUtils utils = JPAUtils.getJPAUtilsInstance(emf);
-    assertEquals(utils.dbLockdownIgnoreErrors(), false);
-    utils.dbLockdown();
-    fail("Expecting an exception");
-  }
+        // Test lockdown
+        JPAUtils utils = JPAUtils.getJPAUtilsInstance(emf);
+        assertEquals(utils.dbLockdownIgnoreErrors(), false);
+        utils.dbLockdown();
+        fail("Expecting an exception");
+    }
 }
index 4e5535c..e3a5754 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -24,28 +26,28 @@ import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 
 public class JsonMessageTest {
-  @Test
-  public void testSetAndGet() {
-    String data = "testData";
-    String data2 = "testData2";
-    String data3 = "testData3";
+    @Test
+    public void testSetAndGet() {
+        String data = "testData";
+        String data2 = "testData2";
+        String data3 = "testData3";
 
-    // Test constructors
-    JsonMessage msg = new JsonMessage(data);
-    assertEquals(msg.getData(), data);
+        // Test constructors
+        JsonMessage msg = new JsonMessage(data);
+        assertEquals(msg.getData(), data);
 
-    JsonMessage msg2 = new JsonMessage(data, data2);
-    assertEquals(msg2.getData2(), data2);
+        JsonMessage msg2 = new JsonMessage(data, data2);
+        assertEquals(msg2.getData2(), data2);
 
-    JsonMessage msg3 = new JsonMessage(data, data2, data3);
-    assertEquals(msg3.getData3(), data3);
+        JsonMessage msg3 = new JsonMessage(data, data2, data3);
+        assertEquals(msg3.getData3(), data3);
 
-    // Test set and get
-    msg.setData(data);
-    msg.setData2(data2);
-    msg.setData3(data3);
-    assertEquals(msg.getData(), data);
-    assertEquals(msg.getData2(), data2);
-    assertEquals(msg.getData3(), data3);
-  }
+        // Test set and get
+        msg.setData(data);
+        msg.setData2(data2);
+        msg.setData3(data3);
+        assertEquals(msg.getData(), data);
+        assertEquals(msg.getData2(), data2);
+        assertEquals(msg.getData3(), data3);
+    }
 }
index 133d4a8..fb11e24 100644 (file)
@@ -1,15 +1,17 @@
 /*-
  * ============LICENSE_START=======================================================
- * ONAP Policy Engine
+ * ONAP Portal SDK
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,37 +38,36 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 
 public class ExternalAppConfigTest {
-  @Test
-  public void testConfig() throws MalformedURLException {
-    // Setup test data
-    ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
-    UrlResource value = new UrlResource("http://localhost");
-    Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
-    ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
-    InterceptorRegistry interceptor = new InterceptorRegistry();
-    RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
-    Registerable reg = Mockito.mock(Registerable.class);
-    Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
-    schedulerRegistryAdapter.setRegistry(reg);
-    WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
-    schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
-    Mockito.when(workflowScheduleService.triggerWorkflowScheduling())
-        .thenReturn(Collections.emptyList());
+    @Test
+    public void testConfig() throws MalformedURLException {
+        // Setup test data
+        ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
+        UrlResource value = new UrlResource("http://localhost");
+        Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
+        ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
+        InterceptorRegistry interceptor = new InterceptorRegistry();
+        RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
+        Registerable reg = Mockito.mock(Registerable.class);
+        Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
+        schedulerRegistryAdapter.setRegistry(reg);
+        WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
+        schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
+        Mockito.when(workflowScheduleService.triggerWorkflowScheduling()).thenReturn(Collections.emptyList());
 
-    // Test constructor
-    ExternalAppConfig config = new ExternalAppConfig();
-    assertNotNull(config);
+        // Test constructor
+        ExternalAppConfig config = new ExternalAppConfig();
+        assertNotNull(config);
 
-    // Test set and get
-    config.setApplicationContext(ctx);
-    assertNotNull(config.viewResolver());
-    config.addResourceHandlers(registry);
-    assertNotNull(config.dataAccessService());
-    assertNotNull(config.addTileDefinitions());
-    config.addInterceptors(interceptor);
-    assertNotNull(config.cacheManager());
-    config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
-    assertNull(config.schedulerFactoryBean());
-    assertNotNull(config.loginStrategy());
-  }
+        // Test set and get
+        config.setApplicationContext(ctx);
+        assertNotNull(config.viewResolver());
+        config.addResourceHandlers(registry);
+        assertNotNull(config.dataAccessService());
+        assertNotNull(config.addTileDefinitions());
+        config.addInterceptors(interceptor);
+        assertNotNull(config.cacheManager());
+        config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
+        assertNull(config.schedulerFactoryBean());
+        assertNotNull(config.loginStrategy());
+    }
 }
index 81bf7e9..7a2ab16 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.portalapp.conf;
 
 import static org.junit.Assert.assertTrue;
-
 import org.junit.Test;
 
 public class ExternalAppInitializerTest {
 
-       @Test
-       public void testExternalAppInitializer(){
-               ExternalAppInitializer initializer = new ExternalAppInitializer();
-               assertTrue(initializer.getRootConfigClasses()!=null);
-               assertTrue(initializer.getServletConfigClasses()!=null);
-               assertTrue(initializer.getServletMappings()!=null);
-       }
-       
-       @Test
-       public void testExternalAppConfig(){
-               ExternalAppConfig appConfig = new ExternalAppConfig();
-               assertTrue(appConfig.dataAccessService()!=null);
-               assertTrue(appConfig.addTileDefinitions()!=null);
-               assertTrue(appConfig.cacheManager()!=null);
-               assertTrue(appConfig.loginStrategy()!=null);
-               assertTrue(appConfig.viewResolver()!=null);
-       }
+    @Test
+    public void testExternalAppInitializer() {
+        ExternalAppInitializer initializer = new ExternalAppInitializer();
+        assertTrue(initializer.getRootConfigClasses() != null);
+        assertTrue(initializer.getServletConfigClasses() != null);
+        assertTrue(initializer.getServletMappings() != null);
+    }
+
+    @Test
+    public void testExternalAppConfig() {
+        ExternalAppConfig appConfig = new ExternalAppConfig();
+        assertTrue(appConfig.dataAccessService() != null);
+        assertTrue(appConfig.addTileDefinitions() != null);
+        assertTrue(appConfig.cacheManager() != null);
+        assertTrue(appConfig.loginStrategy() != null);
+        assertTrue(appConfig.viewResolver() != null);
+    }
 }
index 6762e4a..25d878e 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.portalapp.conf;
 
 import static org.junit.Assert.assertTrue;
-
 import org.junit.Test;
 
 public class HibernateMappingLocationsTest {
 
-       @Test
-       public void testHibernateMappingLocations(){
-               HibernateMappingLocations locations = new HibernateMappingLocations();
-               assertTrue(locations.getMappingLocations()!=null);
-               assertTrue(locations.getPackagesToScan()!=null);
-       }
+    @Test
+    public void testHibernateMappingLocations() {
+        HibernateMappingLocations locations = new HibernateMappingLocations();
+        assertTrue(locations.getMappingLocations() != null);
+        assertTrue(locations.getPackagesToScan() != null);
+    }
 }
index 210b1d9..65fe123 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,21 +34,21 @@ import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpServletResponse;
 
 public class SecurityXssFilterTest {
-       @Test
-       public void testGets() throws ServletException, IOException {
-               SecurityXssFilter filter = new SecurityXssFilter();
-               assertNotNull(filter);
-               
-               MockHttpServletRequest request = new MockHttpServletRequest();
-               request.setMethod("POST");
-               request.setBodyContent("testBody");
-               request.setupAddParameter("testKey", "testVal");
-               request.setAttribute("testKey", "testVal");
-               request.setRequestURI("testVal");
-               request.setRequestURL("testVal");
-               MockHttpServletResponse response = new MockHttpServletResponse();
-               FilterChain filterChain = Mockito.mock(FilterChain.class);
-               filter.doFilterInternal(request, response, filterChain);
-               assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
-       }
+    @Test
+    public void testGets() throws ServletException, IOException {
+        SecurityXssFilter filter = new SecurityXssFilter();
+        assertNotNull(filter);
+
+        MockHttpServletRequest request = new MockHttpServletRequest();
+        request.setMethod("POST");
+        request.setBodyContent("testBody");
+        request.setupAddParameter("testKey", "testVal");
+        request.setAttribute("testKey", "testVal");
+        request.setRequestURI("testVal");
+        request.setRequestURL("testVal");
+        MockHttpServletResponse response = new MockHttpServletResponse();
+        FilterChain filterChain = Mockito.mock(FilterChain.class);
+        filter.doFilterInternal(request, response, filterChain);
+        assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
+    }
 }
index 25b6779..ac13bdc 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,13 +29,13 @@ import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
 import org.springframework.mock.web.MockHttpServletRequest;
 
 public class LoginStrategyImplTest {
-       @Test
-       public void testLoginStrategyImpl() throws PortalAPIException {
-               LoginStrategyImpl impl = new LoginStrategyImpl();
-               MockHttpServletRequest request = new MockHttpServletRequest();
-               Cookie cookie1 = new Cookie("EPService", "serviceName");
-               Cookie cookie2 = new Cookie("UserId", "userName");
-               request.setCookies(cookie1, cookie2);
-               assertNull(impl.getUserId(request));
-       }
+    @Test
+    public void testLoginStrategyImpl() throws PortalAPIException {
+        LoginStrategyImpl impl = new LoginStrategyImpl();
+        MockHttpServletRequest request = new MockHttpServletRequest();
+        Cookie cookie1 = new Cookie("EPService", "serviceName");
+        Cookie cookie2 = new Cookie("UserId", "userName");
+        request.setCookies(cookie1, cookie2);
+        assertNull(impl.getUserId(request));
+    }
 }
index 0f406b1..675a87e 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,10 +24,8 @@ package org.onap.portalapp.scheduler;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import org.junit.Test;
 import org.quartz.Trigger;
 import org.quartz.TriggerBuilder;
index b49ad6a..a7386aa 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,39 +32,39 @@ import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
 import org.springframework.scheduling.quartz.SchedulerFactoryBean;
 
 public class RegistryAdapterTest {
-       @Rule 
-       public final ExpectedException thrown = ExpectedException.none();
+    @Rule
+    public final ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testRegistryAdapter() {
+        RegistryAdapter adapter = new RegistryAdapter();
+        SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
+        Registerable registry = null;
+        WorkflowScheduleService workflowScheduleService = null;
+
+        adapter.setSchedulerBean(schedulerBean);
+        assertEquals(adapter.getSchedulerBean(), schedulerBean);
+        adapter.setRegistry(registry);
+        assertEquals(adapter.getRegistry(), registry);
+        adapter.setWorkflowScheduleService(workflowScheduleService);
+        assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
+    }
 
-       @Test
-       public void testRegistryAdapter() {
-               RegistryAdapter adapter = new RegistryAdapter();
-               SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
-               Registerable registry = null;
-               WorkflowScheduleService workflowScheduleService = null;
+    @Test
+    public void testRegistryAdapterNegCase1() {
+        thrown.expect(NullPointerException.class);
 
-               adapter.setSchedulerBean(schedulerBean);
-               assertEquals(adapter.getSchedulerBean(), schedulerBean);
-               adapter.setRegistry(registry);
-               assertEquals(adapter.getRegistry(), registry);
-               adapter.setWorkflowScheduleService(workflowScheduleService);
-               assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
-       }
-       
-       @Test
-       public void testRegistryAdapterNegCase1() {
-               thrown.expect(NullPointerException.class);
+        RegistryAdapter adapter = new RegistryAdapter();
+        adapter.getTriggers();
+        fail("Expecting an exception.");
+    }
 
-               RegistryAdapter adapter = new RegistryAdapter();
-               adapter.getTriggers();
-               fail("Expecting an exception.");
-       }
-       
-       @Test
-       public void testRegistryAdapterNegCase2() {
-               thrown.expect(NullPointerException.class);
+    @Test
+    public void testRegistryAdapterNegCase2() {
+        thrown.expect(NullPointerException.class);
 
-               RegistryAdapter adapter = new RegistryAdapter();
-               adapter.addCoreTriggers();
-               fail("Expecting an exception.");
-       }
+        RegistryAdapter adapter = new RegistryAdapter();
+        adapter.addCoreTriggers();
+        fail("Expecting an exception.");
+    }
 }
index 30a38d4..116f705 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.portalapp.service;
 
 import static org.junit.Assert.*;
-
 import java.util.SortedSet;
 import java.util.TreeSet;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -33,54 +33,54 @@ import org.onap.portalsdk.core.domain.User;
 
 public class AdminAuthExtensionTest {
 
-       private CommonClassDao commonClassDao;
-       private AdminAuthExtension extension;
-       private User user;
+    private CommonClassDao commonClassDao;
+    private AdminAuthExtension extension;
+    private User user;
 
 
-       @Before
-       public void setUp(){
-               extension = new AdminAuthExtension();
-               commonClassDao = Mockito.mock(CommonClassDao.class);
-               Mockito.doNothing().when(commonClassDao).updateQuery("");
-               Mockito.doNothing().when(commonClassDao).save(new Object());
-               extension.setCommonClassDao(commonClassDao);
-               user = new User();
-               user.setFirstName("Test");
-               user.setLoginId("Test");
-       }
+    @Before
+    public void setUp() {
+        extension = new AdminAuthExtension();
+        commonClassDao = Mockito.mock(CommonClassDao.class);
+        Mockito.doNothing().when(commonClassDao).updateQuery("");
+        Mockito.doNothing().when(commonClassDao).save(new Object());
+        extension.setCommonClassDao(commonClassDao);
+        user = new User();
+        user.setFirstName("Test");
+        user.setLoginId("Test");
+    }
 
-       @Test
-       public void testAdminAuthExtension(){
-               try{
-                       callSaveUserFunction("Policy Super Admin");
-                       callSaveUserFunction("Policy Super Editor");
-                       callSaveUserFunction("Policy Super Guest");
-                       callSaveUserFunction("Policy Admin");
-                       callSaveUserFunction("Policy Editor");
-                       callSaveUserFunction("Policy Guest");
-                       extension.editUserExtension(user);
-                       extension.saveUserRoleExtension(null, user);
-               }catch(Exception e){
-                       fail("Not Expecting any exception.");
-               }
-       }
+    @Test
+    public void testAdminAuthExtension() {
+        try {
+            callSaveUserFunction("Policy Super Admin");
+            callSaveUserFunction("Policy Super Editor");
+            callSaveUserFunction("Policy Super Guest");
+            callSaveUserFunction("Policy Admin");
+            callSaveUserFunction("Policy Editor");
+            callSaveUserFunction("Policy Guest");
+            extension.editUserExtension(user);
+            extension.saveUserRoleExtension(null, user);
+        } catch (Exception e) {
+            fail("Not Expecting any exception.");
+        }
+    }
 
-       @Test
-       public void expectException(){
-               try{
-                       extension.saveUserExtension(null);
-               }catch(Exception e){
-                       assertEquals(NullPointerException.class, e.getClass());
-               }
-       }
+    @Test
+    public void expectException() {
+        try {
+            extension.saveUserExtension(null);
+        } catch (Exception e) {
+            assertEquals(NullPointerException.class, e.getClass());
+        }
+    }
 
-       public void callSaveUserFunction(String roleName){
-               SortedSet<Role> roles = new TreeSet<>();
-               Role role = new Role();
-               role.setName(roleName);
-               roles.add(role);
-               user.setRoles(roles);
-               extension.saveUserExtension(user);
-       }
+    public void callSaveUserFunction(String roleName) {
+        SortedSet<Role> roles = new TreeSet<>();
+        Role role = new Role();
+        role.setName(roleName);
+        roles.add(role);
+        user.setRoles(roles);
+        extension.saveUserExtension(user);
+    }
 }
index 2214817..0166a12 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,11 +30,13 @@ import org.junit.Test;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 
 public class XACMLErrorConstantsTest {
-       @Test
-       public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
-         Constructor<XACMLErrorConstants> constructor = XACMLErrorConstants.class.getDeclaredConstructor();
-         assertTrue(Modifier.isPrivate(constructor.getModifiers()));
-         constructor.setAccessible(true);
-         constructor.newInstance();
-       }
+    @Test
+    public void testConstructorIsPrivate1() throws NoSuchMethodException, IllegalAccessException,
+            InvocationTargetException, InstantiationException {
+        Constructor<XACMLErrorConstants> constructor =
+                XACMLErrorConstants.class.getDeclaredConstructor();
+        assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+        constructor.setAccessible(true);
+        constructor.newInstance();
+    }
 }
index 2e0a0de..6ab9790 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,58 +23,55 @@ package org.onap.policy.xacml.test.std.pap;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import java.io.IOException;
 import java.util.Properties;
-
 import org.junit.Test;
 import org.onap.policy.xacml.std.pap.StdEngineFactory;
-
 import com.att.research.xacml.api.pap.PAPException;
 import com.att.research.xacml.std.pap.StdEngine;
 import com.att.research.xacml.util.FactoryException;
 
 public class StdEngineFactoryTest {
-  @Test
-  public void testStdEngineFactory() throws FactoryException, PAPException, IOException {
-    StdEngineFactory stdFactory = new StdEngineFactory();
-    System.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
-    assertTrue(stdFactory.newEngine() != null);
-    Properties properties = new Properties();
-    properties.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
-    assertTrue(stdFactory.newEngine(properties) != null);
+    @Test
+    public void testStdEngineFactory() throws FactoryException, PAPException, IOException {
+        StdEngineFactory stdFactory = new StdEngineFactory();
+        System.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
+        assertTrue(stdFactory.newEngine() != null);
+        Properties properties = new Properties();
+        properties.setProperty("xacml.pap.pdps", "src/test/resources/pdps");
+        assertTrue(stdFactory.newEngine(properties) != null);
 
-    StdEngineFactory stdFactoryNew = new StdEngineFactory();
-    System.setProperty("xacml.pap.pdps", "src/test/resources/pdpstest");
-    assertTrue(stdFactoryNew.newEngine() != null);
-  }
+        StdEngineFactory stdFactoryNew = new StdEngineFactory();
+        System.setProperty("xacml.pap.pdps", "src/test/resources/pdpstest");
+        assertTrue(stdFactoryNew.newEngine() != null);
+    }
 
-  @Test
-  public void testNegativeCase() throws Exception {
-    // Setup test data
-    Properties props = new Properties();
-    String tmpdir = System.getProperty("java.io.tmpdir");
-    props.setProperty(StdEngine.PROP_PAP_REPO, tmpdir);
+    @Test
+    public void testNegativeCase() throws Exception {
+        // Setup test data
+        Properties props = new Properties();
+        String tmpdir = System.getProperty("java.io.tmpdir");
+        props.setProperty(StdEngine.PROP_PAP_REPO, tmpdir);
 
-    // Set the system property temporarily
-    String systemKey = StdEngine.PROP_PAP_REPO;
-    String oldProperty = System.getProperty(systemKey);
-    System.setProperty(systemKey, tmpdir);
+        // Set the system property temporarily
+        String systemKey = StdEngine.PROP_PAP_REPO;
+        String oldProperty = System.getProperty(systemKey);
+        System.setProperty(systemKey, tmpdir);
 
-    // Test factory failure cases
-    try {
-      StdEngineFactory factory = new StdEngineFactory();
-      factory.newEngine();
-      factory.newEngine(props);
-    } catch (Exception ex) {
-      fail("Not expecting any exceptions: " + ex);
-    }
+        // Test factory failure cases
+        try {
+            StdEngineFactory factory = new StdEngineFactory();
+            factory.newEngine();
+            factory.newEngine(props);
+        } catch (Exception ex) {
+            fail("Not expecting any exceptions: " + ex);
+        }
 
-    // Restore the original system property
-    if (oldProperty != null) {
-      System.setProperty(systemKey, oldProperty);
-    } else {
-      System.clearProperty(systemKey);
+        // Restore the original system property
+        if (oldProperty != null) {
+            System.setProperty(systemKey, oldProperty);
+        } else {
+            System.clearProperty(systemKey);
+        }
     }
-  }
 }
index f0ee8dd..79b43b1 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,16 +54,20 @@ public class StdEngineTest {
     private Path repository;
     Properties properties = new Properties();
     StdEngine stdEngine = null;
-    
+
     @Rule
     public ExpectedException expectedException = ExpectedException.none();
-    
+
     @BeforeClass
-    public static void setUpClass() throws IOException{
+    public static void setUpClass() throws IOException {
         new File("target/test/resources/pdps").mkdirs();
         new File("target/test/resources/emptyPapGroupsDefault").mkdirs();
-        Files.copy(Paths.get("src/test/resources/pdps/xacml.properties"), Paths.get("target/test/resources/pdps/xacml.properties"), StandardCopyOption.REPLACE_EXISTING);
-        Files.copy(Paths.get("src/test/resources/emptyPapGroupsDefault/xacml.properties"), Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties"), StandardCopyOption.REPLACE_EXISTING);
+        Files.copy(Paths.get("src/test/resources/pdps/xacml.properties"),
+                Paths.get("target/test/resources/pdps/xacml.properties"),
+                StandardCopyOption.REPLACE_EXISTING);
+        Files.copy(Paths.get("src/test/resources/emptyPapGroupsDefault/xacml.properties"),
+                Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties"),
+                StandardCopyOption.REPLACE_EXISTING);
     }
 
     @Before
@@ -100,47 +106,53 @@ public class StdEngineTest {
     public void testNoRepository() throws PAPException, IOException {
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("No repository specified.");
-        new StdEngine((Path)null);
+        new StdEngine((Path) null);
     }
-    
+
     @Test
     public void testRepositoryDoesNotExist() throws PAPException, IOException {
         repository = Paths.get("target/test/resources/nonExisting");
         new StdEngine(repository);
-        
-        assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/default/xacml.pip.properties")));
-        assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/default/xacml.policy.properties")));
+
+        assertTrue(Files.exists(
+                Paths.get("target/test/resources/nonExisting/default/xacml.pip.properties")));
+        assertTrue(Files.exists(
+                Paths.get("target/test/resources/nonExisting/default/xacml.policy.properties")));
         assertTrue(Files.exists(Paths.get("target/test/resources/nonExisting/xacml.properties")));
         FileUtils.deleteDirectory(repository.toFile());
     }
-    
+
     @Test
     public void testEmptyPapGroupsDefault() throws PAPException, IOException {
         System.setProperty("xacml.pap.groups.default", "");
         repository = Paths.get("target/test/resources/emptyPapGroupsDefault");
         new StdEngine(repository);
-        
-        assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/default/xacml.pip.properties")));
-        assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/default/xacml.policy.properties")));
-        assertTrue(Files.exists(Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties")));
+
+        assertTrue(Files.exists(Paths
+                .get("target/test/resources/emptyPapGroupsDefault/default/xacml.pip.properties")));
+        assertTrue(Files.exists(Paths.get(
+                "target/test/resources/emptyPapGroupsDefault/default/xacml.policy.properties")));
+        assertTrue(Files
+                .exists(Paths.get("target/test/resources/emptyPapGroupsDefault/xacml.properties")));
     }
-    
+
     @Test
-    public void testNewGroupAndRemoveGroup() throws NullPointerException, PAPException, IOException {
+    public void testNewGroupAndRemoveGroup()
+            throws NullPointerException, PAPException, IOException {
         OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
         assertNotNull(newGroup);
 
         stdEngine.removeGroup(stdEngine.getGroup("newGroup"), null);
         assertNull(stdEngine.getGroup("newGroup"));
     }
-    
+
     @Test
     public void testRemoveGroupNull() throws NullPointerException, PAPException, IOException {
         expectedException.expect(NullPointerException.class);
         stdEngine.removeGroup(null, null);
         assertNull(stdEngine.getGroup("newGroup"));
     }
-    
+
     @Test
     public void testRemoveGroupUnknown() throws NullPointerException, PAPException, IOException {
         OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
@@ -149,7 +161,7 @@ public class StdEngineTest {
         expectedException.expectMessage("The group 'unknownId' does not exist");
         stdEngine.removeGroup(unknownGroup, null);
     }
-    
+
     @Test
     public void testRemoveGroupDefault() throws NullPointerException, PAPException, IOException {
         OnapPDPGroup defaultGroup = stdEngine.getDefaultGroup();
@@ -158,141 +170,145 @@ public class StdEngineTest {
         expectedException.expectMessage("You cannot delete the default group.");
         stdEngine.removeGroup(defaultGroup, null);
     }
-    
+
     @Test
     public void testSetDefaultGroup() throws NullPointerException, PAPException, IOException {
         OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
         assertNotNull(newGroup);
-        
+
         OnapPDPGroup defaultGroup = stdEngine.getDefaultGroup();
         assertEquals("default", defaultGroup.getName());
         stdEngine.setDefaultGroup(newGroup);
         assertEquals(newGroup, stdEngine.getDefaultGroup());
-        
+
         stdEngine.setDefaultGroup(defaultGroup);
         stdEngine.removeGroup(stdEngine.getGroup("newGroup"), null);
     }
-    
+
     @Test
-    public void testPdps() throws NullPointerException, PAPException{
+    public void testPdps() throws NullPointerException, PAPException {
         OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
         assertEquals(0, group1.getPdps().size());
-        
+
         stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
         assertEquals(1, group1.getPdps().size());
         assertEquals("newPdp", group1.getPdps().iterator().next().getId());
         assertEquals("newPdpName", group1.getPdps().iterator().next().getName());
         assertEquals("A new pdp", group1.getPdps().iterator().next().getDescription());
-        
+
         OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
         assertEquals(0, group2.getPdps().size());
-        
+
         stdEngine.movePDP(group1.getOnapPdps().iterator().next(), group2);
         assertEquals(0, group1.getPdps().size());
         assertEquals(1, group2.getPdps().size());
-        
+
         OnapPDP pdp = group2.getOnapPdps().iterator().next();
         pdp.setName("AnUpdatedName");;
         pdp.setDescription("An updated description");
         stdEngine.updatePDP(pdp);
         assertEquals("AnUpdatedName", group2.getPdps().iterator().next().getName());
         assertEquals("An updated description", group2.getPdps().iterator().next().getDescription());
-        
+
         stdEngine.removePDP(group2.getOnapPdps().iterator().next());
         assertEquals(0, group1.getPdps().size());
         assertEquals(0, group2.getPdps().size());
     }
-    
+
     @Test
-    public void testNewPdpNullGroup() throws NullPointerException, PAPException{
+    public void testNewPdpNullGroup() throws NullPointerException, PAPException {
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("You must specify which group the PDP will belong to.");
         stdEngine.newPDP("newPdp", null, "newPdpName", "A new pdp", 1);
     }
-    
+
     @Test
-    public void testNewPdpUnknownGroup() throws NullPointerException, PAPException{
+    public void testNewPdpUnknownGroup() throws NullPointerException, PAPException {
         OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
 
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("Unknown group, not in our list.");
         stdEngine.newPDP("newPdp", unknownGroup, "newPdpName", "A new pdp", 1);
     }
-    
+
     @Test
-    public void testNewPdpAlreadyExistingPdp() throws NullPointerException, PAPException{
+    public void testNewPdpAlreadyExistingPdp() throws NullPointerException, PAPException {
         OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
         assertEquals(0, group1.getPdps().size());
-        
+
         stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
         assertEquals(1, group1.getPdps().size());
-        
+
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("A PDP with this ID exists.");
         stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
     }
-    
+
     @Test
-    public void testRemoveGroupWithPdps() throws NullPointerException, PAPException{
+    public void testRemoveGroupWithPdps() throws NullPointerException, PAPException {
         OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
-        
+
         stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
         assertEquals(1, group1.getPdps().size());
-        
+
         OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
         assertEquals(0, group2.getPdps().size());
-        
+
         stdEngine.removeGroup(group1, group2);
         assertNull(stdEngine.getGroup("newGroup"));
         assertEquals(1, group2.getPdps().size());
     }
-    
+
     @Test
-    public void testRemoveGroupWithPdpsNoTarget() throws NullPointerException, PAPException{
+    public void testRemoveGroupWithPdpsNoTarget() throws NullPointerException, PAPException {
         OnapPDPGroup group1 = createGroup("newGroup", "Description of new group");
-        
+
         stdEngine.newPDP("newPdp", group1, "newPdpName", "A new pdp", 1);
         assertEquals(1, group1.getPdps().size());
-        
+
         OnapPDPGroup group2 = createGroup("anotherNewGroup", "Description of new group");
         assertEquals(0, group2.getPdps().size());
-        
+
         expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("Group targeted for deletion has PDPs, you must provide a new group for them.");
+        expectedException.expectMessage(
+                "Group targeted for deletion has PDPs, you must provide a new group for them.");
         stdEngine.removeGroup(group1, null);
     }
-    
+
     @Test
     public void testUpdateGroupName() throws NullPointerException, PAPException, IOException {
         OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
-        
+
         OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup);
         updatedGroup.setName("AnUpdatedName");
         stdEngine.updateGroup(updatedGroup);
         assertNull(stdEngine.getGroup("newGroup"));
         assertNotNull(stdEngine.getGroup("AnUpdatedName"));
         assertEquals("AnUpdatedName", stdEngine.getGroup("AnUpdatedName").getName());
-        assertEquals("Description of new group", stdEngine.getGroup("AnUpdatedName").getDescription());
+        assertEquals("Description of new group",
+                stdEngine.getGroup("AnUpdatedName").getDescription());
     }
-    
+
     @Test
-    public void testUpdateGroupDescription() throws NullPointerException, PAPException, IOException {
+    public void testUpdateGroupDescription()
+            throws NullPointerException, PAPException, IOException {
         OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
-                
-        OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup.getId(), newGroup.getName(), "An updated description", Paths.get("target/test/resources/pdps/newGroup"));
+
+        OnapPDPGroup updatedGroup = new StdPDPGroup(newGroup.getId(), newGroup.getName(),
+                "An updated description", Paths.get("target/test/resources/pdps/newGroup"));
         updatedGroup.setDescription("An updated description");
         stdEngine.updateGroup(updatedGroup);
         assertEquals("newGroup", stdEngine.getGroup("newGroup").getName());
         assertEquals("An updated description", stdEngine.getGroup("newGroup").getDescription());
     }
-    
+
     @Test
     public void testUpdateGroupNull() throws NullPointerException, PAPException, IOException {
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("Group or id is null");
         stdEngine.updateGroup(null);
     }
-    
+
     @Test
     public void testUpdateGroupIdNull() throws NullPointerException, PAPException, IOException {
         StdPDPGroup group = new StdPDPGroup(null, null);
@@ -300,7 +316,7 @@ public class StdEngineTest {
         expectedException.expectMessage("Group or id is null");
         stdEngine.updateGroup(group);
     }
-    
+
     @Test
     public void testUpdateGroupNameNull() throws NullPointerException, PAPException, IOException {
         StdPDPGroup group = new StdPDPGroup("groupId", null);
@@ -308,15 +324,16 @@ public class StdEngineTest {
         expectedException.expectMessage("New name for group cannot be null or blank");
         stdEngine.updateGroup(group);
     }
-    
+
     @Test
-    public void testUpdateGroupNameEmptyString() throws NullPointerException, PAPException, IOException {
+    public void testUpdateGroupNameEmptyString()
+            throws NullPointerException, PAPException, IOException {
         StdPDPGroup group = new StdPDPGroup("groupId", "", "description", null);
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("New name for group cannot be null or blank");
         stdEngine.updateGroup(group);
     }
-    
+
     @Test
     public void testUpdateGroupUnknown() throws NullPointerException, PAPException, IOException {
         StdPDPGroup group = new StdPDPGroup("groupId", "groupName", "description", null);
@@ -324,69 +341,77 @@ public class StdEngineTest {
         expectedException.expectMessage("Update found no existing group with id 'groupId'");
         stdEngine.updateGroup(group);
     }
-    
+
     @Test
-    public void testPublishAndRemovePolicy() throws NullPointerException, PAPException, FileNotFoundException{
+    public void testPublishAndRemovePolicy()
+            throws NullPointerException, PAPException, FileNotFoundException {
         OnapPDPGroup newGroup = createGroup("newGroup", "Description of new group");
-        InputStream inputStream = new FileInputStream("src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
-        stdEngine.publishPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml", "Config_BRMS_Param_BRMSParamvFWDemoPolicy", true, inputStream, newGroup);
+        InputStream inputStream = new FileInputStream(
+                "src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
+        stdEngine.publishPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml",
+                "Config_BRMS_Param_BRMSParamvFWDemoPolicy", true, inputStream, newGroup);
         PDPPolicy policy = newGroup.getPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml");
         assertNotNull(policy);
-        
+
         stdEngine.removePolicy(policy, newGroup);
         assertNull(newGroup.getPolicy("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml"));
     }
-    
+
     @Test
-    public void testPublishPolicyNull() throws NullPointerException, PAPException, FileNotFoundException{
+    public void testPublishPolicyNull()
+            throws NullPointerException, PAPException, FileNotFoundException {
         expectedException.expect(NullPointerException.class);
         stdEngine.publishPolicy(null, null, true, null, null);
     }
-    
+
     @Test
-    public void testPublishPolicyUnknownGroup() throws NullPointerException, PAPException, FileNotFoundException{
+    public void testPublishPolicyUnknownGroup()
+            throws NullPointerException, PAPException, FileNotFoundException {
         OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
 
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("Unknown PDP Group: unknownId");
         stdEngine.publishPolicy(null, null, true, null, unknownGroup);
     }
-    
+
     @Test
-    public void testRemovePolicyNull() throws NullPointerException, PAPException, FileNotFoundException{
+    public void testRemovePolicyNull()
+            throws NullPointerException, PAPException, FileNotFoundException {
         expectedException.expect(NullPointerException.class);
         stdEngine.removePolicy(null, null);
     }
-    
+
     @Test
-    public void testRemovePolicyUnknownGroup() throws NullPointerException, PAPException, FileNotFoundException{
+    public void testRemovePolicyUnknownGroup()
+            throws NullPointerException, PAPException, FileNotFoundException {
         OnapPDPGroup unknownGroup = new StdPDPGroup("unknownId", null);
 
         expectedException.expect(PAPException.class);
         expectedException.expectMessage("Unknown PDP Group: unknownId");
         stdEngine.removePolicy(null, unknownGroup);
     }
-    
-    private OnapPDPGroup createGroup(final String name, final String description) throws NullPointerException, PAPException{
+
+    private OnapPDPGroup createGroup(final String name, final String description)
+            throws NullPointerException, PAPException {
         ensureGroupDoesntExist(name);
         stdEngine.newGroup(name, description);
         return stdEngine.getGroup(name);
     }
-    
+
     @After
-    public void tearDown() throws PAPException{
+    public void tearDown() throws PAPException {
         ensureGroupDoesntExist("newGroup");
         ensureGroupDoesntExist("anotherNewGroup");
         ensureGroupDoesntExist("AnUpdatedName");
     }
-    
-    private void ensureGroupDoesntExist(final String groupName) throws PAPException{
+
+    private void ensureGroupDoesntExist(final String groupName) throws PAPException {
         OnapPDPGroup group = stdEngine.getGroup(groupName);
-        if (group != null){
-            for (OnapPDP pdp: group.getOnapPdps()){
+        if (group != null) {
+            for (OnapPDP pdp : group.getOnapPdps()) {
                 stdEngine.removePDP(pdp);
             }
-            stdEngine.removeGroup(group, null);       
-       }
+            stdEngine.removeGroup(group, null);
+        }
     }
 }
index 3e1d815..55413d8 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -223,35 +225,35 @@ public class StdPDPGroupStatusTest {
         stdPDPGroupStatus.addFailedPipConfig(new StdPDPPIPConfig());
         assertFalse(stdPDPGroupStatus.pipConfigOK());
     }
-    
+
     @Test
     public void testPdpsOKOutOfSyncPdp() {
         assertTrue(stdPDPGroupStatus.pdpsOK());
         stdPDPGroupStatus.addOutOfSynchPDP(new StdPDP());
         assertFalse(stdPDPGroupStatus.pdpsOK());
     }
-    
+
     @Test
     public void testPdpsOKFailedPdp() {
         assertTrue(stdPDPGroupStatus.pdpsOK());
         stdPDPGroupStatus.addFailedPDP(new StdPDP());
         assertFalse(stdPDPGroupStatus.pdpsOK());
     }
-    
+
     @Test
     public void testPdpsOKLastUpdateFailedPdp() {
         assertTrue(stdPDPGroupStatus.pdpsOK());
         stdPDPGroupStatus.addLastUpdateFailedPDP(new StdPDP());
         assertFalse(stdPDPGroupStatus.pdpsOK());
     }
-    
+
     @Test
     public void testPdpsOKUnknownPdp() {
         assertTrue(stdPDPGroupStatus.pdpsOK());
         stdPDPGroupStatus.addUnknownPDP(new StdPDP());
         assertFalse(stdPDPGroupStatus.pdpsOK());
     }
-    
+
     @Test
     public void testIsGroupOkFailedPolicy() {
         stdPDPGroupStatus.setStatus(Status.OK);
@@ -259,7 +261,7 @@ public class StdPDPGroupStatusTest {
         stdPDPGroupStatus.addFailedPolicy(new StdPDPPolicy());
         assertFalse(stdPDPGroupStatus.isGroupOk());
     }
-    
+
     @Test
     public void testIsGroupOkFailedPipConfig() {
         stdPDPGroupStatus.setStatus(Status.OK);
@@ -267,30 +269,30 @@ public class StdPDPGroupStatusTest {
         stdPDPGroupStatus.addFailedPipConfig(new StdPDPPIPConfig());
         assertFalse(stdPDPGroupStatus.isGroupOk());
     }
-    
+
     @Test
     public void testIsGroupOkFailedPdp() {
         stdPDPGroupStatus.setStatus(Status.OK);
         assertTrue(stdPDPGroupStatus.isGroupOk());
         stdPDPGroupStatus.addLastUpdateFailedPDP(new StdPDP());
         assertFalse(stdPDPGroupStatus.isGroupOk());
-    }  
-    
+    }
+
     @Test
     public void testIsGroupOkLoadErrors() {
         stdPDPGroupStatus.setStatus(Status.OK);
         assertTrue(stdPDPGroupStatus.isGroupOk());
         stdPDPGroupStatus.addLoadError("A load error");
         assertFalse(stdPDPGroupStatus.isGroupOk());
-    }  
-    
+    }
+
     @Test
     public void testIsGroupOkStatusOutOfSynch() {
         stdPDPGroupStatus.setStatus(Status.OK);
         assertTrue(stdPDPGroupStatus.isGroupOk());
         stdPDPGroupStatus.setStatus(Status.OUT_OF_SYNCH);
         assertFalse(stdPDPGroupStatus.isGroupOk());
-    }  
+    }
 
     @Test
     public void testConstructor() {
@@ -477,5 +479,4 @@ public class StdPDPGroupStatusTest {
     public void testEqualsInstanceOfDiffClass() {
         assertFalse(stdPDPGroupStatus.equals(""));
     }
-
 }
index 323b034..e5e058a 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.policy.xacml.test.std.pap;
 
 import static org.junit.Assert.assertTrue;
-
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.Set;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -36,194 +36,191 @@ import org.onap.policy.xacml.std.pap.StdPDPGroup;
 public class StdPDPGroupTest {
 
 
-       private static Logger logger = FlexLogger.getLogger(StdPDPGroupTest.class);
-       
-       private StdPDPGroup stdPDPGroup;
-       private Path repository;
-       private StdPDP testPdp = new StdPDP();
-       private StdPDP testPdp1 = new StdPDP();
-       
-       @Before
-       public void setUp(){
-       
-               try {
-                       stdPDPGroup = new StdPDPGroup();
-                       repository = Paths.get("src/test/resources/pdps");
-                       testPdp1.setId("100");
-                       
-               } catch (Exception e) {
-                       logger.error(e);
-               } 
-       }
-
-
-       @Test
-       public void testGetStatus() {
-               try {
-                       assertTrue(stdPDPGroup.getStatus() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetId() {
-               try {
-                       stdPDPGroup.setId("testId");
-                       assertTrue(stdPDPGroup.getId() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testIsDefaultGroup() {
-               try {
-                       stdPDPGroup.setDefaultGroup(true);
-                       assertTrue(stdPDPGroup.isDefaultGroup() == true);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetName() {
-               try {
-                       stdPDPGroup.setName("testing");
-                       assertTrue(stdPDPGroup.getName() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetDescription() {
-               try {
-                       stdPDPGroup.setDescription("description");
-                       assertTrue(stdPDPGroup.getDescription() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }       
-       }
-
-       @Test
-       public void testGetDirectory() {
-               try {
-                       stdPDPGroup.setDirectory(repository);
-                       assertTrue(stdPDPGroup.getDirectory() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetSelectedPolicies() {
-               try {
-                       assertTrue(stdPDPGroup.getSelectedPolicies() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetOperation() {
-               try {
-                       stdPDPGroup.setOperation("test");
-                       assertTrue(stdPDPGroup.getOperation() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetPdps() {
-               try {
-                       stdPDPGroup.setOnapPdps(new HashSet<>());
-                       assertTrue(stdPDPGroup.getPdps() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetOnapPdps() {
-               try {
-                       stdPDPGroup.setOnapPdps(new HashSet<>());
-                       assertTrue(stdPDPGroup.getOnapPdps() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testAddPDP() {
-               try {
-                       assertTrue(stdPDPGroup.addPDP(testPdp) == true);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testRemovePDP() {
-               try {
-                       assertTrue(stdPDPGroup.removePDP(testPdp) == false);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetPolicies() {
-               try {
-                       stdPDPGroup.setPolicies(new HashSet());
-                       assertTrue(stdPDPGroup.getPolicies() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetPolicy() {
-               try {
-                       assertTrue(stdPDPGroup.getPolicy("wrongId") == null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-
-       @Test
-       public void testGetPipConfigs() {
-               try {
-                       stdPDPGroup.setPipConfigs(new HashSet());
-                       assertTrue(stdPDPGroup.getPipConfigs() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetPipConfig() {
-               try {
-                       Set pipConfigs = new HashSet();                 
-                       StdPDP testPdp = new StdPDP();
-                       testPdp.setId("20");
-                       pipConfigs.add(testPdp);                        
-                       stdPDPGroup.setId("testId");
-                       assertTrue(stdPDPGroup.getPipConfig("222") == null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
-       @Test
-       public void testGetPipConfigProperties() {
-               try {
-                       assertTrue(stdPDPGroup.getPipConfigProperties() != null);
-               } catch (Exception e) {
-                       logger.error(e);
-               }
-       }
-
+    private static Logger logger = FlexLogger.getLogger(StdPDPGroupTest.class);
+
+    private StdPDPGroup stdPDPGroup;
+    private Path repository;
+    private StdPDP testPdp = new StdPDP();
+    private StdPDP testPdp1 = new StdPDP();
+
+    @Before
+    public void setUp() {
+
+        try {
+            stdPDPGroup = new StdPDPGroup();
+            repository = Paths.get("src/test/resources/pdps");
+            testPdp1.setId("100");
+
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetStatus() {
+        try {
+            assertTrue(stdPDPGroup.getStatus() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetId() {
+        try {
+            stdPDPGroup.setId("testId");
+            assertTrue(stdPDPGroup.getId() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testIsDefaultGroup() {
+        try {
+            stdPDPGroup.setDefaultGroup(true);
+            assertTrue(stdPDPGroup.isDefaultGroup() == true);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetName() {
+        try {
+            stdPDPGroup.setName("testing");
+            assertTrue(stdPDPGroup.getName() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetDescription() {
+        try {
+            stdPDPGroup.setDescription("description");
+            assertTrue(stdPDPGroup.getDescription() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetDirectory() {
+        try {
+            stdPDPGroup.setDirectory(repository);
+            assertTrue(stdPDPGroup.getDirectory() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetSelectedPolicies() {
+        try {
+            assertTrue(stdPDPGroup.getSelectedPolicies() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetOperation() {
+        try {
+            stdPDPGroup.setOperation("test");
+            assertTrue(stdPDPGroup.getOperation() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPdps() {
+        try {
+            stdPDPGroup.setOnapPdps(new HashSet<>());
+            assertTrue(stdPDPGroup.getPdps() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetOnapPdps() {
+        try {
+            stdPDPGroup.setOnapPdps(new HashSet<>());
+            assertTrue(stdPDPGroup.getOnapPdps() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testAddPDP() {
+        try {
+            assertTrue(stdPDPGroup.addPDP(testPdp) == true);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testRemovePDP() {
+        try {
+            assertTrue(stdPDPGroup.removePDP(testPdp) == false);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPolicies() {
+        try {
+            stdPDPGroup.setPolicies(new HashSet());
+            assertTrue(stdPDPGroup.getPolicies() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPolicy() {
+        try {
+            assertTrue(stdPDPGroup.getPolicy("wrongId") == null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPipConfigs() {
+        try {
+            stdPDPGroup.setPipConfigs(new HashSet());
+            assertTrue(stdPDPGroup.getPipConfigs() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPipConfig() {
+        try {
+            Set pipConfigs = new HashSet();
+            StdPDP testPdp = new StdPDP();
+            testPdp.setId("20");
+            pipConfigs.add(testPdp);
+            stdPDPGroup.setId("testId");
+            assertTrue(stdPDPGroup.getPipConfig("222") == null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetPipConfigProperties() {
+        try {
+            assertTrue(stdPDPGroup.getPipConfigProperties() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
 }
index 1be34ee..cea7c32 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,16 +30,16 @@ import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier;
 import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
 
 public class StdPDPItemSetChangeNotifierTest {
-  @Test
-  public void testNotifier() {
-    StdPDPItemSetChangeNotifier notifier = new StdPDPItemSetChangeNotifier();
-    StdItemSetChangeListener listener = Mockito.mock(StdItemSetChangeListener.class);
-    notifier.addItemSetChangeListener(listener);
-    notifier.removeItemSetChangeListener(listener);
-    notifier.fireChanged();
-    OnapPDP pdp = Mockito.mock(OnapPDP.class);
-    notifier.firePDPChanged(pdp);
-    OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class);
-    notifier.firePDPGroupChanged(group);
-  }
+    @Test
+    public void testNotifier() {
+        StdPDPItemSetChangeNotifier notifier = new StdPDPItemSetChangeNotifier();
+        StdItemSetChangeListener listener = Mockito.mock(StdItemSetChangeListener.class);
+        notifier.addItemSetChangeListener(listener);
+        notifier.removeItemSetChangeListener(listener);
+        notifier.fireChanged();
+        OnapPDP pdp = Mockito.mock(OnapPDP.class);
+        notifier.firePDPChanged(pdp);
+        OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class);
+        notifier.firePDPGroupChanged(group);
+    }
 }
index 05b8ae7..b5713d3 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,76 +34,76 @@ import org.junit.Test;
 import org.onap.policy.xacml.std.pap.StdPDPPIPConfig;
 
 public class StdPDPPIPConfigTest {
-  @Test
-  public void testConfig() {
-    // Setup test data
-    String id = "testID";
-    String value = "testVal";
-    Properties props = new Properties();
-    props.setProperty(id + ".classname", value);
-    Map<String, String> map = new HashMap<String, String>();
-    map.put(id, value);
+    @Test
+    public void testConfig() {
+        // Setup test data
+        String id = "testID";
+        String value = "testVal";
+        Properties props = new Properties();
+        props.setProperty(id + ".classname", value);
+        Map<String, String> map = new HashMap<String, String>();
+        map.put(id, value);
 
-    // Test constructors
-    StdPDPPIPConfig config = new StdPDPPIPConfig();
-    assertNotNull(config);
-    StdPDPPIPConfig config2 = new StdPDPPIPConfig(id);
-    assertNotNull(config2);
-    StdPDPPIPConfig config3 = new StdPDPPIPConfig(id, value, value);
-    assertNotNull(config3);
-    StdPDPPIPConfig config4 = new StdPDPPIPConfig(id, props);
-    assertNotNull(config4);
-    StdPDPPIPConfig config5 = new StdPDPPIPConfig(id, props);
-    assertNotNull(config5);
+        // Test constructors
+        StdPDPPIPConfig config = new StdPDPPIPConfig();
+        assertNotNull(config);
+        StdPDPPIPConfig config2 = new StdPDPPIPConfig(id);
+        assertNotNull(config2);
+        StdPDPPIPConfig config3 = new StdPDPPIPConfig(id, value, value);
+        assertNotNull(config3);
+        StdPDPPIPConfig config4 = new StdPDPPIPConfig(id, props);
+        assertNotNull(config4);
+        StdPDPPIPConfig config5 = new StdPDPPIPConfig(id, props);
+        assertNotNull(config5);
 
-    // Test set and get
-    config.setId(value);
-    assertEquals(value, config.getId());
-    config.setName(value);
-    assertEquals(value, config.getName());
-    config.setDescription(value);
-    assertEquals(value, config.getDescription());
-    config.setClassname(value);
-    assertEquals(value, config.getClassname());
-    config.setValues(map);
-    assertEquals(map, config.getConfiguration());
-    assertEquals(true, config.isConfigured());
-    config.setConfig(map);
-    assertEquals(map, config.getConfig());
+        // Test set and get
+        config.setId(value);
+        assertEquals(value, config.getId());
+        config.setName(value);
+        assertEquals(value, config.getName());
+        config.setDescription(value);
+        assertEquals(value, config.getDescription());
+        config.setClassname(value);
+        assertEquals(value, config.getClassname());
+        config.setValues(map);
+        assertEquals(map, config.getConfiguration());
+        assertEquals(true, config.isConfigured());
+        config.setConfig(map);
+        assertEquals(map, config.getConfig());
 
-    // Test equals combinations
-    assertEquals(true, config4.equals(config5));
-    assertEquals(true, config4.equals(config4));
-    assertEquals(false, config4.equals(null));
-    assertEquals(false, config4.equals(value));
-    config4.setClassname(null);
-    config5.setClassname(value);
-    assertEquals(false, config4.equals(config5));
-    config4.setClassname(id);
-    assertEquals(false, config4.equals(config5));
-    config4.setClassname(value);
-    config5.setConfig(map);
-    assertEquals(false, config4.equals(config5));
-    config4.setConfig(null);
-    assertEquals(false, config4.equals(config5));
-    config4.setConfig(map);
-    config5.setDescription(value);
-    assertEquals(false, config4.equals(config5));
-    config4.setDescription(id);
-    assertEquals(false, config4.equals(config5));
-    config4.setDescription(value);
-    config4.setId(null);
-    assertEquals(false, config4.equals(config5));
-    config4.setId(value);
-    assertEquals(false, config4.equals(config5));
-    config4.setId(id);
-    config5.setName(value);
-    assertEquals(false, config4.equals(config5));
-    config4.setName(id);
-    assertEquals(false, config4.equals(config5));
-    assertThat(config.hashCode(), is(not(0)));
+        // Test equals combinations
+        assertEquals(true, config4.equals(config5));
+        assertEquals(true, config4.equals(config4));
+        assertEquals(false, config4.equals(null));
+        assertEquals(false, config4.equals(value));
+        config4.setClassname(null);
+        config5.setClassname(value);
+        assertEquals(false, config4.equals(config5));
+        config4.setClassname(id);
+        assertEquals(false, config4.equals(config5));
+        config4.setClassname(value);
+        config5.setConfig(map);
+        assertEquals(false, config4.equals(config5));
+        config4.setConfig(null);
+        assertEquals(false, config4.equals(config5));
+        config4.setConfig(map);
+        config5.setDescription(value);
+        assertEquals(false, config4.equals(config5));
+        config4.setDescription(id);
+        assertEquals(false, config4.equals(config5));
+        config4.setDescription(value);
+        config4.setId(null);
+        assertEquals(false, config4.equals(config5));
+        config4.setId(value);
+        assertEquals(false, config4.equals(config5));
+        config4.setId(id);
+        config5.setName(value);
+        assertEquals(false, config4.equals(config5));
+        config4.setName(id);
+        assertEquals(false, config4.equals(config5));
+        assertThat(config.hashCode(), is(not(0)));
 
-    // Test toString
-    assertThat(config.toString().length(), is(not(0)));
-  }
+        // Test toString
+        assertThat(config.toString().length(), is(not(0)));
+    }
 }
index 26af008..7aaa381 100644 (file)
@@ -3,14 +3,15 @@
  * ONAP-XACML
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,129 +37,114 @@ import org.onap.policy.xacml.std.pap.StdPDPPolicy;
 import com.att.research.xacml.api.pap.PAPException;
 import org.onap.policy.xacml.std.pap.StdPDPPolicyParams;
 
-
 public class StdPDPPolicyTest {
-  @Test
-  public void testPolicy() throws URISyntaxException, IOException, PAPException {
-    // Set up test data
-    String value = "testVal";
-    URI uri = new URI("http://localhost/");
-    int[] array = {1, 1};
+    @Test
+    public void testPolicy() throws URISyntaxException, IOException, PAPException {
+        // Set up test data
+        String value = "testVal";
+        URI uri = new URI("http://localhost/");
+        int[] array = {1, 1};
 
-    // Test constructors
-    StdPDPPolicy policy = new StdPDPPolicy(value, true);
-    assertNotNull(policy);
-    StdPDPPolicy policy2 = new StdPDPPolicy(value, true, value);
-    assertNotNull(policy2);
-    StdPDPPolicy policy4 = new StdPDPPolicy();
-    assertNotNull(policy4);
+        // Test constructors
+        StdPDPPolicy policy = new StdPDPPolicy(value, true);
+        assertNotNull(policy);
+        StdPDPPolicy policy2 = new StdPDPPolicy(value, true, value);
+        assertNotNull(policy2);
+        StdPDPPolicy policy4 = new StdPDPPolicy();
+        assertNotNull(policy4);
 
-    StdPDPPolicy policy5 = new StdPDPPolicy(StdPDPPolicyParams.builder()
-            .id(value)
-            .isRoot(true)
-            .name(value)
-            .location(uri)
-            .isValid(false)
-            .policyId(value)
-            .description(value)
-            .version("1")
-            .build());
-    assertNotNull(policy5);
-    StdPDPPolicy policy6 = new StdPDPPolicy(value, true, value, uri, false);
-    assertNotNull(policy6);
-    StdPDPPolicy policy8 = new StdPDPPolicy(value, true, value, uri, false);
-    assertNotNull(policy8);
+        StdPDPPolicy policy5 = new StdPDPPolicy(
+                StdPDPPolicyParams.builder().id(value).isRoot(true).name(value).location(uri)
+                        .isValid(false).policyId(value).description(value).version("1").build());
+        assertNotNull(policy5);
+        StdPDPPolicy policy6 = new StdPDPPolicy(value, true, value, uri, false);
+        assertNotNull(policy6);
+        StdPDPPolicy policy8 = new StdPDPPolicy(value, true, value, uri, false);
+        assertNotNull(policy8);
 
-    // Test set and get
-    policy.setId(value);
-    assertEquals(value, policy.getId());
-    policy.setName(value);
-    assertEquals(value, policy.getName());
-    policy.setPolicyId(value);
-    assertEquals(value, policy.getPolicyId());
-    policy.setDescription(value);
-    assertEquals(value, policy.getDescription());
-    policy.setVersion("1");
-    assertEquals("1", policy.getVersion());
-    assertEquals(1, policy.getVersionInts()[0]);
-    assertEquals(true, policy.isRoot());
-    policy.setValid(true);
-    assertEquals(true, policy.isValid());
-    assertEquals(uri, policy5.getLocation());
-    policy.setRoot(false);
-    assertEquals(false, policy.isRoot());
-    policy.setLocation(uri);
-    assertEquals(uri, policy.getLocation());
+        // Test set and get
+        policy.setId(value);
+        assertEquals(value, policy.getId());
+        policy.setName(value);
+        assertEquals(value, policy.getName());
+        policy.setPolicyId(value);
+        assertEquals(value, policy.getPolicyId());
+        policy.setDescription(value);
+        assertEquals(value, policy.getDescription());
+        policy.setVersion("1");
+        assertEquals("1", policy.getVersion());
+        assertEquals(1, policy.getVersionInts()[0]);
+        assertEquals(true, policy.isRoot());
+        policy.setValid(true);
+        assertEquals(true, policy.isValid());
+        assertEquals(uri, policy5.getLocation());
+        policy.setRoot(false);
+        assertEquals(false, policy.isRoot());
+        policy.setLocation(uri);
+        assertEquals(uri, policy.getLocation());
 
-    // Test equals combinations
-    assertThat(policy.hashCode(), is(not(0)));
-    assertEquals(true, policy.equals(policy));
-    assertEquals(false, policy.equals(null));
-    assertEquals(false, policy.equals(value));
-    assertEquals(true, policy6.equals(policy8));
-    policy6.setId("1");
-    assertEquals(false, policy6.equals(policy8));
-    policy6.setId(null);
-    assertEquals(false, policy6.equals(policy8));
-    policy8.setId(null);
-    assertEquals(true, policy6.equals(policy8));
-    policy8.setPolicyId(value);
-    assertEquals(false, policy6.equals(policy8));
-    policy6.setPolicyId("1");
-    policy8.setPolicyId("2");
-    assertEquals(false, policy6.equals(policy8));
-    policy8.setPolicyId("1");
-    policy6.setVersion("1");
-    policy8.setVersion("2");
-    assertEquals(false, policy6.equals(policy8));
+        // Test equals combinations
+        assertThat(policy.hashCode(), is(not(0)));
+        assertEquals(true, policy.equals(policy));
+        assertEquals(false, policy.equals(null));
+        assertEquals(false, policy.equals(value));
+        assertEquals(true, policy6.equals(policy8));
+        policy6.setId("1");
+        assertEquals(false, policy6.equals(policy8));
+        policy6.setId(null);
+        assertEquals(false, policy6.equals(policy8));
+        policy8.setId(null);
+        assertEquals(true, policy6.equals(policy8));
+        policy8.setPolicyId(value);
+        assertEquals(false, policy6.equals(policy8));
+        policy6.setPolicyId("1");
+        policy8.setPolicyId("2");
+        assertEquals(false, policy6.equals(policy8));
+        policy8.setPolicyId("1");
+        policy6.setVersion("1");
+        policy8.setVersion("2");
+        assertEquals(false, policy6.equals(policy8));
 
-    // Test toString
-    assertThat(policy.toString().length(), is(not(0)));
-    assertEquals("1.1", StdPDPPolicy.versionArrayToString(array));
-    assertEquals("", StdPDPPolicy.versionArrayToString(null));
-    assertEquals(0, StdPDPPolicy.versionStringToArray(null).length);
-  }
+        // Test toString
+        assertThat(policy.toString().length(), is(not(0)));
+        assertEquals("1.1", StdPDPPolicy.versionArrayToString(array));
+        assertEquals("", StdPDPPolicy.versionArrayToString(null));
+        assertEquals(0, StdPDPPolicy.versionStringToArray(null).length);
+    }
 
-  @Test(expected = ConnectException.class)
-  public void negTestStream() throws URISyntaxException, IOException, PAPException {
-    // Set up test data
-    String value = "testVal";
-    URI uri = new URI("http://localhost:54287");
-    StdPDPPolicy policy = new StdPDPPolicy(StdPDPPolicyParams.builder()
-            .id(value)
-            .isRoot(true)
-            .name(value)
-            .location(uri)
-            .isValid(false)
-            .policyId(value)
-            .description(value)
-            .version("1")
-            .build());
+    @Test(expected = ConnectException.class)
+    public void negTestStream() throws URISyntaxException, IOException, PAPException {
+        // Set up test data
+        String value = "testVal";
+        URI uri = new URI("http://localhost:54287");
+        StdPDPPolicy policy = new StdPDPPolicy(
+                StdPDPPolicyParams.builder().id(value).isRoot(true).name(value).location(uri)
+                        .isValid(false).policyId(value).description(value).version("1").build());
 
-    // Negative test stream
-    policy.getStream();
-  }
+        // Negative test stream
+        policy.getStream();
+    }
 
-  @Test(expected = ConnectException.class)
-  public void negTestConstructor1() throws URISyntaxException, IOException {
-    // Set up test data
-    String value = "testVal";
-    URI uri = new URI("http://localhost:54287");
+    @Test(expected = ConnectException.class)
+    public void negTestConstructor1() throws URISyntaxException, IOException {
+        // Set up test data
+        String value = "testVal";
+        URI uri = new URI("http://localhost:54287");
 
-    // Test constructor
-    StdPDPPolicy policy = new StdPDPPolicy(value, true, value, uri);
-    assertNotNull(policy);
-  }
+        // Test constructor
+        StdPDPPolicy policy = new StdPDPPolicy(value, true, value, uri);
+        assertNotNull(policy);
+    }
 
-  @Test(expected = ConnectException.class)
-  public void negTestConstructor2() throws URISyntaxException, IOException {
-    // Set up test data
-    String value = "testVal";
-    URI uri = new URI("http://localhost:54287");
-    Properties props = new Properties();
+    @Test(expected = ConnectException.class)
+    public void negTestConstructor2() throws URISyntaxException, IOException {
+        // Set up test data
+        String value = "testVal";
+        URI uri = new URI("http://localhost:54287");
+        Properties props = new Properties();
 
-    // Test constructor
-    StdPDPPolicy policy = new StdPDPPolicy(value, true, uri, props);
-    assertNotNull(policy);
-  }
+        // Test constructor
+        StdPDPPolicy policy = new StdPDPPolicy(value, true, uri, props);
+        assertNotNull(policy);
+    }
 }
index c99eef8..dfdbf5f 100644 (file)
@@ -2,12 +2,14 @@
  * ============LICENSE_START=======================================================
  * Copyright (C) 2018 Ericsson. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -132,33 +134,33 @@ public class StdPDPStatusTest {
         stdPDPStatus.setStatus(Status.OUT_OF_SYNCH);
         assertFalse(stdPDPStatus.isOk());
     }
-    
+
     @Test
     public void testAddLoadError() {
         stdPDPStatus.addLoadError("An error");
         assertEquals("An error", stdPDPStatus.getLoadErrors().iterator().next());
     }
-    
+
     @Test
     public void testAddLoadWarning() {
         stdPDPStatus.addLoadWarning("A warning");
         assertEquals("A warning", stdPDPStatus.getLoadWarnings().iterator().next());
     }
-    
+
     @Test
     public void testAddLoadedPolicy() {
         PDPPolicy policy = new StdPDPPolicy();
         stdPDPStatus.addLoadedPolicy(policy);
         assertEquals(policy, stdPDPStatus.getLoadedPolicies().iterator().next());
     }
-    
+
     @Test
     public void testAddRootPolicy() {
         PDPPolicy policy = new StdPDPPolicy();
         stdPDPStatus.addRootPolicy(policy);
         assertEquals(policy, stdPDPStatus.getLoadedRootPolicies().iterator().next());
     }
-    
+
     @Test
     public void testAddAllLoadedRootPolicy() {
         Set<PDPPolicy> policies = new HashSet<>();
@@ -167,9 +169,9 @@ public class StdPDPStatusTest {
         stdPDPStatus.addAllLoadedRootPolicies(policies);
         assertEquals(policies, stdPDPStatus.getLoadedRootPolicies());
     }
-    
+
     @Test
-    public void testAddLoadedPipConfig(){
+    public void testAddLoadedPipConfig() {
         PDPPIPConfig pipConfig = new StdPDPPIPConfig();
         stdPDPStatus.addLoadedPipConfig(pipConfig);
         assertEquals(pipConfig, stdPDPStatus.getLoadedPipConfigs().iterator().next());
@@ -214,12 +216,16 @@ public class StdPDPStatusTest {
         assertEquals(loadedPIPConfigs, stdPDPStatus1.getLoadedPipConfigs());
         assertEquals(failedPIPConfigs, stdPDPStatus1.getFailedPipConfigs());
 
-        assertEquals("StdPDPStatus [status=UP_TO_DATE, loadErrors=[An error], loadWarnings=[An error], loadedPolicies=[StdPDPPolicy " 
-                        + "[id=null, name=null, policyId=null, description=null, version=, isRoot=false, isValid=false, location=null]], "
-                        + "loadedRootPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null, version=, isRoot=false, "
-                        + "isValid=false, location=null]], failedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null, "
-                        + "version=, isRoot=false, isValid=false, location=null]], loadedPIPConfigs=[StdPDPPIPConfig [id=null, name=null, "
-                        + "description=null, classname=null, config={}]], failedPIPConfigs=[StdPDPPIPConfig [id=null, name=null, description=null, classname=null, config={}]]]",
+        assertEquals(
+                "StdPDPStatus [status=UP_TO_DATE, loadErrors=[An error], loadWarnings=[An error],"
+                        + " loadedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+                        + " version=, isRoot=false, isValid=false, location=null]],"
+                        + " loadedRootPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+                        + " version=, isRoot=false, isValid=false, location=null]],"
+                        + " failedPolicies=[StdPDPPolicy [id=null, name=null, policyId=null, description=null,"
+                        + " version=, isRoot=false, isValid=false, location=null]], loadedPIPConfigs=[StdPDPPIPConfig"
+                        + " [id=null, name=null, description=null, classname=null, config={}]], failedPIPConfigs="
+                        + "[StdPDPPIPConfig [id=null, name=null, description=null, classname=null, config={}]]]",
                 stdPDPStatus1.toString());
     }
 
index e62f1fd..0beb282 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,132 +42,132 @@ import com.att.research.xacml.api.pap.PDPPolicy;
 
 public class StdPDPTest {
 
-  private static Logger logger = FlexLogger.getLogger(StdPDPTest.class);
+    private static Logger logger = FlexLogger.getLogger(StdPDPTest.class);
 
-  private StdPDP stdPDP;
+    private StdPDP stdPDP;
 
-  @Before
-  public void setUp() {
+    @Before
+    public void setUp() {
 
-    try {
-      stdPDP = new StdPDP();
-    } catch (Exception e) {
-      logger.error(e);
+        try {
+            stdPDP = new StdPDP();
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetId() {
-    try {
-      stdPDP.setId("testId");
-      assertTrue(stdPDP.getId() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testGetId() {
+        try {
+            stdPDP.setId("testId");
+            assertTrue(stdPDP.getId() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetName() {
-    try {
-      stdPDP.setName("abc");
-      assertTrue(stdPDP.getName() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testGetName() {
+        try {
+            stdPDP.setName("abc");
+            assertTrue(stdPDP.getName() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetDescription() {
-    try {
-      stdPDP.setDescription("somee here");
-      assertTrue(stdPDP.getDescription() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testGetDescription() {
+        try {
+            stdPDP.setDescription("somee here");
+            assertTrue(stdPDP.getDescription() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetStatus() {
-    try {
-      stdPDP.setStatus(new StdPDPStatus());
-      assertTrue(stdPDP.getStatus() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testGetStatus() {
+        try {
+            stdPDP.setStatus(new StdPDPStatus());
+            assertTrue(stdPDP.getStatus() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetPipConfigs() {
-    try {
-      assertTrue(stdPDP.getPipConfigs() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testGetPipConfigs() {
+        try {
+            assertTrue(stdPDP.getPipConfigs() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+    }
+
+    @Test
+    public void testGetJmxPort() {
+        try {
+            stdPDP.setJmxPort(123);
+            assertTrue(stdPDP.getJmxPort() != null);
+        } catch (Exception e) {
+            logger.error(e);
+        }
     }
-  }
-
-  @Test
-  public void testGetJmxPort() {
-    try {
-      stdPDP.setJmxPort(123);
-      assertTrue(stdPDP.getJmxPort() != null);
-    } catch (Exception e) {
-      logger.error(e);
+
+    @Test
+    public void testPDP() {
+        // Set up test data
+        String id = "testID";
+        String value = "testVal";
+        Properties props = new Properties();
+        props.setProperty(id + ".name", value);
+        props.setProperty(id + ".description", value);
+        props.setProperty(id + ".jmxport", "0");
+        Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+        Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+
+        // Test constructors
+        StdPDP pdp = new StdPDP(id, 0);
+        assertNotNull(pdp);
+        StdPDP pdp2 = new StdPDP(id, value, 0);
+        assertNotNull(pdp2);
+        StdPDP pdp3 = new StdPDP(id, value, value, 0);
+        assertNotNull(pdp3);
+        StdPDP pdp4 = new StdPDP(id, props);
+        assertNotNull(pdp4);
+        StdPDP pdp5 = new StdPDP(id, props);
+        assertNotNull(pdp5);
+
+        // Test set and get
+        pdp.setPipConfigs(pipConfigs);
+        assertEquals(pipConfigs, pdp.getPipConfigs());
+        pdp.setPolicies(policies);
+        assertEquals(policies, pdp.getPolicies());
+
+        // Test equals combinations
+        assertEquals(true, pdp4.equals(pdp5));
+        assertEquals(true, pdp4.equals(pdp4));
+        assertEquals(false, pdp4.equals(null));
+        assertEquals(false, pdp4.equals(value));
+        pdp4.setId(null);
+        assertEquals(false, pdp4.equals(value));
+        pdp5.setId(id);
+        assertEquals(false, pdp4.equals(pdp5));
+        pdp4.setId(value);
+        assertEquals(false, pdp4.equals(pdp5));
+        assertThat(pdp.hashCode(), is(not(0)));
+
+        // Test compare
+        assertEquals(-1, pdp4.compareTo(null));
+        assertEquals(0, pdp4.compareTo(pdp4));
+        pdp5.setName(null);
+        assertEquals(-1, pdp4.compareTo(pdp5));
+        pdp4.setName(null);
+        pdp5.setName(value);
+        assertEquals(1, pdp4.compareTo(pdp5));
+
+        // Test toString
+        assertThat(pdp.toString().length(), is(not(0)));
     }
-  }
-
-  @Test
-  public void testPDP() {
-    // Set up test data
-    String id = "testID";
-    String value = "testVal";
-    Properties props = new Properties();
-    props.setProperty(id + ".name", value);
-    props.setProperty(id + ".description", value);
-    props.setProperty(id + ".jmxport", "0");
-    Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
-    Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
-
-    // Test constructors
-    StdPDP pdp = new StdPDP(id, 0);
-    assertNotNull(pdp);
-    StdPDP pdp2 = new StdPDP(id, value, 0);
-    assertNotNull(pdp2);
-    StdPDP pdp3 = new StdPDP(id, value, value, 0);
-    assertNotNull(pdp3);
-    StdPDP pdp4 = new StdPDP(id, props);
-    assertNotNull(pdp4);
-    StdPDP pdp5 = new StdPDP(id, props);
-    assertNotNull(pdp5);
-
-    // Test set and get
-    pdp.setPipConfigs(pipConfigs);
-    assertEquals(pipConfigs, pdp.getPipConfigs());
-    pdp.setPolicies(policies);
-    assertEquals(policies, pdp.getPolicies());
-
-    // Test equals combinations
-    assertEquals(true, pdp4.equals(pdp5));
-    assertEquals(true, pdp4.equals(pdp4));
-    assertEquals(false, pdp4.equals(null));
-    assertEquals(false, pdp4.equals(value));
-    pdp4.setId(null);
-    assertEquals(false, pdp4.equals(value));
-    pdp5.setId(id);
-    assertEquals(false, pdp4.equals(pdp5));
-    pdp4.setId(value);
-    assertEquals(false, pdp4.equals(pdp5));
-    assertThat(pdp.hashCode(), is(not(0)));
-
-    // Test compare
-    assertEquals(-1, pdp4.compareTo(null));
-    assertEquals(0, pdp4.compareTo(pdp4));
-    pdp5.setName(null);
-    assertEquals(-1, pdp4.compareTo(pdp5));
-    pdp4.setName(null);
-    pdp5.setName(value);
-    assertEquals(1, pdp4.compareTo(pdp5));
-
-    // Test toString
-    assertThat(pdp.toString().length(), is(not(0)));
-  }
 }
index bc9a674..2b43ce7 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,17 +34,17 @@ import com.att.research.xacml.std.StdMutableAttribute;
 import com.att.research.xacml.std.pip.StdPIPRequest;
 
 public class OperationHistoryEngineTest {
-       @Test
-       public void testBaseNegativeCase() throws PIPException {
-               OperationHistoryEngine engine = new OperationHistoryEngine();
-               Collection<PIPRequest> required = engine.attributesRequired();
-               assertEquals(required.size(), 0);
-               Collection<PIPRequest> provided = engine.attributesProvided();
-               assertEquals(provided.size(), 0);
-               
-               Attribute attribute = new StdMutableAttribute();
-               PIPRequest pipRequest = new StdPIPRequest(attribute);
-               PIPResponse response = engine.getAttributes(pipRequest, null);
-               assertEquals(response.getStatus().isOk(), true);
-       }
+    @Test
+    public void testBaseNegativeCase() throws PIPException {
+        OperationHistoryEngine engine = new OperationHistoryEngine();
+        Collection<PIPRequest> required = engine.attributesRequired();
+        assertEquals(required.size(), 0);
+        Collection<PIPRequest> provided = engine.attributesProvided();
+        assertEquals(provided.size(), 0);
+
+        Attribute attribute = new StdMutableAttribute();
+        PIPRequest pipRequest = new StdPIPRequest(attribute);
+        PIPResponse response = engine.getAttributes(pipRequest, null);
+        assertEquals(response.getStatus().isOk(), true);
+    }
 }
index f60645f..319198e 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,32 +36,33 @@ import com.att.research.xacml.util.XACMLProperties;
 import com.att.research.xacml.api.XACML3;
 
 public class AAFEngineTest {
-       @Test
-       public void aafEngineTest(){
-               String testId = "testId";
-               System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.properties");
-               AAFEngine aafEngine = new AAFEngine();
-               assertTrue(AAFEngine.DEFAULT_DESCRIPTION.equals("PIP for authenticating aaf attributes using the AAF REST interface"));
-               assertTrue(AAFEngine.DEFAULT_ISSUER.equals("aaf"));
-               
-               Properties props = new Properties();
-               try {
-                       aafEngine.configure(testId, props);
-                       assertEquals(aafEngine.getName(), testId);
-                       assertEquals(aafEngine.getDescription(), AAFEngine.DEFAULT_DESCRIPTION);
-                       assertEquals(aafEngine.getIssuer(), AAFEngine.DEFAULT_ISSUER);
-                       assertEquals(aafEngine.attributesProvided().size(), 2);
-                       assertEquals(aafEngine.attributesRequired().size(), 5);
-                       
-                       PIPRequest pipRequest = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, AAFEngine.AAF_RESPONSE_ID, XACML3.ID_DATATYPE_STRING);
-                       StdPIPFinderFactory pipFactory = new StdPIPFinderFactory();
-                       PIPFinder pipFinder = pipFactory.getFinder();
-                       assertEquals(pipFinder.getPIPEngines().size(), 0);
-                       PIPResponse pipResponse = aafEngine.getAttributes(pipRequest, pipFinder);
-                       assertEquals(pipResponse.getStatus().isOk(), true);
-               }
-               catch (Exception ex) {
-                       fail("Not expecting any exceptions");
-               }
-       }
+    @Test
+    public void aafEngineTest() {
+        String testId = "testId";
+        System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.properties");
+        AAFEngine aafEngine = new AAFEngine();
+        assertTrue(AAFEngine.DEFAULT_DESCRIPTION
+                .equals("PIP for authenticating aaf attributes using the AAF REST interface"));
+        assertTrue(AAFEngine.DEFAULT_ISSUER.equals("aaf"));
+
+        Properties props = new Properties();
+        try {
+            aafEngine.configure(testId, props);
+            assertEquals(aafEngine.getName(), testId);
+            assertEquals(aafEngine.getDescription(), AAFEngine.DEFAULT_DESCRIPTION);
+            assertEquals(aafEngine.getIssuer(), AAFEngine.DEFAULT_ISSUER);
+            assertEquals(aafEngine.attributesProvided().size(), 2);
+            assertEquals(aafEngine.attributesRequired().size(), 5);
+
+            PIPRequest pipRequest = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                    AAFEngine.AAF_RESPONSE_ID, XACML3.ID_DATATYPE_STRING);
+            StdPIPFinderFactory pipFactory = new StdPIPFinderFactory();
+            PIPFinder pipFinder = pipFactory.getFinder();
+            assertEquals(pipFinder.getPIPEngines().size(), 0);
+            PIPResponse pipResponse = aafEngine.getAttributes(pipRequest, pipFinder);
+            assertEquals(pipResponse.getStatus().isOk(), true);
+        } catch (Exception ex) {
+            fail("Not expecting any exceptions");
+        }
+    }
 }
index 041acde..291bae8 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.policy.xacml.test.util;
 
 import static org.junit.Assert.*;
-
 import org.junit.Test;
 import org.onap.policy.xacml.util.MetricsUtil;
 
 public class MetricsUtilTest {
-       
-       @Test
-       public void metricsUtilTest(){
-               MetricsUtil.AvgLatency avgLatency = new MetricsUtil.AvgLatency();
-               avgLatency.compute(0);
-               assertTrue(avgLatency.avg() == 0);
-               avgLatency.compute(2);
-               assertTrue(avgLatency.avg() == 1);
-               avgLatency.reset();
-               assertTrue(avgLatency.avg() == 0);
-               
-               MetricsUtil.MaxLatency maxLatency = new MetricsUtil.MaxLatency();
-               maxLatency.compute(2);
-               assertTrue(maxLatency.max() == 2);
-               maxLatency.reset();
-               assertTrue(maxLatency.max() < 0);
-               
-               MetricsUtil.MinLatency minLatency = new MetricsUtil.MinLatency();
-               minLatency.compute(2);
-               assertTrue(minLatency.min() == 2);
-               minLatency.reset();
-               assertTrue(minLatency.min() > 0);
-       }
+
+    @Test
+    public void metricsUtilTest() {
+        MetricsUtil.AvgLatency avgLatency = new MetricsUtil.AvgLatency();
+        avgLatency.compute(0);
+        assertTrue(avgLatency.avg() == 0);
+        avgLatency.compute(2);
+        assertTrue(avgLatency.avg() == 1);
+        avgLatency.reset();
+        assertTrue(avgLatency.avg() == 0);
+
+        MetricsUtil.MaxLatency maxLatency = new MetricsUtil.MaxLatency();
+        maxLatency.compute(2);
+        assertTrue(maxLatency.max() == 2);
+        maxLatency.reset();
+        assertTrue(maxLatency.max() < 0);
+
+        MetricsUtil.MinLatency minLatency = new MetricsUtil.MinLatency();
+        minLatency.compute(2);
+        assertTrue(minLatency.min() == 2);
+        minLatency.reset();
+        assertTrue(minLatency.min() > 0);
+    }
 
 }
index 09dcf83..0270a89 100644 (file)
@@ -4,12 +4,14 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,68 +23,69 @@ package org.onap.policy.xacml.test.util;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.List;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.xacml.util.XACMLPolicyScanner;
-
 import com.att.research.xacml.util.XACMLPolicyScanner.Callback;
 
 public class XACMLPolicyScannerTest {
 
-       private static final Log logger                         = LogFactory.getLog(XACMLPolicyScannerTest.class);
-       private static Path configPolicyPathValue;
-       private static Path actionPolicyPathValue;
-       
-       @Before
-       public void setUp() {
-               File templateFile;
-               ClassLoader classLoader = getClass().getClassLoader();
+    private static final Log logger = LogFactory.getLog(XACMLPolicyScannerTest.class);
+    private static Path configPolicyPathValue;
+    private static Path actionPolicyPathValue;
+
+    @Before
+    public void setUp() {
+        File templateFile;
+        ClassLoader classLoader = getClass().getClassLoader();
+        try {
+            templateFile =
+                    new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
+            configPolicyPathValue = templateFile.toPath();
+            templateFile =
+                    new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
+            actionPolicyPathValue = templateFile.toPath();
+        } catch (Exception e1) {
+            logger.error("Exception Occured" + e1);
+        }
+    }
+
+    @Test
+    public void xacmlPolicyScannerTest() throws IOException {
+        Callback callback = null;
         try {
-               templateFile = new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
-               configPolicyPathValue = templateFile.toPath();
-               templateFile = new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
-               actionPolicyPathValue = templateFile.toPath();
-               } catch (Exception e1) {
-                       logger.error("Exception Occured"+e1);
-               }
-       }
-       
-       @Test
-       public void xacmlPolicyScannerTest() throws IOException{
-               Callback callback = null;
-               try{
-                       XACMLPolicyScanner actionScanner = new XACMLPolicyScanner(actionPolicyPathValue, callback);
-                       assertTrue(actionScanner.getPolicyObject() != null);
-                       Object actionObject = actionScanner.scan();
-                       assertTrue(actionObject != null);
-                       
-                       XACMLPolicyScanner scanner = new XACMLPolicyScanner(configPolicyPathValue, callback);
-                       assertTrue(scanner.getPolicyObject() != null);
-                       Object object = scanner.scan();
-                       assertTrue(object != null);
-                       String id = XACMLPolicyScanner.getID(scanner.getPolicyObject());
-                       assertTrue(id.equals("urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1"));
-                       String version = XACMLPolicyScanner.getVersion(scanner.getPolicyObject());
-                       assertTrue(version.equals("1"));
-                       String versionFromPath = XACMLPolicyScanner.getVersion(configPolicyPathValue);
-                       assertTrue(versionFromPath.equals("1"));
-                       List<String> returnValue = XACMLPolicyScanner.getCreatedByModifiedBy(configPolicyPathValue);
-                       assertTrue(returnValue.get(0).equals("test"));
-                       String createdBy = XACMLPolicyScanner.getCreatedBy(configPolicyPathValue);
-                       assertTrue(createdBy.equals("test"));
-                       String modifiedBy = XACMLPolicyScanner.getModifiedBy(configPolicyPathValue);
-                       assertTrue(modifiedBy.equals("test"));
-               }catch(Exception e){
-                       fail();
-                       logger.error("Exception Occured"+e);
-               }
-       }
+            XACMLPolicyScanner actionScanner =
+                    new XACMLPolicyScanner(actionPolicyPathValue, callback);
+            assertTrue(actionScanner.getPolicyObject() != null);
+            Object actionObject = actionScanner.scan();
+            assertTrue(actionObject != null);
+
+            XACMLPolicyScanner scanner = new XACMLPolicyScanner(configPolicyPathValue, callback);
+            assertTrue(scanner.getPolicyObject() != null);
+            Object object = scanner.scan();
+            assertTrue(object != null);
+            String id = XACMLPolicyScanner.getID(scanner.getPolicyObject());
+            assertTrue(id.equals("urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1"));
+            String version = XACMLPolicyScanner.getVersion(scanner.getPolicyObject());
+            assertTrue(version.equals("1"));
+            String versionFromPath = XACMLPolicyScanner.getVersion(configPolicyPathValue);
+            assertTrue(versionFromPath.equals("1"));
+            List<String> returnValue =
+                    XACMLPolicyScanner.getCreatedByModifiedBy(configPolicyPathValue);
+            assertTrue(returnValue.get(0).equals("test"));
+            String createdBy = XACMLPolicyScanner.getCreatedBy(configPolicyPathValue);
+            assertTrue(createdBy.equals("test"));
+            String modifiedBy = XACMLPolicyScanner.getModifiedBy(configPolicyPathValue);
+            assertTrue(modifiedBy.equals("test"));
+        } catch (Exception e) {
+            fail();
+            logger.error("Exception Occured" + e);
+        }
+    }
 }
index 446a87d..4cf40a3 100644 (file)
@@ -1,15 +1,17 @@
-/*
+/*-
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,73 +23,74 @@ package org.onap.policy.xacml.test.util;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Path;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.xacml.util.XACMLPolicyWriter;
-
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 
 public class XACMLPolicyWriterTest {
-  private static final Log logger = LogFactory.getLog(XACMLPolicyWriterTest.class);
-  private static Path configPolicyPathValue;
-  private static Path actionPolicyPathValue;
+    private static final Log logger = LogFactory.getLog(XACMLPolicyWriterTest.class);
+    private static Path configPolicyPathValue;
+    private static Path actionPolicyPathValue;
 
-  @Before
-  public void setUp() {
-    File templateFile;
-    ClassLoader classLoader = getClass().getClassLoader();
-    try {
-      templateFile = new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
-      configPolicyPathValue = templateFile.toPath();
-      templateFile = new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
-      actionPolicyPathValue = templateFile.toPath();
-    } catch (Exception e1) {
-      logger.error("Exception Occured" + e1);
+    @Before
+    public void setUp() {
+        File templateFile;
+        ClassLoader classLoader = getClass().getClassLoader();
+        try {
+            templateFile =
+                    new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
+            configPolicyPathValue = templateFile.toPath();
+            templateFile =
+                    new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
+            actionPolicyPathValue = templateFile.toPath();
+        } catch (Exception e1) {
+            logger.error("Exception Occured" + e1);
+        }
     }
-  }
 
-  @SuppressWarnings("static-access")
-  @Test
-  public void xacmlPolicyWriterTest() throws IOException {
-    XACMLPolicyWriter writer = new XACMLPolicyWriter();
-    String configResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(configPolicyPathValue);
-    assertTrue(configResponseValue.equals("txt"));
-    String actionResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(actionPolicyPathValue);
-    assertTrue(actionResponseValue.equals("json"));
-  }
+    @SuppressWarnings("static-access")
+    @Test
+    public void xacmlPolicyWriterTest() throws IOException {
+        XACMLPolicyWriter writer = new XACMLPolicyWriter();
+        String configResponseValue =
+                writer.changeFileNameInXmlWhenRenamePolicy(configPolicyPathValue);
+        assertTrue(configResponseValue.equals("txt"));
+        String actionResponseValue =
+                writer.changeFileNameInXmlWhenRenamePolicy(actionPolicyPathValue);
+        assertTrue(actionResponseValue.equals("json"));
+    }
+
+    @Test
+    public void testWrites() throws Exception {
+        // Set up test data
+        PolicyType policyType = new PolicyType();
+        OutputStream os = new ByteArrayOutputStream();
+        File tmpfile = File.createTempFile("foo", null);
+        Path filename = tmpfile.toPath();
+        PolicySetType policySet = new PolicySetType();
 
-  @Test
-  public void testWrites() throws Exception {
-    // Set up test data
-    PolicyType policyType = new PolicyType();
-    OutputStream os = new ByteArrayOutputStream();
-    File tmpfile = File.createTempFile("foo", null);
-    Path filename = tmpfile.toPath();
-    PolicySetType policySet = new PolicySetType();
-    
-    // delete tmp file before running the test
-    tmpfile.delete();
+        // delete tmp file before running the test
+        tmpfile.delete();
 
-    // ensure its deleted after writePolicyFile() re-creates it
-    tmpfile.deleteOnExit();
+        // ensure its deleted after writePolicyFile() re-creates it
+        tmpfile.deleteOnExit();
 
-    // Test write combinations
-    assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policySet));
-    assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policyType));
-    assertNotNull(XACMLPolicyWriter.getXmlAsInputStream(policyType));
-    XACMLPolicyWriter.writePolicyFile(os, policySet);
-    assertNotNull(os.toString());
-    XACMLPolicyWriter.writePolicyFile(os, policyType);
-    assertNotNull(os.toString());
-  }
+        // Test write combinations
+        assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policySet));
+        assertNotNull(XACMLPolicyWriter.writePolicyFile(filename, policyType));
+        assertNotNull(XACMLPolicyWriter.getXmlAsInputStream(policyType));
+        XACMLPolicyWriter.writePolicyFile(os, policySet);
+        assertNotNull(os.toString());
+        XACMLPolicyWriter.writePolicyFile(os, policyType);
+        assertNotNull(os.toString());
+    }
 }