X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2FOpsListenerTest.java;fp=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2FRpcListenerTest.java;h=d5cfcc009f969dd98b4f8e979619e07aabba62e3;hb=927bce5688e4b9d33d3e5e9b769d8a0dba5ccdd4;hp=7ae8a0a57fdf9fc963522beb03d34a6ad482cd6a;hpb=a2b838f96589b502578fa4e15cef2769f886a378;p=controller.git diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/OpsListenerTest.java similarity index 60% rename from opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java rename to opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/OpsListenerTest.java index 7ae8a0a57f..d5cfcc009f 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/OpsListenerTest.java @@ -5,7 +5,6 @@ * 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 org.opendaylight.controller.remote.rpc; import akka.actor.ActorRef; @@ -16,19 +15,24 @@ import java.util.Collections; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.opendaylight.controller.remote.rpc.registry.ActionRegistry; import org.opendaylight.controller.remote.rpc.registry.RpcRegistry; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMActionInstance; import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaPath; -public class RpcListenerTest { +public class OpsListenerTest { private static final QName TEST_QNAME = QName.create("test", "2015-06-12", "test"); private static final SchemaPath RPC_TYPE = SchemaPath.create(true, TEST_QNAME); private static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier .create(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)); private static final DOMRpcIdentifier RPC_ID = DOMRpcIdentifier.create(RPC_TYPE, TEST_PATH); + private static final DOMActionInstance ACTION_INSTANCE = DOMActionInstance.of(RPC_TYPE, + LogicalDatastoreType.OPERATIONAL, TEST_PATH); private static ActorSystem SYSTEM; @@ -49,19 +53,40 @@ public class RpcListenerTest { final TestKit probeReg = new TestKit(SYSTEM); final ActorRef rpcRegistry = probeReg.getRef(); - final RpcListener rpcListener = new RpcListener(rpcRegistry); - rpcListener.onRpcAvailable(Collections.singleton(RPC_ID)); + final OpsListener opsListener = new OpsListener(rpcRegistry, rpcRegistry); + opsListener.onRpcAvailable(Collections.singleton(RPC_ID)); probeReg.expectMsgClass(RpcRegistry.Messages.AddOrUpdateRoutes.class); } + @Test + public void testActionRouteAdd() { + // Test announcements + final TestKit probeReg = new TestKit(SYSTEM); + final ActorRef actionRegistry = probeReg.getRef(); + + final OpsListener opsListener = new OpsListener(actionRegistry, actionRegistry); + opsListener.onActionsChanged(Collections.emptySet(),Collections.singleton(ACTION_INSTANCE)); + probeReg.expectMsgClass(ActionRegistry.Messages.UpdateActions.class); + } + @Test public void testRouteRemove() { // Test announcements final TestKit probeReg = new TestKit(SYSTEM); final ActorRef rpcRegistry = probeReg.getRef(); - final RpcListener rpcListener = new RpcListener(rpcRegistry); - rpcListener.onRpcUnavailable(Collections.singleton(RPC_ID)); + final OpsListener opsListener = new OpsListener(rpcRegistry, rpcRegistry); + opsListener.onRpcUnavailable(Collections.singleton(RPC_ID)); probeReg.expectMsgClass(RpcRegistry.Messages.RemoveRoutes.class); } + +// @Test +// public void testAcceptsImplementation() { +// +// final TestKit probeReg = new TestKit(SYSTEM); +// final ActorRef opsRegistry = probeReg.getRef(); +// +// final OpsListener opsListener = new OpsListener(opsRegistry, opsRegistry); +// opsListener.acceptsImplementation() +// } }