本文整理汇总了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);
}
示例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();
}
示例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);
}
};
}
示例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);
}
};
}