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


Java TestProbe.ref方法代码示例

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


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

示例1: createLocalProxy

import akka.testkit.TestProbe; //导入方法依赖的package包/类
protected TransactionTester<LocalReadWriteProxyTransaction> createLocalProxy() {
    final TestProbe backendProbe = new TestProbe(system, "backend2");
    final TestProbe clientContextProbe = new TestProbe(system, "clientContext2");
    final ClientActorContext context =
            AccessClientUtil.createClientActorContext(system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    final ShardBackendInfo backend = new ShardBackendInfo(backendProbe.ref(), 0L, ABIVersion.BORON,
            "default", UnsignedLong.ZERO, Optional.empty(), 3);
    final AbstractClientConnection<ShardBackendInfo> connection =
            AccessClientUtil.createConnectedConnection(context, 0L, backend);
    final AbstractClientHistory history = mock(AbstractClientHistory.class);
    final ProxyHistory parent = ProxyHistory.createClient(history, connection, HISTORY_ID);
    final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class);
    when(snapshot.newModification()).thenReturn(mock(CursorAwareDataTreeModification.class));
    final LocalReadWriteProxyTransaction tx =
            new LocalReadWriteProxyTransaction(parent, TestUtils.TRANSACTION_ID, snapshot);
    return new TransactionTester<>(tx, connection, backendProbe);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:AbstractProxyTransactionTest.java

示例2: testHandleForwardedRemoteReadRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testHandleForwardedRemoteReadRequest() throws Exception {
    final TestProbe probe = createProbe();
    final ReadTransactionRequest request =
            new ReadTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
    final Consumer<Response<?, ?>> callback = createCallbackMock();
    setupExecuteInActor();

    transaction.handleReplayedRemoteRequest(request, callback, Ticker.systemTicker().read());
    final ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
    verify(callback).accept(captor.capture());
    final Response<?, ?> value = captor.getValue();
    Assert.assertTrue(value instanceof ReadTransactionSuccess);
    final ReadTransactionSuccess success = (ReadTransactionSuccess) value;
    Assert.assertTrue(success.getData().isPresent());
    Assert.assertEquals(DATA_1, success.getData().get());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:LocalProxyTransactionTest.java

示例3: testHandleForwardedRemoteExistsRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testHandleForwardedRemoteExistsRequest() throws Exception {
    final TestProbe probe = createProbe();
    final ExistsTransactionRequest request =
            new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
    final Consumer<Response<?, ?>> callback = createCallbackMock();
    setupExecuteInActor();

    transaction.handleReplayedRemoteRequest(request, callback, Ticker.systemTicker().read());
    final ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
    verify(callback).accept(captor.capture());
    final Response<?, ?> value = captor.getValue();
    Assert.assertTrue(value instanceof ExistsTransactionSuccess);
    final ExistsTransactionSuccess success = (ExistsTransactionSuccess) value;
    Assert.assertTrue(success.getExists());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:LocalProxyTransactionTest.java

示例4: applyModifyTransactionRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
private void applyModifyTransactionRequest(final boolean coordinated) {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder =
            new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    final TransactionModification write = new TransactionWrite(PATH_1, DATA_1);
    final TransactionModification merge = new TransactionMerge(PATH_2, DATA_2);
    final TransactionModification delete = new TransactionDelete(PATH_3);
    builder.addModification(write);
    builder.addModification(merge);
    builder.addModification(delete);
    builder.setSequence(0L);
    builder.setCommit(coordinated);
    final ModifyTransactionRequest request = builder.build();
    final Consumer<Response<?, ?>> callback = createCallbackMock();
    transaction.replayModifyTransactionRequest(request, callback, Ticker.systemTicker().read());
    verify(modification).write(PATH_1, DATA_1);
    verify(modification).merge(PATH_2, DATA_2);
    verify(modification).delete(PATH_3);
    final CommitLocalTransactionRequest commitRequest =
            getTester().expectTransactionRequest(CommitLocalTransactionRequest.class);
    Assert.assertEquals(modification, commitRequest.getModification());
    Assert.assertEquals(coordinated, commitRequest.isCoordinated());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:LocalReadWriteProxyTransactionTest.java

示例5: testApplyModifyTransactionRequestNotAbort

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testApplyModifyTransactionRequestNotAbort() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder =
            new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0);
    builder.setReady();
    final ModifyTransactionRequest request = builder.build();
    assertOperationThrowsException(() -> transaction.replayModifyTransactionRequest(request, createCallbackMock(),
        Ticker.systemTicker().read()), VerifyException.class);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:LocalReadOnlyProxyTransactionTest.java

示例6: testForwardToRemoteAbort

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Override
@Test
public void testForwardToRemoteAbort() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionAbortRequest request = new TransactionAbortRequest(TRANSACTION_ID, 0L, probe.ref());
    testForwardToRemote(request, TransactionAbortRequest.class);

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:RemoteProxyTransactionTest.java

示例7: testForwardToRemoteModifyCommitSimple

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testForwardToRemoteModifyCommitSimple() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder =
            new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0L);
    builder.setCommit(false);
    final ModifyTransactionRequest request = builder.build();
    final ModifyTransactionRequest received = testForwardToRemote(request, ModifyTransactionRequest.class);
    Assert.assertEquals(request.getPersistenceProtocol(), received.getPersistenceProtocol());
    Assert.assertEquals(request.getModifications(), received.getModifications());
    Assert.assertEquals(request.getTarget(), received.getTarget());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:RemoteProxyTransactionTest.java

示例8: testForwardToRemoteModifyCommit3Phase

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testForwardToRemoteModifyCommit3Phase() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder =
            new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0L);
    builder.setCommit(true);
    final ModifyTransactionRequest request = builder.build();
    final ModifyTransactionRequest received = testForwardToRemote(request, ModifyTransactionRequest.class);
    Assert.assertEquals(request.getPersistenceProtocol(), received.getPersistenceProtocol());
    Assert.assertEquals(request.getModifications(), received.getModifications());
    Assert.assertEquals(request.getTarget(), received.getTarget());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:RemoteProxyTransactionTest.java

示例9: testForwardToRemoteAbort

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Override
@Test
public void testForwardToRemoteAbort() throws Exception {
    final TestProbe probe = createProbe();
    final AbortLocalTransactionRequest request = new AbortLocalTransactionRequest(TRANSACTION_ID, probe.ref());
    final ModifyTransactionRequest modifyRequest = testForwardToRemote(request, ModifyTransactionRequest.class);
    Assert.assertTrue(modifyRequest.getPersistenceProtocol().isPresent());
    Assert.assertEquals(PersistenceProtocol.ABORT, modifyRequest.getPersistenceProtocol().get());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:LocalProxyTransactionTest.java

示例10: testRoutingLogic

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testRoutingLogic() {
    List<Pair<ActorRef, Long>> pairList = new ArrayList<>();
    TestProbe probe1 = new TestProbe(system);
    TestProbe probe2 = new TestProbe(system);
    TestProbe probe3 = new TestProbe(system);
    ActorRef actor1 = probe1.ref();
    ActorRef actor2 = probe2.ref();
    ActorRef actor3 = probe3.ref();
    pairList.add(new Pair<>(actor1, 1000L));
    pairList.add(new Pair<>(actor2, 3000L));
    pairList.add(new Pair<>(actor3, 2000L));
    RoutingLogic logic = new LatestEntryRoutingLogic(pairList);
    assertTrue(logic.select().equals(actor2));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:LatestEntryRoutingLogicTest.java

示例11: testApplyModifyTransactionRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testApplyModifyTransactionRequest() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder =
            new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0);
    builder.setAbort();
    final ModifyTransactionRequest request = builder.build();
    transaction.replayModifyTransactionRequest(request, createCallbackMock(), Ticker.systemTicker().read());
    getTester().expectTransactionRequest(AbortLocalTransactionRequest.class);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:LocalReadOnlyProxyTransactionTest.java

示例12: testForwardToRemoteModifyPreCommit

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testForwardToRemoteModifyPreCommit() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionPreCommitRequest request =
            new TransactionPreCommitRequest(TRANSACTION_ID, 0L, probe.ref());
    final TransactionPreCommitRequest received = testForwardToRemote(request, TransactionPreCommitRequest.class);
    Assert.assertEquals(request.getTarget(), received.getTarget());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:RemoteProxyTransactionTest.java

示例13: testHandleForwardedRemotePreCommitRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testHandleForwardedRemotePreCommitRequest() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionPreCommitRequest request =
            new TransactionPreCommitRequest(TRANSACTION_ID, 0L, probe.ref());
    testHandleForwardedRemoteRequest(request);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:LocalReadWriteProxyTransactionTest.java

示例14: setup

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    probe = new TestProbe(system);
    ctx = new ClientActorContext(probe.ref(), PERSISTENCE_ID, system,
            CLIENT_ID, AccessClientUtil.newMockClientActorConfig());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:ClientActorContextTest.java

示例15: testHandleForwardedRemoteAbortRequest

import akka.testkit.TestProbe; //导入方法依赖的package包/类
@Test
public void testHandleForwardedRemoteAbortRequest() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionAbortRequest request =
            new TransactionAbortRequest(TRANSACTION_ID, 0L, probe.ref());
    testHandleForwardedRemoteRequest(request);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:LocalReadWriteProxyTransactionTest.java


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