[jboss-cvs] JBossAS SVN: r76164 - in trunk/testsuite: src/main/org/jboss/test/web/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 24 00:00:05 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-07-24 00:00:05 -0400 (Thu, 24 Jul 2008)
New Revision: 76164

Modified:
   trunk/testsuite/imports/sections/web.xml
   trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/web/test/SSOBaseCase.java
   trunk/testsuite/src/main/org/jboss/test/web/test/SingleSignOnUnitTestCase.java
   trunk/testsuite/src/resources/web/sso/application.xml
   trunk/testsuite/src/resources/web/sso/clustered-application.xml
Log:
[JBAS-4669] Port ClusteredSingleSignOn testNoAuthSingleSignOn test to trunk

Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/imports/sections/web.xml	2008-07-24 04:00:05 UTC (rev 76164)
@@ -400,6 +400,23 @@
            <include name="**/*.jsp"/>
          </fileset>
       </war>
+      <war destfile="${build.lib}/sso-with-no-auth.war"
+         webxml="${build.resources}/web/sso/war/web-form-auth.xml">
+<!-- Exclude jboss-web.xml so the war will not have an authenticator          
+         <webinf dir="${build.resources}/web/sso/war">
+            <include name="jboss-web.xml"/>
+         </webinf>
+-->         
+         <classes dir="${build.classes}">
+            <include name="org/jboss/test/web/servlets/EJBServlet.class"/>
+            <include name="org/jboss/test/web/servlets/LogoutServlet.class"/>
+            <include name="org/jboss/test/web/util/Util*"/>
+         </classes>
+         <fileset dir="${build.resources}/web/sso/war">
+            <include name="**/*.html"/>
+            <include name="**/*.jsp"/>
+         </fileset>
+      </war>
       <ear earfile="${build.lib}/web-sso.ear"
       	   appxml="${build.resources}/web/sso/application.xml">
          <zipfileset dir="${build.resources}/web">
@@ -410,6 +427,8 @@
             fullpath="sso-form-auth1.war"/>
          <zipfileset dir="${build.lib}" includes="sso-form-auth.war"
             fullpath="sso-form-auth2.war"/>
+         <zipfileset dir="${build.lib}" includes="sso-with-no-auth.war"
+            fullpath="sso-with-no-auth.war"/>
          <zipfileset dir="${build.lib}" includes="jbosstest-web-ejbs.jar"/>
       </ear>
       <ear earfile="${build.lib}/web-sso-clustered.ear"
@@ -427,6 +446,8 @@
            fullpath="sso-form-auth4.war"/>
         <zipfileset dir="${build.lib}" includes="sso-form-auth.war"
            fullpath="sso-form-auth5.war"/>
+         <zipfileset dir="${build.lib}" includes="sso-with-no-auth.war"
+            fullpath="sso-with-no-auth.war"/>
          <zipfileset dir="${build.lib}" includes="jbosstest-web-ejbs.jar"/>
       </ear>
 

Modified: trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java	2008-07-24 04:00:05 UTC (rev 76164)
@@ -195,6 +195,23 @@
       SSOBaseCase.executeFormAuthSingleSignOnTest(serverA, serverB, getLog());
    }
    
+   /** Test single sign-on across two web apps using form based auth
+    * 
+    * @throws Exception
+    */ 
+   public void testNoAuthSingleSignOn() throws Exception
+   {
+      log.info("+++ testNoAuthSingleSignOn");
+      String[] httpURLs  = super.getHttpURLs();
+
+      String serverA = httpURLs[0];
+      String serverB = httpURLs[1];
+      log.info(System.getProperties());
+      log.info("serverA: "+serverA);
+      log.info("serverB: "+serverB);
+      SSOBaseCase.executeNoAuthSingleSignOnTest(serverA, serverB, getLog());
+   }
+   
    /** 
     * Tests that use of transactions in ClusteredSSO does not interfere 
     * with session expiration thread.  See JBAS-2212.

Modified: trunk/testsuite/src/main/org/jboss/test/web/test/SSOBaseCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/SSOBaseCase.java	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/SSOBaseCase.java	2008-07-24 04:00:05 UTC (rev 76164)
@@ -101,6 +101,53 @@
       
    }
 
+   protected static void executeNoAuthSingleSignOnTest(String serverA, String serverB, Logger log)
+         throws Exception
+   {
+      String warA1 = serverA + "/war1/";
+      String warB2 = serverB + "/war2/";
+      String warB6 = serverB + "/war6/";
+      
+      // Start by accessing the secured index.html of war1
+      HttpClient httpConn = new HttpClient();
+
+      checkAccessDenied(httpConn, warA1 + "index.html");
+
+      HttpState state = httpConn.getState();
+
+      String sessionID = getSessionIdFromState(state);
+      log.debug("Saw JSESSIONID=" + sessionID);
+
+      // Submit the login form
+      executeFormLogin(httpConn, warA1);
+
+      String ssoID = processSSOCookie(state, serverA, serverB);
+      log.debug("Saw JSESSIONIDSSO=" + ssoID);
+
+      // Pause a moment before switching wars to better simulate real life
+      // use cases.  Otherwise, the test case can "outrun" the async
+      // replication in the TreeCache used by the clustered SSO
+      // 500 ms is a long time, but this isn't a test of replication speed
+      // and we don't want spurious failures.
+      if (!serverA.equals(serverB))
+         Thread.sleep(500);
+
+      // Now try getting the war2 index using the JSESSIONIDSSO cookie 
+      log.debug("Prepare /war2/index.html get");
+      checkAccessAllowed(httpConn, warB2 + "index.html");
+
+      /* Access a secured servlet that calls a secured ejb in war2 to test
+       propagation of the SSO identity to the ejb container. */
+      checkAccessAllowed(httpConn, warB2 + "EJBServlet");
+      
+      /* do the same test on war6 to test SSO auth replication with no 
+         auth configured war */ 
+      checkAccessAllowed(httpConn, warB6 + "index.html");
+      
+      checkAccessAllowed(httpConn, warB2 + "EJBServlet");
+
+   }
+
    public static void executeLogout(HttpClient httpConn, String warURL) throws IOException, HttpException
    {
       GetMethod logout = new GetMethod(warURL + "Logout");

Modified: trunk/testsuite/src/main/org/jboss/test/web/test/SingleSignOnUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/SingleSignOnUnitTestCase.java	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/SingleSignOnUnitTestCase.java	2008-07-24 04:00:05 UTC (rev 76164)
@@ -57,7 +57,18 @@
       SSOBaseCase.executeFormAuthSingleSignOnTest(baseURLNoAuth, baseURLNoAuth, getLog());
       
    }
+   
+   /** Test single sign-on across two web apps using form based auth
+    * 
+    * @throws Exception
+    */ 
+   public void testNoAuthSingleSignOn() throws Exception
+   {
+      log.info("+++ testNoAuthSingleSignOn");
 
+      SSOBaseCase.executeNoAuthSingleSignOnTest(baseURLNoAuth, baseURLNoAuth, getLog());
+   }
+
    /** One time setup for all SingleSignOnUnitTestCase unit tests
     */
    public static Test suite() throws Exception

Modified: trunk/testsuite/src/resources/web/sso/application.xml
===================================================================
--- trunk/testsuite/src/resources/web/sso/application.xml	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/src/resources/web/sso/application.xml	2008-07-24 04:00:05 UTC (rev 76164)
@@ -19,6 +19,12 @@
       </web>
    </module>
    <module>
+      <web>
+         <web-uri>sso-with-no-auth.war</web-uri>
+         <context-root>/war6</context-root>
+      </web>
+   </module>
+   <module>
       <ejb>jbosstest-web-ejbs.jar</ejb>
    </module>
 </application>

Modified: trunk/testsuite/src/resources/web/sso/clustered-application.xml
===================================================================
--- trunk/testsuite/src/resources/web/sso/clustered-application.xml	2008-07-24 03:57:11 UTC (rev 76163)
+++ trunk/testsuite/src/resources/web/sso/clustered-application.xml	2008-07-24 04:00:05 UTC (rev 76164)
@@ -35,6 +35,12 @@
          <web-uri>sso-form-auth5.war</web-uri>
          <context-root>/war5</context-root>
       </web>
+   </module>
+   <module>
+      <web>
+         <web-uri>sso-with-no-auth.war</web-uri>
+         <context-root>/war6</context-root>
+      </web>
    </module>
    <module>
       <ejb>jbosstest-web-ejbs.jar</ejb>




More information about the jboss-cvs-commits mailing list