From 3b9a2d4870110d14d7e2b6ea672023fd18328c8b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 21 Aug 2019 11:40:15 +0200 Subject: [PATCH] Another round of checkstyle fixes This fixes failures reported by upgraded checkstyle, as well as some non-enforced violations. Change-Id: I8b6a9667c6586bef528587d455f7a8597b4f483f Signed-off-by: Robert Varga --- .../timer/HashedWheelTimerCloseable.java | 14 +++--- .../mdsal/it/base/AbstractMdsalTestBase.java | 48 +++++++++---------- .../messagebus/spi/EventSourceRegistry.java | 2 +- .../data/ConcurrentImplicitCreateTest.java | 4 +- .../WildcardedDataChangeListenerTest.java | 4 +- .../sal/binding/test/bugfix/package-info.java | 8 ++-- .../dom/DOMRpcServiceTestBugfix560.java | 47 ++++++++---------- .../dom/MessageCapturingFlowService.java | 11 +++-- 8 files changed, 63 insertions(+), 75 deletions(-) diff --git a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java index b519af1b99..7bc1352164 100644 --- a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java +++ b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java @@ -47,24 +47,24 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer { public static HashedWheelTimerCloseable newInstance(final @Nullable ThreadFactory threadFactory, final @Nullable Long duration, final @Nullable Integer ticksPerWheel) { TimeUnit unit = TimeUnit.MILLISECONDS; - if(!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) { + if (!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit)); } - if(!nullOrNonPositive(duration) && threadFactory == null && !nullOrNonPositive(ticksPerWheel)) { + if (!nullOrNonPositive(duration) && threadFactory == null && !nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit, ticksPerWheel)); } - if(nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { + if (nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(threadFactory)); } - if(!nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { + if (!nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable( new HashedWheelTimer(threadFactory, duration, unit)); } - if(!nullOrNonPositive(duration) && threadFactory != null && !nullOrNonPositive(ticksPerWheel)) { + if (!nullOrNonPositive(duration) && threadFactory != null && !nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable( new HashedWheelTimer(threadFactory, duration, unit, ticksPerWheel)); } @@ -72,7 +72,7 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer { return new HashedWheelTimerCloseable(new HashedWheelTimer()); } - private static boolean nullOrNonPositive(final Number n) { - return n == null || n.longValue() <= 0; + private static boolean nullOrNonPositive(final Number num) { + return num == null || num.longValue() <= 0; } } diff --git a/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java b/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java index 6d31034d8f..ad0934122d 100644 --- a/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java +++ b/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java @@ -139,30 +139,30 @@ public abstract class AbstractMdsalTestBase { final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf.features", "org.apache.karaf.features.core"); options = OptionUtils.combine(options, new VMOption[] { - new VMOption("--add-reads=java.xml=java.logging"), - new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"), - new VMOption("--patch-module"), - new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + karafVersion + ".jar"), - new VMOption("--patch-module"), - new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + karafVersion + ".jar"), - new VMOption("--add-opens"), - new VMOption("java.base/java.security=ALL-UNNAMED"), - new VMOption("--add-opens"), - new VMOption("java.base/java.net=ALL-UNNAMED"), - new VMOption("--add-opens"), - new VMOption("java.base/java.lang=ALL-UNNAMED"), - new VMOption("--add-opens"), - new VMOption("java.base/java.util=ALL-UNNAMED"), - new VMOption("--add-opens"), - new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"), - new VMOption("--add-opens"), - new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"), - new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"), - new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"), - new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"), - new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"), - new VMOption("-classpath"), - new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*") + new VMOption("--add-reads=java.xml=java.logging"), + new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"), + new VMOption("--patch-module"), + new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + karafVersion + ".jar"), + new VMOption("--patch-module"), + new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + karafVersion + ".jar"), + new VMOption("--add-opens"), + new VMOption("java.base/java.security=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.net=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.lang=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.util=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"), + new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"), + new VMOption("-classpath"), + new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*") }); } diff --git a/opendaylight/md-sal/messagebus-spi/src/main/java/org/opendaylight/controller/messagebus/spi/EventSourceRegistry.java b/opendaylight/md-sal/messagebus-spi/src/main/java/org/opendaylight/controller/messagebus/spi/EventSourceRegistry.java index 893ea16940..bb9761d1ae 100644 --- a/opendaylight/md-sal/messagebus-spi/src/main/java/org/opendaylight/controller/messagebus/spi/EventSourceRegistry.java +++ b/opendaylight/md-sal/messagebus-spi/src/main/java/org/opendaylight/controller/messagebus/spi/EventSourceRegistry.java @@ -18,7 +18,7 @@ public interface EventSourceRegistry extends AutoCloseable { * * @param eventSource the EventSource instance to register * @return an EventSourceRegistration instance that is used to unregister the EventSource - * via {@link EventSourceRegistration#close()}. + * via {@link EventSourceRegistration#close()}. */ EventSourceRegistration registerEventSource(T eventSource); } diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java index 6959912d36..1930e2b4c9 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java @@ -21,9 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -/** - * FIXME: THis test should be moved to sal-binding-broker and rewritten to use new DataBroker API - */ +// FIXME: THis test should be moved to sal-binding-broker and rewritten to use new DataBroker API public class ConcurrentImplicitCreateTest extends AbstractDataServiceTest { private static final TopLevelListKey FOO_KEY = new TopLevelListKey("foo"); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java index 4f11c50e53..13f36f1721 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java @@ -35,9 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; -/** - * FIXME: THis test should be moved to compat test-suite - */ +// FIXME: This test should be moved to compat test-suite public class WildcardedDataChangeListenerTest extends AbstractDataTreeChangeListenerTest { private static final TopLevelListKey TOP_LEVEL_LIST_0_KEY = new TopLevelListKey("test:0"); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java index 84559d506b..f328661477 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java @@ -6,10 +6,8 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ /** - * This testsuite test Hydrogen-level API and regression for most of it, - * - * FIXME: this testsuite needs to be refactored to use new DataBroker API, - * moved to sal-binding-broker-impl and uses models only from sal-test-model. - * + * This testsuite test Hydrogen-level API and regression for most of it. */ +// FIXME: this testsuite needs to be refactored to use new DataBroker API, moved to sal-binding-broker-impl +// and uses models only from sal-test-model. package org.opendaylight.controller.sal.binding.test.bugfix; \ No newline at end of file diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java index 81171349d7..cce41da2d7 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java @@ -52,7 +52,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; /** - * Test case for reported bug 560 + * Test case for reported bug 560. * * @author Lukas Sedlak * @see BA_MOUNT_ID = createBATllIdentifier(TLL_NAME); - private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_MOUNT_ID = createBITllIdentifier(TLL_NAME); + private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_MOUNT_ID = + createBITllIdentifier(TLL_NAME); private BindingTestContext testContext; private DOMMountPointService domMountPointService; private MountPointService bindingMountPointService; private SchemaContext schemaContext; - /** - * @throws java.lang.Exception - */ @Before public void setUp() throws Exception { final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory(); @@ -118,21 +116,19 @@ public class DOMRpcServiceTestBugfix560 { @Test public void test() throws ExecutionException, InterruptedException { // FIXME: This is made to only make sure instance identifier codec for path is instantiated. - domMountPointService - .createMountPoint(BI_MOUNT_ID).addService(DOMRpcService.class, new DOMRpcService() { - - @Override - public ListenerRegistration registerRpcListener(final T arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public CheckedFuture invokeRpc(final SchemaPath arg0, final NormalizedNode arg1) { - final DOMRpcResult result = new DefaultDOMRpcResult((NormalizedNode) null); - return Futures.immediateCheckedFuture(result); - } - }).register(); + domMountPointService.createMountPoint(BI_MOUNT_ID).addService(DOMRpcService.class, new DOMRpcService() { + @Override + public ListenerRegistration registerRpcListener(final T arg0) { + // TODO Auto-generated method stub + return null; + } + + @Override + public CheckedFuture invokeRpc(final SchemaPath arg0, + final NormalizedNode arg1) { + return Futures.immediateCheckedFuture(new DefaultDOMRpcResult((NormalizedNode) null)); + } + }).register(); final Optional mountInstance = bindingMountPointService.getMountPoint(BA_MOUNT_ID); assertTrue(mountInstance.isPresent()); @@ -152,9 +148,6 @@ public class DOMRpcServiceTestBugfix560 { } } - /** - * @throws java.lang.Exception - */ @After public void teardown() { testContext.close(); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java index 9987bffda1..bc521d1254 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java @@ -32,7 +32,8 @@ public class MessageCapturingFlowService implements OpendaylightOfMigrationTestM return knockKnockResult; } - public MessageCapturingFlowService setKnockKnockResult(final ListenableFuture> kkOutput) { + public MessageCapturingFlowService setKnockKnockResult( + final ListenableFuture> kkOutput) { this.knockKnockResult = kkOutput; return this; } @@ -52,12 +53,14 @@ public class MessageCapturingFlowService implements OpendaylightOfMigrationTestM registration.close(); } - public MessageCapturingFlowService registerPath(final Class context, final InstanceIdentifier path) { + public MessageCapturingFlowService registerPath(final Class context, + final InstanceIdentifier path) { registration.registerPath(context, path); return this; } - public MessageCapturingFlowService unregisterPath(final Class context, final InstanceIdentifier path) { + public MessageCapturingFlowService unregisterPath(final Class context, + final InstanceIdentifier path) { registration.unregisterPath(context, path); return this; } @@ -77,6 +80,4 @@ public class MessageCapturingFlowService implements OpendaylightOfMigrationTestM receivedKnocks.put(input.getKnockerId(), input); return knockKnockResult; } - - } -- 2.36.6