From 386d8b15efd66cbd176e9911806c55a437cc6376 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 3 Sep 2020 13:32:01 +0100 Subject: Clean up warnings and SONAR issues Issue-ID: POLICY-2654 Change-Id: Ifd391ea9141d37cfd3ca4110d66c667962230ae1 Signed-off-by: liamfallon --- .../engine/parameters/ApexParametersTest.java | 7 +- .../engine/parameters/ContextParameterTests.java | 103 ++++++++++----------- .../engine/parameters/ProducerConsumerTests.java | 92 ++++++++---------- 3 files changed, 93 insertions(+), 109 deletions(-) (limited to 'services/services-engine/src/test') diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java index 330de42dd..1c816768f 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java @@ -27,7 +27,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.service.engine.main.ApexCommandLineArguments; @@ -42,7 +41,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesOk() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/javaPropertiesOK.json"}; + final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesOK.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -56,7 +55,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesEmpty() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/javaPropertiesEmpty.json"}; + final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesEmpty.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -66,7 +65,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesBad() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/javaPropertiesBad.json"}; + final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesBad.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) 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 018fda668..e8485d109 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 @@ -23,7 +23,6 @@ package org.onap.policy.apex.service.engine.parameters; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.service.engine.main.ApexCommandLineArguments; @@ -41,30 +40,29 @@ public class ContextParameterTests { @Test public void testNoParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextNoParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextNoParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) .hasMessage("error reading parameters from \"src/test/resources/parameters/serviceContextNoParams.json\"\n" - + "(ParameterRuntimeException):could not find field \"parameterClassName\" in " - + "\"contextParameters\" entry"); + + "(ParameterRuntimeException):could not find field \"parameterClassName\" in " + + "\"contextParameters\" entry"); } @Test public void testBadParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) .hasMessage("error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\"" - + "\n(ParameterRuntimeException):failed to deserialize the parameters for " - + "\"contextParameters\" to parameter class " - + "\"hello\"\njava.lang.ClassNotFoundException: hello"); + + "\n(ParameterRuntimeException):failed to deserialize the parameters for " + + "\"contextParameters\" to parameter class " + "\"hello\"\njava.lang.ClassNotFoundException: hello"); } @Test public void testBadPluginParamNameTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadPluginNameParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadPluginNameParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -76,21 +74,19 @@ public class ContextParameterTests { @Test public void testBadClassParamTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadClassParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("error reading parameters from " - + "\"src/test/resources/parameters/serviceContextBadClassParams.json\"" - + "\n(ParameterRuntimeException):failed to deserialize " - + "the parameters for \"contextParameters\"" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "error reading parameters from " + "\"src/test/resources/parameters/serviceContextBadClassParams.json\"" + + "\n(ParameterRuntimeException):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 $"); } @Test public void testBadPluginClassTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadPluginClassParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadPluginClassParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -106,88 +102,87 @@ public class ContextParameterTests { @Test public void testOkFlushParamTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextOKFlushParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKFlushParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters - .getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); + assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); assertEquals(123456, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getFlushPeriod()); + .getPersistorParameters().getFlushPeriod()); } @Test public void testOkDefaultParamTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextOKDefaultParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKDefaultParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters - .getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); + assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); assertEquals(300000, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getFlushPeriod()); + .getPersistorParameters().getFlushPeriod()); } @Test public void testOkDistParamTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextOKDistParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKDistParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters - .getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); + assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.DistributorParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getDistributorParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getDistributorParameters().getClass().getName()); } @Test public void testOkFullDefaultParamTest() throws ParameterException { - 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); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters - .getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); + assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.DistributorParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getDistributorParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getDistributorParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.LockManagerParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getLockManagerParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getLockManagerParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.PersistorParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getPersistorParameters().getClass().getName()); assertEquals(300000, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getFlushPeriod()); + .getPersistorParameters().getFlushPeriod()); } @Test public void testOkFullParamTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextOKFullParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKFullParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); - assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters - .getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); + assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.LockManagerParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getLockManagerParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getLockManagerParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.PersistorParameters", - parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getClass().getName()); + parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() + .getPersistorParameters().getClass().getName()); assertEquals(123456, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getFlushPeriod()); + .getPersistorParameters().getFlushPeriod()); - final SuperDooperDistributorParameters infinispanParameters = - (SuperDooperDistributorParameters) parameters.getEngineServiceParameters().getEngineParameters() - .getContextParameters().getDistributorParameters(); + final SuperDooperDistributorParameters infinispanParameters = (SuperDooperDistributorParameters) parameters + .getEngineServiceParameters().getEngineParameters().getContextParameters().getDistributorParameters(); assertEquals("org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperDistributorParameters", - infinispanParameters.getClass().getName()); + infinispanParameters.getClass().getName()); assertEquals("my/lovely/configFile.xml", infinispanParameters.getConfigFile()); assertEquals("holy/stone.xml", infinispanParameters.getJgroupsFile()); assertEquals(false, infinispanParameters.isPreferIPv4Stack()); @@ -197,7 +192,7 @@ public class ContextParameterTests { @Test public void testBadClassDistParamTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadClassDistParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassDistParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -212,7 +207,7 @@ public class ContextParameterTests { @Test public void testBadClassLockParamTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadClassLockParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassLockParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -227,7 +222,7 @@ public class ContextParameterTests { @Test public void testBadClassPersistParamTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceContextBadClassPersistParams.json"}; + final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassPersistParams.json" }; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) 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 a80aa09c8..8c7c9df82 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 @@ -24,7 +24,6 @@ package org.onap.policy.apex.service.engine.parameters; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters; @@ -41,7 +40,7 @@ import org.onap.policy.common.parameters.ParameterException; public class ProducerConsumerTests { @Test public void testGoodParametersTest() throws ParameterException { - 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); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -51,35 +50,34 @@ public class ProducerConsumerTests { assertEquals(45, parameters.getEngineServiceParameters().getId()); assertEquals(19, parameters.getEngineServiceParameters().getInstanceCount()); assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort()); - assertEquals("FILE", parameters.getEventOutputParameters().get("FirstProducer") - .getCarrierTechnologyParameters().getLabel()); + assertEquals("FILE", + parameters.getEventOutputParameters().get("FirstProducer").getCarrierTechnologyParameters().getLabel()); assertEquals("JSON", - parameters.getEventOutputParameters().get("FirstProducer").getEventProtocolParameters().getLabel()); - assertEquals("FILE", parameters.getEventOutputParameters().get("MyOtherProducer") - .getCarrierTechnologyParameters().getLabel()); - assertEquals("JSON", parameters.getEventOutputParameters().get("MyOtherProducer") - .getEventProtocolParameters().getLabel()); - assertEquals("FILE", parameters.getEventInputParameters().get("TheFileConsumer1") - .getCarrierTechnologyParameters().getLabel()); - assertEquals("JSON", parameters.getEventInputParameters().get("TheFileConsumer1") - .getEventProtocolParameters().getLabel()); + parameters.getEventOutputParameters().get("FirstProducer").getEventProtocolParameters().getLabel()); + assertEquals("FILE", + parameters.getEventOutputParameters().get("MyOtherProducer").getCarrierTechnologyParameters().getLabel()); + assertEquals("JSON", + parameters.getEventOutputParameters().get("MyOtherProducer").getEventProtocolParameters().getLabel()); + assertEquals("FILE", + parameters.getEventInputParameters().get("TheFileConsumer1").getCarrierTechnologyParameters().getLabel()); + assertEquals("JSON", + parameters.getEventInputParameters().get("TheFileConsumer1").getEventProtocolParameters().getLabel()); assertEquals("SUPER_DOOPER", parameters.getEventInputParameters().get("MySuperDooperConsumer1") - .getCarrierTechnologyParameters().getLabel()); - assertEquals("SUPER_TOK_DEL", parameters.getEventInputParameters().get("MySuperDooperConsumer1") - .getEventProtocolParameters().getLabel()); + .getCarrierTechnologyParameters().getLabel()); + assertEquals("SUPER_TOK_DEL", + parameters.getEventInputParameters().get("MySuperDooperConsumer1").getEventProtocolParameters().getLabel()); } @Test public void testNoCarrierTechnology() { - 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); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) .hasMessage("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 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, " @@ -88,15 +86,14 @@ public class ProducerConsumerTests { @Test public void testNoEventProcol() { - 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); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) .hasMessage("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 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, " @@ -114,7 +111,7 @@ public class ProducerConsumerTests { @Test public void testNoCarrierTechnologyParClass() { - 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); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -125,27 +122,24 @@ public class ProducerConsumerTests { @Test public void testMismatchCarrierTechnologyParClass() { - 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); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("error reading parameters from " - + "\"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "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\""); + + "\", specify correct carrier technology parameter plugin " + "in parameter \"parameterClassName\""); } @Test public void testWrongTypeCarrierTechnologyParClass() { - 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); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("error reading parameters from " - + "\"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "error reading parameters from " + "\"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" + "(ParameterRuntimeException):could not create default parameters for carrier technology " + "\"SUPER_DOOPER\"\n" + "class org.onap.policy.apex.service.engine.parameters.dummyclasses." + "SuperTokenDelimitedEventProtocolParameters cannot be cast to class " @@ -157,12 +151,12 @@ public class ProducerConsumerTests { @Test public void testOkFileNameCarrierTechnology() throws ParameterException { - 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); 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()); @@ -172,16 +166,14 @@ public class ProducerConsumerTests { @Test public void testBadFileNameCarrierTechnology() { - 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); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("validation error(s) on parameters from " - + "\"src/test/resources/parameters/prodConsBadFileName.json\"\n" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "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 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 " @@ -194,7 +186,7 @@ public class ProducerConsumerTests { @Test public void testBadEventProtocolParClass() { - 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); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -207,7 +199,7 @@ public class ProducerConsumerTests { @Test public void testNoEventProtocolParClass() { - 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); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -218,12 +210,11 @@ public class ProducerConsumerTests { @Test public void testMismatchEventProtocolParClass() { - 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); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("error reading parameters from " - + "\"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "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." @@ -233,12 +224,11 @@ public class ProducerConsumerTests { @Test public void testWrongTypeEventProtocolParClass() { - 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); - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("error reading parameters from " - + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" + assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( + "error reading parameters from " + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" + "(ParameterRuntimeException):could not create default parameters for event protocol " + "\"SUPER_TOK_DEL\"\n" + "class org.onap.policy.apex.service.engine." + "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " -- cgit 1.2.3-korg