Removing unnecessary checks for cache invalidation calls.
This commit is contained in:
parent
0b6adcc598
commit
10ab37b775
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue