Examples of SignerInfoPrefetchResultListener


Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

  /**
   * Test prefetchDeltaSignerInfo for a single request on a single domain, and that subsequent
   * requests on the same domain return instantly.
   */
  public void test_prefetchDeltaSignerInfo1() throws Exception {
    SignerInfoPrefetchResultListener mockListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSuccessfulProvider(), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, mockListener);
    verify(mockListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());

View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

   * Test prefetchDeltaSignerInfo for multiple requests on a single domain where the first one
   * does not terminate.  The entire request should fail.
   */
  public void test_prefetchDeltaSignerInfo2() throws Exception {
    // The dead listener won't return
    SignerInfoPrefetchResultListener deadListener = mock(SignerInfoPrefetchResultListener.class);
    manager.prefetchDeltaSignerInfo(getDeadProvider(), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, deadListener);
    verifyZeroInteractions(deadListener);

    // But this will.  However, it shouldn't be called since the other was added first, and only
    // 1 request is started per domain
    SignerInfoPrefetchResultListener aliveListener = mock(SignerInfoPrefetchResultListener.class);
    manager.prefetchDeltaSignerInfo(getSuccessfulProvider(), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, aliveListener);

    verifyZeroInteractions(aliveListener);
  }
View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

   * Test prefetchDeltaSignerInfo for multiple requests on different domains where the first one
   * does not terminate.  However the second should terminate, and both callbacks called.
   */
  public void test_prefetchDeltaSignerInfo3() throws Exception {
    // This will never return, but the callback will run later
    SignerInfoPrefetchResultListener deadListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getDeadProvider(), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, deadListener);
    verifyZeroInteractions(deadListener);

    // This should succeed later, after some number of ticks
    SignerInfoPrefetchResultListener slowSuccessListener =
        mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSlowSuccessfulProvider(ticker, EASY_TICKS),
        getRealSignerId(), getFakeWaveletName(OTHER_DOMAIN), null, slowSuccessListener);
    verifyZeroInteractions(slowSuccessListener);

    // This would succeed right now if it didn't have to wait for the slow success
    SignerInfoPrefetchResultListener successListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSuccessfulProvider(), getRealSignerId(),
        getFakeWaveletName(OTHER_DOMAIN), null, successListener);
    verifyZeroInteractions(successListener);

    // After ticking, each callback should run
    ticker.tick(EASY_TICKS);
    verify(deadListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());
    verify(slowSuccessListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());
    verify(successListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());

    // Subsequent calls should also succeed immediately without calling the callback
    SignerInfoPrefetchResultListener nullListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(null, getRealSignerId(), getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null,
        nullListener);
    verify(nullListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());
  }
View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

   * Test prefetchDeltaSignerInfo for failing requests -- the failure should be propagated to
   * the prefetch listener, and requests on the same domain should fail.
   */
  public void test_prefetchDeltaSignerInfo4() throws Exception {
    // This will fail later
    SignerInfoPrefetchResultListener failListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSlowFailingProvider(ticker, EASY_TICKS), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, failListener);

    // This would succeed later if it weren't for the previous one failing
    SignerInfoPrefetchResultListener successListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSuccessfulProvider(), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), null, successListener);
    verifyZeroInteractions(failListener);
    verifyZeroInteractions(successListener);
View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

   * Test prefetchDeltaSignerInfo for failing requests where a previous request on a different
   * domain has already succeeded.  The failing request should also appear to succeed.
   */
  public void test_prefetchDeltaSignerInfo5() throws Exception {
    // This would fail if the next (immediate) request didn't succeed
    SignerInfoPrefetchResultListener failListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSlowFailingProvider(ticker, EASY_TICKS), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), getHashedVersion(), failListener);
    verifyZeroInteractions(failListener);

    // This will succeed immediately
    SignerInfoPrefetchResultListener successListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSuccessfulProvider(), getRealSignerId(),
        getFakeWaveletName(OTHER_DOMAIN), getHashedVersion(), successListener);

    verify(successListener).onSuccess(Certificates.getRealSignerInfo().toProtoBuf());
View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

   * Test prefetchDeltaSignerInfo for failing requests -- even though the first request fails,
   * the second request on a different domain should succeed.
   */
  public void test_prefetchDeltaSignerInfo6() throws Exception {
    // This will fail later
    SignerInfoPrefetchResultListener failListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSlowFailingProvider(ticker, EASY_TICKS), getRealSignerId(),
        getFakeWaveletName(CertificateManagerImplTest.DOMAIN), getHashedVersion(), failListener);
    verifyZeroInteractions(failListener);

    // This will succeed later, after the failing one fails
    SignerInfoPrefetchResultListener successListener = mock(SignerInfoPrefetchResultListener.class);

    manager.prefetchDeltaSignerInfo(getSlowSuccessfulProvider(ticker, EASY_TICKS * 2),
        getRealSignerId(), getFakeWaveletName(OTHER_DOMAIN), getHashedVersion(), successListener);
    verifyZeroInteractions(successListener);

View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

          internalUpdateAfterSignerInfoRetrieval(
              appliedDeltas, domain, federationProvider, certificateManager, futureResult);
        }
      }
    };
    SignerInfoPrefetchResultListener prefetchListener = new SignerInfoPrefetchResultListener() {
      @Override
      public void onFailure(FederationError error) {
        LOG.warning("Signer info prefetch failed: " + error);
        countDown.run();
      }
View Full Code Here

Examples of org.waveprotocol.box.server.waveserver.CertificateManager.SignerInfoPrefetchResultListener

          internalUpdateAfterSignerInfoRetrieval(
              appliedDeltas, domain, federationProvider, certificateManager, futureResult);
        }
      }
    };
    SignerInfoPrefetchResultListener prefetchListener = new SignerInfoPrefetchResultListener() {
      @Override
      public void onFailure(FederationError error) {
        LOG.warning("Signer info prefetch failed: " + error);
        countDown.run();
      }
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.