* 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());
}