當前位置: 首頁>>代碼示例>>Java>>正文


Java ActorSystem.apply方法代碼示例

本文整理匯總了Java中akka.actor.ActorSystem.apply方法的典型用法代碼示例。如果您正苦於以下問題:Java ActorSystem.apply方法的具體用法?Java ActorSystem.apply怎麽用?Java ActorSystem.apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在akka.actor.ActorSystem的用法示例。


在下文中一共展示了ActorSystem.apply方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    clientContextProbe = new TestProbe(system, "clientContext");
    backendProbe = new TestProbe(system, "backend");
    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 ProxyHistory parent = ProxyHistory.createClient(history, connection, HISTORY_ID);
    transaction = createTransaction(parent, TestUtils.TRANSACTION_ID, snapshot);
    tester = new TransactionTester<>(transaction, connection, backendProbe);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:17,代碼來源:AbstractProxyTransactionTest.java

示例2: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    final TestProbe clientContextProbe = new TestProbe(system, "clientContext");
    final ClientActorContext context =
            AccessClientUtil.createClientActorContext(system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    transactions = new ArrayList<>();
    for (int i = 0; i < TRANSACTIONS; i++) {
        transactions.add(createTransactionTester(new TestProbe(system, "backend" + i), context, history));
    }
    final Collection<AbstractProxyTransaction> proxies = transactions.stream()
            .map(TransactionTester::getTransaction)
            .collect(Collectors.toList());
    proxies.forEach(AbstractProxyTransaction::seal);
    cohort = new ClientTransactionCommitCohort(history, TRANSACTION_ID, proxies);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:18,代碼來源:ClientTransactionCommitCohortTest.java

示例3: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    system = ActorSystem.apply();

    final TestProbe clientContextProbe = new TestProbe(system, "client");
    final TestProbe actorContextProbe = new TestProbe(system, "actor-context");
    clientActorContext = AccessClientUtil.createClientActorContext(
            system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    final ActorContext actorContextMock = createActorContextMock(system, actorContextProbe.ref());
    behavior = new SimpleDataStoreClientBehavior(clientActorContext, actorContextMock, SHARD_NAME);

    object = new ClientLocalHistory(behavior, HISTORY_ID);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:16,代碼來源:ClientLocalHistoryTest.java

示例4: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    system = ActorSystem.apply();
    clientActorProbe = new TestProbe(system, "client");
    actorContextProbe = new TestProbe(system, "actor-context");
    final ActorContext context = createActorContextMock(system, actorContextProbe.ref());
    clientContext =
            AccessClientUtil.createClientActorContext(system, clientActorProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    behavior = createBehavior(clientContext, context);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:11,代碼來源:AbstractDataStoreClientBehaviorTest.java

示例5: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    final TestProbe clientContextProbe = new TestProbe(system, "clientContext");
    final ClientActorContext context =
            AccessClientUtil.createClientActorContext(system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    transaction = createTransactionTester(new TestProbe(system, "backend"), context, history);
    final AbstractProxyTransaction proxy = transaction.getTransaction();
    proxy.seal();
    cohort = new DirectTransactionCommitCohort(history, TRANSACTION_ID, proxy);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:13,代碼來源:DirectTransactionCommitCohortTest.java

示例6: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    system = ActorSystem.apply();

    final TestProbe clientContextProbe = new TestProbe(system, "client");
    final TestProbe actorContextProbe = new TestProbe(system, "actor-context");
    clientActorContext = AccessClientUtil.createClientActorContext(
            system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    final ActorContext actorContextMock = createActorContextMock(system, actorContextProbe.ref());
    behavior = new SimpleDataStoreClientBehavior(clientActorContext, actorContextMock, SHARD_NAME);

    object = new SingleClientHistory(behavior, HISTORY_ID);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:16,代碼來源:SingleClientHistoryTest.java

示例7: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    final TestProbe contextProbe = new TestProbe(system, "context");
    final TestProbe clientContextProbe = new TestProbe(system, "client-context");
    backendProbe = new TestProbe(system, "backend");
    //create handle dependencies
    final ActorContext actorContext = createActorContextMock(system, contextProbe.ref());
    final ClientActorContext clientContext =
            AccessClientUtil.createClientActorContext(system, clientContextProbe.ref(), CLIENT_ID, PERSISTENCE_ID);
    client = new SimpleDataStoreClientBehavior(clientContext, actorContext, "shard");
    client.createLocalHistory();
    parent = new SingleClientHistory(client, HISTORY_ID);
    //connect client
    client.getConnection(0L);
    contextProbe.expectMsgClass(ConnectClientRequest.class);
    final long sequence = 0L;
    contextProbe.reply(new ConnectClientSuccess(CLIENT_ID, sequence, backendProbe.ref(),
            Collections.emptyList(), dataTree, 3));
    final InternalCommand<ShardBackendInfo> command = clientContextProbe.expectMsgClass(InternalCommand.class);
    command.execute(client);
    //data tree mock
    when(dataTree.takeSnapshot()).thenReturn(dataTreeSnapshot);

    handle = createHandle(parent);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:28,代碼來源:AbstractClientHandleTest.java

示例8: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    contextProbe = new TestProbe(system, "context");
    final ActorContext actorContext = createActorContextMock(system, contextProbe.ref());
    moduleShardBackendResolver = new ModuleShardBackendResolver(CLIENT_ID, actorContext);
    when(actorContext.getShardStrategyFactory()).thenReturn(shardStrategyFactory);
    when(shardStrategyFactory.getStrategy(YangInstanceIdentifier.EMPTY)).thenReturn(shardStrategy);
    final PrimaryShardInfoFutureCache cache = new PrimaryShardInfoFutureCache();
    when(actorContext.getPrimaryShardInfoCache()).thenReturn(cache);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:13,代碼來源:ModuleShardBackendResolverTest.java

示例9: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    system = ActorSystem.apply();
    notifier = system.actorOf(RoleChangeNotifier.getProps(MEMBER_ID));
    listeners = new ArrayList<>(LISTENER_COUNT);
    for (int i = 0; i < LISTENER_COUNT; i++) {
        listeners.add(new TestProbe(system));
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:10,代碼來源:RoleChangeNotifierTest.java

示例10: setup

import akka.actor.ActorSystem; //導入方法依賴的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

示例11: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    backendProbe = new TestProbe(system);
    contextProbe = new TestProbe(system);
    context = new ClientActorContext(contextProbe.ref(), PERSISTENCE_ID, system,
            CLIENT_ID, AccessClientUtil.newMockClientActorConfig());
    replyToProbe = new TestProbe(system);
    connection = createConnection();
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:12,代碼來源:AbstractClientConnectionTest.java

示例12: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    initialBehavior = createInitialBehaviorMock();
    system = ActorSystem.apply("system1");
    final ActorRef storeRef = system.registerExtension(Persistence.lookup()).snapshotStoreFor(null);
    probe = new TestProbe(system);
    storeRef.tell(probe.ref(), ActorRef.noSender());
    final MemberName name = MemberName.forName("member-1");
    id = FrontendIdentifier.create(name, FrontendType.forName("type-1"));
    mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
    //handle initial actor recovery
    saveRequest = handleRecovery(null);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:14,代碼來源:ActorBehaviorTest.java

示例13: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Override
@Before
public void setUp() throws Exception {
    system = ActorSystem.apply();
    JavaSerializer.currentSystem().value_$eq((ExtendedActorSystem) system);
    super.setUp();
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:8,代碼來源:RequestEnvelopeTest.java

示例14: setUp

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    actor = system.actorOf(QuarantinedMonitorActor.props(callback));
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:7,代碼來源:QuarantinedMonitorActorTest.java

示例15: setupClass

import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setupClass() {
    actorSystem = ActorSystem.apply();
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:5,代碼來源:ConnectingClientConnectionTest.java


注:本文中的akka.actor.ActorSystem.apply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。