diff options
author | liamfallon <liam.fallon@est.tech> | 2018-12-07 22:28:49 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2018-12-08 11:45:20 +0000 |
commit | 92dd84cb28d341e9fff892adb4b616b8b795be91 (patch) | |
tree | d330e221c7c7b6970d8419067b97712fcef3735a | |
parent | e6753352980648bac92aff9a7295639349ea1295 (diff) |
Fix checkstyle issues
Some minor line length and formatting checkstyle warnings fixed.
Change-Id: Ib92069bbdb444560083e6d0dbf5d16a3ab824d82
Issue-ID: POLICY-1074
Signed-off-by: liamfallon <liam.fallon@est.tech>
10 files changed, 66 insertions, 49 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java index b897b83f6..e92d6a9c1 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java @@ -96,8 +96,8 @@ public class ContextUpdate { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals("Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\":" - + " LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with" - + " class \"java.lang.Long\"", e.getMessage()); + + " LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with" + + " class \"java.lang.Long\"", e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -106,9 +106,9 @@ public class ContextUpdate { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals( - "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum" - + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"", - e.getMessage()); + "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum" + + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"", + e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -117,7 +117,7 @@ public class ContextUpdate { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals("album \"LongContextAlbum:0.0.1\" null values are illegal on key \"0\" for put()", - e.getMessage()); + e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -132,7 +132,6 @@ public class ContextUpdate { assertNull(dateContextAlbum.put("date0", tciA)); assertTrue(dateContextAlbum.put("date0", tciA).equals(tciA)); - assertNull(mapContextAlbum.put("map0", tciC)); assertTrue(mapContextAlbum.put("map0", tciC).equals(tciC)); @@ -161,9 +160,9 @@ public class ContextUpdate { } private ContextAlbum getContextAlbum(final String albumKey, final Distributor contextDistributor) - throws ContextException { - final ContextAlbum longContextAlbum = - contextDistributor.createContextAlbum(new AxArtifactKey(albumKey, VERSION)); + throws ContextException { + final ContextAlbum longContextAlbum = contextDistributor + .createContextAlbum(new AxArtifactKey(albumKey, VERSION)); assertNotNull(longContextAlbum); longContextAlbum.setUserArtifactStack(getAxArtifactKeyArray()); return longContextAlbum; @@ -173,7 +172,6 @@ public class ContextUpdate { final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION); final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey); - final AxContextModel multiModel = TestContextAlbumFactory.createMultiAlbumsContextModel(); contextDistributor.registerModel(multiModel); return contextDistributor; diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java index df845f563..90b1519f5 100644 --- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java +++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java @@ -32,9 +32,8 @@ import org.slf4j.ext.XLoggerFactory; * The Class {@link BatchDeployer} deploys an Apex model held as an XML or Json file onto an Apex engine. It uses the * EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java web sockets. * - * <p> - * This deployer is a simple command line deployer that reads the communication parameters and the location of the Apex - * model file as arguments. + * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of the + * Apex model file as arguments. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -97,7 +96,7 @@ public class BatchDeployer { * @throws ApexException on Apex errors */ public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force) - throws ApexException { + throws ApexException { engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force); } @@ -110,7 +109,7 @@ public class BatchDeployer { * @throws ApexException on Apex errors */ public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force) - throws ApexException { + throws ApexException { engineServiceFacade.deployModel(policyModel, ignoreConflicts, force); } @@ -133,7 +132,7 @@ public class BatchDeployer { public static void main(final String[] args) throws ApexException { if (args.length != NUM_ARGUMENTS) { final String message = "invalid arguments: " + Arrays.toString(args) - + "\nusage: BatchDeployer <server address> <port address> <model file path"; + + "\nusage: BatchDeployer <server address> <port address> <model file path"; LOGGER.error(message); throw new ApexDeploymentException(message); } diff --git a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java index b12e526d7..d5b34a054 100644 --- a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java +++ b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java @@ -65,7 +65,7 @@ public class DeploymentClientTest { @SuppressWarnings("unchecked") @Test public void testDeploymentClientStart() throws Exception { - DeploymentClient deploymentClient = new DeploymentClient("localhost", 51273); + DeploymentClient deploymentClient = new DeploymentClient("localhost", 51332); final Field factoryField = deploymentClient.getClass().getDeclaredField("factory"); factoryField.setAccessible(true); @@ -81,7 +81,7 @@ public class DeploymentClientTest { Thread clientThread = new Thread(deploymentClient); clientThread.start(); - ThreadUtilities.sleep(20); + ThreadUtilities.sleep(100); assertTrue(deploymentClient.isStarted()); assertTrue(clientThread.isAlive()); @@ -114,26 +114,28 @@ public class DeploymentClientTest { @Test public void testDeploymentClientStartException() throws Exception { - DeploymentClient depoymentClient = new DeploymentClient("localhost", 51273); + DeploymentClient deploymentClient = new DeploymentClient("localhost", 51273); - final Field factoryField = depoymentClient.getClass().getDeclaredField("factory"); + final Field factoryField = deploymentClient.getClass().getDeclaredField("factory"); factoryField.setAccessible(true); - factoryField.set(depoymentClient, mockServiceFactory); + factoryField.set(deploymentClient, mockServiceFactory); Mockito.doReturn(mockService).when(mockServiceFactory).createClient(anyObject()); Mockito.doNothing().when(mockService).addMessageListener(anyObject()); Mockito.doThrow(new ApexRuntimeException("connection start failed")).when(mockService).startConnection(); - Thread clientThread = new Thread(depoymentClient); + Thread clientThread = new Thread(deploymentClient); clientThread.start(); ThreadUtilities.sleep(50); - assertFalse(depoymentClient.isStarted()); + assertFalse(deploymentClient.isStarted()); assertFalse(clientThread.isAlive()); - assertEquals(0, depoymentClient.getReceiveQueue().size()); + assertEquals(0, deploymentClient.getReceiveQueue().size()); ThreadUtilities.sleep(100); + + deploymentClient.stopClient(); } } diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java index 32387d047..ef697b077 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java @@ -49,10 +49,10 @@ public class AutoLearnPolicyDecideTaskSelectionLogic { public boolean getTask(final TaskSelectionExecutionContext executor) { String idString = executor.subject.getId(); executor.logger.debug(idString); - + String inFieldsString = executor.inFields.toString(); executor.logger.debug(inFieldsString); - + final List<String> tasks = executor.subject.getTaskNames(); size = tasks.size(); @@ -144,22 +144,22 @@ public class AutoLearnPolicyDecideTaskSelectionLogic { autoLearn.setAvDiffs(Arrays.asList(avdiffs)); autoLearn.setCounts(Arrays.asList(counts)); } - /** - * Calculate the return value of the learning + * Calculate the return value of the learning. + * * @param diff the difference - * @param r the random value + * @param random the random value * @param closestupi closest to i upwards * @param closestdowni closest to i downwards * @param closestup closest up value * @param closestdown closest down value * @return the return value */ - private int calculateReturnValue(final double diff, final int r, int closestupi, int closestdowni, double closestup, - double closestdown) { + private int calculateReturnValue(final double diff, final int random, int closestupi, int closestdowni, + double closestup, double closestdown) { if (closestupi == -1 || closestdowni == -1) { - return r; + return random; } if (closestupi == closestdowni) { return closestupi; diff --git a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaExecutorParametersTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaExecutorParametersTest.java index 847146b8b..1e1dbf7ed 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaExecutorParametersTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaExecutorParametersTest.java @@ -25,7 +25,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; /** - * Test the JavaExecutorParameters class + * Test the JavaExecutorParameters class. */ public class JavaExecutorParametersTest { diff --git a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java index c8522547a..6638e7183 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java @@ -51,6 +51,9 @@ import org.onap.policy.common.parameters.ParameterService; * */ public class JavaStateFinalizerExecutorTest { + /** + * Initiate Parameters. + */ @Before public void initiateParameters() { ParameterService.register(new DistributorParameters()); @@ -59,6 +62,9 @@ public class JavaStateFinalizerExecutorTest { ParameterService.register(new EngineParameters()); } + /** + * Clear down Parameters. + */ @After public void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); @@ -90,9 +96,11 @@ public class JavaStateFinalizerExecutorTest { try { parentStateExcutor = new StateExecutor(new ExecutorFactoryImpl()); } catch (StateMachineException e) { + fail("test should not throw an exception here"); } + AxState state = new AxState(); - parentStateExcutor.setContext(null, state , internalContext); + parentStateExcutor.setContext(null, state, internalContext); AxStateFinalizerLogic stateFinalizerLogic = new AxStateFinalizerLogic(); jsfe.setContext(parentStateExcutor, stateFinalizerLogic, internalContext); @@ -116,7 +124,7 @@ public class JavaStateFinalizerExecutorTest { fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("state finalizer logic failed to run for state finalizer \"NULL:0.0.0:NULL:NULL\"", - jtseException.getMessage()); + jtseException.getMessage()); } AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); @@ -126,7 +134,7 @@ public class JavaStateFinalizerExecutorTest { fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("state finalizer logic failed to run for state finalizer \"NULL:0.0.0:NULL:NULL\"", - jtseException.getMessage()); + jtseException.getMessage()); } stateFinalizerLogic.setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaStateFinalizerLogic"); @@ -136,7 +144,7 @@ public class JavaStateFinalizerExecutorTest { fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("execute-post: state finalizer logic execution failure on state \"NULL:0.0.0:NULL:NULL\" " - + "on finalizer logic NULL:0.0.0:NULL:NULL", jtseException.getMessage()); + + "on finalizer logic NULL:0.0.0:NULL:NULL", jtseException.getMessage()); } state.getStateOutputs().put("SelectedOutputIsMe", null); diff --git a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java index 74d0c8260..f3ea1ce4d 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java @@ -45,6 +45,9 @@ import org.onap.policy.common.parameters.ParameterService; * */ public class JavaTaskExecutorTest { + /** + * Initiate Parameters. + */ @Before public void initiateParameters() { ParameterService.register(new DistributorParameters()); @@ -52,6 +55,9 @@ public class JavaTaskExecutorTest { ParameterService.register(new PersistorParameters()); } + /** + * Clear Parameters. + */ @After public void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); diff --git a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java index dbb250f8a..64dfaea10 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java @@ -45,6 +45,9 @@ import org.onap.policy.common.parameters.ParameterService; * */ public class JavaTaskSelectExecutorTest { + /** + * Initiate Parameters. + */ @Before public void initiateParameters() { ParameterService.register(new DistributorParameters()); @@ -52,6 +55,9 @@ public class JavaTaskSelectExecutorTest { ParameterService.register(new PersistorParameters()); } + /** + * Clear Parameters. + */ @After public void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchTest.java index f315f6402..821cb68bd 100644 --- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchTest.java +++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchTest.java @@ -37,12 +37,13 @@ public class EventBatchTest { EventBatch batch = new EventBatch(1, "TheApexClient"); assertNotNull(batch); - assertEquals("\"nameSpace\": \"org.onap.policy.apex.sample.events\"", batch.getBatchAsJsonString().substring(4, 53)); + assertEquals("\"nameSpace\": \"org.onap.policy.apex.sample.events\"", + batch.getBatchAsJsonString().substring(4, 53)); EventBatchStats stats = batch.getStats(); assertEquals(1, stats.getBatchSize()); InputEvent ie = batch.getInputEvent(0); - assertEquals("org.onap.policy.apex.sample.events",ie.getNameSpace()); + assertEquals("org.onap.policy.apex.sample.events", ie.getNameSpace()); } } diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java index e37ea963c..3d37b3f4c 100644 --- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java +++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java @@ -55,8 +55,8 @@ public class EventGeneratorTest { EventGenerator eventGenerator = new EventGenerator(pars); - final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/REST2RESTJsonEventJavascript.json" }; + final String[] args = { "-rfr", "target", "-c", + "target/examples/config/SampleDomain/REST2RESTJsonEventJavascript.json" }; final ApexMain apexMain = new ApexMain(args); @@ -76,8 +76,7 @@ public class EventGeneratorTest { public void testEventGeneratorBadParams() { System.setOut(new PrintStream(outContent)); - final String[] args = - { "-zzz" }; + final String[] args = { "-zzz" }; EventGenerator.main(args); @@ -92,9 +91,7 @@ public class EventGeneratorTest { public void testEventGeneratorHelp() { System.setOut(new PrintStream(outContent)); - final String[] args = { - "-h" - }; + final String[] args = { "-h" }; EventGenerator.main(args); @@ -114,7 +111,7 @@ public class EventGeneratorTest { public void run() { EventGenerator.main(null); } - }).start(); + }).start(); ThreadUtilities.sleep(1000); final String outString = outContent.toString(); @@ -127,7 +124,7 @@ public class EventGeneratorTest { @Test public void testEventGeneratorOutfileGood() { - EventGeneratorParameters pars =new EventGeneratorParameters(); + EventGeneratorParameters pars = new EventGeneratorParameters(); pars.setOutFile("target/statsOutFile.json"); EventGenerator generator = new EventGenerator(pars); |