Author: tolusha
Date: 2010-08-25 10:39:42 -0400 (Wed, 25 Aug 2010)
New Revision: 2988
Modified:
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/ext/TestCaching.java
Log:
EXOJCR-879: test fixed
Modified:
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/ext/TestCaching.java
===================================================================
---
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/ext/TestCaching.java 2010-08-25
08:34:21 UTC (rev 2987)
+++
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/ext/TestCaching.java 2010-08-25
14:39:42 UTC (rev 2988)
@@ -63,52 +63,52 @@
{
Node contentNode = node.getNode("jcr:content");
Property lastModifiedProperty =
contentNode.getProperty("jcr:lastModified");
-
+
SimpleDateFormat dateFormat = new
SimpleDateFormat(WebDavConst.DateFormat.IF_MODIFIED_SINCE_PATTERN, Locale.US);
Calendar lastModifiedDate = lastModifiedProperty.getDate();
-
- lastModifiedDate.roll(Calendar.SECOND, -10);
+
+ lastModifiedDate.add(Calendar.SECOND, -10);
// Rollback If-Modified-Since 10 seconds earlier.
String ifModifiedDate = dateFormat.format(lastModifiedDate.getTime());
-
+
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.add(ExtHttpHeaders.IF_MODIFIED_SINCE, ifModifiedDate);
ContainerResponse response = service(WebDAVMethods.GET, getPathWS() + path,
"", headers, null);
-
+
assertEquals(HTTPStatus.OK, response.getStatus());
}
-
+
public void testIfModifiedSince() throws Exception
{
Node contentNode = node.getNode("jcr:content");
Property lastModifiedProperty =
contentNode.getProperty("jcr:lastModified");
-
+
SimpleDateFormat dateFormat = new
SimpleDateFormat(WebDavConst.DateFormat.IF_MODIFIED_SINCE_PATTERN, Locale.US);
Calendar lastModifiedDate = lastModifiedProperty.getDate();
-
+
lastModifiedDate.add(Calendar.WEEK_OF_MONTH, 1);
String ifModifiedDate = dateFormat.format(lastModifiedDate.getTime());
-
+
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.add(ExtHttpHeaders.IF_MODIFIED_SINCE, ifModifiedDate);
ContainerResponse response = service(WebDAVMethods.GET, getPathWS() + path,
"", headers, null);
-
+
assertEquals(HTTPStatus.NOT_MODIFIED, response.getStatus());
}
public void _testModifiedSinceLocaleFR() throws Exception
{
- SimpleDateFormat sdf = new
SimpleDateFormat(WebDavConst.DateFormat.IF_MODIFIED_SINCE_PATTERN, Locale.FRENCH);
+ SimpleDateFormat sdf = new
SimpleDateFormat(WebDavConst.DateFormat.IF_MODIFIED_SINCE_PATTERN, Locale.FRENCH);
String ifModifiedDate = sdf.format(sdf.getCalendar().getTime());
-
+
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.add(ExtHttpHeaders.IF_MODIFIED_SINCE, ifModifiedDate);
ContainerResponse response = service(WebDAVMethods.GET, getPathWS() + path,
"", headers, null);
-
+
assertEquals(HTTPStatus.OK, response.getStatus());
}
-
+
public void testCacheConf() throws Exception
{
ArrayList<CacheControlType> testValues = new
ArrayList<CacheControlType>();
Show replies by date