Remove useless imports and vars 18/97418/1
authorPamela Dragosh <pdragosh@research.att.com>
Tue, 22 Oct 2019 11:51:12 +0000 (07:51 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Tue, 22 Oct 2019 11:52:42 +0000 (07:52 -0400)
Some formatting and javadoc cleanup also.

Issue-ID: POLICY-2133
Change-Id: Icb0f76c7e69df87918b4bc5a02a013f9d2bfae89
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
16 files changed:
BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/XACMLPapServletTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/utils/test/PolicyApiUtilsTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/notifications/test/NotificationTest.java
ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java
PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java
PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java

index 1a6dc47..8fda22e 100644 (file)
@@ -7,9 +7,9 @@
  * 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,7 +29,6 @@ import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.EntityTransaction;
 import javax.persistence.Persistence;
-import javax.persistence.Query;
 import javax.persistence.TypedQuery;
 
 import org.junit.Test;
index eca473f..228dc83 100644 (file)
@@ -693,10 +693,8 @@ public class FirewallConfigPolicy extends Policy {
                         String type = null;
                         for (int membersIndex = 0; membersIndex < membersArray.size(); membersIndex++) {
                             JsonObject membersObj = membersArray.getJsonObject(membersIndex);
-                            //String value = membersObj.get("value").toString();
                             type = membersObj.get("type").toString().replace("\"", "");
 
-                            String value = null;
                             prefixIP = getName(prefixIP, membersObj, type);
                         }
                         String prefixList = "'"+prefixIP+"'";
@@ -1065,7 +1063,6 @@ public class FirewallConfigPolicy extends Policy {
                                 JsonObject membersObj = membersArray.getJsonObject(membersIndex);
                                 type = membersObj.get("type").toString().replace("\"", "");
 
-                                String value = null;
                                 prefixIP = getName(prefixIP, membersObj, type);
                             }
 
index ee274d2..5b42fc3 100644 (file)
@@ -74,9 +74,7 @@ public class MicroServiceDictionaryController {
     private static String dictionaryDBQuery = "dictionaryDBQuery";
     private LinkedHashMap<String, MSAttributeObject> classMap;
     private List<String> modelList = new ArrayList<>();
-    private static String apiflag = "apiflag";
     private static String dictionaryFields = "dictionaryFields";
-    private static String update = "update";
     private static String duplicateResponseString = "Duplicate";
     private static String microServiceModelsDictionaryDatas = "microServiceModelsDictionaryDatas";
     private static String modelName = "modelName";
index fd0c157..1b65fed 100644 (file)
@@ -93,10 +93,6 @@ public class XACMLPAPTest {
     private static SessionFactory sessionFactory;
     private static CommonClassDao commonClassDao;
 
-    private static final String DEFAULT_DB_DRIVER = "org.h2.Driver";
-    private static final String DEFAULT_DB_USER = "sa";
-    private static final String DEFAULT_DB_PWD = "";
-
     @BeforeClass
     public static void beforeClassSetup() throws ServletException {
         sessionFactory = PolicyDBDaoTest.setupH2DbDaoImpl("xacmlpaptest");
index 36d4027..56d511c 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
index 542d45e..f131c97 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -51,7 +51,7 @@ public class ClosedLoopPolicyTest {
     @Test
     public void testReadFile() throws IOException {
         thrown.expect(IOException.class);
-        String read = ClosedLoopPolicy.readFile("/foo",  StandardCharsets.UTF_8);
+        ClosedLoopPolicy.readFile("/foo",  StandardCharsets.UTF_8);
         fail("Expecting an exception.");
     }
 
index 25e94c1..40c2d4b 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,6 @@
 package org.onap.policy.pap.xacml.rest.components;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 import static org.mockito.Matchers.anyString;
index e4da430..64e46f5 100644 (file)
@@ -30,8 +30,6 @@ import java.nio.file.Paths;
 import java.util.Date;
 import java.util.List;
 import java.util.Properties;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
 import javax.persistence.Persistence;
 import javax.persistence.PersistenceException;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
index 5e0b7ce..aeb01ee 100644 (file)
@@ -28,9 +28,6 @@ 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;
@@ -39,9 +36,6 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
 import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.DCAEuuid;
-import org.onap.policy.rest.jpa.MicroServiceLocation;
-import org.onap.policy.rest.jpa.MicroServiceModels;
 import org.onap.policy.rest.jpa.OptimizationModels;
 import org.onap.policy.rest.jpa.UserInfo;
 import org.springframework.mock.web.MockHttpServletResponse;
index d1da554..d090599 100644 (file)
@@ -28,7 +28,6 @@ import static org.junit.Assert.assertTrue;
 import javax.json.Json;
 import javax.json.JsonArray;
 import javax.json.JsonObject;
-import org.json.JSONObject;
 import org.junit.Test;
 import org.onap.policy.pdp.rest.api.utils.PolicyApiUtils;
 
index 2612265..190f93a 100644 (file)
@@ -23,8 +23,6 @@ package org.onap.policy.pdp.rest.notifications.test;
 
 import static org.junit.Assert.assertEquals;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import org.junit.Test;
 import org.onap.policy.api.NotificationType;
index 675a87e..6845411 100644 (file)
@@ -40,8 +40,8 @@ public class RegisterTest {
         triggers.add(trigger);
 
         register.setScheduleTriggers(triggers);
-        assertEquals(register.getScheduleTriggers(), triggers);
-        assertEquals(register.getTriggers().length, 1);
+        assertEquals(triggers, register.getScheduleTriggers());
+        assertEquals(1, register.getTriggers().length);
     }
 
     @Test(expected = NullPointerException.class)
@@ -54,7 +54,6 @@ public class RegisterTest {
     @Test(expected = NullPointerException.class)
     public void testRegisterNegativeCase2() {
         // Setup test data
-        String value = "testVal";
         Register register = new Register();
         List<Trigger> triggers = new ArrayList<Trigger>();
         register.setScheduleTriggers(triggers);
index 0003e12..e0ee60a 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -37,8 +37,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
@@ -73,18 +71,18 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableDefinitionType;
 
 /**
  * class XACMLPolicyScanner
- * 
+ *
  * This class traverses the hierarchy of a XACML 3.0 policy. You can optionally pass a Callback class
- * and override any desired methods to retrieve information from a policy. 
- * 
+ * and override any desired methods to retrieve information from a policy.
+ *
  *
  */
 public class XACMLPolicyScanner {
-       
+
        private static final Log logger                         = LogFactory.getLog(XACMLPolicyScanner.class);
        private Object policyObject = null;
        private Callback callback = null;
-       
+
        public XACMLPolicyScanner(Path filename, Callback callback) {
                try (InputStream is = Files.newInputStream(filename)) {
                        this.policyObject = XACMLPolicyScanner.readPolicy(is);
@@ -93,7 +91,7 @@ public class XACMLPolicyScanner {
                }
                this.callback = callback;
        }
-       
+
        public XACMLPolicyScanner(InputStream filename, Callback callback) {
                try (InputStream is = filename) {
                        this.policyObject = XACMLPolicyScanner.readPolicy(is);
@@ -102,37 +100,37 @@ public class XACMLPolicyScanner {
                }
                this.callback = callback;
        }
-       
+
        public XACMLPolicyScanner(PolicySetType policySet, Callback callback) {
                this.policyObject = policySet;
                this.callback = callback;
        }
-       
+
        public XACMLPolicyScanner(PolicySetType policySet) {
                this(policySet, null);
        }
-       
+
        public XACMLPolicyScanner(PolicyType policy, Callback callback) {
                this.policyObject = policy;
                this.callback = callback;
        }
-       
+
        public XACMLPolicyScanner(PolicyType policy) {
                this(policy, null);
        }
-       
+
        /**
         * Sets the callback interface to be used.
-        * 
+        *
         * @param cb
         */
        public void setCallback(Callback cb) {
                this.callback = cb;
        }
-       
+
        /**
         * Saves the given callback object then calls the scan() method.
-        * 
+        *
         * @param cb
         * @return
         */
@@ -140,11 +138,11 @@ public class XACMLPolicyScanner {
                this.callback = cb;
                return this.scan();
        }
-       
+
        /**
-        * 
+        *
         * This begins the scanning of the contained object.
-        * 
+        *
         * @return - The PolicySet/Policy that was scanned.
         */
        public Object scan() {
@@ -166,10 +164,10 @@ public class XACMLPolicyScanner {
                }
                return this.policyObject;
        }
-       
+
        /**
         * This performs the scan of a PolicySet
-        * 
+        *
         * @param parent - Its parent PolicySet. Can be null if this is the root.
         * @param policySet - The PolicySet object.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -203,7 +201,7 @@ public class XACMLPolicyScanner {
                //
                List<JAXBElement<?>> list = policySet.getPolicySetOrPolicyOrPolicySetIdReference();
                for (JAXBElement<?> element: list) {
-                       if ("PolicySet".equals(element.getName().getLocalPart()) && 
+                       if ("PolicySet".equals(element.getName().getLocalPart()) &&
                                this.scanPolicySet(policySet, (PolicySetType)element.getValue()) == CallbackResult.STOP) {
                                return CallbackResult.STOP;
                        } else if ("Policy".equals(element.getName().getLocalPart()) &&
@@ -218,11 +216,11 @@ public class XACMLPolicyScanner {
                }
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
-        * 
+        *
         * This performs scanning of the Policy object.
-        * 
+        *
         * @param parent - The parent PolicySet of the policy. This can be null if this is a root Policy.
         * @param policy - The policy being scanned.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -292,10 +290,10 @@ public class XACMLPolicyScanner {
                }
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
         * Scans the given target for attributes. Its sole purpose is to return attributes found.
-        * 
+        *
         * @param parent - The parent PolicySet/Policy/Rule for the target.
         * @param target - The target.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -355,10 +353,10 @@ public class XACMLPolicyScanner {
                }
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
         * Scan the list of obligations.
-        * 
+        *
         * @param parent - The parent PolicySet/Policy/Rule for the obligation.
         * @param obligationExpressionsType - All the obligation expressions.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -398,9 +396,9 @@ public class XACMLPolicyScanner {
        }
 
        /**
-        * 
+        *
         * Scans the list of advice expressions returning each individually.
-        * 
+        *
         * @param parent - The parent PolicySet/Policy/Rule for the advice.
         * @param adviceExpressionstype - The list of advice expressions.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -437,10 +435,10 @@ public class XACMLPolicyScanner {
                }
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
         * Scans the list of variable definitions.
-        * 
+        *
         * @param policy - Policy object containing the variable definition.
         * @param list - List of variable definitions.
         * @return CallbackResult - CONTINUE to continue, STOP to terminate scanning.
@@ -454,13 +452,13 @@ public class XACMLPolicyScanner {
                                return CallbackResult.STOP;
                        }
                }
-               
+
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
         * Scans the list of conditions.
-        * 
+        *
         * @param rule
         * @param condition
         * @return
@@ -471,13 +469,13 @@ public class XACMLPolicyScanner {
                }
                return CallbackResult.CONTINUE;
        }
-       
+
        /**
         * Reads the XACML XML policy file in and returns the version contained in the root Policy/PolicySet element.
-        * 
+        *
         * @param policy - The policy file.
         * @return - The version string from the file (uninterpreted)
-        * @throws IOException 
+        * @throws IOException
         */
        public static String    getVersion(Path policy) throws IOException {
                Object data = null;
@@ -493,10 +491,10 @@ public class XACMLPolicyScanner {
                }
                return getVersion(data);
        }
-               
+
        /**
         * Reads the Policy/PolicySet element object and returns its current version.
-        * 
+        *
         * @param data - Either a PolicySet or Policy XACML type object.
         * @return - The integer version value. -1 if it doesn't exist or was un-parsable.
         */
@@ -524,10 +522,10 @@ public class XACMLPolicyScanner {
                }
                return null;
        }
-       
+
        /**
         * Returns the Policy or PolicySet ID.
-        * 
+        *
         * @param data - A XACML 3.0 Policy or PolicySet element object.
         * @return The policy/policyset's policy ID
         */
@@ -541,7 +539,7 @@ public class XACMLPolicyScanner {
                        return null;
                }
        }
-       
+
        public static List<String> getCreatedByModifiedBy(Path policyPath) throws IOException{
                String createdBy = "";
                String modifiedBy= "";
@@ -560,7 +558,7 @@ public class XACMLPolicyScanner {
                }
                return Arrays.asList(createdBy, modifiedBy);
        }
-       
+
        //get the Created Name of the User on reading the Xml file
        public static String getCreatedBy(Path policyPath) throws IOException{
                String userId = "";
@@ -577,7 +575,7 @@ public class XACMLPolicyScanner {
                }
                return userId;
        }
-       
+
        //get the Modified Name of the User on reading the Xml file
        public static String getModifiedBy(Path policyPath) throws IOException{
                String modifiedBy = "";
@@ -597,7 +595,7 @@ public class XACMLPolicyScanner {
 
        /**
         * readPolicy - does the work to read in policy data from a file.
-        * 
+        *
         * @param policy - The path to the policy file.
         * @return - The policy data object. This *should* be either a PolicySet or a Policy.
         */
index f8af9c4..1b55fef 100644 (file)
@@ -22,7 +22,6 @@
 
 package org.onap.policy.std.test;
 
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import java.util.LinkedList;
 import java.util.List;
index cb5c40c..ce17944 100644 (file)
@@ -25,7 +25,6 @@ package org.onap.policy.std.test;
 import org.junit.*;
 import org.onap.policy.std.NotificationStore;
 import org.onap.policy.std.StdPDPNotification;
-import static org.junit.Assert.*;
 
 /**
  * The class <code>NotificationStoreTest</code> contains tests for the class
index e7d8249..a5c4e85 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,8 +23,6 @@ package org.onap.policy.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.api.PolicyConfigStatus;