private OperationChannel checkSendClobberingSnapshot(ViewChannel.Listener viewListener, OperationChannel channelToClobber, ObservableWaveletData snapshotUpdate, HashedVersion committed) throws ChannelException { viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); muxListener.verifyOperationChannelRemoved(channelToClobber); return muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); }
private OperationChannel checkSendClobberingSnapshot(ViewChannel.Listener viewListener, OperationChannel channelToClobber, ObservableWaveletData snapshotUpdate, HashedVersion committed) throws ChannelException { viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); muxListener.verifyOperationChannelRemoved(channelToClobber); return muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); }
private ConnectedChannel expectConnectedChannel(ObservableWaveletData knownSnapshot, Accessibility accessibility) { OperationChannel channel = muxListener.verifyOperationChannelCreated(knownSnapshot, accessibility); MockOperationChannelListener listener = new MockOperationChannelListener(); channel.setListener(listener); return new ConnectedChannel(channel, listener); }
private ConnectedChannel expectConnectedChannel(ObservableWaveletData knownSnapshot, Accessibility accessibility) { OperationChannel channel = muxListener.verifyOperationChannelCreated(knownSnapshot, accessibility); MockOperationChannelListener listener = new MockOperationChannelListener(); channel.setListener(listener); return new ConnectedChannel(channel, listener); }
private OperationChannel createOperationChannel(WaveletId waveletId, ParticipantId address) { mux.createOperationChannel(waveletId, address); return muxListener.verifyOperationChannelCreated( DATA_FACTORY.create( new EmptyWaveletSnapshot(WAVE_ID, waveletId, address, HashedVersion.unsigned(0), 1273307837000L /* arbitrary time */)), Accessibility.READ_WRITE); }
private OperationChannel createOperationChannel(WaveletId waveletId, ParticipantId address) { mux.createOperationChannel(waveletId, address); return muxListener.verifyOperationChannelCreated( DATA_FACTORY.create( new EmptyWaveletSnapshot(WAVE_ID, waveletId, address, HashedVersion.unsigned(0), 1273307837000L /* arbitrary time */)), Accessibility.READ_WRITE); }
private ConnectedChannel connectChannelSnapshot(ViewChannel.Listener viewListener, ObservableWaveletData snapshot, HashedVersion committed) throws ChannelException { viewListener.onSnapshot(snapshot.getWaveletId(), snapshot, committed, null); OperationChannel channel = muxListener.verifyOperationChannelCreated(snapshot, Accessibility.READ_WRITE); MockOperationChannelListener listener = new MockOperationChannelListener(); channel.setListener(listener); return new ConnectedChannel(channel, listener); }
private ConnectedChannel createOperationChannel(WaveletId waveletId, ParticipantId address) { mux.createOperationChannel(waveletId, address); OperationChannel channel = muxListener.verifyOperationChannelCreated(createSnapshot( WAVELET_ID_1, 0, NOSIG), Accessibility.READ_WRITE); MockOperationChannelListener channelListener = new MockOperationChannelListener(); channel.setListener(channelListener); return new ConnectedChannel(channel, channelListener); }
private ConnectedChannel createOperationChannel(WaveletId waveletId, ParticipantId address) { mux.createOperationChannel(waveletId, address); OperationChannel channel = muxListener.verifyOperationChannelCreated(createSnapshot( WAVELET_ID_1, 0, NOSIG), Accessibility.READ_WRITE); MockOperationChannelListener channelListener = new MockOperationChannelListener(); channel.setListener(channelListener); return new ConnectedChannel(channel, channelListener); }
private ConnectedChannel connectChannelSnapshot(ViewChannel.Listener viewListener, ObservableWaveletData snapshot, HashedVersion committed) throws ChannelException { viewListener.onSnapshot(snapshot.getWaveletId(), snapshot, committed, null); OperationChannel channel = muxListener.verifyOperationChannelCreated(snapshot, Accessibility.READ_WRITE); MockOperationChannelListener listener = new MockOperationChannelListener(); channel.setListener(listener); return new ConnectedChannel(channel, listener); }
public void testReceivedSnapshotClobbersOnlyAppropriateChannel() throws ChannelException { MockViewChannel viewChannel = openMux(); ViewChannel.Listener viewListener = viewChannel.takeListener(); muxListener.verifyNoMoreInteractions(); viewListener.onConnected(); ObservableWaveletData snapshotUpdate = createSnapshot(WAVELET_ID_1, 1, SIG1); HashedVersion committed = HashedVersion.unsigned(0); viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); OperationChannel ch = muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); // This snapshot should clobber wavelet 1's channel committed = HashedVersion.of(1, SIG1); checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); muxListener.verifyNoMoreInteractions(); // This snapshot should only create a new channel and nothing else viewListener.onSnapshot(WAVELET_ID_2, snapshotUpdate, committed, null); muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); muxListener.verifyNoMoreInteractions(); }
public void testReceivedSnapshotClobbersOnlyAppropriateChannel() throws ChannelException { MockViewChannel viewChannel = openMux(); ViewChannel.Listener viewListener = viewChannel.takeListener(); muxListener.verifyNoMoreInteractions(); viewListener.onConnected(); ObservableWaveletData snapshotUpdate = createSnapshot(WAVELET_ID_1, 1, SIG1); HashedVersion committed = HashedVersion.unsigned(0); viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); OperationChannel ch = muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); // This snapshot should clobber wavelet 1's channel committed = HashedVersion.of(1, SIG1); checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); muxListener.verifyNoMoreInteractions(); // This snapshot should only create a new channel and nothing else viewListener.onSnapshot(WAVELET_ID_2, snapshotUpdate, committed, null); muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); muxListener.verifyNoMoreInteractions(); }
public void testReceivedSnapshotClobbersExistingChannel() throws ChannelException { MockViewChannel viewChannel = openMux(); ViewChannel.Listener viewListener = viewChannel.takeListener(); muxListener.verifyNoMoreInteractions(); viewListener.onConnected(); ObservableWaveletData snapshotUpdate = createSnapshot(WAVELET_ID_1, 1, SIG1); HashedVersion committed = HashedVersion.unsigned(0); viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); OperationChannel ch = muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); // The second snapshot may have a non-zero version. committed = HashedVersion.unsigned(1); ch = checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); // Repeat the clobbering with a higher version. committed = HashedVersion.unsigned(2000); checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); }
public void testReceivedSnapshotClobbersExistingChannel() throws ChannelException { MockViewChannel viewChannel = openMux(); ViewChannel.Listener viewListener = viewChannel.takeListener(); muxListener.verifyNoMoreInteractions(); viewListener.onConnected(); ObservableWaveletData snapshotUpdate = createSnapshot(WAVELET_ID_1, 1, SIG1); HashedVersion committed = HashedVersion.unsigned(0); viewListener.onSnapshot(WAVELET_ID_1, snapshotUpdate, committed, null); OperationChannel ch = muxListener.verifyOperationChannelCreated(snapshotUpdate, Accessibility.READ_WRITE); // The second snapshot may have a non-zero version. committed = HashedVersion.unsigned(1); ch = checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); // Repeat the clobbering with a higher version. committed = HashedVersion.unsigned(2000); checkSendClobberingSnapshot(viewListener, ch, snapshotUpdate, committed); }
.setLastCommittedVersion(HashedVersion.unsigned(0)); openCallback.onUpdate(update); OperationChannel channel = muxListener.verifyOperationChannelCreated( update.getWaveletSnapshot(), Accessibility.READ_WRITE); openCallback.onUpdate(new FakeWaveViewServiceUpdate().setMarker(false));
.setLastCommittedVersion(HashedVersion.unsigned(0)); openCallback.onUpdate(update); OperationChannel channel = muxListener.verifyOperationChannelCreated( update.getWaveletSnapshot(), Accessibility.READ_WRITE); openCallback.onUpdate(new FakeWaveViewServiceUpdate().setMarker(false));
.setLastCommittedVersion(HashedVersion.unsigned(0)); openCallback.onUpdate(update); OperationChannel channel = muxListener.verifyOperationChannelCreated( update.getWaveletSnapshot(), Accessibility.READ_WRITE); openCallback.onUpdate(new FakeWaveViewServiceUpdate().setMarker(false));
.setLastCommittedVersion(HashedVersion.unsigned(0)); openCallback.onUpdate(update); OperationChannel channel = muxListener.verifyOperationChannelCreated( update.getWaveletSnapshot(), Accessibility.READ_WRITE); openCallback.onUpdate(new FakeWaveViewServiceUpdate().setMarker(false));