incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1091328 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
Date Tue, 12 Apr 2011 09:06:36 GMT
Author: bdelacretaz
Date: Tue Apr 12 09:06:35 2011
New Revision: 1091328

URL: http://svn.apache.org/viewvc?rev=1091328&view=rev
Log:
SLING-2050 - use an invalid operation instead of recursive copy for PostServletOutputContentTypeTest

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java?rev=1091328&r1=1091327&r2=1091328&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
Tue Apr 12 09:06:35 2011
@@ -79,22 +79,22 @@ public class PostServletOutputContentTyp
     }
     
     public void testJsonContentTypeException() throws Exception {
-      final String testPath = MY_TEST_PATH + "/abs/" + System.currentTimeMillis();
-      final String url = HTTP_BASE_URL + "/" + MY_TEST_PATH;
-
-      // create dest as parent
-      testClient.createNode(HTTP_BASE_URL + testPath + "/dest", null);
 
-      // Perform a POST that should fail.
+      // Perform a POST that fails: invalid PostServlet operation
+      // with Accept header set to JSON  
+      final String url = HTTP_BASE_URL + "/" + MY_TEST_PATH;
       final PostMethod post = new PostMethod(url);
       post.setFollowRedirects(false);
-      post.addParameter(new NameValuePair(SlingPostConstants.RP_DEST, testPath + "/dest/"));
-      post.addParameter(new NameValuePair(SlingPostConstants.RP_OPERATION,
-          SlingPostConstants.OPERATION_COPY));
+      post.addParameter(new NameValuePair(
+          SlingPostConstants.RP_OPERATION,
+          "InvalidTestOperationFor" + getClass().getSimpleName()));
       post.addRequestHeader("Accept", CONTENT_TYPE_JSON);
 
       final int status = httpClient.executeMethod(post);
       assertEquals(500, status);
+      final String contentType = post.getResponseHeader("Content-Type").getValue();
+      final String expected = CONTENT_TYPE_JSON;
+      assertTrue("Expecting content-type " + expected + " for failed POST request, got "
+ contentType,
+              contentType!=null && contentType.startsWith(expected));
     }
-
 }



Mime
View raw message