Package org.apache.shindig.common.util

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


  }

  @Before
  public void setUp() {
    fetcher = createMock(HttpFetcher.class);
    timeSource = new FakeTimeSource();
    timeSource.setCurrentTimeMillis(0);
    loader = new TestFeatureResourceLoader(fetcher, timeSource, new DefaultFeatureFileSystem());
  }
View Full Code Here


  @Test
  public void testWithCache() throws Exception {
    String url = "http://example.org/file.evil";
    String domain = "example.org";
    HttpResponse.setTimeSource(new FakeTimeSource());

    setupProxyRequestMock(domain, url, false, 120, null, null);
    setupGadgetAdminMock(true);

    HttpRequest req = new HttpRequestCache(Uri.parse(url)).setCacheTtl(120).setIgnoreCache(false);
View Full Code Here

  @Test
  public void testWithBadTtl() throws Exception {
    String url = "http://example.org/file.evil";
    String domain = "example.org";
    HttpResponse.setTimeSource(new FakeTimeSource());

    setupProxyRequestMock(domain, url, false, -1, null, null);
    setupGadgetAdminMock(true);

    HttpRequest req = new HttpRequestCache(Uri.parse(url)).setCacheTtl(-1).setIgnoreCache(false);
View Full Code Here

    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

    privateToken.setAppUrl(GADGET_URL);

    stateCrypter = new BasicBlobCrypter("abcdefghijklmnop".getBytes());
    clientState = new OAuthClientState(stateCrypter);
    responseParams = new OAuthResponseParams(socialToken, null, stateCrypter);
    fetcherConfig = new OAuthFetcherConfig(stateCrypter, store, new FakeTimeSource(), null, false);
    fetcherConfigSecureOwner = new OAuthFetcherConfig(stateCrypter, store, new FakeTimeSource(), null, true);
  }
View Full Code Here

  private BasicBlobCrypter crypter;
  private FakeTimeSource timeSource;

  public BlobCrypterTest() {
    crypter = new BasicBlobCrypter("0123456789abcdef".getBytes());
    timeSource = new FakeTimeSource();
    crypter.timeSource = timeSource;
  }
View Full Code Here

public class CryptoTest {
  private BasicBlobCrypter crypter;

  public CryptoTest() {
    crypter = new BasicBlobCrypter("0123456789abcdef".getBytes());
    crypter.timeSource = new FakeTimeSource();
  }
View Full Code Here

        .addContainer(makeContainer("default"))
        .addContainer(makeContainer("container"))
        .addContainer(makeContainer("example"))
        .commit();
    codec = new BlobCrypterSecurityTokenCodec(config);
    timeSource = new FakeTimeSource();
  }
View Full Code Here

        .addContainer(makeContainer("default"))
        .addContainer(makeContainer("container"))
        .addContainer(makeContainer("example"))
        .commit();
    codec = new BlobCrypterSecurityTokenCodec(config);
    timeSource = new FakeTimeSource();
  }
View Full Code Here

    privateToken.setAppUrl(GADGET_URL);

    stateCrypter = new BasicBlobCrypter("abcdefghijklmnop".getBytes());
    clientState = new OAuthClientState(stateCrypter);
    responseParams = new OAuthResponseParams(socialToken, null, stateCrypter);
    fetcherConfig = new OAuthFetcherConfig(stateCrypter, store, new FakeTimeSource(), null, false);
  }
View Full Code Here

TOP

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

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.