Package org.apache.shindig.common.util

Examples of org.apache.shindig.common.util.TimeSource


    HttpResponse response = new HttpResponseBuilder()
        .setExpirationTime(expiration)
        .create();
    cache.map.put(key, response);

    TimeSource fakeClock = new FakeTimeSource(expiration + 60L);

    cache.setClock(fakeClock);

    assertNull("Returned an expired entry when removing from the cache.",
               cache.removeResponse(request));
View Full Code Here


  public void testOAuthFetcherConfig() {
    BlobCrypter crypter = mock(BlobCrypter.class);
    mock(HttpCache.class);
    GadgetOAuthTokenStore tokenStore = mock(GadgetOAuthTokenStore.class);
    OAuthCallbackGenerator callbackGenerator = mock(OAuthCallbackGenerator.class);
    OAuthFetcherConfig config = new OAuthFetcherConfig(crypter, tokenStore, new TimeSource(),
        callbackGenerator);
    assertEquals(crypter, config.getStateCrypter());
    assertEquals(tokenStore, config.getTokenStore());
    assertEquals(callbackGenerator, config.getOAuthCallbackGenerator());
  }
View Full Code Here

        .andReturn(badResponse).once();
    replay(pipeline);

    final AtomicLong time = new AtomicLong();

    bundleFactory.cache.setTimeSource(new TimeSource() {
      @Override
      public long currentTimeMillis() {
        return time.get();
      }
    });
View Full Code Here

   public ExoDefaultSecurityTokenGenerator() throws Exception
   {
      // TODO should be moved to config
      // generateKeys("RSA", 1024);
      this.containerKey =  getKeyFilePath();
      this.timeSource = new TimeSource();
   }
View Full Code Here

        .andReturn(badResponse).once();
    replay(pipeline);

    final AtomicLong time = new AtomicLong();

    bundleFactory.cache.setTimeSource(new TimeSource() {
      @Override
      public long currentTimeMillis() {
        return time.get();
      }
    });
View Full Code Here

    /** . */
    private final Logger log = LoggerFactory.getLogger(ExoDefaultSecurityTokenGenerator.class);

    public ExoDefaultSecurityTokenGenerator() throws Exception {
        this.timeSource = new TimeSource();
    }
View Full Code Here

  private static class TestFeatureResourceLoader extends FeatureResourceLoader {
    private final ResourceMock resourceMock;
    private Map<String, String> lastAttribs;

    private TestFeatureResourceLoader(ResourceMock resourceMock) {
      super(null, new TimeSource(), new DefaultFeatureFileSystem());
      this.resourceMock = resourceMock;
    }
View Full Code Here

  public void testOAuthFetcherConfig() {
    BlobCrypter crypter = mock(BlobCrypter.class);
    mock(HttpCache.class);
    GadgetOAuthTokenStore tokenStore = mock(GadgetOAuthTokenStore.class);
    OAuthCallbackGenerator callbackGenerator = mock(OAuthCallbackGenerator.class);
    OAuthFetcherConfig config = new OAuthFetcherConfig(crypter, tokenStore, new TimeSource(),
        callbackGenerator, false);
    assertEquals(crypter, config.getStateCrypter());
    assertEquals(tokenStore, config.getTokenStore());
    assertEquals(callbackGenerator, config.getOAuthCallbackGenerator());
    assertFalse(config.isViewerAccessTokensEnabled());
View Full Code Here

        .andReturn(badResponse).once();
    replay(pipeline);

    final AtomicLong time = new AtomicLong();

    bundleFactory.cache.setTimeSource(new TimeSource() {
      @Override
      public long currentTimeMillis() {
        return time.get();
      }
    });
View Full Code Here

  @Test
  public void testOAuthFetcherConfig() {
    BlobCrypter crypter = mock(BlobCrypter.class);
    HttpCache cache = mock(HttpCache.class);
    GadgetOAuthTokenStore tokenStore = mock(GadgetOAuthTokenStore.class);
    OAuthFetcherConfig config = new OAuthFetcherConfig(crypter, tokenStore, cache, new TimeSource());
    assertEquals(crypter, config.getStateCrypter());
    assertEquals(cache, config.getHttpCache());
    assertEquals(tokenStore, config.getTokenStore());
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.common.util.TimeSource

Copyright © 2018 www.massapicom. 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.