当前位置: 首页>>代码示例>>Java>>正文


Java JavaTestKit.getRef方法代码示例

本文整理汇总了Java中akka.testkit.JavaTestKit.getRef方法的典型用法代码示例。如果您正苦于以下问题:Java JavaTestKit.getRef方法的具体用法?Java JavaTestKit.getRef怎么用?Java JavaTestKit.getRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在akka.testkit.JavaTestKit的用法示例。


在下文中一共展示了JavaTestKit.getRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    system = ActorSystem.create("test");

    final DOMRpcIdentifier emptyRpcIdentifier = DOMRpcIdentifier.create(
            EMPTY_SCHEMA_PATH, YangInstanceIdentifier.EMPTY);
    final DOMRpcIdentifier localRpcIdentifier = DOMRpcIdentifier.create(
            LOCAL_SCHEMA_PATH, YangInstanceIdentifier.of(LOCAL_QNAME));

    buckets = Lists.newArrayList(emptyRpcIdentifier, localRpcIdentifier);

    final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
    final JavaTestKit invoker = new JavaTestKit(system);
    final JavaTestKit registrar = new JavaTestKit(system);
    final JavaTestKit supervisor = new JavaTestKit(system);
    final Props props = RpcRegistry.props(config, invoker.getRef(), registrar.getRef());
    testActor = new TestActorRef<>(system, props, supervisor.getRef(), "testActor");
    final RpcRegistry rpcRegistry = testActor.underlyingActor();

    mxBean = new RemoteRpcRegistryMXBeanImpl(rpcRegistry);
    Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:RemoteRpcRegistryMXBeanImplTest.java

示例2: setUp

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.create("test");

    final JavaTestKit testKit = new JavaTestKit(system);
    final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
    final Props props = RpcRegistrar.props(config, service);
    testActorRef = new TestActorRef<>(system, props, testKit.getRef(), "actorRef");
    endpointAddress = new Address("http", "local");

    final DOMRpcIdentifier firstEndpointId = DOMRpcIdentifier.create(
            SchemaPath.create(true, QName.create("first:identifier", "foo")));
    final DOMRpcIdentifier secondEndpointId = DOMRpcIdentifier.create(
            SchemaPath.create(true, QName.create("second:identifier", "bar")));

    final JavaTestKit senderKit = new JavaTestKit(system);
    firstEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(firstEndpointId));
    secondEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(secondEndpointId));

    Mockito.doReturn(oldReg).when(service).registerRpcImplementation(
            Mockito.any(RemoteRpcImplementation.class), Mockito.eq(firstEndpoint.getRpcs()));

    Mockito.doReturn(newReg).when(service).registerRpcImplementation(
            Mockito.any(RemoteRpcImplementation.class), Mockito.eq(secondEndpoint.getRpcs()));

    rpcRegistrar = testActorRef.underlyingActor();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:29,代码来源:RpcRegistrarTest.java

示例3: testRouteAdd

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testRouteAdd() throws URISyntaxException, InterruptedException {
    new JavaTestKit(system) {
        {
            // Test announcements
            final JavaTestKit probeReg = new JavaTestKit(system);
            final ActorRef rpcRegistry = probeReg.getRef();

            final RpcListener rpcListener = new RpcListener(rpcRegistry);
            rpcListener.onRpcAvailable(Collections.singleton(RPC_ID));
            probeReg.expectMsgClass(RpcRegistry.Messages.AddOrUpdateRoutes.class);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:RpcListenerTest.java

示例4: testRouteRemove

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testRouteRemove() throws URISyntaxException, InterruptedException {
    new JavaTestKit(system) {
        {
            // Test announcements
            final JavaTestKit probeReg = new JavaTestKit(system);
            final ActorRef rpcRegistry = probeReg.getRef();

            final RpcListener rpcListener = new RpcListener(rpcRegistry);
            rpcListener.onRpcUnavailable(Collections.singleton(RPC_ID));
            probeReg.expectMsgClass(RpcRegistry.Messages.RemoveRoutes.class);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:RpcListenerTest.java


注:本文中的akka.testkit.JavaTestKit.getRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。