diff options
16 files changed, 60 insertions, 89 deletions
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java index 1a6dc4719..8fda22e26 100644 --- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java +++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java @@ -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; diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java index eca473f41..228dc83d2 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java @@ -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); } diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java index ee274d2a7..5b42fc310 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java @@ -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"; diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java index fd0c157fe..1b65feddb 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java @@ -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"); diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/XACMLPapServletTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/XACMLPapServletTest.java index 36d40278b..56d511cb3 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/XACMLPapServletTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/XACMLPapServletTest.java @@ -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. diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicyTest.java index 542d45e3e..f131c9732 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicyTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicyTest.java @@ -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."); } diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicyTest.java index 25e94c1a2..40c2d4b44 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicyTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicyTest.java @@ -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; diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java index e4da430a5..64e46f59e 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java @@ -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; diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java index 5e0b7ce28..aeb01ee26 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java @@ -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; diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/utils/test/PolicyApiUtilsTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/utils/test/PolicyApiUtilsTest.java index d1da554d9..d09059978 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/utils/test/PolicyApiUtilsTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/utils/test/PolicyApiUtilsTest.java @@ -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; diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/notifications/test/NotificationTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/notifications/test/NotificationTest.java index 261226527..190f93aa7 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/notifications/test/NotificationTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/notifications/test/NotificationTest.java @@ -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; diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java index 675a87e43..68454112d 100644 --- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java +++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java @@ -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); diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java index 0003e12c6..e0ee60ade 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java @@ -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. */ diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java index f8af9c4f2..1b55fef91 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/ManualClientEndUEBTest.java @@ -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; diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java index cb5c40c60..ce1794450 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/test/NotificationStoreTest.java @@ -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 diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java index e7d82499f..a5c4e85fa 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyConfigStatusTest.java @@ -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; |