Bug 8829: Ignore error when initializing dsbenchmark 41/60141/2
authorVratko Polak <vrpolak@cisco.com>
Mon, 27 Feb 2017 14:49:52 +0000 (15:49 +0100)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 21 Sep 2017 10:29:44 +0000 (10:29 +0000)
+ More capabilities listed in the config file,
  the list is probably still not complete.
+ Also fix ParenPad violations.

Change-Id: I6f4902bb8236fc1560e1e38554465aefadb775ee
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
benchmark/dsbenchmark/src/main/config/default-config.xml
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java

index 7fc1b6bc616cd5437ba9b3816e323209cb67c515..65ac54429ddb2f5a375e751d557355598d6bb98d 100644 (file)
@@ -10,6 +10,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 <snapshot>
   <required-capabilities>
     <capability>urn:opendaylight:params:xml:ns:yang:dsbenchmark:impl?module=dsbenchmark-impl&amp;revision=2014-12-10</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider?module=distributed-datastore-provider&amp;revision=2014-06-12</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store?module=opendaylight-config-dom-datastore&amp;revision=2014-06-17</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&amp;revision=2014-06-17</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom?module=opendaylight-md-sal-dom&amp;revision=2013-10-28</capability>
     <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
   </required-capabilities>
   <configuration>
index e762d6d9adf094b2b9d84b4b985408d81f40cdce..a8838331a58ba44350b0ff2ace17dfe6222ffd45 100644 (file)
@@ -79,9 +79,14 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
     @Override
     public void onSessionInitiated(ProviderContext session) {
         this.dataBroker = session.getSALService(DataBroker.class);
-        this.dstReg = session.addRpcImplementation( DsbenchmarkService.class, this );
+        this.dstReg = session.addRpcImplementation(DsbenchmarkService.class, this);
         listenerProvider.setDataBroker(dataBroker);
-        setTestOperData(this.execStatus.get(), testsCompleted);
+
+        try {
+            setTestOperData(this.execStatus.get(), testsCompleted);
+        } catch (Exception e) {
+            LOG.warn("Working around Bugs 8829 and 6793 by ignoring exception from setTestOperData: {}", e);
+        }
 
         LOG.debug("DsbenchmarkProvider Session Initiated");
     }
@@ -96,7 +101,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
     public Future<RpcResult<Void>> cleanupStore() {
         cleanupTestStore();
         LOG.debug("Data Store cleaned up");
-        return Futures.immediateFuture( RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
     }
 
     @Override
@@ -104,7 +109,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
         LOG.info("Starting the data store benchmark test, input: {}", input);
 
         // Check if there is a test in progress
-        if ( execStatus.compareAndSet(ExecStatus.Idle, ExecStatus.Executing) == false ) {
+        if (execStatus.compareAndSet(ExecStatus.Idle, ExecStatus.Executing) == false) {
             LOG.info("Test in progress");
             return RpcResultBuilder.success(new StartTestOutputBuilder()
                     .setStatus(StartTestOutput.Status.TESTINPROGRESS)
@@ -136,16 +141,16 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
 
             this.testsCompleted++;
 
-        } catch (Exception e) {
-            LOG.error( "Test error: {}", e.toString());
-            execStatus.set( ExecStatus.Idle );
+        } catch (final Exception e) {
+            LOG.error("Test error: {}", e.toString());
+            execStatus.set(ExecStatus.Idle);
             return RpcResultBuilder.success(new StartTestOutputBuilder()
                     .setStatus(StartTestOutput.Status.FAILED)
                     .build()).buildFuture();
         }
 
         LOG.info("Test finished");
-        setTestOperData( ExecStatus.Idle, testsCompleted);
+        setTestOperData(ExecStatus.Idle, testsCompleted);
         execStatus.set(ExecStatus.Idle);
 
         // Get the number of data change events and cleanup the data change listeners
@@ -165,7 +170,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
         return RpcResultBuilder.success(output).buildFuture();
     }
 
-    private void setTestOperData( ExecStatus sts, long tstCompl ) {
+    private void setTestOperData(final ExecStatus sts, final long tstCompl) {
         TestStatus status = new TestStatusBuilder()
                 .setExecStatus(sts)
                 .setTestsCompleted(tstCompl)