sal-binding-dom-it: use lambdas 79/57179/6
authorStephen Kitt <skitt@redhat.com>
Tue, 16 May 2017 15:50:51 +0000 (17:50 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 15 Sep 2017 20:43:18 +0000 (20:43 +0000)
This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.

Change-Id: Id3c04094ba78356b59e3faaf3ae7bb9008146f5a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java

index d14bd72..a6b5cba 100644 (file)
@@ -12,16 +12,13 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.concurrent.Future;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
@@ -44,7 +41,6 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public class CrossBrokerRpcTest {
@@ -119,13 +115,9 @@ public class CrossBrokerRpcTest {
         builder.setAnswer("open");
         final KnockKnockOutput output = builder.build();
 
-        provisionRegistry.registerRpcImplementation(new DOMRpcImplementation() {
-
-            @Override
-            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));
-            }
+        provisionRegistry.registerRpcImplementation((rpc, input) -> {
+            ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
+            return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
         }, DOMRpcIdentifier.create(KNOCK_KNOCK_PATH, BI_NODE_C_ID));
 
         OpendaylightOfMigrationTestModelService baKnockInvoker =

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.