Fix checkstyle/spotbugs violations 64/84164/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 3 Sep 2019 07:34:01 +0000 (09:34 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 3 Sep 2019 08:46:07 +0000 (10:46 +0200)
Enabling checkstyle/spotbugs by default finds these, fix them up.

Change-Id: Ib407830f0a15cb4c04492f3c694fb463cdb30bad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 files changed:
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomWrite.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchmarkProvider.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/GlobalBindingRTCClient.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RTCClient.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RoutedBindingRTClient.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RpcbenchmarkProvider.java
opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NotificationIT.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceIT.java
opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java

index c5232a2b79f6fbef55d5df02ad7bf55e33dad652..1547f2ba8c40978342c5d9b07065637cedb679ab 100644 (file)
@@ -77,7 +77,7 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable {
             setTestOperData(this.execStatus.get(), testsCompleted);
         } catch (final Exception e) {
             // TODO: Use a singleton service to make sure the initial write is performed only once.
             setTestOperData(this.execStatus.get(), testsCompleted);
         } catch (final Exception e) {
             // TODO: Use a singleton service to make sure the initial write is performed only once.
-            LOG.warn("Working around Bugs 8829 and 6793 by ignoring exception from setTestOperData: {}", e);
+            LOG.warn("Working around Bugs 8829 and 6793 by ignoring exception from setTestOperData", e);
         }
 
         LOG.info("DsbenchmarkProvider initiated");
         }
 
         LOG.info("DsbenchmarkProvider initiated");
index f41cb1f50e6d5c494ef1d5a9a7d296a9cf7fb2f1..be52c401fd3f37f400830d166f282a2424cda2f5 100644 (file)
@@ -64,7 +64,7 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
                     tx.commit().get();
                     txOk++;
                 } catch (final InterruptedException | ExecutionException e) {
                     tx.commit().get();
                     txOk++;
                 } catch (final InterruptedException | ExecutionException e) {
-                    LOG.error("Transaction failed: {}", e);
+                    LOG.error("Transaction failed", e);
                     txError++;
                 }
                 tx = dataBroker.newWriteOnlyTransaction();
                     txError++;
                 }
                 tx = dataBroker.newWriteOnlyTransaction();
@@ -75,7 +75,7 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
-                LOG.error("Transaction failed: {}", e);
+                LOG.error("Transaction failed", e);
             }
         }
     }
             }
         }
     }
index 80e42d0efedb4e1fe5092712a87b8e7cb4a28b67..8893a70574a4ab97e8245d3474edb5c38b7999b7 100644 (file)
@@ -63,7 +63,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
                     tx.commit().get();
                     txOk++;
                 } catch (final InterruptedException | ExecutionException e) {
                     tx.commit().get();
                     txOk++;
                 } catch (final InterruptedException | ExecutionException e) {
-                    LOG.error("Transaction failed: {}", e);
+                    LOG.error("Transaction failed", e);
                     txError++;
                 }
                 tx = dataBroker.newWriteOnlyTransaction();
                     txError++;
                 }
                 tx = dataBroker.newWriteOnlyTransaction();
@@ -76,7 +76,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
-                LOG.error("Transaction failed: {}", e);
+                LOG.error("Transaction failed", e);
             }
         }
     }
             }
         }
     }
index ce70d4d85441b397b0640d4ee8062f7fb611002d..4f29cdceab0b342aadefe9e153f0bdee9939e7db 100644 (file)
@@ -69,7 +69,7 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
                     tx.commit().get();
                     txOk++;
                 } catch (final  InterruptedException | ExecutionException e) {
                     tx.commit().get();
                     txOk++;
                 } catch (final  InterruptedException | ExecutionException e) {
-                    LOG.error("Transaction failed: {}", e);
+                    LOG.error("Transaction failed", e);
                     txError++;
                 }
                 tx = domDataBroker.newWriteOnlyTransaction();
                     txError++;
                 }
                 tx = domDataBroker.newWriteOnlyTransaction();
@@ -80,7 +80,7 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
             try {
                 tx.commit().get();
             } catch (final InterruptedException | ExecutionException e) {
-                LOG.error("Transaction failed: {}", e);
+                LOG.error("Transaction failed", e);
             }
         }
     }
             }
         }
     }
index 75fb89241866aa42f3a68425252cef3e6ba303ac..bd947acddb13ea595757e72557dac0871f3a1de0 100644 (file)
@@ -98,7 +98,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
         try {
             chain.close();
         } catch (final IllegalStateException e) {
         try {
             chain.close();
         } catch (final IllegalStateException e) {
-            LOG.error("Transaction close failed,", e);
+            LOG.error("Transaction close failed", e);
         }
         LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
         }
         LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
@@ -106,8 +106,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in TxchainBaDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
-            cause);
+        LOG.error("Broken chain {} in TxchainBaDelete, transaction {}", chain, transaction.getIdentifier(), cause);
     }
 
     @Override
     }
 
     @Override
index 4394daacb6370929a246dd89a0ce220aa32ab007..101ae39b968ae0858c23f8d91aa9067d24c0097d 100644 (file)
@@ -96,8 +96,7 @@ public class TxchainBaRead extends DatastoreAbstractWriter implements Transactio
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in TxchainBaDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
-            cause);
+        LOG.error("Broken chain {} in TxchainBaDelete, transaction {}", chain, transaction.getIdentifier(), cause);
     }
 
     @Override
     }
 
     @Override
index b0ee4b4d2234c3cfd18bdfe7488e1f65e3a9cee7..b96c1763b7a423ae54c8d4e8832ae77b08a54d4f 100644 (file)
@@ -108,8 +108,8 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in DatastoreBaAbstractWrite, transaction {}, cause {}", chain,
-            transaction.getIdentifier(), cause);
+        LOG.error("Broken chain {} in DatastoreBaAbstractWrite, transaction {}", chain, transaction.getIdentifier(),
+            cause);
     }
 
     @Override
     }
 
     @Override
index 8f04c0a0a9444d0afc14d7944b1da2fb677735e3..75dee6267346960e00ddc8480b8f243043fbf5be 100644 (file)
@@ -29,7 +29,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class TxchainDomDelete extends DatastoreAbstractWriter implements DOMTransactionChainListener {
 import org.slf4j.LoggerFactory;
 
 public class TxchainDomDelete extends DatastoreAbstractWriter implements DOMTransactionChainListener {
-    private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
+    private static final Logger LOG = LoggerFactory.getLogger(TxchainDomDelete.class);
     private final DOMDataBroker domDataBroker;
 
     public TxchainDomDelete(final DOMDataBroker domDataBroker, final int outerListElem, final int innerListElem,
     private final DOMDataBroker domDataBroker;
 
     public TxchainDomDelete(final DOMDataBroker domDataBroker, final int outerListElem, final int innerListElem,
@@ -110,8 +110,7 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements DOMTran
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in TxchainDomDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
-            cause);
+        LOG.error("Broken chain {} in TxchainDomDelete, transaction {}", chain, transaction.getIdentifier(), cause);
     }
 
     @Override
     }
 
     @Override
index 84eca17990a1a4cf1e5eab88d5a2159e4b79fa5f..4ff133db73f10bde52708381d5fe7bbb27dc6c8c 100644 (file)
@@ -79,8 +79,7 @@ public class TxchainDomRead extends DatastoreAbstractWriter implements DOMTransa
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in TxchainDomDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
-            cause);
+        LOG.error("Broken chain {} in TxchainDomDelete, transaction {}", chain, transaction.getIdentifier(), cause);
     }
 
     @Override
     }
 
     @Override
index 01f60656d73153a036802f53069cf25525462502..4f254a2ce99cfba935fcf4190d9ba18008a109f4 100644 (file)
@@ -114,8 +114,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements DOMTrans
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
     @Override
     public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
             final Throwable cause) {
-        LOG.error("Broken chain {} in TxchainDomWrite, transaction {}, cause {}", chain, transaction.getIdentifier(),
-            cause);
+        LOG.error("Broken chain {} in TxchainDomWrite, transaction {}", chain, transaction.getIdentifier(), cause);
     }
 
     @Override
     }
 
     @Override
index c6e2e8affb2af60bb4f88820498a0546a876439e..b0e239c4d45f99f483c7abbd1ae681d98498f723 100644 (file)
@@ -8,14 +8,13 @@
 package ntfbenchmark.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
 package ntfbenchmark.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
 
 public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
-
-    private final SettableFuture<?> lastDeliveryFuture = SettableFuture.create();
-
+    private static final Logger LOG = LoggerFactory.getLogger(NtfbenchNonblockingProducer.class);
 
     public NtfbenchNonblockingProducer(final NotificationPublishService publishService, final int iterations,
             final int payloadSize) {
 
     public NtfbenchNonblockingProducer(final NotificationPublishService publishService, final int iterations,
             final int payloadSize) {
@@ -39,6 +38,7 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
                     lastOkFuture = result;
                 }
             } catch (final Exception e) {
                     lastOkFuture = result;
                 }
             } catch (final Exception e) {
+                LOG.debug("Failed to publish notification", e);
                 ntfError++;
             }
         }
                 ntfError++;
             }
         }
index 5ea3b0fffb2ddb618a30cd2049d53e7a85823e22..39e8273bdb8833e119cfe25f5963208025b5dd97 100644 (file)
@@ -7,6 +7,8 @@
  */
 package ntfbenchmark.impl;
 
  */
 package ntfbenchmark.impl;
 
+import static com.google.common.base.Verify.verifyNotNull;
+
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
@@ -83,7 +85,8 @@ public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService
             final long startTime = System.nanoTime();
 
             for (int i = 0; i < input.getProducers().intValue(); i++) {
             final long startTime = System.nanoTime();
 
             for (int i = 0; i < input.getProducers().intValue(); i++) {
-                executor.submit(producers.get(i));
+                // FIXME: fools RV_RETURN_VALUE_IGNORED_BAD_PRACTICE for now, but we should check some more
+                verifyNotNull(executor.submit(producers.get(i)));
             }
             executor.shutdown();
             try {
             }
             executor.shutdown();
             try {
@@ -106,7 +109,6 @@ public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService
                 allListeners += listenerRegistration.getInstance().getReceived();
             }
 
                 allListeners += listenerRegistration.getInstance().getReceived();
             }
 
-            final long listenerEndTime = System.nanoTime();
             final long listenerElapsedTime = producerEndTime - startTime;
 
             LOG.info("Test Done");
             final long listenerElapsedTime = producerEndTime - startTime;
 
             LOG.info("Test Done");
index f03c064b03aee53f597dcba90d80d8f1d454150c..f09bd7fc15e876b99e6451110f1b63e82e4034fb 100644 (file)
@@ -12,7 +12,6 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicLong;
-
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInputBuilder;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInputBuilder;
@@ -25,18 +24,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class GlobalBindingRTCClient implements RTCClient {
 import org.slf4j.LoggerFactory;
 
 public class GlobalBindingRTCClient implements RTCClient {
-
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCClient.class);
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCClient.class);
+
     private final RpcbenchPayloadService service;
     private final AtomicLong rpcOk = new AtomicLong(0);
     private final AtomicLong rpcError = new AtomicLong(0);
     private final GlobalRpcBenchInput inVal;
     private final int inSize;
 
     private final RpcbenchPayloadService service;
     private final AtomicLong rpcOk = new AtomicLong(0);
     private final AtomicLong rpcError = new AtomicLong(0);
     private final GlobalRpcBenchInput inVal;
     private final int inSize;
 
+    @Override
     public long getRpcOk() {
         return rpcOk.get();
     }
 
     public long getRpcOk() {
         return rpcOk.get();
     }
 
+    @Override
     public long getRpcError() {
         return rpcError.get();
     }
     public long getRpcError() {
         return rpcError.get();
     }
@@ -56,9 +57,10 @@ public class GlobalBindingRTCClient implements RTCClient {
         inVal = new GlobalRpcBenchInputBuilder().setPayload(listVals).build();
     }
 
         inVal = new GlobalRpcBenchInputBuilder().setPayload(listVals).build();
     }
 
+    @Override
     public void runTest(final int iterations) {
     public void runTest(final int iterations) {
-        int rpcOk = 0;
-        int rpcError = 0;
+        int ok = 0;
+        int error = 0;
 
         for (int i = 0; i < iterations; i++) {
             Future<RpcResult<GlobalRpcBenchOutput>> output = service.globalRpcBench(inVal);
 
         for (int i = 0; i < iterations; i++) {
             Future<RpcResult<GlobalRpcBenchOutput>> output = service.globalRpcBench(inVal);
@@ -68,20 +70,20 @@ public class GlobalBindingRTCClient implements RTCClient {
                 if (rpcResult.isSuccessful()) {
                     List<Payload> retVal = rpcResult.getResult().getPayload();
                     if (retVal.size() == inSize) {
                 if (rpcResult.isSuccessful()) {
                     List<Payload> retVal = rpcResult.getResult().getPayload();
                     if (retVal.size() == inSize) {
-                        rpcOk++;
+                        ok++;
                     }
                     else {
                     }
                     else {
-                        rpcError++;
+                        error++;
                     }
                 }
             } catch (InterruptedException | ExecutionException e) {
                     }
                 }
             } catch (InterruptedException | ExecutionException e) {
-                rpcError++;
+                error++;
                 LOG.error("Execution failed: ", e);
             }
         }
 
                 LOG.error("Execution failed: ", e);
             }
         }
 
-        this.rpcOk.addAndGet(rpcOk);
-        this.rpcError.addAndGet(rpcError);
+        rpcOk.addAndGet(ok);
+        rpcError.addAndGet(error);
     }
 
     @Override
     }
 
     @Override
index 5565e037c0eb4fc3c2b0f2d4e1435d5f20ec85b1..d1b5edd726896976309f751e26c0a9687bc064fd 100644 (file)
@@ -5,12 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package rpcbenchmark.impl;
 
 public interface RTCClient {
     long getRpcOk();
 package rpcbenchmark.impl;
 
 public interface RTCClient {
     long getRpcOk();
+
     long getRpcError();
     long getRpcError();
+
     void runTest(int iterations);
     void runTest(int iterations);
+
     void close();
 }
     void close();
 }
index 1c44b98a3701d7d7620c309a5f7ec2af25fdb5cf..cc388a33cd676b5f5d268c3c1c5611666cb70dec 100644 (file)
@@ -14,7 +14,6 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicLong;
-
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInputBuilder;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInputBuilder;
@@ -28,22 +27,25 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class RoutedBindingRTClient implements RTCClient {
 import org.slf4j.LoggerFactory;
 
 public class RoutedBindingRTClient implements RTCClient {
-    private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCClient.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RoutedBindingRTClient.class);
     private final RpcbenchPayloadService service;
     private final AtomicLong rpcOk = new AtomicLong(0);
     private final AtomicLong rpcError = new AtomicLong(0);
     private final List<RoutedRpcBenchInput> inVal;
     private final int inSize;
 
     private final RpcbenchPayloadService service;
     private final AtomicLong rpcOk = new AtomicLong(0);
     private final AtomicLong rpcError = new AtomicLong(0);
     private final List<RoutedRpcBenchInput> inVal;
     private final int inSize;
 
+    @Override
     public long getRpcOk() {
         return rpcOk.get();
     }
 
     public long getRpcOk() {
         return rpcOk.get();
     }
 
+    @Override
     public long getRpcError() {
         return rpcError.get();
     }
 
     public long getRpcError() {
         return rpcError.get();
     }
 
-    public RoutedBindingRTClient(final RpcConsumerRegistry registry, final int inSize, final List<InstanceIdentifier<?>> routeIid) {
+    public RoutedBindingRTClient(final RpcConsumerRegistry registry, final int inSize,
+            final List<InstanceIdentifier<?>> routeIid) {
         if (registry != null) {
             this.service = registry.getRpcService(RpcbenchPayloadService.class);
         } else {
         if (registry != null) {
             this.service = registry.getRpcService(RpcbenchPayloadService.class);
         } else {
@@ -63,9 +65,10 @@ public class RoutedBindingRTClient implements RTCClient {
 
     }
 
 
     }
 
+    @Override
     public void runTest(final int iterations) {
     public void runTest(final int iterations) {
-        int rpcOk = 0;
-        int rpcError = 0;
+        int ok = 0;
+        int error = 0;
 
         int rpcServerCnt = inVal.size();
         for (int i = 0; i < iterations; i++) {
 
         int rpcServerCnt = inVal.size();
         for (int i = 0; i < iterations; i++) {
@@ -77,20 +80,20 @@ public class RoutedBindingRTClient implements RTCClient {
                 if (rpcResult.isSuccessful()) {
                     List<Payload> retVal = rpcResult.getResult().getPayload();
                     if (retVal.size() == inSize) {
                 if (rpcResult.isSuccessful()) {
                     List<Payload> retVal = rpcResult.getResult().getPayload();
                     if (retVal.size() == inSize) {
-                        rpcOk++;
+                        ok++;
                     }
                     else {
                     }
                     else {
-                        rpcError++;
+                        error++;
                     }
                 }
             } catch (InterruptedException | ExecutionException e) {
                     }
                 }
             } catch (InterruptedException | ExecutionException e) {
-                rpcError++;
+                error++;
                 LOG.error("Execution failed: ", e);
             }
         }
 
                 LOG.error("Execution failed: ", e);
             }
         }
 
-        this.rpcOk.addAndGet(rpcOk);
-        this.rpcError.addAndGet(rpcError);
+        rpcOk.addAndGet(ok);
+        rpcError.addAndGet(error);
     }
 
     @Override
     }
 
     @Override
@@ -98,5 +101,4 @@ public class RoutedBindingRTClient implements RTCClient {
         // TODO Auto-generated method stub
 
     }
         // TODO Auto-generated method stub
 
     }
-
 }
 }
index 8e8e31e97527ef09cb1749cb6b82cb0c64ec9df9..ddcf2547007a095b46a900e11ffe4977746dcd9d 100644 (file)
@@ -7,6 +7,8 @@
  */
 package rpcbenchmark.impl;
 
  */
 package rpcbenchmark.impl;
 
+import static com.google.common.base.Verify.verifyNotNull;
+
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
@@ -39,7 +41,7 @@ import org.slf4j.LoggerFactory;
 public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService {
 
     private static final Logger LOG = LoggerFactory.getLogger(RpcbenchmarkProvider.class);
 public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService {
 
     private static final Logger LOG = LoggerFactory.getLogger(RpcbenchmarkProvider.class);
-    private static final int testTimeout = 5;
+    private static final int TEST_TIMEOUT = 5;
 
     private final GlobalBindingRTCServer globalServer;
     private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
 
     private final GlobalBindingRTCServer globalServer;
     private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
@@ -67,32 +69,32 @@ public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService
         final List<RoutedRpcRegistration<?>> rpcRegs = new ArrayList<>();
 
         switch (input.getOperation()) {
         final List<RoutedRpcRegistration<?>> rpcRegs = new ArrayList<>();
 
         switch (input.getOperation()) {
-        case ROUTEDRTC:
-            List<InstanceIdentifier<?>> routeIid = new ArrayList<>();
-            for (int i = 0; i < input.getNumServers().intValue(); i++) {
-                GlobalBindingRTCServer server = new GlobalBindingRTCServer();
-                RoutedRpcRegistration<RpcbenchPayloadService> routedReg =
-                        providerRegistry.addRoutedRpcImplementation(RpcbenchPayloadService.class, server);
-
-                KeyedInstanceIdentifier<RpcRoute, RpcRouteKey> iid =
-                        InstanceIdentifier
+            case ROUTEDRTC:
+                List<InstanceIdentifier<?>> routeIid = new ArrayList<>();
+                for (int i = 0; i < input.getNumServers().intValue(); i++) {
+                    GlobalBindingRTCServer server = new GlobalBindingRTCServer();
+                    RoutedRpcRegistration<RpcbenchPayloadService> routedReg =
+                            providerRegistry.addRoutedRpcImplementation(RpcbenchPayloadService.class, server);
+
+                    KeyedInstanceIdentifier<RpcRoute, RpcRouteKey> iid =
+                            InstanceIdentifier
                             .create(RpcbenchRpcRoutes.class)
                             .child(RpcRoute.class, new RpcRouteKey(Integer.toString(i)));
                             .create(RpcbenchRpcRoutes.class)
                             .child(RpcRoute.class, new RpcRouteKey(Integer.toString(i)));
-                routeIid.add(iid);
-                routedReg.registerPath(NodeContext.class, iid);
-                rpcRegs.add(routedReg);
-            }
+                    routeIid.add(iid);
+                    routedReg.registerPath(NodeContext.class, iid);
+                    rpcRegs.add(routedReg);
+                }
 
 
-            client = new RoutedBindingRTClient(providerRegistry, input.getPayloadSize().intValue(), routeIid);
-            break;
+                client = new RoutedBindingRTClient(providerRegistry, input.getPayloadSize().intValue(), routeIid);
+                break;
 
 
-        case GLOBALRTC:
-            client = new GlobalBindingRTCClient(providerRegistry, input.getPayloadSize().intValue());
-            break;
+            case GLOBALRTC:
+                client = new GlobalBindingRTCClient(providerRegistry, input.getPayloadSize().intValue());
+                break;
 
 
-        default:
-            LOG.error("Unsupported server/client type {}", input.getOperation());
-            throw new IllegalArgumentException("Unsupported server/client type" + input.getOperation());
+            default:
+                LOG.error("Unsupported server/client type {}", input.getOperation());
+                throw new IllegalArgumentException("Unsupported server/client type" + input.getOperation());
         }
 
         try {
         }
 
         try {
@@ -101,17 +103,18 @@ public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService
             final Runnable testRun = () -> client.runTest(input.getIterations().intValue());
 
             LOG.info("Test Started");
             final Runnable testRun = () -> client.runTest(input.getIterations().intValue());
 
             LOG.info("Test Started");
-            long startTime = System.nanoTime();
+            final long startTime = System.nanoTime();
 
 
-            for (int i = 0; i < input.getNumClients().intValue(); i++ ) {
-                executor.submit(testRun);
+            for (int i = 0; i < input.getNumClients().intValue(); i++) {
+                // FIXME: fools RV_RETURN_VALUE_IGNORED_BAD_PRACTICE, but we should check more
+                verifyNotNull(executor.submit(testRun));
             }
 
             executor.shutdown();
             try {
             }
 
             executor.shutdown();
             try {
-                executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
+                executor.awaitTermination(TEST_TIMEOUT, TimeUnit.MINUTES);
             } catch (final InterruptedException e) {
             } catch (final InterruptedException e) {
-                LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout);
+                LOG.error("Out of time: test did not finish within the {} min deadline ", TEST_TIMEOUT);
             }
 
             long endTime = System.nanoTime();
             }
 
             long endTime = System.nanoTime();
@@ -124,7 +127,8 @@ public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService
                                             .setGlobalRtcClientError(client.getRpcError())
                                             .setGlobalRtcClientOk(client.getRpcOk())
                                             .setExecTime(TimeUnit.NANOSECONDS.toMillis(elapsedTime))
                                             .setGlobalRtcClientError(client.getRpcError())
                                             .setGlobalRtcClientOk(client.getRpcOk())
                                             .setExecTime(TimeUnit.NANOSECONDS.toMillis(elapsedTime))
-                                            .setRate((client.getRpcOk() + client.getRpcError()) * 1000000000 / elapsedTime)
+                                            .setRate(
+                                                (client.getRpcOk() + client.getRpcError()) * 1000000000 / elapsedTime)
                                             .build();
             return RpcResultBuilder.success(output).buildFuture();
         } finally {
                                             .build();
             return RpcResultBuilder.success(output).buildFuture();
         } finally {
index ad0934122dd565f200344760110b88ea4676d30c..b8cabad0be35297024b1478c22456956df680f6b 100644 (file)
@@ -91,7 +91,7 @@ public abstract class AbstractMdsalTestBase {
      * @return An array of additional config options
      */
     protected Option[] getAdditionalOptions() {
      * @return An array of additional config options
      */
     protected Option[] getAdditionalOptions() {
-        return null;
+        return new Option[0];
     }
 
     /**
     }
 
     /**
index c073619ad16e9f22ff019c4ccadb1f7397e81af7..bea912a3020788c68525534391a83de7ed0a688d 100644 (file)
@@ -18,10 +18,12 @@ import org.ops4j.pax.exam.options.DefaultCompositeOption;
 import org.ops4j.pax.exam.util.PathUtils;
 
 /**
 import org.ops4j.pax.exam.util.PathUtils;
 
 /**
+ * Helper utility for running IT tests.
+ *
  * @deprecated Use config-it and/or mdsal-it instead.
  */
 @Deprecated
  * @deprecated Use config-it and/or mdsal-it instead.
  */
 @Deprecated
-public class TestHelper {
+public final class TestHelper {
 
     public static final String CONTROLLER = "org.opendaylight.controller";
     public static final String MDSAL = "org.opendaylight.mdsal";
 
     public static final String CONTROLLER = "org.opendaylight.controller";
     public static final String MDSAL = "org.opendaylight.mdsal";
@@ -30,19 +32,23 @@ public class TestHelper {
     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
     public static final String MDSAL_MODELS = "org.opendaylight.mdsal.model";
 
     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
     public static final String MDSAL_MODELS = "org.opendaylight.mdsal.model";
 
+    private TestHelper() {
+
+    }
+
     public static Option mdSalCoreBundles() {
     public static Option mdSalCoreBundles() {
-        return new DefaultCompositeOption( //
-                mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "util").versionAsInProject(), // //
-                mavenBundle(MDSAL, "yang-binding").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(), // //
-                mavenBundle("tech.pantheon", "triemap").versionAsInProject(), // //
-                mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), // //
-                mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(), // //
-
-                mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), //
+        return new DefaultCompositeOption(
+                mavenBundle(YANGTOOLS, "concepts").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "util").versionAsInProject(),
+                mavenBundle(MDSAL, "yang-binding").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(),
+                mavenBundle("tech.pantheon", "triemap").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(),
+
+                mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
                 mavenBundle("com.google.guava", "guava").versionAsInProject(),
                 mavenBundle("com.github.romix", "java-concurrent-hash-trie-map").versionAsInProject()
         );
                 mavenBundle("com.google.guava", "guava").versionAsInProject(),
                 mavenBundle("com.github.romix", "java-concurrent-hash-trie-map").versionAsInProject()
         );
@@ -50,20 +56,20 @@ public class TestHelper {
 
     public static Option configMinumumBundles() {
         return new DefaultCompositeOption(
 
     public static Option configMinumumBundles() {
         return new DefaultCompositeOption(
-                mavenBundle(CONTROLLER, "config-api").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "config-api").versionAsInProject(),
                 bindingAwareSalBundles(),
                 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
 
                 systemPackages("sun.nio.ch", "sun.misc"),
 
                 bindingAwareSalBundles(),
                 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
 
                 systemPackages("sun.nio.ch", "sun.misc"),
 
-                mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), // //
-                mavenBundle(CONTROLLER, "config-util").versionAsInProject(), // //
-                mavenBundle("commons-io", "commons-io").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "config-manager-facade-xml").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
+                mavenBundle(CONTROLLER, "config-manager").versionAsInProject(),
+                mavenBundle(CONTROLLER, "config-util").versionAsInProject(),
+                mavenBundle("commons-io", "commons-io").versionAsInProject(),
+                mavenBundle(CONTROLLER, "config-manager-facade-xml").versionAsInProject(),
+                mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(),
+                mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(),
 
 
-                mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
+                mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(),
 
                 mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
                 mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
 
                 mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
                 mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
@@ -75,93 +81,90 @@ public class TestHelper {
     }
 
     public static Option bindingAwareSalBundles() {
     }
 
     public static Option bindingAwareSalBundles() {
-        return new DefaultCompositeOption( //
+        return new DefaultCompositeOption(
                 mdSalCoreBundles(),
 
                 mdSalCoreBundles(),
 
-                mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
-
-                mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(), // //
-                mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(), //
-                mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
-                mavenBundle(MDSAL, "mdsal-binding-generator-api").versionAsInProject(), //
-                mavenBundle(MDSAL, "mdsal-binding-generator-util").versionAsInProject(), //
+                mavenBundle("org.javassist", "javassist").versionAsInProject(),
+
+                mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(),
+                mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(),
+                mavenBundle(MDSAL, "mdsal-binding-generator-api").versionAsInProject(),
+                mavenBundle(MDSAL, "mdsal-binding-generator-util").versionAsInProject(),
                 mavenBundle(MDSAL, "mdsal-binding-generator-impl").versionAsInProject(),
                 mavenBundle(MDSAL, "mdsal-binding-dom-codec").versionAsInProject(),
                 mavenBundle(MDSAL, "mdsal-binding-generator-impl").versionAsInProject(),
                 mavenBundle(MDSAL, "mdsal-binding-dom-codec").versionAsInProject(),
-                mavenBundle("org.antlr", "antlr4-runtime").versionAsInProject(), // //
+                mavenBundle("org.antlr", "antlr4-runtime").versionAsInProject(),
 
 
-                mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(),
 
 
 
 
-                mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
-                mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(),
+                mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(),
 
 
-                mavenBundle("com.lmax", "disruptor").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
-                mavenBundle(CONTROLLER, "sal-dom-config").versionAsInProject(), // //
+                mavenBundle("com.lmax", "disruptor").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-dom-config").versionAsInProject(),
 
 
-                mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "sal-dom-broker-config").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-dom-broker-config").versionAsInProject(),
 
 
-                mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
+                mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(),
 
 
-                mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
-                mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
+                mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(),
+                mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(),
 
 
-                systemProperty("netconf.config.persister.active").value("1"), //
+                systemProperty("netconf.config.persister.active").value("1"),
                 systemProperty("netconf.config.persister.1.storageAdapterClass").value(
                 systemProperty("netconf.config.persister.1.storageAdapterClass").value(
-                        "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"), //
+                        "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"),
                 systemProperty("netconf.config.persister.1.properties.fileStorage")
                 systemProperty("netconf.config.persister.1.properties.fileStorage")
-                        .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"), //
-                systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1") //
+                        .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"),
+                systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1")
 
         );
 
         );
-
     }
 
     public static Option bindingIndependentSalBundles() {
         return new DefaultCompositeOption(
 
         );
     }
 
     public static Option bindingIndependentSalBundles() {
         return new DefaultCompositeOption(
 
         );
-
     }
 
     public static Option protocolFrameworkBundles() {
         return new DefaultCompositeOption(
     }
 
     public static Option protocolFrameworkBundles() {
         return new DefaultCompositeOption(
-            mavenBundle("io.netty", "netty-common").versionAsInProject(), //
-            mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
-            mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
-            mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
-            mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
-            mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(), //
+            mavenBundle("io.netty", "netty-common").versionAsInProject(),
+            mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
+            mavenBundle("io.netty", "netty-handler").versionAsInProject(),
+            mavenBundle("io.netty", "netty-codec").versionAsInProject(),
+            mavenBundle("io.netty", "netty-transport").versionAsInProject(),
+            mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(),
             mavenBundle(CONTROLLER, "protocol-framework").versionAsInProject()
         );
             mavenBundle(CONTROLLER, "protocol-framework").versionAsInProject()
         );
-
     }
 
     public static Option flowCapableModelBundles() {
     }
 
     public static Option flowCapableModelBundles() {
-        return new DefaultCompositeOption( //
-                mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
+        return new DefaultCompositeOption(
+                mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject()
         );
         );
-
     }
 
     /**
     }
 
     /**
+     * Return an option containing models for testing purposes.
+     *
      * @return option containing models for testing purposes
      */
     public static Option salTestModelBundles() {
      * @return option containing models for testing purposes
      */
     public static Option salTestModelBundles() {
-        return new DefaultCompositeOption( //
+        return new DefaultCompositeOption(
                 mavenBundle(CONTROLLER, "sal-test-model").versionAsInProject()
         );
                 mavenBundle(CONTROLLER, "sal-test-model").versionAsInProject()
         );
-
     }
 
     public static Option baseModelBundles() {
     }
 
     public static Option baseModelBundles() {
-        return new DefaultCompositeOption( //
+        return new DefaultCompositeOption(
                 mavenBundle(MDSAL + ".model", "yang-ext").versionAsInProject(),
                 mavenBundle(MDSAL_MODELS, "ietf-type-util").versionAsInProject(),
                 mavenBundle(MDSAL_MODELS, "ietf-inet-types").versionAsInProject(),
                 mavenBundle(MDSAL + ".model", "yang-ext").versionAsInProject(),
                 mavenBundle(MDSAL_MODELS, "ietf-type-util").versionAsInProject(),
                 mavenBundle(MDSAL_MODELS, "ietf-inet-types").versionAsInProject(),
index e10eb0c3a668e52d0651aa20fd1c24f9de64654c..53d88aee681162add8fe05b3de66d415d122b65a 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.ops4j.pax.exam.util.Filter;
 
 /**
 import org.ops4j.pax.exam.util.Filter;
 
 /**
- * covers creating, reading and deleting of an item in dataStore
+ * Covers creating, reading and deleting of an item in dataStore.
  */
 public class DataServiceIT extends AbstractIT {
     @Inject
  */
 public class DataServiceIT extends AbstractIT {
     @Inject
@@ -36,12 +36,8 @@ public class DataServiceIT extends AbstractIT {
     DataBroker dataBroker;
 
     /**
     DataBroker dataBroker;
 
     /**
-     *
-     * Ignored this, because classes here are constructed from
-     * very different class loader as MD-SAL is run into,
+     * Ignored this, because classes here are constructed from very different class loader as MD-SAL is run into,
      * this is code is run from different classloader.
      * this is code is run from different classloader.
-     *
-     * @throws Exception
      */
     @Test
     public void test() throws Exception {
      */
     @Test
     public void test() throws Exception {
@@ -74,7 +70,6 @@ public class DataServiceIT extends AbstractIT {
         assertFalse(readedData2.isPresent());
     }
 
         assertFalse(readedData2.isPresent());
     }
 
-
     private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
         UnorderedListKey key = new UnorderedListKey(string);
         return InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key)
     private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
         UnorderedListKey key = new UnorderedListKey(string);
         return InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key)
index 468fc1b1fc834c60f3e924bc0dca5142853f33d5..9654ebf27a881dbe81c79b29e6358a0887101d31 100644 (file)
@@ -36,8 +36,7 @@ public class NotificationIT extends AbstractIT {
     NotificationProviderService notificationService;
 
     /**
     NotificationProviderService notificationService;
 
     /**
-     * test of delivering of notification
-     * @throws Exception
+     * Test of delivering of notification.
      */
     @Test
     public void notificationTest() throws Exception {
      */
     @Test
     public void notificationTest() throws Exception {
@@ -53,7 +52,6 @@ public class NotificationIT extends AbstractIT {
 
         /**
          * Check that one notification was delivered and has correct cookie.
 
         /**
          * Check that one notification was delivered and has correct cookie.
-         *
          */
         assertEquals(1, listener1.notificationBag.size());
         assertEquals("rainy day", listener1.notificationBag.get(0).getReason());
          */
         assertEquals(1, listener1.notificationBag.size());
         assertEquals("rainy day", listener1.notificationBag.get(0).getReason());
@@ -80,7 +78,6 @@ public class NotificationIT extends AbstractIT {
         /**
          * Check that 3 notification was delivered to both listeners (first one
          * received 4 in total, second 3 in total).
         /**
          * Check that 3 notification was delivered to both listeners (first one
          * received 4 in total, second 3 in total).
-         *
          */
         assertEquals(4, listener1.notificationBag.size());
         assertEquals(3, listener2.notificationBag.size());
          */
         assertEquals(4, listener1.notificationBag.size());
         assertEquals(3, listener2.notificationBag.size());
@@ -108,18 +105,14 @@ public class NotificationIT extends AbstractIT {
          */
         assertEquals(5, listener1.notificationBag.size());
         assertEquals(3, listener2.notificationBag.size());
          */
         assertEquals(5, listener1.notificationBag.size());
         assertEquals(3, listener2.notificationBag.size());
-
     }
 
     /**
     }
 
     /**
-     * Creates instance of the type OutOfPixieDustNotification. It is
-     * used only for testing purpose.
+     * Creates instance of the type OutOfPixieDustNotification. It is used only for testing purpose.
      *
      *
-     * @param reason
-     * @param days
      * @return instance of the type OutOfPixieDustNotification
      */
      * @return instance of the type OutOfPixieDustNotification
      */
-    public static OutOfPixieDustNotification noDustNotification(String reason, int days) {
+    public static OutOfPixieDustNotification noDustNotification(final String reason, final int days) {
         OutOfPixieDustNotificationBuilder ret = new OutOfPixieDustNotificationBuilder();
         ret.setReason(reason).setDaysTillNewDust(days);
         return ret.build();
         OutOfPixieDustNotificationBuilder ret = new OutOfPixieDustNotificationBuilder();
         ret.setReason(reason).setDaysTillNewDust(days);
         return ret.build();
@@ -131,13 +124,11 @@ public class NotificationIT extends AbstractIT {
      * the type {@link OutOfFairyDustNotification}.
      */
     public static class NotificationTestListener implements OpendaylightTestNotificationListener {
      * the type {@link OutOfFairyDustNotification}.
      */
     public static class NotificationTestListener implements OpendaylightTestNotificationListener {
-
         List<OutOfPixieDustNotification> notificationBag = new ArrayList<>();
 
         @Override
         List<OutOfPixieDustNotification> notificationBag = new ArrayList<>();
 
         @Override
-        public void onOutOfPixieDustNotification(OutOfPixieDustNotification arg0) {
+        public void onOutOfPixieDustNotification(final OutOfPixieDustNotification arg0) {
             notificationBag.add(arg0);
         }
             notificationBag.add(arg0);
         }
-
     }
 }
     }
 }
index 7bd28020eaea6190e8a9963bb7bafb08829f20bc..91e53d0cc8c443af02d86bb486ae72d88a452c45 100644 (file)
@@ -37,7 +37,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
 import org.slf4j.LoggerFactory;
 
 /**
- * covers routed rpc creation, registration, invocation, unregistration
+ * Covers routed rpc creation, registration, invocation, unregistration.
  */
 public class RoutedServiceIT extends AbstractIT {
 
  */
 public class RoutedServiceIT extends AbstractIT {
 
@@ -52,7 +52,7 @@ public class RoutedServiceIT extends AbstractIT {
     RpcProviderRegistry rpcProviderRegistry;
 
     /**
     RpcProviderRegistry rpcProviderRegistry;
 
     /**
-     * prepare mocks
+     * Prepare mocks.
      */
     @Before
     public void setUp() {
      */
     @Before
     public void setUp() {
@@ -93,15 +93,13 @@ public class RoutedServiceIT extends AbstractIT {
         firstReg.registerPath(TestContext.class, nodeOnePath);
 
         /**
         firstReg.registerPath(TestContext.class, nodeOnePath);
 
         /**
-         * Consumer creates addFlow message for node one and sends it to the
-         * MD-SAL
+         * Consumer creates addFlow message for node one and sends it to the MD-SAL.
          */
         final RoutedSimpleRouteInput simpleRouteFirstFoo = createSimpleRouteInput(nodeOnePath);
         consumerService.routedSimpleRoute(simpleRouteFirstFoo);
 
         /**
          */
         final RoutedSimpleRouteInput simpleRouteFirstFoo = createSimpleRouteInput(nodeOnePath);
         consumerService.routedSimpleRoute(simpleRouteFirstFoo);
 
         /**
-         * Verifies that implementation of the first provider received the same
-         * message from MD-SAL.
+         * Verifies that implementation of the first provider received the same message from MD-SAL.
          */
         verify(odlRoutedService1).routedSimpleRoute(simpleRouteFirstFoo);
         /**
          */
         verify(odlRoutedService1).routedSimpleRoute(simpleRouteFirstFoo);
         /**
@@ -114,8 +112,7 @@ public class RoutedServiceIT extends AbstractIT {
         secondReg.registerPath(TestContext.class, nodeTwo);
 
         /**
         secondReg.registerPath(TestContext.class, nodeTwo);
 
         /**
-         * Consumer sends message to nodeTwo for three times. Should be
-         * processed by second instance.
+         * Consumer sends message to nodeTwo for three times. Should be processed by second instance.
          */
         final RoutedSimpleRouteInput simpleRouteSecondFoo = createSimpleRouteInput(nodeTwo);
         consumerService.routedSimpleRoute(simpleRouteSecondFoo);
          */
         final RoutedSimpleRouteInput simpleRouteSecondFoo = createSimpleRouteInput(nodeTwo);
         consumerService.routedSimpleRoute(simpleRouteSecondFoo);
@@ -123,9 +120,7 @@ public class RoutedServiceIT extends AbstractIT {
         consumerService.routedSimpleRoute(simpleRouteSecondFoo);
 
         /**
         consumerService.routedSimpleRoute(simpleRouteSecondFoo);
 
         /**
-         * Verifies that second instance was invoked 3 times with second message
-         * and first instance wasn't invoked.
-         *
+         * Verifies that second instance was invoked 3 times with second message and first instance wasn't invoked.
          */
         verify(odlRoutedService2, times(3)).routedSimpleRoute(simpleRouteSecondFoo);
         verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteSecondFoo);
          */
         verify(odlRoutedService2, times(3)).routedSimpleRoute(simpleRouteSecondFoo);
         verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteSecondFoo);
@@ -137,43 +132,36 @@ public class RoutedServiceIT extends AbstractIT {
         secondReg.registerPath(TestContext.class, nodeOnePath);
 
         /**
         secondReg.registerPath(TestContext.class, nodeOnePath);
 
         /**
-         * A consumer sends third message to node 1
+         * A consumer sends third message to node 1.
          */
         final RoutedSimpleRouteInput simpleRouteThirdFoo = createSimpleRouteInput(nodeOnePath);
         consumerService.routedSimpleRoute(simpleRouteThirdFoo);
 
         /**
          */
         final RoutedSimpleRouteInput simpleRouteThirdFoo = createSimpleRouteInput(nodeOnePath);
         consumerService.routedSimpleRoute(simpleRouteThirdFoo);
 
         /**
-         * Verifies that provider 1 wasn't invoked and provider 2 was invoked 1
-         * time.
+         * Verifies that provider 1 wasn't invoked and provider 2 was invoked 1 time.
          * TODO: fix unregister path
          */
         //verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteThirdFoo);
         verify(odlRoutedService2).routedSimpleRoute(simpleRouteThirdFoo);
          * TODO: fix unregister path
          */
         //verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteThirdFoo);
         verify(odlRoutedService2).routedSimpleRoute(simpleRouteThirdFoo);
-
     }
 
     /**
     }
 
     /**
-     * Returns node reference from string which represents path
+     * Returns node reference from string which represents path.
      *
      *
-     * @param string
-     *            string with key(path)
+     * @param string string with key(path)
      * @return instance identifier to {@link UnorderedList}
      */
     private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
      * @return instance identifier to {@link UnorderedList}
      */
     private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
-        final UnorderedListKey key = new UnorderedListKey(string);
-        final InstanceIdentifier<UnorderedList> path = InstanceIdentifier.builder(Lists.class)
+        return InstanceIdentifier.builder(Lists.class)
                 .child(UnorderedContainer.class)
                 .child(UnorderedContainer.class)
-                .child(UnorderedList.class, key)
+                .child(UnorderedList.class, new UnorderedListKey(string))
                 .build();
                 .build();
-
-        return path;
     }
 
     /**
     }
 
     /**
-     * Creates flow AddFlowInput for which only node and cookie are set
+     * Creates flow AddFlowInput for which only node and cookie are set.
      *
      *
-     * @param node
-     *            NodeRef value
+     * @param node NodeRef value
      * @return simpleRouteInput instance
      */
     static RoutedSimpleRouteInput createSimpleRouteInput(final InstanceIdentifier<UnorderedList> node) {
      * @return simpleRouteInput instance
      */
     static RoutedSimpleRouteInput createSimpleRouteInput(final InstanceIdentifier<UnorderedList> node) {
index 63d18421b80c3b3237ea1e87e2013245af346e84..15beb2deabd5c9c4ac028f31ff078840548cd9af 100644 (file)
@@ -29,7 +29,7 @@ import org.ops4j.pax.exam.util.Filter;
 @RunWith(PaxExam.class)
 public class ToasterTest extends AbstractMdsalTestBase {
     @Inject
 @RunWith(PaxExam.class)
 public class ToasterTest extends AbstractMdsalTestBase {
     @Inject
-    @Filter(timeout = 60*1000)
+    @Filter(timeout = 60 * 1000)
     KitchenService kitchenService;
 
     @Override
     KitchenService kitchenService;
 
     @Override
@@ -56,7 +56,7 @@ public class ToasterTest extends AbstractMdsalTestBase {
 
         // Make toasts using OSGi service
         success &= kitchenService.makeBreakfast(EggsType.SCRAMBLED, HashBrown.class, 4).get().isSuccessful();
 
         // Make toasts using OSGi service
         success &= kitchenService.makeBreakfast(EggsType.SCRAMBLED, HashBrown.class, 4).get().isSuccessful();
-        success &= kitchenService.makeBreakfast(EggsType.POACHED, WhiteBread.class, 8 ).get().isSuccessful();
+        success &= kitchenService.makeBreakfast(EggsType.POACHED, WhiteBread.class, 8).get().isSuccessful();
 
         assertTrue("Not all breakfasts succeeded", success);
 
 
         assertTrue("Not all breakfasts succeeded", success);