BUG-7446: remove use of deprecated Guava methods 75/50175/2
authorRobert Varga <rovarga@cisco.com>
Tue, 10 Jan 2017 12:22:55 +0000 (13:22 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 17 Jan 2017 08:07:46 +0000 (08:07 +0000)
These methods have been deprecated in 18.0 and removed
in 21.0 (or sooner). Remove their use as a preparatory
patch for migration.

Change-Id: Id905760eb7bf817e475aeb1860f9dba39ce1a77d
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/NotifyTask.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AbstractDataServiceTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java

index 59be9af..8bb27f9 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
@@ -90,7 +90,7 @@ class NotifyTask implements Runnable {
 
     @Override
     public String toString() {
-        return Objects.toStringHelper(this)
+        return MoreObjects.toStringHelper(this)
                 .add("listener", registration)
                 .add("notification", notification.getClass())
                 .toString();
index ab6d144..23600a3 100644 (file)
@@ -60,13 +60,13 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMStore createConfigurationDatastore() {
-        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", MoreExecutors.sameThreadExecutor());
+        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService());
         schemaService.registerSchemaContextListener(store);
         return store;
     }
 
     public DOMStore createOperationalDatastore() {
-        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.sameThreadExecutor());
+        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
         schemaService.registerSchemaContextListener(store);
         return store;
     }
@@ -85,7 +85,7 @@ public class DataBrokerTestCustomizer {
 
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
-        return MoreExecutors.sameThreadExecutor();
+        return MoreExecutors.newDirectExecutorService();
     }
 
     public DataBroker createDataBroker() {
index 7acdafe..d79bff1 100644 (file)
@@ -22,7 +22,7 @@ public abstract class AbstractDataServiceTest {
 
     @Before
     public void setUp() {
-        ListeningExecutorService executor = MoreExecutors.sameThreadExecutor();
+        ListeningExecutorService executor = MoreExecutors.newDirectExecutorService();
         BindingBrokerTestFactory factory = new BindingBrokerTestFactory();
         factory.setExecutor(executor);
         factory.setStartWithParsedSchema(getStartWithSchema());
index 526f400..4f577ee 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.sal.binding.test.util;
 
 import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableMap;
@@ -15,6 +16,7 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.MutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
@@ -59,7 +61,6 @@ import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import javassist.ClassPool;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
@@ -132,8 +133,10 @@ public class BindingTestContext implements AutoCloseable {
 
     public void startNewDomDataBroker() {
         checkState(executor != null, "Executor needs to be set");
-        final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.sameThreadExecutor());
-        final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.sameThreadExecutor());
+        final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER",
+            MoreExecutors.newDirectExecutorService());
+        final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
+            MoreExecutors.newDirectExecutorService());
         newDatastores = ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
                 .put(LogicalDatastoreType.OPERATIONAL, operStore)
                 .put(LogicalDatastoreType.CONFIGURATION, configStore)
index 23e6053..6eeb6a6 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.binding.test.connect.dom;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -106,7 +107,7 @@ public class CrossBrokerMountPointTest {
     @Before
     public void setup() {
         final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
-        testFactory.setExecutor(MoreExecutors.sameThreadExecutor());
+        testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
         testFactory.setStartWithParsedSchema(true);
         testContext = testFactory.getTestContext();
 
index 63b0484..d14bd72 100644 (file)
@@ -74,7 +74,7 @@ public class CrossBrokerRpcTest {
     @Before
     public void setup() {
         BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
-        testFactory.setExecutor(MoreExecutors.sameThreadExecutor());
+        testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
         testFactory.setStartWithParsedSchema(true);
         testContext = testFactory.getTestContext();
 
@@ -122,7 +122,7 @@ public class CrossBrokerRpcTest {
         provisionRegistry.registerRpcImplementation(new DOMRpcImplementation() {
 
             @Override
-            public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(DOMRpcIdentifier rpc, NormalizedNode<?, ?> input) {
+            public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
                 ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
                 return Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(new DefaultDOMRpcResult(result));
             }
@@ -135,7 +135,7 @@ public class CrossBrokerRpcTest {
         assertEquals(output, baResult.get().getResult());
     }
 
-    private ContainerNode toDomRpcInput(DataObject addFlowA) {
+    private ContainerNode toDomRpcInput(final DataObject addFlowA) {
         return testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(addFlowA);
     }
 
@@ -144,26 +144,26 @@ public class CrossBrokerRpcTest {
         testContext.close();
     }
 
-    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(TopLevelListKey listKey) {
+    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(final TopLevelListKey listKey) {
         return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder().node(Top.QNAME)
                 .node(TopLevelList.QNAME)
                 .nodeWithKey(TopLevelList.QNAME, NODE_ID_QNAME, listKey.getName()).build();
     }
 
-    private Future<RpcResult<KnockKnockOutput>> knockResult(boolean success, String answer) {
+    private Future<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
         KnockKnockOutput output = new KnockKnockOutputBuilder() //
                 .setAnswer(answer).build();
         RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
         return Futures.immediateFuture(result);
     }
 
-    private static KnockKnockInputBuilder knockKnock(InstanceIdentifier<TopLevelList> listId) {
+    private static KnockKnockInputBuilder knockKnock(final InstanceIdentifier<TopLevelList> listId) {
         KnockKnockInputBuilder builder = new KnockKnockInputBuilder();
         builder.setKnockerId(listId);
         return builder;
     }
 
-    private ContainerNode toDomRpc(QName rpcName, KnockKnockInput knockInput) {
+    private ContainerNode toDomRpc(final QName rpcName, final KnockKnockInput knockInput) {
         return toDomRpcInput(knockInput);
     }
 }