本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
}
示例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());
}
示例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();
}
示例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);
}
示例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();
}
示例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));
}
示例15: setupClass
import akka.actor.ActorSystem; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() {
actorSystem = ActorSystem.apply();
}