本文整理匯總了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();
}