diff options
54 files changed, 546 insertions, 426 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 <?xml...> + private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; // starts with <?xml...> /** * 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 <C> 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<EnEvent, AxArtifact @Override public final void executePost(final boolean returnValue) throws StateMachineException { if (!returnValue) { - String errorMessage = - "execute-post: task selection logic failed on state \"" + axState.getKey().getId() + "\""; + String errorMessage = "execute-post: task selection logic failed on state \"" + axState.getKey().getId() + + "\""; if (executionContext.getMessage() != null) { errorMessage += ", user message: " + executionContext.getMessage(); } @@ -232,5 +232,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact * {@inheritDoc}. */ @Override - public void setParameters(final ExecutorParameters parameters) {} + public void setParameters(final ExecutorParameters parameters) { + // Not used + } } diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java index 16a3369fb..6da92d55e 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java +++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java @@ -60,7 +60,9 @@ public abstract class ClassUtils { /** * Private constructor used to prevent sub class instantiation. */ - private ClassUtils() {} + private ClassUtils() { + // Private constructor to block subclassing + } /** * Get the class names of all classes on the class path. WARNING: This is a heavy call, use sparingly diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java index a6c3c5854..1c5f2a3a6 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java +++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java @@ -29,12 +29,13 @@ import java.net.NetworkInterface; import java.net.Socket; import java.net.UnknownHostException; import java.util.Enumeration; + import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class MessagingUtils is a class with static methods used in IPC messaging for finding free - * ports, translating host names to addresses, serializing objects and flushing object streams. + * The Class MessagingUtils is a class with static methods used in IPC messaging for finding free ports, translating + * host names to addresses, serializing objects and flushing object streams. * * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) */ @@ -53,11 +54,13 @@ public final class MessagingUtils { /** * Private constructor used to prevent sub class instantiation. */ - private MessagingUtils() {} + private MessagingUtils() { + // Private constructor to block subclassing + } /** - * This method searches the availability of the port, if the requested port not available, this - * method will throw an exception. + * This method searches the availability of the port, if the requested port not available, this method will throw an + * exception. * * @param port the port to check * @return the port verified as being free @@ -75,9 +78,9 @@ public final class MessagingUtils { } /** - * This method searches the availability of the port, if the requested port not available,this - * method will increment the port number and check the availability of that port, this process - * will continue until it reaches max port range which is MAX_PORT_RANGE. + * This method searches the availability of the port, if the requested port not available,this method will increment + * the port number and check the availability of that port, this process will continue until it reaches max port + * range which is MAX_PORT_RANGE. * * @param port the first port to check * @return the port that was found @@ -129,9 +132,8 @@ public final class MessagingUtils { } /** - * This method searches the availability of the port, if the requested port not available,this - * method will increment the port number and check the availability, this process will continue - * until it find port available. + * This method searches the availability of the port, if the requested port not available,this method will increment + * the port number and check the availability, this process will continue until it find port available. * * @param port the first port to check * @return the port that was found diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java index b5663e452..eb4e0210b 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java +++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java @@ -30,7 +30,9 @@ public final class ThreadUtilities { /** * Private constructor to prevent sub-classing of this class. */ - private ThreadUtilities() {} + private ThreadUtilities() { + // Private constructor to prevent subclassing + } /** * Sleeps for the specified number of milliseconds, hiding interrupt handling. diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java index 1269d4401..b73b98bc4 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java @@ -53,6 +53,7 @@ import org.slf4j.ext.XLoggerFactory; // TODO: Auto-generated Javadoc /** * This class tests AADM use case. + * * @author Sergey Sachkov (sergey.sachkov@ericsson.com) * */ @@ -86,7 +87,7 @@ public class AadmUseCaseTest { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); ParameterService.register(engineParameters); @@ -98,7 +99,7 @@ public class AadmUseCaseTest { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -441,7 +442,9 @@ public class AadmUseCaseTest { * Test vpn cleardown. */ @After - public void testAadmCleardown() {} + public void testAadmCleardown() { + // Not used + } /** * Gets the trigger event. diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java index 6eff2d806..3f2affb42 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java @@ -43,7 +43,9 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> { /** * 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 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e000</UUID> - <description><![CDATA[Generated description for concept referred to by key "ContextSchemas:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "ContextSchemas:0.0.1"]]></description> </value> </entry> <entry> @@ -55,7 +55,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e001</UUID> - <description><![CDATA[Generated description for concept referred to by key "KeyInfoMapKey:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "KeyInfoMapKey:0.0.1"]]></description> </value> </entry> <entry> @@ -69,7 +69,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e002</UUID> - <description><![CDATA[Generated description for concept referred to by key "MapType:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "MapType:0.0.1"]]></description> </value> </entry> <entry> @@ -83,7 +83,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e003</UUID> - <description><![CDATA[Generated description for concept referred to by key "PolicyModel:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "PolicyModel:0.0.1"]]></description> </value> </entry> <entry> @@ -97,7 +97,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e004</UUID> - <description><![CDATA[Generated description for concept referred to by key "StringType:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "StringType:0.0.1"]]></description> </value> </entry> <entry> @@ -111,7 +111,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e005</UUID> - <description><![CDATA[Generated description for concept referred to by key "context:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "context:0.0.1"]]></description> </value> </entry> <entry> @@ -125,7 +125,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e006</UUID> - <description><![CDATA[Generated description for concept referred to by key "contextAlbum0:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "contextAlbum0:0.0.1"]]></description> </value> </entry> <entry> @@ -139,7 +139,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e007</UUID> - <description><![CDATA[Generated description for concept referred to by key "contextAlbum1:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "contextAlbum1:0.0.1"]]></description> </value> </entry> <entry> @@ -153,7 +153,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e008</UUID> - <description><![CDATA[Generated description for concept referred to by key "eventContextItem0:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "eventContextItem0:0.0.1"]]></description> </value> </entry> <entry> @@ -167,7 +167,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e009</UUID> - <description><![CDATA[Generated description for concept referred to by key "eventContextItem1:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "eventContextItem1:0.0.1"]]></description> </value> </entry> <entry> @@ -181,7 +181,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e010</UUID> - <description><![CDATA[Generated description for concept referred to by key "events:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "events:0.0.1"]]></description> </value> </entry> <entry> @@ -195,7 +195,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e011</UUID> - <description><![CDATA[Generated description for concept referred to by key "inEvent:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "inEvent:0.0.1"]]></description> </value> </entry> <entry> @@ -209,7 +209,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e012</UUID> - <description><![CDATA[Generated description for concept referred to by key "outEvent0:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "outEvent0:0.0.1"]]></description> </value> </entry> <entry> @@ -223,7 +223,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e013</UUID> - <description><![CDATA[Generated description for concept referred to by key "outEvent1:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "outEvent1:0.0.1"]]></description> </value> </entry> <entry> @@ -237,7 +237,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e014</UUID> - <description><![CDATA[Generated description for concept referred to by key "policies:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "policies:0.0.1"]]></description> </value> </entry> <entry> @@ -251,7 +251,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e015</UUID> - <description><![CDATA[Generated description for concept referred to by key "policy:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "policy:0.0.1"]]></description> </value> </entry> <entry> @@ -265,7 +265,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e016</UUID> - <description><![CDATA[Generated description for concept referred to by key "task:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "task:0.0.1"]]></description> </value> </entry> <entry> @@ -279,7 +279,7 @@ <version>0.0.1</version> </key> <UUID>0ce9168c-e6df-414f-9646-6da464b6e017</UUID> - <description><![CDATA[Generated description for concept referred to by key "tasks:0.0.1"]]></description> + <description><![CDATA[Description for concept with key "tasks:0.0.1"]]></description> </value> </entry> </keyInfoMap> @@ -709,7 +709,8 @@ <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> </key> <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A</schemaDefinition> + <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A + </schemaDefinition> </value> </entry> <entry> @@ -723,7 +724,8 @@ <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> </key> <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem000</schemaDefinition> + <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem000 + </schemaDefinition> </value> </entry> <entry> 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 <T> 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========================================================= --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> - <persistence-unit name="org.onap.policy.apex.core.model.eclipselink.runtime" transaction-type="RESOURCE_LOCAL"> + <persistence-unit name="org.onap.policy.apex.core.model.eclipselink.runtime" + transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>org.onap.policy.apex.core.basicmodel.dao.converters.UUID2String</class> @@ -76,7 +77,8 @@ </properties> </persistence-unit> - <persistence-unit name="org.onap.policy.apex.core.model.eclipselink.test" transaction-type="RESOURCE_LOCAL"> + <persistence-unit name="org.onap.policy.apex.core.model.eclipselink.test" + transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>org.onap.policy.apex.core.basicmodel.dao.converters.UUID2String</class> @@ -183,7 +185,8 @@ <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL94Dialect" /> <property name="hibernate.hbm2ddl.auto" value="update" /> - <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" /> + <property name="hibernate.connection.provider_class" + value="org.hibernate.connection.C3P0ConnectionProvider" /> <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" /> <property name="hibernate.c3p0.max_size" value="100" /> <property name="hibernate.c3p0.min_size" value="0" /> @@ -244,7 +247,8 @@ <property name="javax.persistence.jdbc.password" value="postgres" /> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL94Dialect" /> <property name="hibernate.hbm2ddl.auto" value="create" /> - <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" /> + <property name="hibernate.connection.provider_class" + value="org.hibernate.connection.C3P0ConnectionProvider" /> <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" /> <property name="hibernate.c3p0.max_size" value="100" /> <property name="hibernate.c3p0.min_size" value="0" /> 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<String, Object> 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/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java index affbf39e9..ec2f5b34a 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java @@ -36,10 +36,12 @@ import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; +import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.common.utils.services.ServiceManager; import org.onap.policy.common.utils.services.ServiceManagerException; import org.onap.policy.models.pdp.enums.PdpMessageType; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,6 +77,9 @@ public class ApexStarterActivator { @Setter(lombok.AccessLevel.PRIVATE) private volatile boolean alive = false; + @Getter + private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes; + /** * Instantiate the activator for onappf PDP-A. * @@ -88,10 +93,8 @@ public class ApexStarterActivator { topicSources = TopicEndpointManager.getManager() .addTopicSources(apexStarterParameterGroup.getTopicParameterGroup().getTopicSources()); - // TODO: instanceId currently set as a random string, could be fetched from actual deployment - final int random = (int) (Math.random() * 100); - final String instanceId = "apex_" + random; - LOGGER.debug("ApexStarterActivator initializing with instance id:" + instanceId); + final String instanceId = NetworkUtil.getHostname(); + LOGGER.debug("ApexStarterActivator initializing with instance id: {}", instanceId); try { this.apexStarterParameterGroup = apexStarterParameterGroup; this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES); @@ -101,6 +104,10 @@ public class ApexStarterActivator { final PdpUpdateListener pdpUpdateListener = new PdpUpdateListener(); final PdpStateChangeListener pdpStateChangeListener = new PdpStateChangeListener(); + final PdpMessageHandler pdpMessageHandler = new PdpMessageHandler(); + supportedPolicyTypes = + pdpMessageHandler.getSupportedPolicyTypesFromParameters(apexStarterParameterGroup.getPdpStatusParameters()); + // @formatter:off this.manager = new ServiceManager() .addAction("topics", @@ -111,7 +118,7 @@ public class ApexStarterActivator { () -> setAlive(false)) .addAction("register pdp status context object", () -> Registry.register(ApexStarterConstants.REG_PDP_STATUS_OBJECT, - new PdpMessageHandler().createPdpStatusFromParameters(instanceId, + pdpMessageHandler.createPdpStatusFromParameters(instanceId, apexStarterParameterGroup.getPdpStatusParameters())), () -> Registry.unregister(ApexStarterConstants.REG_PDP_STATUS_OBJECT)) .addAction("topic sinks", diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java index b1f38d688..697f3d47f 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java @@ -59,7 +59,6 @@ public class PdpMessageHandler { pdpStatus.setHealthy(PdpHealthStatus.HEALTHY); pdpStatus.setDescription(pdpStatusParameters.getDescription()); pdpStatus.setName(instanceId); - pdpStatus.setSupportedPolicyTypes(getSupportedPolicyTypesFromParameters(pdpStatusParameters)); return pdpStatus; } @@ -69,7 +68,7 @@ public class PdpMessageHandler { * @param pdpStatusParameters pdp status parameters * @return supportedPolicyTypes list of PolicyTypeIdent */ - private List<ToscaPolicyTypeIdentifier> getSupportedPolicyTypesFromParameters( + public List<ToscaPolicyTypeIdentifier> getSupportedPolicyTypesFromParameters( final PdpStatusParameters pdpStatusParameters) { final List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>(pdpStatusParameters.getSupportedPolicyTypes().size()); @@ -94,7 +93,6 @@ public class PdpMessageHandler { pdpStatus.setState(pdpStatusContext.getState()); pdpStatus.setHealthy(pdpStatusContext.getHealthy()); pdpStatus.setDescription(pdpStatusContext.getDescription()); - pdpStatus.setSupportedPolicyTypes(pdpStatusContext.getSupportedPolicyTypes()); pdpStatus.setPolicies(pdpStatusContext.getPolicies()); pdpStatus.setPdpGroup(pdpStatusContext.getPdpGroup()); pdpStatus.setPdpSubgroup(pdpStatusContext.getPdpSubgroup()); 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<String, Object> 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========================================================= --> -<config xmlns="urn:org:jgroups" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-4.0.xsd"> - <UDP mcast_addr="${jgroups.udp.mcast_addr:228.6.7.8}" +<config + xmlns="urn:org:jgroups" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-4.0.xsd"> + <UDP + mcast_addr="${jgroups.udp.mcast_addr:228.6.7.8}" mcast_port="${jgroups.udp.mcast_port:46655}" bind_port="${jgroups.udp.mcast.bind_port:63005}" bind_addr="${jgroups.udp.mcast.bind_addr:127.0.0.1}" @@ -38,45 +40,48 @@ thread_pool.min_threads="${jgroups.thread_pool.min_threads:0}" thread_pool.max_threads="${jgroups.thread_pool.max_threads:200}" - thread_pool.keep_alive_time="60000" - /> - <PING /> - <MERGE3 min_interval="10000" - max_interval="30000" - /> - <FD_SOCK /> - <FD_SOCK bind_addr="${jgroups.udp.mcast.bind_addr:127.0.0.1}" sock_conn_timeout="60000" start_port="${jgroups.udp.fd.sock.start_port:63010}" port_range="1000"/> - - <FD_ALL timeout="60000" - interval="15000" - timeout_check_interval="5000" - /> - <VERIFY_SUSPECT timeout="5000" /> - <pbcast.NAKACK2 xmit_interval="100" - xmit_table_num_rows="50" - xmit_table_msgs_per_row="1024" - xmit_table_max_compaction_time="30000" - resend_last_seqno="true" - /> - <UNICAST3 xmit_interval="100" - xmit_table_num_rows="50" - xmit_table_msgs_per_row="1024" - xmit_table_max_compaction_time="30000" - conn_expiry_timeout="0" - /> - <pbcast.STABLE stability_delay="500" - desired_avg_gossip="5000" - max_bytes="1M" - /> - <pbcast.GMS print_local_addr="false" - install_view_locally_first="true" - join_timeout="${jgroups.join_timeout:5000}" - /> - <UFC max_credits="2m" - min_threshold="0.40" - /> - <MFC max_credits="2m" - min_threshold="0.40" - /> - <FRAG3 frag_size="8000"/> + thread_pool.keep_alive_time="60000" /> + <PING /> + <MERGE3 + min_interval="10000" + max_interval="30000" /> + <FD_SOCK /> + <FD_SOCK + bind_addr="${jgroups.udp.mcast.bind_addr:127.0.0.1}" + sock_conn_timeout="60000" + start_port="${jgroups.udp.fd.sock.start_port:63010}" + port_range="1000" /> + + <FD_ALL + timeout="60000" + interval="15000" + timeout_check_interval="5000" /> + <VERIFY_SUSPECT timeout="5000" /> + <pbcast.NAKACK2 + xmit_interval="100" + xmit_table_num_rows="50" + xmit_table_msgs_per_row="1024" + xmit_table_max_compaction_time="30000" + resend_last_seqno="true" /> + <UNICAST3 + xmit_interval="100" + xmit_table_num_rows="50" + xmit_table_msgs_per_row="1024" + xmit_table_max_compaction_time="30000" + conn_expiry_timeout="0" /> + <pbcast.STABLE + stability_delay="500" + desired_avg_gossip="5000" + max_bytes="1M" /> + <pbcast.GMS + print_local_addr="false" + install_view_locally_first="true" + join_timeout="${jgroups.join_timeout:5000}" /> + <UFC + max_credits="2m" + min_threshold="0.40" /> + <MFC + max_credits="2m" + min_threshold="0.40" /> + <FRAG3 frag_size="8000" /> </config> 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<String, Object> eventDataMap = new HashMap<String, Object>(); 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 @@ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" /> - <!-- USE FOR STD OUT ONLY --> + <!-- USE FOR STD OUT ONLY --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> 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 + } } |