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 --- .../engine/parameters/ExecutorParameterTests.java | 95 ++++++----- .../service/engine/parameters/ParameterTests.java | 18 +-- .../engine/parameters/ProducerConsumerTests.java | 179 ++++++++++----------- .../engine/parameters/SyncParameterTests.java | 30 ++-- .../dummyclasses/DummyStateFinalizerExecutor.java | 4 +- .../parameters/dummyclasses/DummyTaskExecutor.java | 12 +- .../dummyclasses/DummyTaskSelectExecutor.java | 11 +- .../SuperDooperCarrierTechnologyParameters.java | 45 +++--- .../dummyclasses/SuperDooperEventProducer.java | 16 +- .../dummyclasses/SuperDooperEventSubscriber.java | 5 +- .../SuperTokenDelimitedEventConverter.java | 10 +- ...SuperTokenDelimitedEventProtocolParameters.java | 10 +- 12 files changed, 222 insertions(+), 213 deletions(-) (limited to 'services/services-engine') diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java index 4ba63a3cd..2af051ea7 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.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========================================================= */ @@ -33,7 +33,7 @@ import org.onap.policy.common.parameters.ParameterException; /** * Test for an empty parameter file. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ExecutorParameterTests { @@ -44,14 +44,13 @@ public class ExecutorParameterTests { @Test public void noParamsTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorNoParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorNoParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals(0, parameters.getEngineServiceParameters().getEngineParameters().getExecutorParameterMap() - .size()); + assertEquals(0, + parameters.getEngineServiceParameters().getEngineParameters().getExecutorParameterMap().size()); } catch (final ParameterException e) { fail("This test should not throw any exception: " + e.getMessage()); } @@ -59,8 +58,7 @@ public class ExecutorParameterTests { @Test public void badParamsTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorBadParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -68,16 +66,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorBadParams.json\"\n" - + "(ParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not " - + "a parameter JSON object", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorBadParams.json\"\n" + + "(ParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not " + + "a parameter JSON object", e.getMessage()); } } @Test public void noExecutorParamsTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorNoExecutorParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorNoExecutorParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -85,16 +82,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" - + "(ParameterRuntimeException):no \"executorParameters\" entry found in parameters," - + " at least one executor parameter entry must be specified", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" + + "(ParameterRuntimeException):no \"executorParameters\" entry found in parameters," + + " at least one executor parameter entry must be specified", e.getMessage()); } } @Test public void emptyParamsTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorEmptyParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorEmptyParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -102,16 +98,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" - + "(ParameterRuntimeException):could not find field \"parameterClassName\" " - + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" + + "(ParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @Test public void badPluginParamNameTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorBadPluginNameParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginNameParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -119,16 +114,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" - + "(ParameterRuntimeException):could not find field \"parameterClassName\" " - + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" + + "(ParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @Test public void badPluginParamObjectTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -136,16 +130,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" - + "(ParameterRuntimeException):value for field \"parameterClassName\" " - + "of \"executorParameters:LOOBY\" entry is not a plain string", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" + + "(ParameterRuntimeException):value for field \"parameterClassName\" " + + "of \"executorParameters:LOOBY\" entry is not a plain string", e.getMessage()); } } @Test public void badPluginParamBlankTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -153,16 +146,15 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" - + "(ParameterRuntimeException):value for field \"parameterClassName\" " - + "in \"executorParameters:LOOBY\" entry is not specified or is blank", e.getMessage()); + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" + + "(ParameterRuntimeException):value for field \"parameterClassName\" " + + "in \"executorParameters:LOOBY\" entry is not specified or is blank", e.getMessage()); } } @Test public void badPluginParamValueTest() { - final String[] args = - { "-c", "src/test/resources/parameters/serviceExecutorBadPluginValueParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -170,17 +162,16 @@ public class ExecutorParameterTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from" - + " \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" - + "(ParameterRuntimeException):failed to deserialize the parameters " - + "for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" - + "java.lang.ClassNotFoundException: helloworld", e.getMessage()); + + " \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" + + "(ParameterRuntimeException):failed to deserialize the parameters " + + "for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" + + "java.lang.ClassNotFoundException: helloworld", e.getMessage()); } } @Test public void goodParametersTest() { - final String[] args = - { "-c", "src/test/resources/parameters/goodParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -198,8 +189,14 @@ public class ExecutorParameterTests { @Test public void relativeParametersTest() { - final String[] args = - { "-rfr", "src/test/resources", "-c", "src/test/resources/parameters/goodParamsRelative.json" }; + // @formatter:off + final String[] args = { + "-rfr", + "src/test/resources", + "-c", + "src/test/resources/parameters/goodParamsRelative.json" + }; + // @formatter:on final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -211,7 +208,7 @@ public class ExecutorParameterTests { assertEquals(19, parameters.getEngineServiceParameters().getInstanceCount()); assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort()); assertTrue(parameters.getEngineServiceParameters().getPolicyModelFileName() - .endsWith("policymodels/SmallModel.json")); + .endsWith("policymodels/SmallModel.json")); } catch (final ParameterException e) { fail("This test should not throw any exception: " + e.getMessage()); } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java index 5dd00117c..e12bb6142 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java @@ -49,7 +49,7 @@ import org.onap.policy.common.parameters.ParameterException; public class ParameterTests { @Test public void invalidParametersNoFileTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/invalidNoFile.json" }; + final String[] args = {"-c", "src/test/resources/parameters/invalidNoFile.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -63,7 +63,7 @@ public class ParameterTests { @Test public void invalidParametersEmptyTest() { - final String[] args = { "-c", "src/test/resources/parameters/empty.json" }; + final String[] args = {"-c", "src/test/resources/parameters/empty.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -77,7 +77,7 @@ public class ParameterTests { @Test public void invalidParametersNoParamsTest() { - final String[] args = { "-c", "src/test/resources/parameters/noParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/noParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -98,7 +98,7 @@ public class ParameterTests { @Test public void invalidParametersBlankParamsTest() { - final String[] args = { "-c", "src/test/resources/parameters/blankParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/blankParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -123,7 +123,7 @@ public class ParameterTests { @Test public void invalidParametersTest() { - final String[] args = { "-c", "src/test/resources/parameters/badParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/badParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -169,7 +169,7 @@ public class ParameterTests { @Test public void modelNotFileTest() { - final String[] args = { "-c", "src/test/resources/parameters/badParamsModelNotFile.json" }; + final String[] args = {"-c", "src/test/resources/parameters/badParamsModelNotFile.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -191,7 +191,7 @@ public class ParameterTests { @Test public void goodParametersTest() { - final String[] args = { "-c", "src/test/resources/parameters/goodParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -240,7 +240,7 @@ public class ParameterTests { @Test public void superDooperParametersTest() { - final String[] args = { "-c", "src/test/resources/parameters/superDooperParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/superDooperParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -287,7 +287,7 @@ public class ParameterTests { assertEquals("some.key.deserailizer", superDooperParameters.getKeyDeserializer()); assertEquals("some.value.deserailizer", superDooperParameters.getValueDeserializer()); - final String[] consumerTopics = { "consumer-out-0", "consumer-out-1", "consumer-out-2" }; + final String[] consumerTopics = {"consumer-out-0", "consumer-out-1", "consumer-out-2"}; assertEquals(Arrays.asList(consumerTopics), superDooperParameters.getConsumerTopicList()); } catch (final ParameterException e) { fail("This test should not throw an exception"); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java index 792897f23..20d54ae3e 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java @@ -40,8 +40,7 @@ import org.onap.policy.common.parameters.ParameterException; public class ProducerConsumerTests { @Test public void goodParametersTest() { - final String[] args = - { "-c", "src/test/resources/parameters/goodParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -53,21 +52,21 @@ public class ProducerConsumerTests { assertEquals(19, parameters.getEngineServiceParameters().getInstanceCount()); assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort()); assertEquals("FILE", parameters.getEventOutputParameters().get("FirstProducer") - .getCarrierTechnologyParameters().getLabel()); - assertEquals("JSON", parameters.getEventOutputParameters().get("FirstProducer").getEventProtocolParameters() - .getLabel()); + .getCarrierTechnologyParameters().getLabel()); + assertEquals("JSON", + parameters.getEventOutputParameters().get("FirstProducer").getEventProtocolParameters().getLabel()); assertEquals("FILE", parameters.getEventOutputParameters().get("MyOtherProducer") - .getCarrierTechnologyParameters().getLabel()); + .getCarrierTechnologyParameters().getLabel()); assertEquals("JSON", parameters.getEventOutputParameters().get("MyOtherProducer") - .getEventProtocolParameters().getLabel()); + .getEventProtocolParameters().getLabel()); assertEquals("FILE", parameters.getEventInputParameters().get("TheFileConsumer1") - .getCarrierTechnologyParameters().getLabel()); + .getCarrierTechnologyParameters().getLabel()); assertEquals("JSON", parameters.getEventInputParameters().get("TheFileConsumer1") - .getEventProtocolParameters().getLabel()); + .getEventProtocolParameters().getLabel()); assertEquals("SUPER_DOOPER", parameters.getEventInputParameters().get("MySuperDooperConsumer1") - .getCarrierTechnologyParameters().getLabel()); + .getCarrierTechnologyParameters().getLabel()); assertEquals("SUPER_TOK_DEL", parameters.getEventInputParameters().get("MySuperDooperConsumer1") - .getEventProtocolParameters().getLabel()); + .getEventProtocolParameters().getLabel()); } catch (final ParameterException e) { fail("This test should not throw an exception"); } @@ -75,8 +74,7 @@ public class ProducerConsumerTests { @Test public void noCarrierTechnology() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsNoCT.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsNoCT.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -84,21 +82,20 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("validation error(s) on parameters from \"src/test/resources/parameters/prodConsNoCT.json\"\n" - + "parameter group \"APEX_PARAMETERS\" type " - + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " - + "parameter group has status INVALID\n" - + " parameter group map \"eventInputParameters\" INVALID, " - + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" type " - + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID," - + " parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, " - + "event handler carrierTechnologyParameters not specified or blank\n", e.getMessage()); + + "parameter group \"APEX_PARAMETERS\" type " + + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " + + "parameter group has status INVALID\n" + + " parameter group map \"eventInputParameters\" INVALID, " + + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" type " + + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID," + + " parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, " + + "event handler carrierTechnologyParameters not specified or blank\n", e.getMessage()); } } @Test public void noEventProcol() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsNoEP.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsNoEP.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -106,30 +103,29 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("validation error(s) on parameters from \"src/test/resources/parameters/prodConsNoEP.json\"\n" - + "parameter group \"APEX_PARAMETERS\" type " - + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " - + "parameter group has status INVALID\n" - + " parameter group map \"eventOutputParameters\" INVALID, " - + "parameter group map has status INVALID\n" + " parameter group \"aProducer\" type " - + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID" - + ", parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, " - + "event handler eventProtocolParameters not specified or blank\n" - + " parameter group map \"eventInputParameters\" INVALID, " - + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" type " - + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID" - + ", parameter group has status INVALID\n" + " parameter group \"FILE\" type " - + "\"org.onap.policy.apex.service.engine.event.impl." - + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, " - + "parameter group has status INVALID\n" - + " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, " - + "\"null\" invalid, must be specified as a non-empty string\n", e.getMessage()); + + "parameter group \"APEX_PARAMETERS\" type " + + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " + + "parameter group has status INVALID\n" + + " parameter group map \"eventOutputParameters\" INVALID, " + + "parameter group map has status INVALID\n" + " parameter group \"aProducer\" type " + + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID" + + ", parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, " + + "event handler eventProtocolParameters not specified or blank\n" + + " parameter group map \"eventInputParameters\" INVALID, " + + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" type " + + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID" + + ", parameter group has status INVALID\n" + " parameter group \"FILE\" type " + + "\"org.onap.policy.apex.service.engine.event.impl." + + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, " + + "parameter group has status INVALID\n" + + " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, " + + "\"null\" invalid, must be specified as a non-empty string\n", e.getMessage()); } } @Test public void noCarrierTechnologyParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsNoCTParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsNoCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -137,15 +133,14 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoCTParClass.json\"\n" - + "(ParameterRuntimeException):carrier technology \"SUPER_DOOPER\" " - + "parameter \"parameterClassName\" value \"null\" invalid in JSON file", e.getMessage()); + + "(ParameterRuntimeException):carrier technology \"SUPER_DOOPER\" " + + "parameter \"parameterClassName\" value \"null\" invalid in JSON file", e.getMessage()); } } @Test public void mismatchCarrierTechnologyParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsMismatchCTParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsMismatchCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -153,45 +148,44 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" - + "(ParameterRuntimeException):carrier technology \"SUPER_LOOPER\" " - + "does not match plugin \"SUPER_DOOPER\" in \"" + "org.onap.policy.apex.service.engine." - + "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - + "\", specify correct carrier technology parameter plugin " - + "in parameter \"parameterClassName\"", e.getMessage()); + + "\"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" + + "(ParameterRuntimeException):carrier technology \"SUPER_LOOPER\" " + + "does not match plugin \"SUPER_DOOPER\" in \"" + "org.onap.policy.apex.service.engine." + + "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + + "\", specify correct carrier technology parameter plugin " + + "in parameter \"parameterClassName\"", e.getMessage()); } } @Test public void wrongTypeCarrierTechnologyParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsWrongTypeCTParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsWrongTypeCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ParameterException e) { - assertEquals("error reading parameters from " + assertEquals( + "error reading parameters from " + "\"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" + "(ParameterRuntimeException):could not create default parameters for carrier technology " + "\"SUPER_DOOPER\"\n" + "org.onap.policy.apex.service.engine.parameters.dummyclasses." + "SuperTokenDelimitedEventProtocolParameters cannot be cast to " + "org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters", - e.getMessage()); + e.getMessage()); } } @Test public void okFileNameCarrierTechnology() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsOKFileName.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsOKFileName.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); final FileCarrierTechnologyParameters fileParams = (FileCarrierTechnologyParameters) parameters - .getEventOutputParameters().get("aProducer").getCarrierTechnologyParameters(); + .getEventOutputParameters().get("aProducer").getCarrierTechnologyParameters(); assertTrue(fileParams.getFileName().endsWith("target/aaa.json")); assertEquals(false, fileParams.isStandardError()); assertEquals(false, fileParams.isStandardIo()); @@ -203,8 +197,7 @@ public class ProducerConsumerTests { @Test public void badFileNameCarrierTechnology() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsBadFileName.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsBadFileName.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -212,45 +205,44 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("validation error(s) on parameters from " - + "\"src/test/resources/parameters/prodConsBadFileName.json\"\n" - + "parameter group \"APEX_PARAMETERS\" type " - + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " - + "parameter group has status INVALID\n" - + " parameter group map \"eventOutputParameters\" INVALID, " - + "parameter group map has status INVALID\n" + " parameter group \"aProducer\" type " - + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" " - + "INVALID, parameter group has status INVALID\n" + " parameter group \"FILE\" type " - + "\"org.onap.policy.apex.service.engine.event.impl." - + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, " - + "parameter group has status INVALID\n" + " field \"fileName\" type " - + "\"java.lang.String\" value \"null\" INVALID, " - + "\"null\" invalid, must be specified as a non-empty string\n", e.getMessage()); + + "\"src/test/resources/parameters/prodConsBadFileName.json\"\n" + + "parameter group \"APEX_PARAMETERS\" type " + + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " + + "parameter group has status INVALID\n" + + " parameter group map \"eventOutputParameters\" INVALID, " + + "parameter group map has status INVALID\n" + " parameter group \"aProducer\" type " + + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" " + + "INVALID, parameter group has status INVALID\n" + " parameter group \"FILE\" type " + + "\"org.onap.policy.apex.service.engine.event.impl." + + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, " + + "parameter group has status INVALID\n" + " field \"fileName\" type " + + "\"java.lang.String\" value \"null\" INVALID, " + + "\"null\" invalid, must be specified as a non-empty string\n", e.getMessage()); } } @Test public void badEventProtocolParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsBadEPParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsBadEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ParameterException e) { - assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" + assertEquals( + "error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" + "(ParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" " + "does not match plugin \"JSON\" in \"org.onap.policy.apex.service.engine.event.impl" + ".jsonprotocolplugin.JsonEventProtocolParameters" + "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"", - e.getMessage()); + e.getMessage()); } } @Test public void noEventProtocolParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsNoEPParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsNoEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -258,36 +250,35 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoEPParClass.json\"\n" - + "(ParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" parameter " - + "\"parameterClassName\" value \"null\" invalid in JSON file", e.getMessage()); + + "(ParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" parameter " + + "\"parameterClassName\" value \"null\" invalid in JSON file", e.getMessage()); } } @Test public void mismatchEventProtocolParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsMismatchEPParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsMismatchEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ParameterException e) { - assertEquals("error reading parameters from " + assertEquals( + "error reading parameters from " + "\"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n" + "(ParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" " + "does not match plugin \"SUPER_TOK_DEL\" in " + "\"org.onap.policy.apex.service.engine.parameters.dummyclasses." + "SuperTokenDelimitedEventProtocolParameters\", " + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", - e.getMessage()); + e.getMessage()); } } @Test public void wrongTypeEventProtocolParClass() { - final String[] args = - { "-c", "src/test/resources/parameters/prodConsWrongTypeEPParClass.json" }; + final String[] args = {"-c", "src/test/resources/parameters/prodConsWrongTypeEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -295,12 +286,12 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ParameterException e) { assertEquals("error reading parameters from " - + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" - + "(ParameterRuntimeException):could not create default parameters for event protocol " - + "\"SUPER_TOK_DEL\"\n" + "org.onap.policy.apex.service.engine." - + "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " - + "cannot be cast to org.onap.policy.apex.service." - + "parameters.eventprotocol.EventProtocolParameters", e.getMessage()); + + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" + + "(ParameterRuntimeException):could not create default parameters for event protocol " + + "\"SUPER_TOK_DEL\"\n" + "org.onap.policy.apex.service.engine." + + "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " + + "cannot be cast to org.onap.policy.apex.service." + + "parameters.eventprotocol.EventProtocolParameters", e.getMessage()); } } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java index 153913b96..3da682884 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java @@ -46,7 +46,7 @@ import org.onap.policy.common.parameters.ParameterException; public class SyncParameterTests { @Test public void syncBadNoSyncWithPeer() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -68,7 +68,7 @@ public class SyncParameterTests { @Test public void syncBadNotSyncWithPeer() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -90,7 +90,7 @@ public class SyncParameterTests { @Test public void syncBadSyncBadPeers() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsBadPeers.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsBadPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -123,7 +123,7 @@ public class SyncParameterTests { @Test public void syncBadSyncInvalidTimeout() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsInvalidTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsInvalidTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -158,7 +158,7 @@ public class SyncParameterTests { @Test public void syncBadSyncBadTimeout() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsBadTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsBadTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -180,7 +180,7 @@ public class SyncParameterTests { @Test public void syncBadSyncUnpairedTimeout() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncBadParamsUnpairedTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsUnpairedTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -217,7 +217,7 @@ public class SyncParameterTests { @Test public void syncGoodSyncGoodTimeoutProducer() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncGoodParamsProducerTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsProducerTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -237,7 +237,7 @@ public class SyncParameterTests { @Test public void syncGoodSyncGoodTimeoutConsumer() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncGoodParamsConsumerTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsConsumerTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -257,7 +257,7 @@ public class SyncParameterTests { @Test public void syncGoodSyncGoodTimeoutBoth() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncGoodParamsBothTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsBothTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -277,7 +277,7 @@ public class SyncParameterTests { @Test public void syncUnusedConsumerPeers() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncUnusedConsumerPeers.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncUnusedConsumerPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -306,7 +306,7 @@ public class SyncParameterTests { @Test public void syncMismatchedPeers() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncMismatchedPeers.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncMismatchedPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -343,7 +343,7 @@ public class SyncParameterTests { @Test public void syncUnusedProducerPeers() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncUnusedProducerPeers.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncUnusedProducerPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -370,7 +370,7 @@ public class SyncParameterTests { @Test public void syncMismatchedTimeout() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/syncMismatchedTimeout.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncMismatchedTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -399,7 +399,7 @@ public class SyncParameterTests { @Test public void syncGoodParametersTest() { - final String[] args = { "-c", "src/test/resources/parameters/syncGoodParams.json" }; + final String[] args = {"-c", "src/test/resources/parameters/syncGoodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); try { @@ -463,7 +463,7 @@ public class SyncParameterTests { assertEquals("org.apache.superDooper.common.serialization.StringDeserializer", superDooperParameters.getValueDeserializer()); - final String[] consumerTopics = { "apex-in" }; + final String[] consumerTopics = {"apex-in"}; assertEquals(Arrays.asList(consumerTopics), superDooperParameters.getConsumerTopicList()); } catch (final ParameterException e) { fail("This test should not throw an exception"); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java index 6ce7d4aa0..3e5ed14a3 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java @@ -31,7 +31,9 @@ import org.onap.policy.apex.core.engine.executor.exception.StateMachineException * Dummy state finalizer executor for testing. */ public class DummyStateFinalizerExecutor extends StateFinalizerExecutor { - public DummyStateFinalizerExecutor() {} + public DummyStateFinalizerExecutor() { + // Default constructor + } @Override public String execute(final long executionId, final Properties executorProperties, diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java index 9a93a1f2e..a4312bfa8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java @@ -34,10 +34,14 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; * Dummy task executor for testing. */ public class DummyTaskExecutor extends TaskExecutor { - public DummyTaskExecutor() {} + public DummyTaskExecutor() { + // Default constructor + } @Override - public void prepare() throws StateMachineException {} + public void prepare() throws StateMachineException { + // Not used + } @Override public Map execute(final long executionId, final Properties executorProperties, @@ -54,5 +58,7 @@ public class DummyTaskExecutor extends TaskExecutor { } @Override - public void cleanUp() throws StateMachineException {} + public void cleanUp() throws StateMachineException { + // Not used + } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java index cf41d8699..f3000841d 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java @@ -32,10 +32,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; * Dummy task selection executor for testing. */ public class DummyTaskSelectExecutor extends TaskSelectExecutor { - public DummyTaskSelectExecutor() {} + public DummyTaskSelectExecutor() { + } @Override - public void prepare() throws StateMachineException {} + public void prepare() throws StateMachineException { + // Not used + } @Override public AxArtifactKey execute(final long executionId, final Properties executorProperties, @@ -45,5 +48,7 @@ public class DummyTaskSelectExecutor extends TaskSelectExecutor { } @Override - public void cleanUp() throws StateMachineException {} + public void cleanUp() throws StateMachineException { + // Not used + } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java index 6acca2702..42fd6e1d8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.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========================================================= */ @@ -47,8 +47,7 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar private static final int DEFAULT_SESSION_TIMEOUT = 30000; private static final String DEFAULT_PRODUCER_TOPIC = "apex-out"; private static final int DEFAULT_CONSUMER_POLL_TIME = 100; - private static final String[] DEFAULT_CONSUMER_TOPIC_LIST = - { "apex-in" }; + private static final String[] DEFAULT_CONSUMER_TOPIC_LIST = {"apex-in"}; private static final String DEFAULT_KEYSERZER = "org.apache.superDooper.common.serialization.StringSerializer"; private static final String DEFAULT_VALSERZER = "org.apache.superDooper.common.serialization.StringSerializer"; private static final String DEFAULT_KEYDESZER = "org.apache.superDooper.common.serialization.StringDeserializer"; @@ -99,9 +98,9 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar // Set the carrier technology properties for the FILE carrier technology this.setLabel("SUPER_DOOPER"); this.setEventProducerPluginClass( - "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperEventProducer"); + "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperEventProducer"); this.setEventConsumerPluginClass( - "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperEventSubscriber"); + "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperEventSubscriber"); } /** @@ -466,32 +465,32 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar if (bootstrapServers == null || bootstrapServers.trim().length() == 0) { result.setResult("bootstrapServers", ValidationStatus.INVALID, - "bootstrapServers not specified, must be specified as a string of form host:port"); + "bootstrapServers not specified, must be specified as a string of form host:port"); } if (acks == null || acks.trim().length() == 0) { result.setResult("acks", ValidationStatus.INVALID, - "acks not specified, must be specified as a string with values [0|1|all]"); + "acks not specified, must be specified as a string with values [0|1|all]"); } if (retries < 0) { result.setResult("retries", ValidationStatus.INVALID, - "[" + retries + "] invalid, must be specified as retries >= 0"); + "[" + retries + "] invalid, must be specified as retries >= 0"); } if (batchSize < 0) { result.setResult("batchSize", ValidationStatus.INVALID, - "[" + batchSize + "] invalid, must be specified as batchSize >= 0"); + "[" + batchSize + "] invalid, must be specified as batchSize >= 0"); } if (lingerTime < 0) { result.setResult("lingerTime", ValidationStatus.INVALID, - "[" + lingerTime + "] invalid, must be specified as lingerTime >= 0"); + "[" + lingerTime + "] invalid, must be specified as lingerTime >= 0"); } if (bufferMemory < 0) { result.setResult("bufferMemory", ValidationStatus.INVALID, - "[" + bufferMemory + "] invalid, must be specified as bufferMemory >= 0"); + "[" + bufferMemory + "] invalid, must be specified as bufferMemory >= 0"); } if (groupId == null || groupId.trim().length() == 0) { @@ -500,34 +499,34 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar if (autoCommitTime < 0) { result.setResult("autoCommitTime", ValidationStatus.INVALID, - "[" + autoCommitTime + "] invalid, must be specified as autoCommitTime >= 0"); + "[" + autoCommitTime + "] invalid, must be specified as autoCommitTime >= 0"); } if (sessionTimeout < 0) { - result.setResult("sessionTimeout", ValidationStatus.INVALID, "sessionTimeout [" + sessionTimeout - + "] invalid, must be specified as sessionTimeout >= 0"); + result.setResult("sessionTimeout", ValidationStatus.INVALID, + "sessionTimeout [" + sessionTimeout + "] invalid, must be specified as sessionTimeout >= 0"); } if (producerTopic == null || producerTopic.trim().length() == 0) { result.setResult("producerTopic", ValidationStatus.INVALID, - "producerTopic not specified, must be specified as a string"); + "producerTopic not specified, must be specified as a string"); } if (consumerPollTime < 0) { result.setResult("consumerPollTime", ValidationStatus.INVALID, - "[" + consumerPollTime + "] invalid, must be specified as consumerPollTime >= 0"); + "[" + consumerPollTime + "] invalid, must be specified as consumerPollTime >= 0"); } if (consumerTopicList == null || consumerTopicList.length == 0) { result.setResult("consumerTopicList", ValidationStatus.INVALID, - "not specified, must be specified as a list of strings"); + "not specified, must be specified as a list of strings"); } StringBuilder consumerTopicMessageBuilder = new StringBuilder(); for (final String consumerTopic : consumerTopicList) { if (consumerTopic == null || consumerTopic.trim().length() == 0) { consumerTopicMessageBuilder.append(" invalid consumer topic \"" + consumerTopic - + "\" specified on consumerTopicList, consumer topics must be specified as strings"); + + "\" specified on consumerTopicList, consumer topics must be specified as strings"); } } @@ -541,17 +540,17 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar if (valueSerializer == null || valueSerializer.trim().length() == 0) { result.setResult("valueSerializer", ValidationStatus.INVALID, - "not specified, must be specified as a string"); + "not specified, must be specified as a string"); } if (keyDeserializer == null || keyDeserializer.trim().length() == 0) { result.setResult("keyDeserializer", ValidationStatus.INVALID, - "not specified, must be specified as a string"); + "not specified, must be specified as a string"); } if (valueDeserializer == null || valueDeserializer.trim().length() == 0) { result.setResult("valueDeserializer", ValidationStatus.INVALID, - "not specified, must be specified as a string"); + "not specified, must be specified as a string"); } return result; diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java index a87f94201..8e1dfce1b 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java @@ -42,7 +42,9 @@ public class SuperDooperEventProducer implements ApexEventProducer { private String name; - public SuperDooperEventProducer() {} + public SuperDooperEventProducer() { + // Default constructor + } /** * {@inheritDoc}. @@ -72,7 +74,9 @@ public class SuperDooperEventProducer implements ApexEventProducer { * {@inheritDoc}. */ @Override - public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {} + public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) { + // Not used + } /** * {@inheritDoc}. @@ -80,13 +84,15 @@ public class SuperDooperEventProducer implements ApexEventProducer { @Override public void sendEvent(final long executionId, final Properties executionProperties, final String eventName, final Object event) { - LOGGER.info("Sending Event: " + this.getClass().getName() + ":" + this.name + " ... event (" - + eventName + ") : " + event); + LOGGER.info("Sending Event: " + this.getClass().getName() + ":" + this.name + " ... event (" + eventName + + ") : " + event); } /** * {@inheritDoc}. */ @Override - public void stop() {} + public void stop() { + // Not used + } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java index c945480d4..8eb1ca13e 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java @@ -41,7 +41,7 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { @Override public void init(final String name, final EventHandlerParameters consumerParameters, - final ApexEventReceiver apexEventReceiver) throws ApexEventException { + final ApexEventReceiver apexEventReceiver) throws ApexEventException { this.name = name; LOGGER.info("Initialising Apex Consumer: " + this.getClass().getName() + ":" + this.name); } @@ -68,12 +68,13 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { @Override public void start() { - // TODO Auto-generated method stub + // Not used } @Override public void stop() { + // Not used } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventConverter.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventConverter.java index 678961dea..bb414c267 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventConverter.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventConverter.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========================================================= */ @@ -46,5 +46,7 @@ public final class SuperTokenDelimitedEventConverter implements ApexEventProtoco } @Override - public void init(final EventProtocolParameters parameters) {} + public void init(final EventProtocolParameters parameters) { + // Not used + } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java index 9197dfebf..89212fc27 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.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========================================================= */ @@ -33,8 +33,8 @@ public class SuperTokenDelimitedEventProtocolParameters extends EventProtocolTex private static final String SUPER_TOKEN_DELIMITER = "SuperToken"; /** - * Constructor to create a JSON event protocol parameter instance and register the instance with - * the parameter service. + * Constructor to create a JSON event protocol parameter instance and register the instance with the parameter + * service. */ public SuperTokenDelimitedEventProtocolParameters() { super(); -- cgit 1.2.3-korg