hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [1/2] httpcomponents-client git commit: Removing unnecessary checks for cache invalidation calls.
Date Mon, 29 May 2017 19:17:06 GMT
Repository: httpcomponents-client
Updated Branches:
  refs/heads/4.5.x 0b6adcc59 -> dac57c57f


Removing unnecessary checks for cache invalidation calls.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/10ab37b7
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/10ab37b7
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/10ab37b7

Branch: refs/heads/4.5.x
Commit: 10ab37b775bd4f3fdf82c84ab59fbc30b41e8197
Parents: 0b6adcc
Author: Leandro Nunes <a-lnunes@hotels.com>
Authored: Thu May 18 15:12:05 2017 +0100
Committer: Leandro Nunes <a-lnunes@hotels.com>
Committed: Thu May 18 15:12:05 2017 +0100

----------------------------------------------------------------------
 .../org/apache/http/impl/client/cache/TestCachingExec.java  | 3 ---
 .../apache/http/impl/client/cache/TestCachingExecChain.java | 9 ---------
 .../http/impl/client/cache/TestProtocolRequirements.java    | 6 ------
 3 files changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/10ab37b7/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
index abda62a..553163a 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
@@ -170,7 +170,6 @@ public class TestCachingExec extends TestCachingExecChain {
     @Test
     public void testCacheMissCausesBackendRequest() throws Exception {
         mockImplMethods(CALL_BACKEND);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         getCacheEntryReturns(null);
         getVariantCacheEntriesReturns(new HashMap<String,Variant>());
@@ -192,7 +191,6 @@ public class TestCachingExec extends TestCachingExecChain {
     @Test
     public void testUnsuitableUnvalidatableCacheEntryCausesBackendRequest() throws Exception
{
         mockImplMethods(CALL_BACKEND);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         requestIsFatallyNonCompliant(null);
 
@@ -219,7 +217,6 @@ public class TestCachingExec extends TestCachingExecChain {
     @Test
     public void testUnsuitableValidatableCacheEntryCausesRevalidation() throws Exception
{
         mockImplMethods(REVALIDATE_CACHE_ENTRY);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         requestIsFatallyNonCompliant(null);
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/10ab37b7/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
index 852c1ca..f2ddc67 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
@@ -311,7 +311,6 @@ public abstract class TestCachingExecChain {
 
     @Test
     public void testSuitableCacheEntryDoesNotCauseBackendRequest() throws Exception {
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         getCacheEntryReturns(mockCacheEntry);
         cacheEntrySuitable(true);
@@ -352,7 +351,6 @@ public abstract class TestCachingExecChain {
     public void testResponseIsGeneratedWhenCacheEntryIsUsable() throws Exception {
 
         requestIsFatallyNonCompliant(null);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         cacheEntrySuitable(true);
         getCacheEntryReturns(mockCacheEntry);
@@ -1385,7 +1383,6 @@ public abstract class TestCachingExecChain {
             "must-revalidate") });
 
         requestIsFatallyNonCompliant(null);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         getCacheEntryReturns(entry);
         cacheEntrySuitable(false);
@@ -1403,7 +1400,6 @@ public abstract class TestCachingExecChain {
         request.setHeader("Cache-Control", "only-if-cached");
 
         requestIsFatallyNonCompliant(null);
-        cacheInvalidatorWasCalled();
         requestPolicyAllowsCaching(true);
         getCacheEntryReturns(entry);
         cacheEntrySuitable(true);
@@ -1733,11 +1729,6 @@ public abstract class TestCachingExecChain {
         expect(mockCache.getCacheEntry(eq(host), eqRequest(request))).andReturn(result);
     }
 
-    private void cacheInvalidatorWasCalled() throws IOException {
-        mockCache
-            .flushInvalidatedCacheEntriesFor((HttpHost) anyObject(), (HttpRequest) anyObject());
-    }
-
     protected void cacheEntryValidatable(final boolean b) {
         expect(mockValidityPolicy.isRevalidatable((HttpCacheEntry) anyObject())).andReturn(b)
             .anyTimes();

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/10ab37b7/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
index 3378083..27afcd5 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
@@ -2504,8 +2504,6 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         notModified.setHeader("Date", DateUtils.formatDate(now));
         notModified.setHeader("ETag", "\"etag\"");
 
-        mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host),
-                eqRequest(request));
         EasyMock.expect(
                 mockCache.getCacheEntry(EasyMock.eq(host), eqRequest(request)))
                 .andReturn(entry);
@@ -2551,7 +2549,6 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         impl = new CachingExec(mockBackend, mockCache, config);
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/thing", HttpVersion.HTTP_1_1));
 
-        mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host), eqRequest(request));
         EasyMock.expect(mockCache.getCacheEntry(EasyMock.eq(host), eqRequest(request))).andReturn(entry);
 
         replayMocks();
@@ -2599,7 +2596,6 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         impl = new CachingExec(mockBackend, mockCache, config);
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/thing", HttpVersion.HTTP_1_1));
 
-        mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host), eqRequest(request));
         EasyMock.expect(mockCache.getCacheEntry(EasyMock.eq(host), eqRequest(request))).andReturn(entry);
         EasyMock.expect(
                 mockBackend.execute(
@@ -2818,7 +2814,6 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         impl = new CachingExec(mockBackend, mockCache, config);
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/thing", HttpVersion.HTTP_1_1));
 
-        mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host), eqRequest(request));
         EasyMock.expect(mockCache.getCacheEntry(EasyMock.eq(host), eqRequest(request))).andReturn(entry);
 
         replayMocks();
@@ -2881,7 +2876,6 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
 
         final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
 
-        mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host), eqRequest(request));
         mockCache.flushInvalidatedCacheEntriesFor(
                 EasyMock.isA(HttpHost.class),
                 EasyMock.isA(HttpRequestWrapper.class),


Mime
View raw message