incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1205563 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
Date Wed, 23 Nov 2011 20:14:46 GMT
Author: fmeschbe
Date: Wed Nov 23 20:14:46 2011
New Revision: 1205563

URL: http://svn.apache.org/viewvc?rev=1205563&view=rev
Log:
SLING-2299 Browser check in the Sling Authenticator now uses the User-Agent (and not the Accept)
header.

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java?rev=1205563&r1=1205562&r2=1205563&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
Wed Nov 23 20:14:46 2011
@@ -34,7 +34,7 @@ public class RedirectOnLoginErrorTest ex
 	/** Execute a POST request and check status
      * @return the HttpMethod executed
      * @throws IOException */
-    private HttpMethod assertPostStatus(String url, int expectedStatusCode, List<NameValuePair>
postParams, 
+    private HttpMethod assertPostStatus(String url, int expectedStatusCode, List<NameValuePair>
postParams,
     					String assertMessage, String referer) throws IOException {
         final PostMethod post = new PostMethod(url);
         post.setFollowRedirects(false);
@@ -42,9 +42,9 @@ public class RedirectOnLoginErrorTest ex
 
         //set the referer to indicate where we came from
         post.setRequestHeader("Referer", referer);
-        
+
         //set Accept header to trick sling into treating the request as from a browser
-        post.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
+        post.setRequestHeader("User-Agent", "Mozilla/5.0 Sling Integration Test");
 
         if(postParams!=null) {
             final NameValuePair [] nvp = {};
@@ -64,11 +64,11 @@ public class RedirectOnLoginErrorTest ex
         }
         return post;
     }
-	
+
     /**
      * Test SLING-2165.  Login Error should redirect back to the referrer
      * login page.
-     * 
+     *
      * @throws Exception
      */
     public void testRedirectToSelectorLoginFormAfterLoginError() throws Exception {
@@ -77,12 +77,12 @@ public class RedirectOnLoginErrorTest ex
         params.add(new NameValuePair("j_username", "___bogus___"));
         params.add(new NameValuePair("j_password", "not_a_real_user"));
         final String loginPageUrl = String.format("%s/system/sling/selector/login", HTTP_BASE_URL);
-		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check", 
-        		HttpServletResponse.SC_MOVED_TEMPORARILY, 
-        		params, 
+		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check",
+        		HttpServletResponse.SC_MOVED_TEMPORARILY,
+        		params,
         		null,
         		loginPageUrl);
-        
+
         final Header locationHeader = post.getResponseHeader("Location");
         String location = locationHeader.getValue();
         int queryStrStart = location.indexOf('?');
@@ -95,7 +95,7 @@ public class RedirectOnLoginErrorTest ex
     /**
      * Test SLING-2165.  Login Error should redirect back to the referrer
      * login page.
-     * 
+     *
      * @throws Exception
      */
     public void testRedirectToOpenIDLoginFormAfterLoginError() throws Exception {
@@ -103,12 +103,12 @@ public class RedirectOnLoginErrorTest ex
         List<NameValuePair> params = new ArrayList<NameValuePair>();
         params.add(new NameValuePair("openid_identifier", "___bogus___"));
         final String loginPageUrl = String.format("%s/system/sling/openid/login", HTTP_BASE_URL);
-		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check", 
-        		HttpServletResponse.SC_MOVED_TEMPORARILY, 
-        		params, 
+		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check",
+        		HttpServletResponse.SC_MOVED_TEMPORARILY,
+        		params,
         		null,
         		loginPageUrl);
-        
+
         final Header locationHeader = post.getResponseHeader("Location");
         String location = locationHeader.getValue();
         int queryStrStart = location.indexOf('?');
@@ -121,7 +121,7 @@ public class RedirectOnLoginErrorTest ex
     /**
      * Test SLING-2165.  Login Error should redirect back to the referrer
      * login page.
-     * 
+     *
      * @throws Exception
      */
     public void testRedirectToLoginFormAfterLoginError() throws Exception {
@@ -130,12 +130,12 @@ public class RedirectOnLoginErrorTest ex
         params.add(new NameValuePair("j_username", "___bogus___"));
         params.add(new NameValuePair("j_password", "not_a_real_user"));
         final String loginPageUrl = String.format("%s/system/sling/form/login", HTTP_BASE_URL);
-		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check", 
-        		HttpServletResponse.SC_MOVED_TEMPORARILY, 
-        		params, 
+		PostMethod post = (PostMethod)assertPostStatus(HTTP_BASE_URL + "/j_security_check",
+        		HttpServletResponse.SC_MOVED_TEMPORARILY,
+        		params,
         		null,
         		loginPageUrl);
-        
+
         final Header locationHeader = post.getResponseHeader("Location");
         String location = locationHeader.getValue();
         int queryStrStart = location.indexOf('?');



Mime
View raw message