private static void reconnectChannel(ViewChannel.Listener viewListener, WaveletId waveletId, long connectVersion, byte[] connectSignature, long currentVersion, byte[] currentSignature) throws ChannelException { TransformedWaveletDelta reconnect = createReconnect(null, connectVersion, connectSignature); HashedVersion distinctVersion = HashedVersion.of(currentVersion, currentSignature); viewListener.onUpdate(waveletId, Collections.singletonList(reconnect), distinctVersion, distinctVersion); }
private static void reconnectChannel(ViewChannel.Listener viewListener, WaveletId waveletId, long connectVersion, byte[] connectSignature, long currentVersion, byte[] currentSignature) throws ChannelException { TransformedWaveletDelta reconnect = createReconnect(null, connectVersion, connectSignature); HashedVersion distinctVersion = HashedVersion.of(currentVersion, currentSignature); viewListener.onUpdate(waveletId, Collections.singletonList(reconnect), distinctVersion, distinctVersion); }
viewListener.onUpdate(WAVELET_ID_1, ch1reconnect, HashedVersion.of(chInfo1.initialVersion, chInfo1.initialSignature), null);
update.hasCurrentVersion()) { openListener.onUpdate(waveletId, update.getDeltaList(), lastCommittedVersion, currentVersion);
viewListener.onUpdate(WAVELET_ID_1, ch1reconnect, HashedVersion.of(chInfo1.initialVersion, chInfo1.initialSignature), null);
viewListener.onUpdate(WAVELET_ID_1, ch1reconnect, HashedVersion.of(chInfo1.initialVersion, chInfo1.initialSignature), null);
viewListener.onUpdate(WAVELET_ID_1, ch1reconnect, HashedVersion.of(chInfo1.initialVersion, chInfo1.initialSignature), null);
viewListener.onUpdate(WAVELET_ID_1, createServerDeltaList(1, 1, SIG3), null, null);
viewListener.onUpdate(WAVELET_ID_1, createServerDeltaList(1, 1, SIG3), null, null);
public void testMuxCloseClosesViewAndChannels() throws ChannelException { final ConnectionInfo chInfo1 = new ConnectionInfo(WAVELET_ID_1, 1, SIG1); final ConnectionInfo chInfo2 = new ConnectionInfo(WAVELET_ID_2, 20, SIG2); MockViewChannel view = openMux(); ViewChannel.Listener viewListener = view.takeListener(); viewListener.onConnected(); // Receive initial snapshots. ConnectedChannel ch1 = connectChannelSnapshot(viewListener, chInfo1); ConnectedChannel ch2 = connectChannelSnapshot(viewListener, chInfo2); triggerAndCheckOpenFinished(viewListener); view.expectClose(); mux.close(); // Receive lagging delta from view channel, expect nothing. final List<TransformedWaveletDelta> update = createServerDeltaList(1, 1, SIG4); viewListener.onUpdate(chInfo1.waveletId, update, null, null); ch1.listener.checkOpsReceived(0); view.checkExpectationsSatisified(); muxListener.verifyNoMoreInteractions(); }
public void testMuxCloseClosesViewAndChannels() throws ChannelException { final ConnectionInfo chInfo1 = new ConnectionInfo(WAVELET_ID_1, 1, SIG1); final ConnectionInfo chInfo2 = new ConnectionInfo(WAVELET_ID_2, 20, SIG2); MockViewChannel view = openMux(); ViewChannel.Listener viewListener = view.takeListener(); viewListener.onConnected(); // Receive initial snapshots. ConnectedChannel ch1 = connectChannelSnapshot(viewListener, chInfo1); ConnectedChannel ch2 = connectChannelSnapshot(viewListener, chInfo2); triggerAndCheckOpenFinished(viewListener); view.expectClose(); mux.close(); // Receive lagging delta from view channel, expect nothing. final List<TransformedWaveletDelta> update = createServerDeltaList(1, 1, SIG4); viewListener.onUpdate(chInfo1.waveletId, update, null, null); ch1.listener.checkOpsReceived(0); view.checkExpectationsSatisified(); muxListener.verifyNoMoreInteractions(); }
private static void checkReceiveDelta(ViewChannel.Listener viewListener, OperationChannel opChannel, MockOperationChannelListener opChannelListener, WaveletId waveletId, long version, int numOps, byte[] signature) throws ChannelException { // Receive delta from view channel, expect ops on op channel. final List<TransformedWaveletDelta> update = createServerDeltaList(version, numOps, signature); viewListener.onUpdate(waveletId, update, null, null); opChannelListener.checkOpsReceived(1); opChannelListener.clear(); for (int i = 0; i < numOps; ++i) { assertNotNull(opChannel.receive()); } assertNull(opChannel.receive()); }
private static void checkReceiveDelta(ViewChannel.Listener viewListener, OperationChannel opChannel, MockOperationChannelListener opChannelListener, WaveletId waveletId, long version, int numOps, byte[] signature) throws ChannelException { // Receive delta from view channel, expect ops on op channel. final List<TransformedWaveletDelta> update = createServerDeltaList(version, numOps, signature); viewListener.onUpdate(waveletId, update, null, null); opChannelListener.checkOpsReceived(1); opChannelListener.clear(); for (int i = 0; i < numOps; ++i) { assertNotNull(opChannel.receive()); } assertNull(opChannel.receive()); }