[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r979259 - in
From:       olegk () apache ! org
Date:       2010-07-26 12:20:02
Message-ID: 20100726122002.B9DCF2388A39 () eris ! apache ! org
[Download RAW message or body]

Author: olegk
Date: Mon Jul 26 12:20:02 2010
New Revision: 979259

URL: http://svn.apache.org/viewvc?rev=979259&view=rev
Log:
Refactored exception handling: replaced HttpCacheOperationException with a more \
generic IOException. This should provide a more natural way of signaling exceptions \
for file system based caches

Removed:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheOperationException.java
 Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheUpdateCallback.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
  httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCache.java


Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/main/java/org/apache/http/client/cache/HttpCache.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java \
Mon Jul 26 12:20:02 2010 @@ -26,18 +26,20 @@
  */
 package org.apache.http.client.cache;
 
+import java.io.IOException;
+
 /**
  * @since 4.1
  */
 public interface HttpCache {
 
-    void putEntry(String key, HttpCacheEntry entry) throws \
HttpCacheOperationException; +    void putEntry(String key, HttpCacheEntry entry) \
throws IOException;  
-    HttpCacheEntry getEntry(String key) throws HttpCacheOperationException;
+    HttpCacheEntry getEntry(String key) throws IOException;
 
-    void removeEntry(String key) throws HttpCacheOperationException;
+    void removeEntry(String key) throws IOException;
 
     void updateEntry(
-            String key, HttpCacheUpdateCallback callback) throws \
HttpCacheOperationException; +            String key, HttpCacheUpdateCallback \
callback) throws IOException;  
 }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheUpdateCallback.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/main/java/org/apache/http/client/cache/HttpCacheUpdateCallback.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheUpdateCallback.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheUpdateCallback.java \
Mon Jul 26 12:20:02 2010 @@ -26,6 +26,8 @@
  */
 package org.apache.http.client.cache;
 
+import java.io.IOException;
+
 public interface HttpCacheUpdateCallback {
 
     /**
@@ -36,11 +38,9 @@ public interface HttpCacheUpdateCallback
      *            <code>null</code> if nonexistent
      * @return CacheEntry the cache entry that should replace it, again,
      *         possible <code>null</code>
-     * @throws HttpCacheOperationException
-     *             exception containing information about a failure in the cache
      *
      * @since 4.1
      */
-    HttpCacheEntry update(HttpCacheEntry existing) throws \
HttpCacheOperationException; +    HttpCacheEntry update(HttpCacheEntry existing) \
throws IOException;  
 }
\ No newline at end of file

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java \
Mon Jul 26 12:20:02 2010 @@ -26,13 +26,13 @@
  */
 package org.apache.http.impl.client.cache;
 
+import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.client.cache.HttpCache;
 import org.apache.http.client.cache.HttpCacheEntry;
-import org.apache.http.client.cache.HttpCacheOperationException;
 import org.apache.http.client.cache.HttpCacheUpdateCallback;
 
 /**
@@ -69,7 +69,7 @@ public class BasicHttpCache implements H
      * @param entry
      *            HttpCacheEntry to place in the cache
      */
-    public synchronized void putEntry(String url, HttpCacheEntry entry) {
+    public synchronized void putEntry(String url, HttpCacheEntry entry) throws \
IOException {  baseMap.put(url, entry);
     }
 
@@ -80,7 +80,7 @@ public class BasicHttpCache implements H
      *            Url that is the cache key
      * @return HttpCacheEntry if one exists, or null for cache miss
      */
-    public synchronized HttpCacheEntry getEntry(String url) {
+    public synchronized HttpCacheEntry getEntry(String url) throws IOException {
         return baseMap.get(url);
     }
 
@@ -90,13 +90,13 @@ public class BasicHttpCache implements H
      * @param url
      *            Url that is the cache key
      */
-    public synchronized void removeEntry(String url) {
+    public synchronized void removeEntry(String url) throws IOException {
         baseMap.remove(url);
     }
 
     public synchronized void updateEntry(
             String url,
-            HttpCacheUpdateCallback callback) throws HttpCacheOperationException {
+            HttpCacheUpdateCallback callback) throws IOException {
         HttpCacheEntry existingEntry = baseMap.get(url);
         baseMap.put(url, callback.update(existingEntry));
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java \
Mon Jul 26 12:20:02 2010 @@ -26,6 +26,7 @@
  */
 package org.apache.http.impl.client.cache;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 
@@ -39,7 +40,6 @@ import org.apache.http.annotation.Thread
 import org.apache.http.client.cache.HeaderConstants;
 import org.apache.http.client.cache.HttpCache;
 import org.apache.http.client.cache.HttpCacheEntry;
-import org.apache.http.client.cache.HttpCacheOperationException;
 
 /**
  * Given a particular HttpRequest, flush any cache entries that this request
@@ -76,57 +76,50 @@ class CacheInvalidator {
      * @param host The backend host we are talking to
      * @param req The HttpRequest to that host
      */
-    public void flushInvalidatedCacheEntries(HttpHost host, HttpRequest req) {
+    public void flushInvalidatedCacheEntries(HttpHost host, HttpRequest req) throws \
IOException {  if (requestShouldNotBeCached(req)) {
             log.debug("Request should not be cached");
 
-            try {
-                String theUri = uriExtractor.getURI(host, req);
+            String theUri = uriExtractor.getURI(host, req);
 
-                HttpCacheEntry parent = cache.getEntry(theUri);
+            HttpCacheEntry parent = cache.getEntry(theUri);
 
-                log.debug("parent entry: " + parent);
+            log.debug("parent entry: " + parent);
 
-                if (parent != null) {
-                    for (String variantURI : parent.getVariantURIs()) {
-                        cache.removeEntry(variantURI);
-                    }
-                    cache.removeEntry(theUri);
-                }
-                URL reqURL;
-                try {
-                    reqURL = new URL(theUri);
-                } catch (MalformedURLException mue) {
-                    log.error("Couldn't transform request into valid URL");
-                    return;
+            if (parent != null) {
+                for (String variantURI : parent.getVariantURIs()) {
+                    cache.removeEntry(variantURI);
                 }
-                Header clHdr = req.getFirstHeader("Content-Location");
-                if (clHdr != null) {
-                    String contentLocation = clHdr.getValue();
-                    if (!flushAbsoluteUriFromSameHost(reqURL, contentLocation)) {
-                        flushRelativeUriFromSameHost(reqURL, contentLocation);
-                    }
-                }
-                Header lHdr = req.getFirstHeader("Location");
-                if (lHdr != null) {
-                    flushAbsoluteUriFromSameHost(reqURL, lHdr.getValue());
+                cache.removeEntry(theUri);
+            }
+            URL reqURL;
+            try {
+                reqURL = new URL(theUri);
+            } catch (MalformedURLException mue) {
+                log.error("Couldn't transform request into valid URL");
+                return;
+            }
+            Header clHdr = req.getFirstHeader("Content-Location");
+            if (clHdr != null) {
+                String contentLocation = clHdr.getValue();
+                if (!flushAbsoluteUriFromSameHost(reqURL, contentLocation)) {
+                    flushRelativeUriFromSameHost(reqURL, contentLocation);
                 }
-            } catch (HttpCacheOperationException ex) {
-                log.debug("Was unable to REMOVE an entry from the cache based on the \
                uri provided",
-                        ex);
+            }
+            Header lHdr = req.getFirstHeader("Location");
+            if (lHdr != null) {
+                flushAbsoluteUriFromSameHost(reqURL, lHdr.getValue());
             }
         }
     }
 
-    protected void flushUriIfSameHost(URL requestURL, URL targetURL)
-        throws HttpCacheOperationException {
+    protected void flushUriIfSameHost(URL requestURL, URL targetURL) throws \
                IOException {
         if (targetURL.getAuthority().equalsIgnoreCase(requestURL.getAuthority())) {
             cache.removeEntry(targetURL.toString());
         }
     }
 
-    protected void flushRelativeUriFromSameHost(URL reqURL, String relUri)
-        throws HttpCacheOperationException {
+    protected void flushRelativeUriFromSameHost(URL reqURL, String relUri) throws \
IOException {  URL relURL;
         try {
             relURL = new URL(reqURL,relUri);
@@ -137,8 +130,7 @@ class CacheInvalidator {
         flushUriIfSameHost(reqURL, relURL);
     }
 
-    protected boolean flushAbsoluteUriFromSameHost(URL reqURL, String uri)
-            throws HttpCacheOperationException {
+    protected boolean flushAbsoluteUriFromSameHost(URL reqURL, String uri) throws \
IOException {  URL absURL;
         try {
             absURL = new URL(uri);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java \
Mon Jul 26 12:20:02 2010 @@ -50,7 +50,6 @@ import org.apache.http.client.ResponseHa
 import org.apache.http.client.cache.HeaderConstants;
 import org.apache.http.client.cache.HttpCache;
 import org.apache.http.client.cache.HttpCacheEntry;
-import org.apache.http.client.cache.HttpCacheOperationException;
 import org.apache.http.client.cache.HttpCacheUpdateCallback;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.conn.ClientConnectionManager;
@@ -391,25 +390,16 @@ public class CachingHttpClient implement
         return new Date();
     }
 
-    HttpCacheEntry getCacheEntry(HttpHost target, HttpRequest request) {
+    HttpCacheEntry getCacheEntry(HttpHost target, HttpRequest request) throws \
IOException {  String uri = uriExtractor.getURI(target, request);
-        HttpCacheEntry entry = null;
-        try {
-            entry = responseCache.getEntry(uri);
-        } catch (HttpCacheOperationException ex) {
-            log.debug("Was unable to get an entry from the cache based on the uri \
                provided", ex);
-        }
+        HttpCacheEntry entry = responseCache.getEntry(uri);
 
         if (entry == null || !entry.hasVariants()) {
             return entry;
         }
 
         String variantUri = uriExtractor.getVariantURI(target, request, entry);
-        try {
-            return responseCache.getEntry(variantUri);
-        } catch (HttpCacheOperationException ex) {
-            return null;
-        }
+        return responseCache.getEntry(variantUri);
     }
 
     boolean clientRequestsOurOptions(HttpRequest request) {
@@ -471,7 +461,8 @@ public class CachingHttpClient implement
                                      backendResponse);
     }
 
-    void storeInCache(HttpHost target, HttpRequest request, HttpCacheEntry entry) {
+    void storeInCache(
+            HttpHost target, HttpRequest request, HttpCacheEntry entry) throws \
IOException {  if (entry.hasVariants()) {
             storeVariantEntry(target, request, entry);
         } else {
@@ -479,44 +470,33 @@ public class CachingHttpClient implement
         }
     }
 
-    void storeNonVariantEntry(HttpHost target, HttpRequest req, HttpCacheEntry \
entry) { +    void storeNonVariantEntry(
+            HttpHost target, HttpRequest req, HttpCacheEntry entry) throws \
IOException {  String uri = uriExtractor.getURI(target, req);
-        try {
-            responseCache.putEntry(uri, entry);
-        } catch (HttpCacheOperationException ex) {
-            log.debug("Was unable to PUT an entry into the cache based on the uri \
                provided", ex);
-        }
+        responseCache.putEntry(uri, entry);
     }
 
     void storeVariantEntry(
             final HttpHost target,
             final HttpRequest req,
-            final HttpCacheEntry entry) {
+            final HttpCacheEntry entry) throws IOException {
         final String variantURI = uriExtractor.getVariantURI(target, req, entry);
-        try {
-            responseCache.putEntry(variantURI, entry);
-        } catch (HttpCacheOperationException e) {
-            log.debug("Was unable to PUT a variant entry into the cache based on the \
                uri provided", e);
-        }
+        responseCache.putEntry(variantURI, entry);
 
         HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
 
-            public HttpCacheEntry update(HttpCacheEntry existing) throws \
HttpCacheOperationException { +            public HttpCacheEntry \
                update(HttpCacheEntry existing) {
                 return doGetUpdatedParentEntry(existing, entry, variantURI);
             }
 
         };
         String parentURI = uriExtractor.getURI(target, req);
-        try {
-            responseCache.updateEntry(parentURI, callback);
-        } catch (HttpCacheOperationException e) {
-            log.debug("Was unable to UPDATE a parent entry for a variant", e);
-        }
+        responseCache.updateEntry(parentURI, callback);
     }
 
     HttpCacheEntry doGetUpdatedParentEntry(
             HttpCacheEntry existing,
-            HttpCacheEntry entry, String variantURI) throws \
HttpCacheOperationException { +            HttpCacheEntry entry, String variantURI) {
         if (existing != null) {
             return HttpCacheEntry.copyWithVariant(existing, variantURI);
         } else {
@@ -585,11 +565,7 @@ public class CachingHttpClient implement
         }
 
         String uri = uriExtractor.getURI(target, request);
-        try {
-            responseCache.removeEntry(uri);
-        } catch (HttpCacheOperationException ex) {
-            log.debug("Was unable to remove an entry from the cache based on the uri \
                provided", ex);
-        }
+        responseCache.removeEntry(uri);
         return corrected;
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java \
Mon Jul 26 12:20:02 2010 @@ -26,6 +26,7 @@
  */
 package org.apache.http.impl.client.cache;
 
+import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -34,7 +35,6 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.client.cache.HttpCache;
-import org.apache.http.client.cache.HttpCacheOperationException;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.easymock.classextension.EasyMock;
@@ -186,7 +186,7 @@ public class TestCacheInvalidator {
     }
 
     @Test
-    public void testDoesNotInvalidateGETRequest() {
+    public void testDoesNotInvalidateGETRequest() throws Exception {
         HttpRequest request = new BasicHttpRequest("GET","/",HTTP_1_1);
 
         replayMocks();
@@ -197,7 +197,7 @@ public class TestCacheInvalidator {
     }
 
     @Test
-    public void testDoesNotInvalidateHEADRequest() {
+    public void testDoesNotInvalidateHEADRequest() throws Exception {
         HttpRequest request = new BasicHttpRequest("HEAD","/",HTTP_1_1);
 
         replayMocks();
@@ -244,7 +244,7 @@ public class TestCacheInvalidator {
     }
 
     @Test
-    public void testVariantURIsAreFlushedAlso() throws HttpCacheOperationException {
+    public void testVariantURIsAreFlushedAlso() throws Exception {
         HttpRequest request = new BasicHttpRequest("POST","/",HTTP_1_1);
 
         final String theUri = "http://foo.example.com/";
@@ -264,7 +264,7 @@ public class TestCacheInvalidator {
         verifyMocks();
     }
 
-    @Test
+    @Test(expected=IOException.class)
     public void testCacheFlushException() throws Exception {
         HttpRequest request = new BasicHttpRequest("POST","/",HTTP_1_1);
         String theURI = "http://foo.example.com/";
@@ -273,7 +273,6 @@ public class TestCacheInvalidator {
 
         replayMocks();
         impl.flushInvalidatedCacheEntries(host, request);
-        verifyMocks();
     }
 
     // Expectations
@@ -283,16 +282,16 @@ public class TestCacheInvalidator {
         org.easymock.EasyMock.expect(mockEntry.getVariantURIs()).andReturn(variantURIs);
  }
 
-    private void cacheReturnsEntryForUri(String theUri) throws \
HttpCacheOperationException { +    private void cacheReturnsEntryForUri(String \
                theUri) throws IOException {
         org.easymock.EasyMock.expect(mockCache.getEntry(theUri)).andReturn(mockEntry);
  }
 
-    private void cacheReturnsExceptionForUri(String theUri) throws \
HttpCacheOperationException { +    private void cacheReturnsExceptionForUri(String \
                theUri) throws IOException {
         org.easymock.EasyMock.expect(mockCache.getEntry(theUri)).andThrow(
-                new HttpCacheOperationException("TOTAL FAIL"));
+                new IOException("TOTAL FAIL"));
     }
 
-    private void entryIsRemoved(String theUri) throws HttpCacheOperationException {
+    private void entryIsRemoved(String theUri) throws IOException {
         mockCache.removeEntry(theUri);
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java \
Mon Jul 26 12:20:02 2010 @@ -1068,7 +1068,7 @@ public class TestCachingHttpClient {
 
     }
 
-    private void cacheInvalidatorWasCalled() {
+    private void cacheInvalidatorWasCalled()  throws IOException {
         mockInvalidator.flushInvalidatedCacheEntries(host, mockRequest);
     }
 
@@ -1094,7 +1094,7 @@ public class TestCachingHttpClient {
                                                        \
mockBackendResponse)).andReturn(mockUpdatedCacheEntry);  }
 
-    private void getCacheEntryReturns(CacheEntry entry) {
+    private void getCacheEntryReturns(CacheEntry entry) throws IOException {
         EasyMock.expect(impl.getCacheEntry(host, mockRequest)).andReturn(entry);
     }
 
@@ -1235,11 +1235,11 @@ public class TestCachingHttpClient {
                                            \
mockBackendResponse)).andReturn(response);  }
 
-    private void storeInCacheWasCalled() {
+    private void storeInCacheWasCalled() throws IOException {
         impl.storeInCache(host, mockRequest, mockCacheEntry);
     }
 
-    private void storeInCacheWasCalled(CacheEntry entry) {
+    private void storeInCacheWasCalled(CacheEntry entry) throws IOException {
         impl.storeInCache(host, mockRequest, entry);
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCache.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src \
/test/java/org/apache/http/impl/client/cache/TestResponseCache.java?rev=979259&r1=979258&r2=979259&view=diff
 ==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCache.java \
                (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCache.java \
Mon Jul 26 12:20:02 2010 @@ -46,7 +46,7 @@ public class TestResponseCache {
     }
 
     @Test
-    public void testEntryRemainsInCacheWhenPutThere() {
+    public void testEntryRemainsInCacheWhenPutThere() throws Exception {
         cache.putEntry("foo", entry);
 
         HttpCacheEntry cachedEntry = cache.getEntry("foo");
@@ -55,7 +55,7 @@ public class TestResponseCache {
     }
 
     @Test
-    public void testRemovedEntriesDoNotExistAnymore() {
+    public void testRemovedEntriesDoNotExistAnymore() throws Exception {
         cache.putEntry("foo", entry);
 
         cache.removeEntry("foo");
@@ -66,7 +66,7 @@ public class TestResponseCache {
     }
 
     @Test
-    public void testCacheHoldsNoMoreThanSpecifiedMaxEntries() {
+    public void testCacheHoldsNoMoreThanSpecifiedMaxEntries() throws Exception {
         BasicHttpCache cache = new BasicHttpCache(1);
 
         HttpCacheEntry entry1 = new CacheEntry();
@@ -89,7 +89,7 @@ public class TestResponseCache {
     }
 
     @Test
-    public void testSmallCacheKeepsMostRecentlyUsedEntry() {
+    public void testSmallCacheKeepsMostRecentlyUsedEntry() throws Exception {
 
         final int max_size = 3;
         BasicHttpCache cache = new BasicHttpCache(max_size);
@@ -120,7 +120,7 @@ public class TestResponseCache {
     }
 
     @Test
-    public void testZeroMaxSizeCacheDoesNotStoreAnything() {
+    public void testZeroMaxSizeCacheDoesNotStoreAnything() throws Exception {
         BasicHttpCache cache = new BasicHttpCache(0);
 
         HttpCacheEntry entry = new CacheEntry();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic