You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2021/05/10 15:15:43 UTC

[sling-org-apache-sling-launchpad-integration-tests] branch master updated: SLING-10366 Adjust HTTP status codes for SlingPostServlet integration tests

This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git


The following commit(s) were added to refs/heads/master by this push:
     new b1941cd  SLING-10366 Adjust HTTP status codes for SlingPostServlet integration tests
b1941cd is described below

commit b1941cdc7f1b4d9c0c907ee595a0707e1a9033d3
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon May 10 17:15:03 2021 +0200

    SLING-10366 Adjust HTTP status codes for SlingPostServlet integration tests
---
 .../integrationtest/servlets/post/PostServletAtCopyTest.java      | 2 +-
 .../webapp/integrationtest/servlets/post/PostServletCopyTest.java | 2 +-
 .../integrationtest/servlets/post/PostServletCreateTest.java      | 8 ++++----
 .../integrationtest/servlets/post/PostServletImportTest.java      | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletAtCopyTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletAtCopyTest.java
index acbb1a9..8860c57 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletAtCopyTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletAtCopyTest.java
@@ -228,7 +228,7 @@ public class PostServletAtCopyTest extends HttpTestBase {
         final List<NameValuePair> opt = new ArrayList<NameValuePair>();
         opt.add(new NameValuePair(testPath + "./@CopyFrom", "../"));
         
-        final int expectedStatus = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+        final int expectedStatus = HttpServletResponse.SC_CONFLICT;
         assertPostStatus(HTTP_BASE_URL + testPath, expectedStatus, opt, "Expecting status " + expectedStatus);
     }
  }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
index 7c68d09..bce4dea 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
@@ -615,7 +615,7 @@ public class PostServletCopyTest extends HttpTestBase {
         opt.add(new NameValuePair(SlingPostConstants.RP_OPERATION, SlingPostConstants.OPERATION_COPY));
         opt.add(new NameValuePair(SlingPostConstants.RP_DEST, childPath));
         
-        final int expectedStatus = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+        final int expectedStatus = HttpServletResponse.SC_CONFLICT;
         assertPostStatus(testRoot, expectedStatus, opt, "Expecting status " + expectedStatus);
     }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
index 146dc04..2db3432 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
@@ -192,8 +192,8 @@ public class PostServletCreateTest extends HttpTestBase {
 		String location = postUrl + SLASH;
 		List<NameValuePair> postParams = new ArrayList<NameValuePair>();
 		postParams.add(new NameValuePair(SlingPostConstants.RP_NODE_NAME, "exactNodeName*"));
-		//expect a 500 status since the name is invalid
-		assertPostStatus(location, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
+		//expect a 409 status since the name is invalid
+		assertPostStatus(location, HttpServletResponse.SC_CONFLICT, postParams, null);
     }
 
     /**
@@ -252,10 +252,10 @@ public class PostServletCreateTest extends HttpTestBase {
         list.add(new NameValuePair("prop", "value"));
         list.add(new NameValuePair("jcr:primaryType", "nt:unstructured"));
 
-        assertPostStatus(childUrl, 500, list,
+        assertPostStatus(childUrl, HttpServletResponse.SC_CONFLICT, list,
                 "Response to creating a child under nt:file should fail.");
         // we shouldn't check for a specific exception as that one is implementation specific (see SLING-2763)
-        // a result of 500 is enough.
+        // a result of 409 is enough.
     }
 
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletImportTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletImportTest.java
index c971304..cbe86e4 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletImportTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletImportTest.java
@@ -323,7 +323,7 @@ public class PostServletImportTest extends HttpTestBase {
         postParams.add(new NameValuePair(SlingPostConstants.RP_REPLACE_PROPERTIES, "true"));
         postParams.add(new NameValuePair(SlingPostConstants.RP_AUTO_CHECKOUT, "false"));
         postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT, "{ \"abc\": \"def2\" }"));
-        assertPostStatus(importedNodeUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, "Expected error from VersionException");
+        assertPostStatus(importedNodeUrl, HttpServletResponse.SC_CONFLICT, postParams, "Expected error from VersionException");
 
 		//3. now try an update with the :autoCheckout value set to true
         postParams.clear();
@@ -760,9 +760,9 @@ public class PostServletImportTest extends HttpTestBase {
 		postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT_TYPE, "json"));
 		postParams.add(new NameValuePair(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + "/*"));
 
-        //expect a 500 status since the name is invalid
+        //expect a 409 status since the name is invalid
         String location = HTTP_BASE_URL + testPath;
-		assertPostStatus(location, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
+		assertPostStatus(location, HttpServletResponse.SC_CONFLICT, postParams, null);
     }
 
     /**