Examples of HttpCacheEntry


Examples of org.apache.http.client.cache.HttpCacheEntry

    }

    @Test
    public void testCorrectedReceivedAgeIsApparentAgeIfLarger() {
        Header[] headers = new Header[] { new BasicHeader("Age", "6"), };
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        impl = new CacheValidityPolicy() {
            @Override
            protected long getApparentAgeSecs(HttpCacheEntry entry) {
                return 10;
            }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

        assertEquals(10, impl.getCorrectedReceivedAgeSecs(entry));
    }

    @Test
    public void testResponseDelayIsDifferenceBetweenResponseAndRequestTimes() {
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, sixSecondsAgo);
        assertEquals(4, impl.getResponseDelaySecs(entry));
    }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

        assertEquals(4, impl.getResponseDelaySecs(entry));
    }

    @Test
    public void testCorrectedInitialAgeIsCorrectedReceivedAgePlusResponseDelay() {
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
        impl = new CacheValidityPolicy() {
            @Override
            protected long getCorrectedReceivedAgeSecs(HttpCacheEntry entry) {
                return 7;
            }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

        assertEquals(20, impl.getCorrectedInitialAgeSecs(entry));
    }

    @Test
    public void testResidentTimeSecondsIsTimeSinceResponseTime() {
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(now, sixSecondsAgo);
        impl = new CacheValidityPolicy();
        assertEquals(6, impl.getResidentTimeSecs(entry, now));
    }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

        assertEquals(6, impl.getResidentTimeSecs(entry, now));
    }

    @Test
    public void testCurrentAgeIsCorrectedInitialAgePlusResidentTime() {
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
        impl = new CacheValidityPolicy() {
            @Override
            protected long getCorrectedInitialAgeSecs(HttpCacheEntry entry) {
                return 11;
            }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

    }

    @Test
    public void testFreshnessLifetimeIsSMaxAgeIfPresent() {
        Header[] headers = new Header[] { new BasicHeader("Cache-Control", "s-maxage=10") };
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        assertEquals(10, impl.getFreshnessLifetimeSecs(entry));
    }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

    }

    @Test
    public void testFreshnessLifetimeIsMaxAgeIfPresent() {
        Header[] headers = new Header[] { new BasicHeader("Cache-Control", "max-age=10") };
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        assertEquals(10, impl.getFreshnessLifetimeSecs(entry));
    }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

    @Test
    public void testFreshnessLifetimeIsMostRestrictiveOfMaxAgeAndSMaxAge() {
        Header[] headers = new Header[] { new BasicHeader("Cache-Control", "max-age=10"),
                new BasicHeader("Cache-Control", "s-maxage=20") };
        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        assertEquals(10, impl.getFreshnessLifetimeSecs(entry));

        headers = new Header[] { new BasicHeader("Cache-Control", "max-age=20"),
                new BasicHeader("Cache-Control", "s-maxage=10") };
        entry = HttpTestUtils.makeCacheEntry(headers);
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

    public void testFreshnessLifetimeIsMaxAgeEvenIfExpiresIsPresent() {
        Header[] headers = new Header[] { new BasicHeader("Cache-Control", "max-age=10"),
                new BasicHeader("Date", DateUtils.formatDate(tenSecondsAgo)),
                new BasicHeader("Expires", DateUtils.formatDate(sixSecondsAgo)) };

        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        assertEquals(10, impl.getFreshnessLifetimeSecs(entry));
    }
View Full Code Here

Examples of org.apache.http.client.cache.HttpCacheEntry

    public void testFreshnessLifetimeIsSMaxAgeEvenIfExpiresIsPresent() {
        Header[] headers = new Header[] { new BasicHeader("Cache-Control", "s-maxage=10"),
                new BasicHeader("Date", DateUtils.formatDate(tenSecondsAgo)),
                new BasicHeader("Expires", DateUtils.formatDate(sixSecondsAgo)) };

        HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
        assertEquals(10, impl.getFreshnessLifetimeSecs(entry));
    }
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.