当前位置: 首页>>代码示例>>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;未经允许,请勿转载。