@Test public void testCacheNoneStaleRequestRegression() throws IOException { HTTPRequest request = new HTTPRequest(REQUEST_URI, HTTPMethod.HEAD); Headers headers = new Headers(); headers = headers.add(new Header("Cache-Control", "private, max-age=65000")); headers = headers.add(HeaderUtils.toHttpDate(HeaderConstants.DATE, LocalDateTime.now())); HTTPResponse cachedResponse = new HTTPResponse(createClosedPayload(), Status.OK, headers); CacheItem item = new DefaultCacheItem(cachedResponse); when(cacheStorage.get(isA(HTTPRequest.class))).thenReturn(item); assertFalse(item.isStale(LocalDateTime.now())); HTTPResponse response = cache.execute(request); assertFalse(response.getPayload().isPresent()); verify(responseResolver, never()).resolve(request); }
public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); void clear(); CacheStorage getStorage(); ResponseResolver getResolver(); CacheStatistics getStatistics(); HTTPResponse execute(final HTTPRequest request); HTTPResponse executeRefresh(final HTTPRequest request); void shutdown(); boolean isTranslateHEADToGET(); void setTranslateHEADToGET(boolean translateHEADToGET); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); void clear(); CacheStorage getStorage(); ResponseResolver getResolver(); CacheStatistics getStatistics(); HTTPResponse execute(final HTTPRequest request); HTTPResponse executeRefresh(final HTTPRequest request); void shutdown(); boolean isTranslateHEADToGET(); void setTranslateHEADToGET(boolean translateHEADToGET);  }