diff options
author | Dinh Danh Le <dinh.danh.le@ericsson.com> | 2018-08-09 10:51:44 +0100 |
---|---|---|
committer | Dinh Danh Le <dinh.danh.le@ericsson.com> | 2018-08-09 17:56:57 +0100 |
commit | 4f0e4e0acb23479d705747cf6015d4d820659c78 (patch) | |
tree | bda775f623b47fcc1d8d7203c994c10ab9418ea6 /services/services-engine/src/test/java | |
parent | 086f1dcc8d2be436a05932934fd7116b4ec3e729 (diff) |
Checkstyle the services-engine package
Change-Id: I0d7fd6f867ba280953eb4fd0dc2a5ad1779fb045
Signed-off-by: Dinh Danh Le <dinh.danh.le@ericsson.com>
Issue-ID: POLICY-1034
Diffstat (limited to 'services/services-engine/src/test/java')
12 files changed, 195 insertions, 179 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java index 4da8c4201..94210e473 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.service.engine.event; import java.util.Random; /** + * This class generates JSON event used for the test cases. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class JSONEventGenerator { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java index be61b165e..decec767f 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java @@ -50,6 +50,7 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** + * Test JSON Event Handler. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestJSONEventHandler { @@ -159,7 +160,8 @@ public class TestJSONEventHandler { fail("Test should throw an exception here"); } catch (final ApexEventException e) { assertTrue(e.getMessage().startsWith( - "Failed to unmarshal JSON event: an event definition for an event named \"Event0000\" with version \"1.2.3\" not found in Apex model")); + "Failed to unmarshal JSON event: an event definition for an event named " + + "\"Event0000\" with version \"1.2.3\" not found in Apex model")); } apexEventJSONStringIn = JSONEventGenerator.jsonEventNoNamespace(); @@ -181,8 +183,8 @@ public class TestJSONEventHandler { fail("Test should throw an exception here"); } catch (final ApexEventException e) { assertTrue(e.getMessage().startsWith( - "Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" on event \"Event0000\" " - + "does not match namespace \"org.onap.policy.apex.sample.events\" for that event in the Apex model")); + "Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" on event \"Event0000\" does not" + + " match namespace \"org.onap.policy.apex.sample.events\" for that event in the Apex model")); } apexEventJSONStringIn = JSONEventGenerator.jsonEventNoSource(); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java index b19cceec9..49e6f3bdf 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java @@ -34,6 +34,7 @@ import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.TextBlock; /** + * Test JSON Tagged Event Consumer. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestJSONTaggedEventConsumer { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java index 5d77bfd2a..8ecf9b745 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java @@ -35,6 +35,7 @@ import org.onap.policy.apex.service.parameters.ApexParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; /** + * Test Plugin Factories. * @author Liam Fallon (liam.fallon@ericsson.com) * @author John Keeney (john.keeney@ericsson.com) */ diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java index 247f9b935..2b8bd6771 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java @@ -28,6 +28,7 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; /** + * Test Apex Command Line Arguments. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestApexCommandLineArguments { @@ -165,7 +166,7 @@ public class TestApexCommandLineArguments { } final String[] args06 = {"-c", "src/test/resources/parameters/goodParams.json", "-m", - "src/test/resources/main/DummyModelFile.json"}; + "src/test/resources/main/DummyModelFile.json"}; try { apexArguments.parse(args06); apexArguments.validate(); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java index 33bcd0d5f..d22d528c8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java @@ -31,7 +31,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -46,10 +46,9 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextNoParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"contextParameters\" entry", - e.getMessage()); + assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextNoParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in " + + "\"contextParameters\" entry", e.getMessage()); } } @@ -62,10 +61,9 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\" to parameter class \"hello\"\n" - + "java.lang.ClassNotFoundException: hello", + assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\"" + + "\n(ApexParameterRuntimeException):failed to deserialize the parameters for " + + "\"contextParameters\" to parameter class \"hello\"\njava.lang.ClassNotFoundException: hello", e.getMessage()); } } @@ -79,10 +77,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadPluginNameParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"contextParameters\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadPluginNameParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in " + + "\"contextParameters\" entry", e.getMessage()); } } @@ -96,9 +94,10 @@ public class ContextParameterTests { fail("This test should throw an exception"); } catch (final ApexParameterException e) { assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\" to parameter class \"java.lang.Integer\"\n" - + "com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT at path $", + "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassParams.json\"" + + "\n(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\"" + + " to parameter class \"java.lang.Integer\"\ncom.google.gson.JsonSyntaxException: " + + "java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT at path $", e.getMessage()); } } @@ -112,10 +111,11 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadPluginClassParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters cannot be cast to org.onap.policy.apex.context.parameters.ContextParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadPluginClassParams.json\"" + + "\n(ClassCastException):org.onap.policy.apex.service.engine.parameters.dummyclasses." + + "SuperDooperExecutorParameters" + + " cannot be cast to org.onap.policy.apex.context.parameters.ContextParameters", e.getMessage()); } } @@ -235,10 +235,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassDistParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.DistributorParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassDistParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.DistributorParameters", e.getMessage()); } } @@ -251,10 +251,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassLockParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.LockManagerParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassLockParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.LockManagerParameters", e.getMessage()); } } @@ -267,10 +267,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassPersistParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.PersistorParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassPersistParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.PersistorParameters", e.getMessage()); } } } 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 b14cc22be..aa106a695 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 @@ -30,7 +30,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -61,7 +61,8 @@ public class ExecutorParameterTests { } catch (final ApexParameterException e) { assertEquals( "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadParams.json\"\n" - + "(ApexParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not a parameter JSON object", + + "(ApexParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not " + + "a parameter JSON object", e.getMessage()); } } @@ -75,10 +76,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" - + "(ApexParameterRuntimeException):no \"executorParameters\" entry found in parameters, at least one executor parameter entry must be specified", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" + + "(ApexParameterRuntimeException):no \"executorParameters\" entry found in parameters," + + " at least one executor parameter entry must be specified", e.getMessage()); } } @@ -91,10 +92,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"executorParameters:ZOOBY\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @@ -107,10 +108,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"executorParameters:ZOOBY\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @@ -123,10 +124,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" - + "(ApexParameterRuntimeException):value for field \"parameterClassName\" in \"executorParameters:LOOBY\" entry is not a plain string", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" + + "(ApexParameterRuntimeException):value for field \"parameterClassName\" " + + "in \"executorParameters:LOOBY\" entry is not a plain string", e.getMessage()); } } @@ -139,10 +140,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" - + "(ApexParameterRuntimeException):value for field \"parameterClassName\" in \"executorParameters:LOOBY\" entry is not specified or is blank", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" + + "(ApexParameterRuntimeException):value for field \"parameterClassName\" " + + "in \"executorParameters:LOOBY\" entry is not specified or is blank", e.getMessage()); } } @@ -156,11 +157,11 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" - + "java.lang.ClassNotFoundException: helloworld", - e.getMessage()); + assertEquals("error reading parameters from" + + " \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" + + "(ApexParameterRuntimeException):failed to deserialize the parameters " + + "for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" + + "java.lang.ClassNotFoundException: helloworld", 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 6ea8d5924..6d3d7ee20 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 @@ -41,7 +41,7 @@ import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnolo import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -115,19 +115,19 @@ public class ParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/badParams.json\"\n" - + "Apex parameters invalid\n" + " engine service parameters invalid\n" - + " name [hello there] and/or version [PA1] invalid\n" - + " parameter \"name\": value \"hello there\", does not match regular expression \"[A-Za-z0-9\\-_\\.]+\"\n" - + " id not specified or specified value [-45] invalid, must be specified as id >= 0\n" - + " instanceCount [-345] invalid, must be specified as instanceCount >= 1\n" - + " deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n" - + " policyModelFileName [/some/file/name.xml] not found or is not a plain file\n" - + " event input (TheFileConsumer1) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location\n" - + " event output (FirstProducer) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location", + assertEquals("validation error(s) on parameters from \"src/test/resources/parameters/badParams.json\"\n" + + "Apex parameters invalid\n" + " engine service parameters invalid\n" + + " name [hello there] and/or version [PA1] invalid\n" + + " parameter \"name\": value \"hello there\"," + + " does not match regular expression \"[A-Za-z0-9\\-_\\.]+\"\n" + + " id not specified or specified value [-45] invalid, must be specified as id >= 0\n" + + " instanceCount [-345] invalid, must be specified as instanceCount >= 1\n" + + " deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n" + + " policyModelFileName [/some/file/name.xml] not found or is not a plain file\n" + + " event input (TheFileConsumer1) parameters invalid\n" + + " fileName not specified or is blank or null, it must be specified as a valid file location\n" + + " event output (FirstProducer) parameters invalid\n" + + " fileName not specified or is blank or null, it must be specified as a valid file location", e.getMessage()); } } 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 dad989913..a476b84ca 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 @@ -31,7 +31,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -111,11 +111,11 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsNoCTParClass.json\"\n" - + "(ApexParameterRuntimeException):carrier technology \"SUPER_DOOPER\" does not match plugin \"FILE\" in " - + "\"com.ericsson.apex.service.engine.event.impl.filecarrierplugin.FILECarrierTechnologyParameters\", " - + "specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoCTParClass.json\"\n" + + "(ApexParameterRuntimeException):carrier technology \"SUPER_DOOPER\" " + + "does not match plugin \"FILE\" in " + + "\"com.ericsson.apex.service.engine.event.impl.filecarrierplugin.FILECarrierTechnologyParameters" + + "\", specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -129,11 +129,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" - + "(ApexParameterRuntimeException):carrier technology \"SUPER_LOOPER\" does not match plugin \"SUPER_DOOPER\" in " - + "\"com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters\", " - + "specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" + + "(ApexParameterRuntimeException):carrier technology \"SUPER_LOOPER\" " + + "does not match plugin \"SUPER_DOOPER\" in \"" + + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + + "\", specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -147,11 +148,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" - + "(ApexParameterRuntimeException):could not create default parameters for carrier technology \"SUPER_DOOPER\"\n" - + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters " - + "cannot be cast to com.ericsson.apex.service.parameters.carriertechnology.CarrierTechnologyParameters", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" + + "(ApexParameterRuntimeException):could not create default parameters for carrier technology " + + "\"SUPER_DOOPER\"\ncom.ericsson.apex.service.engine.parameters.dummyclasses." + + "SuperTokenDelimitedEventProtocolParameters cannot be cast to " + + "com.ericsson.apex.service.parameters.carriertechnology.CarrierTechnologyParameters", e.getMessage()); } } @@ -184,9 +186,9 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ApexParameterException e) { assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/prodConsBadFileName.json\"\n" - + "Apex parameters invalid\n" + " event output (aProducer) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location", + "validation error(s) on parameters from \"src/test/resources/parameters/prodConsBadFileName.json\"" + + "\nApex parameters invalid\n" + " event output (aProducer) parameters invalid" + + "\n fileName not specified or is blank or null, it must be specified as a valid file location", e.getMessage()); } } @@ -201,11 +203,10 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" in " - + "\"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters\", " - + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" " + + "in \"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters" + + "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -219,11 +220,10 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsNoEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" in " - + "\"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters\", " - + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoEPParClass.json\"\n" + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" " + + "in \"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters" + + "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -239,8 +239,10 @@ public class ProducerConsumerTests { } catch (final ApexParameterException e) { assertEquals( "error reading parameters from \"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" does not match plugin \"SUPER_TOK_DEL\" in " - + "\"com.ericsson.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters\", " + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" " + + "does not match plugin \"SUPER_TOK_DEL\" in " + + "\"com.ericsson.apex.service.engine.parameters.dummyclasses." + + "SuperTokenDelimitedEventProtocolParameters\", " + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } @@ -255,11 +257,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" - + "(ApexParameterRuntimeException):could not create default parameters for event protocol \"SUPER_TOK_DEL\"\n" - + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " - + "cannot be cast to com.ericsson.apex.service.parameters.eventprotocol.EventProtocolParameters", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" + + "(ApexParameterRuntimeException):could not create default parameters for event protocol " + + "\"SUPER_TOK_DEL\"\n" + + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " + + "cannot be cast to com.ericsson.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 62e27eac9..cc1d6d3dc 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 @@ -38,7 +38,7 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -52,11 +52,11 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output " + + "\"SyncProducer0\"", e.getMessage()); } } @@ -69,10 +69,10 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", e.getMessage()); } } @@ -86,14 +86,16 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsBadPeers.json\"\n" - + "Apex parameters invalid\n" - + " specified \"synchronousPeer\" parameter value \"SyncConsumer1\" on event input \"SyncConsumer0\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncConsumer0\" on event input \"SyncConsumer1\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncProducer1\" on event output \"SyncProducer0\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncProducer0\" on event output \"SyncProducer1\" does not exist or is an invalid peer for this event handler", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsBadPeers.json\"" + "\nApex parameters invalid\n" + + " specified \"synchronousPeer\" parameter value \"SyncConsumer1\" on event input " + + "\"SyncConsumer0\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncConsumer0\" on event input " + + "\"SyncConsumer1\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncProducer1\" on event output " + + "\"SyncProducer0\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncProducer0\" on event output " + + "\"SyncProducer1\" does not exist or is an invalid peer for this event handler", e.getMessage()); } } @@ -106,16 +108,21 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsInvalidTimeout.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousTimeout\\\" value \"-1\" is illegal on synchronous event input \"SyncConsumer0\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-99999999\" is illegal on synchronous event input \"SyncConsumer1\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-10\" is illegal on synchronous event output \"SyncProducer0\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-3\" is illegal on synchronous event output \"SyncProducer1\", specify a non-negative timeout value in milliseconds\n" - + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" [-1/-10] do not match\n" - + " synchronous timeout of event input \"SyncConsumer1\" and event output \"SyncProducer1\" [-99999999/-3] do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsInvalidTimeout.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousTimeout\\\" value \"-1\" is illegal on synchronous event input " + + "\"SyncConsumer0\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-99999999\" is illegal on synchronous event input " + + "\"SyncConsumer1\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-10\" is illegal on synchronous event output " + + "\"SyncProducer0\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-3\" is illegal on synchronous event output " + + "\"SyncProducer1\", specify a non-negative timeout value in milliseconds\n" + + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" " + + "[-1/-10] do not match\n" + + " synchronous timeout of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1\" [-99999999/-3] do not match", e.getMessage()); } } @@ -128,11 +135,10 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsBadTimeout.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousTimeout\\\" is illegal on non synchronous event output \"MyOtherProducer\"", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsBadTimeout.json\"\n" + "Apex parameters invalid\n" + + " parameter \\\"synchronousTimeout\\\" is illegal on non synchronous event output " + + "\"MyOtherProducer\"", e.getMessage()); } } @@ -145,12 +151,13 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsUnpairedTimeout.json\"\n" - + "Apex parameters invalid\n" - + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" [1/10] do not match\n" - + " synchronous timeout of event input \"SyncConsumer1\" and event output \"SyncProducer1\" [99999999/3] do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsUnpairedTimeout.json\"\n" + + "Apex parameters invalid\n" + + " synchronous timeout of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer0\" [1/10] do not match\n" + + " synchronous timeout of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1\" [99999999/3] do not match", e.getMessage()); } } @@ -223,13 +230,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedConsumerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event output \"SyncProducer1\" must be unique, it s used on another event output\n" - + "" - + " synchronous peers of event input \"SyncConsumer1\" and event output \"SyncProducer1/SyncConsumer0\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedConsumerPeers.json\"\n" + "Apex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event output \"SyncProducer1\" must be unique, " + + "it s used on another event output\n" + + " synchronous peers of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1/SyncConsumer0\" do not match", e.getMessage()); } } @@ -242,12 +248,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncMismatchedPeers.json\"\n" - + "Apex parameters invalid\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer0/SyncConsumer1\" do not match\n" - + " synchronous peers of event input \"SyncConsumer1\" and event output \"SyncProducer1/SyncConsumer0\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncMismatchedPeers.json\"\nApex parameters invalid\n" + + " synchronous peers of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer0/SyncConsumer1\" do not match\n" + + " synchronous peers of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1/SyncConsumer0\" do not match", e.getMessage()); } } @@ -260,12 +266,11 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, it s used on another event input\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer1/SyncConsumer1\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedProducerPeers.json\"\nApex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, " + + "it is used on another event input\nsynchronous peers of event input \"SyncConsumer0\" and event" + + " output \"SyncProducer1/SyncConsumer1\" do not match", e.getMessage()); } } @@ -278,12 +283,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, it s used on another event input\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer1/SyncConsumer1\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" + "Apex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" " + + "must be unique, it s used on another event input\n" + + " synchronous peers of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer1/SyncConsumer1\" do not match", e.getMessage()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java index 6d7c6ff7e..8d7d65977 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java @@ -24,7 +24,7 @@ import org.onap.policy.apex.context.parameters.DistributorParameters; import org.onap.policy.apex.model.basicmodel.service.ParameterService; /** - * Distributor parameters for the Super Dooper Distributor + * Distributor parameters for the Super Dooper Distributor. * * @author Liam Fallon (liam.fallon@ericsson.com) * @version diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java index 3af772985..a7bf4d5c8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java @@ -23,7 +23,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import org.onap.policy.apex.core.engine.ExecutorParameters; /** - * Default Executor parameters for MVEL + * Default Executor parameters for MVEL. * * @author Liam Fallon (liam.fallon@ericsson.com) * @version |