From 7a0a44eac6167cfeff935c39f2c3f20d3a893c3e Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 4 Dec 2019 09:20:04 +0000 Subject: Minor changes for new Eclipse checkstyle checks The laest Eclipse checkstyle version 8.26.0 does more thorough checking and identified a number of small issues in the apex-pdp codebase. This review fixes those issues. Issue-ID: POLICY-1913 Change-Id: I30ba25e3e425c6d54c77f925e8da3ab841a8357c Signed-off-by: liamfallon --- .../test/concepts/TestContextBooleanItem.java | 4 +- .../context/test/concepts/TestContextByteItem.java | 4 +- .../test/concepts/TestContextDoubleItem.java | 4 +- .../test/concepts/TestContextFloatItem.java | 4 +- .../context/test/concepts/TestContextIntItem.java | 4 +- .../context/test/concepts/TestContextLongItem.java | 4 +- .../test/concepts/TestContextLongObjectItem.java | 4 +- .../test/concepts/TestContextStringItem.java | 4 +- .../test/concepts/TestContextTreeMapItem.java | 4 +- .../test/concepts/TestContextTreeSetItem.java | 4 +- .../context/factory/TestContextAlbumFactory.java | 4 +- .../integration/context/utils/Constants.java | 4 +- .../integration/context/utils/NetworkUtils.java | 11 ++- .../resources/infinispan/default-jgroups-udp.xml | 101 +++++++++++---------- .../executor/handling/TestContextUpdateModel.java | 14 +-- .../uservice/adapt/jms/TestContext.java | 44 ++++++--- .../adapt/jms/TestInitialContextFactory.java | 10 +- .../DummyApexEventProducer.java | 5 +- 18 files changed, 145 insertions(+), 88 deletions(-) (limited to 'testsuites/integration') diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java index 8786d4071..208571a3e 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java @@ -38,7 +38,9 @@ public class TestContextBooleanItem implements Serializable { /** * The Constructor. */ - public TestContextBooleanItem() {} + public TestContextBooleanItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java index 4a0746c15..b152f2715 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java @@ -36,7 +36,9 @@ public class TestContextByteItem implements Serializable { /** * The Constructor. */ - public TestContextByteItem() {} + public TestContextByteItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java index aa3830a4a..e67ba5e7e 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java @@ -37,7 +37,9 @@ public class TestContextDoubleItem implements Serializable { /** * The Constructor. */ - public TestContextDoubleItem() {} + public TestContextDoubleItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java index 350f2bac8..fec1c2545 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java @@ -36,7 +36,9 @@ public class TestContextFloatItem implements Serializable { /** * The Constructor. */ - public TestContextFloatItem() {} + public TestContextFloatItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java index a565583ca..ea76f7049 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java @@ -36,7 +36,9 @@ public class TestContextIntItem implements Serializable { /** * The Constructor. */ - public TestContextIntItem() {} + public TestContextIntItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java index 1c3d5bfd9..dc18da5f5 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java @@ -37,7 +37,9 @@ public class TestContextLongItem implements Serializable { /** * The Constructor. */ - public TestContextLongItem() {} + public TestContextLongItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java index 20a7492db..fb1e9319d 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java @@ -36,7 +36,9 @@ public class TestContextLongObjectItem implements Serializable { /** * The Constructor. */ - public TestContextLongObjectItem() {} + public TestContextLongObjectItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java index 02f39daff..16a180a64 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java @@ -36,7 +36,9 @@ public class TestContextStringItem implements Serializable { /** * The Constructor. */ - public TestContextStringItem() {} + public TestContextStringItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java index 4a5c75066..3e3aae121 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java @@ -38,7 +38,9 @@ public class TestContextTreeMapItem implements Serializable { /** * The Constructor. */ - public TestContextTreeMapItem() {} + public TestContextTreeMapItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java index 610dc10c6..7c83d48e5 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java @@ -40,7 +40,9 @@ public class TestContextTreeSetItem implements Serializable { /** * The Constructor. */ - public TestContextTreeSetItem() {} + public TestContextTreeSetItem() { + // Default constructor + } /** * The Constructor. diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java index 45ea0fdc4..4abbc2051 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java @@ -60,7 +60,9 @@ public final class TestContextAlbumFactory { /** * Default constructor to prevent sub-classing. */ - private TestContextAlbumFactory() {} + private TestContextAlbumFactory() { + // Private constructor to block subclassing + } /** * Creates the policy context model. diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java index 6fdcf6121..bf0c57a5f 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java @@ -68,7 +68,9 @@ public class Constants { /** * Instantiates a new constants. */ - private Constants() {} + private Constants() { + // Private constructor to block subclassing + } /** * Gets the ax artifact key array. diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java index ac43b7120..30bc8d823 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java @@ -37,12 +37,14 @@ public class NetworkUtils { /** * Instantiates a new network utils. */ - private NetworkUtils() {} + private NetworkUtils() { + // Private constructor to block subclassing + } /** - * The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to - * work. In order to ensure that all the JVMs in a test pick up the same IP address, this - * function sets the address to be the first non-loopback IPv4 address on a host + * The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to work. In order to ensure + * that all the JVMs in a test pick up the same IP address, this function sets the address to be the first + * non-loopback IPv4 address on a host * * @return Set of IPv4 addresses * @throws SocketException throw socket exception if error occurs @@ -63,5 +65,4 @@ public class NetworkUtils { return ipAddressSet; } - } diff --git a/testsuites/integration/integration-context-test/src/test/resources/infinispan/default-jgroups-udp.xml b/testsuites/integration/integration-context-test/src/test/resources/infinispan/default-jgroups-udp.xml index a84a737b5..79a3d0633 100644 --- a/testsuites/integration/integration-context-test/src/test/resources/infinispan/default-jgroups-udp.xml +++ b/testsuites/integration/integration-context-test/src/test/resources/infinispan/default-jgroups-udp.xml @@ -6,23 +6,25 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - + SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= --> - - + - - - - - - - - - - - - - - + thread_pool.keep_alive_time="60000" /> + + + + + + + + + + + + + + diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java index 75f84b73c..94bf0c8b8 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java @@ -71,12 +71,12 @@ public class TestContextUpdateModel { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -88,7 +88,7 @@ public class TestContextUpdateModel { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); ParameterService.register(engineParameters); @@ -100,7 +100,7 @@ public class TestContextUpdateModel { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -170,7 +170,9 @@ public class TestContextUpdateModel { * Test context update model after. */ @After - public void testContextUpdateModelAfter() {} + public void testContextUpdateModelAfter() { + // Not used + } /** * Send event. @@ -182,7 +184,7 @@ public class TestContextUpdateModel { * @throws ContextException the context exception */ private void sendEvent(final ApexEngine apexEngine, final TestApexActionListener listener, final String eventName, - final boolean shouldWork) throws ContextException { + final boolean shouldWork) throws ContextException { final Date aDate = new Date(1433453067123L); final Map eventDataMap = new HashMap(); eventDataMap.put("TestSlogan", "This is a test slogan"); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java index a44f84444..b547cc482 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java @@ -90,49 +90,65 @@ public class TestContext implements Context { * {@inheritDoc}. */ @Override - public void bind(final Name name, final Object obj) throws NamingException {} + public void bind(final Name name, final Object obj) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void bind(final String name, final Object obj) throws NamingException {} + public void bind(final String name, final Object obj) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void rebind(final Name name, final Object obj) throws NamingException {} + public void rebind(final Name name, final Object obj) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void rebind(final String name, final Object obj) throws NamingException {} + public void rebind(final String name, final Object obj) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void unbind(final Name name) throws NamingException {} + public void unbind(final Name name) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void unbind(final String name) throws NamingException {} + public void unbind(final String name) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void rename(final Name oldName, final Name newName) throws NamingException {} + public void rename(final Name oldName, final Name newName) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void rename(final String oldName, final String newName) throws NamingException {} + public void rename(final String oldName, final String newName) throws NamingException { + // Not used here + } /** * {@inheritDoc}. @@ -170,13 +186,17 @@ public class TestContext implements Context { * {@inheritDoc}. */ @Override - public void destroySubcontext(final Name name) throws NamingException {} + public void destroySubcontext(final Name name) throws NamingException { + // Not used here + } /** * {@inheritDoc}. */ @Override - public void destroySubcontext(final String name) throws NamingException {} + public void destroySubcontext(final String name) throws NamingException { + // Not used here + } /** * {@inheritDoc}. @@ -270,7 +290,9 @@ public class TestContext implements Context { * {@inheritDoc}. */ @Override - public void close() throws NamingException {} + public void close() throws NamingException { + // Not used here + } /** * {@inheritDoc}. diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java index ddd70a3b9..c54c790cb 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -40,7 +40,9 @@ public class TestInitialContextFactory implements InitialContextFactory { * * @throws NamingException the naming exception */ - public TestInitialContextFactory() throws NamingException {} + public TestInitialContextFactory() throws NamingException { + // Default constructor + } /** * {@inheritDoc}. diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java index 0c2ac32fa..670f4991f 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java @@ -125,7 +125,6 @@ public class DummyApexEventProducer implements ApexEventProducer { throw new ApexEventRuntimeException(message); } - try { executionProperties.store(new FileOutputStream(new File(dummyProducerProperties.getPropertyFileName())), ""); @@ -141,5 +140,7 @@ public class DummyApexEventProducer implements ApexEventProducer { * {@inheritDoc}. */ @Override - public void stop() {} + public void stop() { + // Not used + } } -- cgit 1.2.3-korg