Examples of OpenListener


Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

    CommittedWaveletSnapshot snapshot2 = provideWavelet(WN2);
    when(waveletProvider.getWaveletIds(WAVE_ID)).thenReturn(ImmutableSet.of(W1, W2));
    when(waveletProvider.checkAccessPermission(WN1, USER)).thenReturn(true);
    when(waveletProvider.checkAccessPermission(WN2, USER)).thenReturn(true);

    OpenListener listener = openWave(IdFilters.ALL_IDS);
    verify(listener).onUpdate(eq(WN1), eq(snapshot1), eq(DeltaSequence.empty()),
        eq(V0), isNullMarker(), any(String.class));
    verify(listener).onUpdate(eq(WN2), eq(snapshot2), eq(DeltaSequence.empty()),
        eq(V0), isNullMarker(), any(String.class));
    verifyMarker(listener, WAVE_ID);
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

   * Tests that a snapshot not matching the subscription filter is not received.
   * @throws WaveServerException
   */
  @SuppressWarnings("unchecked") // Mock container
  public void testUnsubscribedSnapshotNotRecieved() throws Exception {
    OpenListener listener = openWave(IdFilter.ofPrefixes("non-existing"));
    verifyChannelId(listener);
    verifyMarker(listener, WAVE_ID);

    ReadableWaveletData wavelet = provideWavelet(WN1).snapshot;
    clientFrontend.waveletUpdate(wavelet, DELTAS);
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

  public void testReceivedDeltasSentToClient() throws Exception {
    CommittedWaveletSnapshot snapshot = provideWavelet(WN1);
    when(waveletProvider.getWaveletIds(WAVE_ID)).thenReturn(ImmutableSet.of(W1));
    when(waveletProvider.checkAccessPermission(WN1, USER)).thenReturn(true);

    OpenListener listener = openWave(IdFilters.ALL_IDS);
    verify(listener).onUpdate(eq(WN1), eq(snapshot), eq(DeltaSequence.empty()),
        eq(V0), isNullMarker(), any(String.class));
    verifyMarker(listener, WAVE_ID);

    TransformedWaveletDelta delta = TransformedWaveletDelta.cloneOperations(USER, V2, 1234567890L,
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

  /**
   * Tests that submit requests are forwarded to the wavelet provider.
   */
  public void testSubmitForwardedToWaveletProvider() {
    OpenListener openListener = openWave(IdFilters.ALL_IDS);
    String channelId = verifyChannelId(openListener);

    SubmitRequestListener submitListener = mock(SubmitRequestListener.class);
    clientFrontend.submitRequest(USER, WN1, SERIALIZED_DELTA, channelId, submitListener);
    verify(waveletProvider).submitRequest(eq(WN1), eq(SERIALIZED_DELTA),
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

    verifyZeroInteractions(submitListener);
  }

  public void testCannotSubmitAsDifferentUser() {
    ParticipantId otherParticipant = new ParticipantId("another@example.com");
    OpenListener openListener = openWave(IdFilters.ALL_IDS);
    String channelId = verifyChannelId(openListener);

    SubmitRequestListener submitListener = mock(SubmitRequestListener.class);
    clientFrontend.submitRequest(otherParticipant, WN1, SERIALIZED_DELTA, channelId,
        submitListener);
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

   * participant or text).
   */
  public void testUninterestingDeltasDontUpdateIndex() throws WaveServerException {
    provideWaves(Collections.<WaveId> emptySet());

    OpenListener listener = openWave(INDEX_WAVE_ID, IdFilters.ALL_IDS);
    verifyChannelId(listener);
    verifyMarker(listener, INDEX_WAVE_ID);

    HashedVersion v1 = HashedVersion.unsigned(1L);
    TransformedWaveletDelta delta = makeDelta(USER, v1, 0L, UTIL.noOp());
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

  /**
   * Opens a wave and returns a mock listener.
   */
  private ClientFrontend.OpenListener openWave(WaveId waveId, IdFilter filter) {
    OpenListener openListener = mock(OpenListener.class);
    clientFrontend.openRequest(USER, waveId, filter, NO_KNOWN_WAVELETS, openListener);
    return openListener;
  }
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

   * wavelets.
   */
  public void testMatchSubscriptions() {
    assertEquals(ImmutableList.<OpenListener>of(), m.matchSubscriptions(W1A));

    OpenListener l1 = mock(OpenListener.class, "listener 1");
    OpenListener l2 = mock(OpenListener.class, "listener 2");
    OpenListener l3 = mock(OpenListener.class, "listener 3");
    OpenListener l4 = mock(OpenListener.class, "listener 4");
    OpenListener l5 = mock(OpenListener.class, "listener 5");
    String channelId = "";

    m.subscribe(W2, IdFilter.ofIds(WA), channelId, l1);
    m.subscribe(W2, IdFilters.ALL_IDS, channelId, l2);
    m.subscribe(W1, IdFilter.ofPrefixes("", WA.getId()), channelId, l3);
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

    }
    assertEquals(expectedListeners, actualListeners);
  }

  public void testEmptyDeltaNotReceived() {
    OpenListener listener = mock(OpenListener.class);
    m.subscribe(W1, IdFilters.ALL_IDS, "ch", listener);
    m.onUpdate(W1A, DeltaSequence.empty());
    verifyZeroInteractions(listener);
  }
View Full Code Here

Examples of org.waveprotocol.box.server.frontend.ClientFrontend.OpenListener

  /**
   * Tests that a single delta update is received by the listener.
   */
  public void testSingleDeltaReceived() {
    OpenListener listener = mock(OpenListener.class);
    m.subscribe(W1, IdFilters.ALL_IDS, "ch", listener);
    m.onUpdate(W1A, DELTAS);
    verify(listener).onUpdate(W1A, null, DELTAS, null, null, "ch");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.