ASF Bugzilla – Attachment 27539 Details for
Bug 51847
[PATCH] Some Junit tests are Locale sensitive and fail if Locale is different from US
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Fix the bug
patch3.txt (text/plain), 4.49 KB, created by
benoit.wiart
on 2011-09-19 22:27:59 UTC
(
hide
)
Description:
Fix the bug
Filename:
MIME Type:
Creator:
benoit.wiart
Created:
2011-09-19 22:27:59 UTC
Size:
4.49 KB
patch
obsolete
>Index: test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java >=================================================================== >--- test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java (revision 1169873) >+++ test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java (working copy) >@@ -22,19 +22,18 @@ > import java.lang.reflect.Field; > import java.net.URL; > import java.net.URLConnection; >-import java.text.SimpleDateFormat; > import java.util.ArrayList; > import java.util.Date; > import java.util.HashMap; > import java.util.List; > import java.util.Map; >-import java.util.SimpleTimeZone; > > import org.apache.commons.httpclient.Header; > import org.apache.commons.httpclient.HttpMethod; > import org.apache.commons.httpclient.URI; > import org.apache.commons.httpclient.URIException; > import org.apache.commons.httpclient.methods.PostMethod; >+import org.apache.commons.httpclient.util.DateUtil; > import org.apache.commons.httpclient.util.HttpURLConnection; > import org.apache.jmeter.junit.JMeterTestCase; > import org.apache.jmeter.protocol.http.control.CacheManager.CacheEntry; >@@ -147,18 +146,12 @@ > super(name); > } > >- private String makeDate(Date d){ >- SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); >- simpleDateFormat.setTimeZone(new SimpleTimeZone(0, "GMT")); >- simpleDateFormat.applyPattern("EEE, dd MMM yyyy HH:mm:ss z"); >- return simpleDateFormat.format(d); >- } > > @Override > public void setUp() throws Exception { > super.setUp(); > this.cacheManager = new CacheManager(); >- this.currentTimeInGMT = makeDate(new Date()); >+ this.currentTimeInGMT = DateUtil.formatDate(new Date()); > this.uri = new URI(LOCAL_HOST, false); > this.url = new URL(LOCAL_HOST); > this.urlConnection = new URLConnectionStub(this.url.openConnection()); >@@ -185,7 +178,7 @@ > this.cacheManager.testIterationStart(null); > assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); > assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); >- ((URLConnectionStub)urlConnection).expires=makeDate(new Date(System.currentTimeMillis()+2000)); >+ ((URLConnectionStub)urlConnection).expires=DateUtil.formatDate(new Date(System.currentTimeMillis()+2000)); > this.cacheManager.saveDetails(this.urlConnection, sampleResultOK); > assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); > assertTrue("Should find valid entry",this.cacheManager.inCache(url)); >@@ -196,7 +189,7 @@ > this.cacheManager.testIterationStart(null); > assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); > assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); >- ((URLConnectionStub)urlConnection).expires=makeDate(new Date(System.currentTimeMillis()+2000)); >+ ((URLConnectionStub)urlConnection).expires=DateUtil.formatDate(new Date(System.currentTimeMillis()+2000)); > this.cacheManager.saveDetails(this.urlConnection, sampleResultOK); > assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); > assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); >@@ -207,7 +200,7 @@ > this.cacheManager.testIterationStart(null); > assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); > assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); >- ((HttpMethodStub)httpMethod).expires=makeDate(new Date(System.currentTimeMillis()+2000)); >+ ((HttpMethodStub)httpMethod).expires=DateUtil.formatDate(new Date(System.currentTimeMillis()+2000)); > this.cacheManager.saveDetails(httpMethod, sampleResultOK); > assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); > assertTrue("Should find valid entry",this.cacheManager.inCache(url)); >@@ -218,7 +211,7 @@ > this.cacheManager.testIterationStart(null); > assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); > assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); >- ((HttpMethodStub)httpMethod).expires=makeDate(new Date(System.currentTimeMillis())); >+ ((HttpMethodStub)httpMethod).expires=DateUtil.formatDate(new Date(System.currentTimeMillis())); > ((HttpMethodStub)httpMethod).cacheControl="public, max-age=10"; > this.cacheManager.saveDetails(httpMethod, sampleResultOK); > assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 51847
: 27539