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 --- .../apex/auth/clicodegen/CliEditorContants.java | 10 +- .../client/editor/rest/handling/RestUtils.java | 12 +- .../engine/executor/StateFinalizerExecutor.java | 4 +- .../apex/core/engine/executor/TaskExecutor.java | 4 +- .../core/engine/executor/TaskSelectExecutor.java | 8 +- .../infrastructure/java/classes/ClassUtils.java | 4 +- .../messaging/util/MessagingUtils.java | 24 +-- .../infrastructure/threading/ThreadUtilities.java | 4 +- .../policy/apex/examples/aadm/AadmUseCaseTest.java | 9 +- .../apex/model/basicmodel/concepts/AxConcept.java | 4 +- .../apex/model/modelapi/impl/ApexModelImpl.java | 7 +- .../src/test/resources/models/PolicyModel.xml | 48 +++--- .../policymodel/handling/PolicyModelSplitter.java | 20 +-- .../policy/apex/model/utilities/TreeMapUtils.java | 17 +- .../src/main/resources/META-INF/persistence.xml | 18 ++- .../avro/AvroSchemaKeyTranslationUtilities.java | 36 +++-- .../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 +- .../dummyclasses/DummyStateFinalizerExecutor.java | 5 +- .../parameters/dummyclasses/DummyTaskExecutor.java | 13 +- .../dummyclasses/DummyTaskSelectExecutor.java | 12 +- .../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 +- .../src/test/resources/logback-test.xml | 8 +- .../apex/tools/model/generator/SchemaUtils.java | 4 +- .../onap/policy/apex/tools/common/CliOptions.java | 12 +- 52 files changed, 533 insertions(+), 418 deletions(-) diff --git a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CliEditorContants.java b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CliEditorContants.java index 3a82af796..b123d9186 100644 --- a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CliEditorContants.java +++ b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CliEditorContants.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========================================================= */ @@ -128,5 +128,7 @@ public class CliEditorContants { public static final String DEFINITIONS = "definitions"; - private CliEditorContants() {} + private CliEditorContants() { + // Private constructor to prevent subclassing + } } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestUtils.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestUtils.java index 5cb7af840..738f33cb1 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestUtils.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestUtils.java @@ -50,7 +50,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; */ public abstract class RestUtils { // Regular expressions for checking input types - private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with + private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; // starts with /** * starts with some kind of bracket [ or ( or {, then has something, then has bracket. */ @@ -59,7 +59,9 @@ public abstract class RestUtils { /** * Constructor, block inheritance. */ - private RestUtils() {} + private RestUtils() { + // Private constructor to block subclassing + } /** * HTTP POST requests can't send nulls so we interpret blanks as nulls. @@ -103,8 +105,7 @@ public abstract class RestUtils { } /** - * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings - * into a map. + * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings into a map. * * @param jsonString the incoming JSON string * @return a map of the JSON strings @@ -123,8 +124,7 @@ public abstract class RestUtils { } /** - * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings - * into a map. + * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings into a map. * * @param the generic type * @param jsonString the incoming JSON string diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java index 698a1d837..b13db033a 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java @@ -244,5 +244,7 @@ public abstract class StateFinalizerExecutor * {@inheritDoc}. */ @Override - public void setParameters(final ExecutorParameters parameters) {} + public void setParameters(final ExecutorParameters parameters) { + // Not used + } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java index ab81a8490..50abeea6d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java @@ -314,5 +314,7 @@ public abstract class TaskExecutor * {@inheritDoc}. */ @Override - public void setParameters(final ExecutorParameters parameters) {} + public void setParameters(final ExecutorParameters parameters) { + // Not used + } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java index d99d6b005..3f360ea9c 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java @@ -131,8 +131,8 @@ public abstract class TaskSelectExecutor implements Executor { /** * Default constructor. */ - public AxConcept() {} + public AxConcept() { + // Default constructor + } /** * Copy constructor. diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 77ded31d6..cdbe62351 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -59,8 +59,7 @@ public final class ApexModelImpl implements ApexModel { * Create an implementation of the Apex editor and model APIs. * * @param apexProperties The properties to use for the model - * @param jsonMode set to true to return JSON strings in list and delete operations, otherwise - * set to false + * @param jsonMode set to true to return JSON strings in list and delete operations, otherwise set to false */ public ApexModelImpl(final Properties apexProperties, final boolean jsonMode) { this.apexProperties = apexProperties; @@ -81,7 +80,9 @@ public final class ApexModelImpl implements ApexModel { /** * Constructor, prevents this class being sub-classed. */ - private ApexModelImpl() {} + private ApexModelImpl() { + // Private constructor to block subclassing + } /** * {@inheritDoc}. diff --git a/model/model-api/src/test/resources/models/PolicyModel.xml b/model/model-api/src/test/resources/models/PolicyModel.xml index 684ce32c9..e3bf59f29 100644 --- a/model/model-api/src/test/resources/models/PolicyModel.xml +++ b/model/model-api/src/test/resources/models/PolicyModel.xml @@ -6,15 +6,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========================================================= --> @@ -41,7 +41,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e000 - + @@ -55,7 +55,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e001 - + @@ -69,7 +69,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e002 - + @@ -83,7 +83,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e003 - + @@ -97,7 +97,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e004 - + @@ -111,7 +111,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e005 - + @@ -125,7 +125,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e006 - + @@ -139,7 +139,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e007 - + @@ -153,7 +153,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e008 - + @@ -167,7 +167,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e009 - + @@ -181,7 +181,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e010 - + @@ -195,7 +195,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e011 - + @@ -209,7 +209,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e012 - + @@ -223,7 +223,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e013 - + @@ -237,7 +237,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e014 - + @@ -251,7 +251,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e015 - + @@ -265,7 +265,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e016 - + @@ -279,7 +279,7 @@ 0.0.1 0ce9168c-e6df-414f-9646-6da464b6e017 - + @@ -709,7 +709,8 @@ 0.0.1 Java - org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A + org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A + @@ -723,7 +724,8 @@ 0.0.1 Java - org.onap.policy.apex.model.policymodel.concepts.TestContextItem000 + org.onap.policy.apex.model.policymodel.concepts.TestContextItem000 + diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java index 7ecb8fb0f..b11158cf6 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.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 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * Helper class used to extract information from a policy model into a policy model that is a subset - * of the original policy model. + * Helper class used to extract information from a policy model into a policy model that is a subset of the original + * policy model. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -44,11 +44,12 @@ public final class PolicyModelSplitter { /** * Private constructor used to prevent sub class instantiation. */ - private PolicyModelSplitter() {} + private PolicyModelSplitter() { + // Private constructor to block subclassing + } /** - * Get a sub policy model with only the information required for the specified policies from a - * larger policy model. + * Get a sub policy model with only the information required for the specified policies from a larger policy model. * * @param sourcePolicyModel the source Apex Model * @param subPolicies the policies to include in sub policy model @@ -61,8 +62,7 @@ public final class PolicyModelSplitter { } /** - * Get a sub policy model with only the information required for the specified policies from a - * larger policy model. + * Get a sub policy model with only the information required for the specified policies from a larger policy model. * * @param sourcePolicyModel the source Apex Model * @param subPolicies the policies to include in sub policy model diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TreeMapUtils.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TreeMapUtils.java index cb0f799a0..4f43e6c4d 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TreeMapUtils.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TreeMapUtils.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========================================================= */ @@ -27,8 +27,8 @@ import java.util.Map.Entry; import java.util.NavigableMap; /** - * This class provides utility functions for tree maps. A function to find the nearest match in the - * tree map to an input string is provided. + * This class provides utility functions for tree maps. A function to find the nearest match in the tree map to an input + * string is provided. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -37,11 +37,12 @@ public abstract class TreeMapUtils { /** * This class is a utility class that can't be instantiated. */ - private TreeMapUtils() {} + private TreeMapUtils() { + // Private constructor to block subclassing + } /** - * Find the list of entries that matches a given word, for example "p" will match "put", - * "policy", and "push". + * Find the list of entries that matches a given word, for example "p" will match "put", "policy", and "push". * * @param the generic type for the value of the tree map * @param searchMap the map that the method operates on diff --git a/packages/apex-pdp-package-full/src/main/resources/META-INF/persistence.xml b/packages/apex-pdp-package-full/src/main/resources/META-INF/persistence.xml index 692a925e7..670acb5f0 100644 --- a/packages/apex-pdp-package-full/src/main/resources/META-INF/persistence.xml +++ b/packages/apex-pdp-package-full/src/main/resources/META-INF/persistence.xml @@ -6,21 +6,22 @@ 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========================================================= --> - + org.eclipse.persistence.jpa.PersistenceProvider org.onap.policy.apex.core.basicmodel.dao.converters.UUID2String @@ -76,7 +77,8 @@ - + org.eclipse.persistence.jpa.PersistenceProvider org.onap.policy.apex.core.basicmodel.dao.converters.UUID2String @@ -183,7 +185,8 @@ - + @@ -244,7 +247,8 @@ - + diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java index b4c8737dd..60b394ccc 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.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========================================================= */ @@ -29,7 +29,7 @@ import java.util.Map.Entry; /** * This static final class contains utility methods for Avro schemas. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class AvroSchemaKeyTranslationUtilities { @@ -42,11 +42,13 @@ public final class AvroSchemaKeyTranslationUtilities { /** * Default constructor to avoid subclassing. */ - private AvroSchemaKeyTranslationUtilities() {} + private AvroSchemaKeyTranslationUtilities() { + // Private constructor to prevent subclassing + } /** - * Translate characters in JSON keys to values that are legal in Avro. Avro names must start - * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_] + * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and + * subsequently contain only [A-Za-z0-9_] * * @param jsonString The JSON string to translate * @param revert True if we want to revert the field names to their original values @@ -58,8 +60,8 @@ public final class AvroSchemaKeyTranslationUtilities { } // Create a JSON element for the incoming JSON string - final JsonElement jsonElement = - new GsonBuilder().serializeNulls().create().fromJson(jsonString, JsonElement.class); + final JsonElement jsonElement = new GsonBuilder().serializeNulls().create().fromJson(jsonString, + JsonElement.class); final JsonElement translatedJsonElement = translateIllegalKeys(jsonElement, revert); @@ -67,8 +69,8 @@ public final class AvroSchemaKeyTranslationUtilities { } /** - * Translate characters in JSON keys to values that are legal in Avro. Avro names must start - * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_] + * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and + * subsequently contain only [A-Za-z0-9_] * * @param jsonElement The JSON element to translate * @param revert True if we want to revert the field names to their original values @@ -86,8 +88,8 @@ public final class AvroSchemaKeyTranslationUtilities { } /** - * Translate characters in JSON keys to values that are legal in Avro. Avro names must start - * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_] + * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and + * subsequently contain only [A-Za-z0-9_] * * @param jsonObject The JSON object to translate * @param revert True if we want to revert the field names to their original values @@ -105,8 +107,8 @@ public final class AvroSchemaKeyTranslationUtilities { } /** - * Translate characters in JSON keys to values that are legal in Avro. Avro names must start - * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_] + * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and + * subsequently contain only [A-Za-z0-9_] * * @param jsonArray The JSON array to translate * @param revert True if we want to revert the field names to their original values @@ -123,8 +125,8 @@ public final class AvroSchemaKeyTranslationUtilities { } /** - * Translate characters in a single JSON key to values that are legal in Avro. Avro names must - * start with [A-Za-z_] and subsequently contain only [A-Za-z0-9_] + * Translate characters in a single JSON key to values that are legal in Avro. Avro names must start with [A-Za-z_] + * and subsequently contain only [A-Za-z0-9_] * * @param key The key to translate * @param revert True if we want to revert the field names to their original values 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(); diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java index cdbd27b8f..6f2474aa1 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.services.onappf.parameters.dummyclasses; import java.util.Map; import java.util.Properties; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.StateFinalizerExecutor; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; @@ -31,7 +32,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-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java index d3fa9b570..387479b12 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.services.onappf.parameters.dummyclasses; import java.util.Map; import java.util.Properties; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.core.engine.executor.TaskExecutor; @@ -34,10 +35,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 +59,7 @@ public class DummyTaskExecutor extends TaskExecutor { } @Override - public void cleanUp() throws StateMachineException {} + public void cleanUp() throws StateMachineException { + // Not used + } } diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java index b27ff6ebc..b6e0dd432 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.services.onappf.parameters.dummyclasses; import java.util.Properties; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.core.engine.executor.TaskSelectExecutor; @@ -32,10 +33,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 +49,7 @@ public class DummyTaskSelectExecutor extends TaskSelectExecutor { } @Override - public void cleanUp() throws StateMachineException {} + public void cleanUp() throws StateMachineException { + // Not used + } } 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 + } } diff --git a/testsuites/performance/performance-benchmark-test/src/test/resources/logback-test.xml b/testsuites/performance/performance-benchmark-test/src/test/resources/logback-test.xml index 52f0e74ef..71fea36bf 100644 --- a/testsuites/performance/performance-benchmark-test/src/test/resources/logback-test.xml +++ b/testsuites/performance/performance-benchmark-test/src/test/resources/logback-test.xml @@ -6,15 +6,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========================================================= --> @@ -25,7 +25,7 @@ - + %d %contextName [%t] %level %logger{36} - %msg%n diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java index 14f84bb44..0a119cdc7 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java @@ -47,7 +47,9 @@ public final class SchemaUtils { /** * Private constructor to avoid instantiation. */ - private SchemaUtils() {} + private SchemaUtils() { + // Private constructor to block subclassing + } /** * Returns the schema for an event. diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java index 122ec90a9..3590a764c 100644 --- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java +++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java @@ -84,9 +84,9 @@ public final class CliOptions { .desc("set the input policy model file").build(); /** A type option defining what type is used for events with "-t" and "--type". */ - public static final Option TYPE = Option.builder("t").hasArg().argName("TYPE").longOpt("type").desc( - "set the event type for generation, one of: stimuli (trigger events), response (action events)," - + " internal (events between states)") + public static final Option TYPE = Option.builder("t").hasArg().argName("TYPE").longOpt("type") + .desc("set the event type for generation, one of: stimuli (trigger events), response (action events)," + + " internal (events between states)") .build(); /** A server option with "-s" and "--server". */ @@ -100,7 +100,9 @@ public final class CliOptions { /** A skip validation option with "-sv" and "--skip-validation". */ public static final Option SKIPVALIDATION = Option.builder("sv").longOpt("skip-validation") .desc("switch of validation of the input file").required(false).type(boolean.class).build(); - + /** Private constructor to prevent instantiation. */ - private CliOptions() {} + private CliOptions() { + // Private constructor to block subclassing + } } -- cgit 1.2.3-korg