use of org.opendaylight.controller.cluster.access.client.ClientActorContext in project controller by opendaylight.
the class AbstractClientHandleTest method setUp.
@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);
}
use of org.opendaylight.controller.cluster.access.client.ClientActorContext in project controller by opendaylight.
the class AbstractProxyTransactionTest method createRemoteProxyTransactionTester.
@SuppressWarnings("checkstyle:hiddenField")
protected TransactionTester<RemoteProxyTransaction> createRemoteProxyTransactionTester() {
final TestProbe clientContextProbe = new TestProbe(system, "remoteClientContext");
final TestProbe backendProbe = new TestProbe(system, "remoteBackend");
final AbstractClientHistory history = mock(AbstractClientHistory.class);
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(), 5);
final AbstractClientConnection<ShardBackendInfo> connection = AccessClientUtil.createConnectedConnection(context, 0L, backend);
final ProxyHistory proxyHistory = ProxyHistory.createClient(history, connection, HISTORY_ID);
final RemoteProxyTransaction transaction = new RemoteProxyTransaction(proxyHistory, TRANSACTION_ID, false, false, false);
return new TransactionTester<>(transaction, connection, backendProbe);
}
use of org.opendaylight.controller.cluster.access.client.ClientActorContext in project controller by opendaylight.
the class AbstractProxyTransactionTest method createLocalProxy.
@SuppressWarnings("checkstyle:hiddenField")
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);
}
use of org.opendaylight.controller.cluster.access.client.ClientActorContext in project controller by opendaylight.
the class ClientLocalHistoryTest method setUp.
@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);
}
use of org.opendaylight.controller.cluster.access.client.ClientActorContext in project controller by opendaylight.
the class DirectTransactionCommitCohortTest method setUp.
@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);
}
Aggregations