AbstractDataStoreClientBehavior extends ClientActorBehavior<ShardBackendInfo> implements DataStoreClient { @Override public final ClientTransaction createTransaction() { return singleHistory.createTransaction(); } AbstractDataStoreClientBehavior(final ClientActorContext context,
            final BackendInfoResolver<ShardBackendInfo> resolver); @Override final ClientLocalHistory createLocalHistory(); @Override final ClientTransaction createTransaction(); @Override final ClientSnapshot createSnapshot(); @Override void close();  }
@Test public void testCreateTransaction() { final ClientTransaction transaction = behavior.createTransaction(); Assert.assertEquals(behavior.getIdentifier(), transaction.getIdentifier().getHistoryId().getClientId()); }
@Test public void testGetConnection() { final CursorAwareDataTreeModification modification = mock(CursorAwareDataTreeModification.class); when(modification.readNode(YangInstanceIdentifier.empty())).thenReturn(Optional.empty()); final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class); when(snapshot.newModification()).thenReturn(modification); final DataTree dataTree = mock(DataTree.class); when(dataTree.takeSnapshot()).thenReturn(snapshot); final TestProbe backendProbe = new TestProbe(system, "backend"); final long shard = 0L; behavior.createTransaction().read(YangInstanceIdentifier.empty()); final AbstractClientConnection<ShardBackendInfo> connection = behavior.getConnection(shard); Assert.assertSame(connection, behavior.getConnection(shard)); final ConnectClientRequest connectClientRequest = actorContextProbe.expectMsgClass(ConnectClientRequest.class); Assert.assertEquals(CLIENT_ID, connectClientRequest.getTarget()); final long sequence = 0L; Assert.assertEquals(sequence, connectClientRequest.getSequence()); actorContextProbe.reply(new ConnectClientSuccess(CLIENT_ID, sequence, backendProbe.ref(), Collections.emptyList(), dataTree, 3)); Assert.assertEquals(clientActorProbe.ref(), connection.localActor()); final InternalCommand<ShardBackendInfo> command = clientActorProbe.expectMsgClass(InternalCommand.class); command.execute(behavior); verify(modification).readNode(YangInstanceIdentifier.empty()); }