Author: sgala
Date: Thu May 15 02:11:20 2008
New Revision: 656561
URL: http://svn.apache.org/viewvc?rev=656561&view=rev
Log:
Simplify BasicHttpCacheTest to use HttpUtil to parse Expiry date
After the patch for SHINDIG-257 was applied, just this one
use of SimpleDateFormat was remaining, and it actually caused a bug
for non English locale users before it was patched. This patch
makes it simpler and it will also make easier doing the right thing
for people looking into the tests to learn how to use the code.
Modified:
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpCacheTest.java
Modified:
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpCacheTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpCacheTest.java?rev=656561&r1=656560&r2=656561&view=diff
==============================================================================
---
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpCacheTest.java
(original)
+++
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpCacheTest.java
Thu May 15 02:11:20 2008
@@ -19,9 +19,10 @@
import junit.framework.TestCase;
+import org.apache.shindig.gadgets.servlet.HttpUtil;
+
import java.net.URI;
import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
@@ -34,14 +35,6 @@
* Tests for basic content cache
*/
public class BasicHttpCacheTest extends TestCase {
- /**
- * Used to parse Expires: header.
- */
- private final static DateFormat dateFormat
- = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", Locale.US);
- static {
- dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
- }
private HttpCache cache;
@@ -76,7 +69,7 @@
private HttpResponse createExpiresResponse(int statusCode, long expiration) {
Date newExpiry = new Date(expiration);
- return createResponse(statusCode, "Expires", dateFormat.format(newExpiry));
+ return createResponse(statusCode, "Expires",
HttpUtil.formatDate(newExpiry));
}
private HttpResponse createMaxAgeResponse(int statusCode, long age) {