Author: metskem
Date: Sun Dec 30 11:57:09 2012
New Revision: 1426919

URL: http://svn.apache.org/viewvc?rev=1426919&view=rev
Log:
       * 2.9.1-svn-9
       
       * repaired broken webtests, we now have one (documented) failing webtest 
(RenameProfile 
          for container managed auth).
          Required fixes:
          - TestContainer now binds the jdbc/UserDatabase jdbc/GroupDatabase in 
Jetty's namespace
          - Logout webtest checks for the specific JSPWikiAssertedName cookie
          - build.xml was missing a lot of tasks and macros, required to 
properly startup hsqldb (don't know how/why)
          - JDBCGroupDatabase : NamingExceptions do not have a cause, we now 
log the exception itself
          - removed the semicolon from the License in .ddl files (they cause 
syntax errors)

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/build.xml
    incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl
    incubator/jspwiki/trunk/etc/db/hsql/userdb-teardown.ddl
    incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
    
incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
    incubator/jspwiki/trunk/tests/etc/selenium/readme.txt
    incubator/jspwiki/trunk/tests/etc/selenium/tests/all/Logout.html
    incubator/jspwiki/trunk/tests/org/apache/wiki/web/TestContainer.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Dec 30 11:57:09 2012
@@ -1,3 +1,16 @@
+2012-12-30  Harry Metske <[email protected]>
+
+       * 2.9.1-svn-9
+       
+       * repaired broken webtests, we now have one (documented) failing 
webtest (RenameProfile 
+          for container managed auth).
+          Required fixes:
+          - TestContainer now binds the jdbc/UserDatabase jdbc/GroupDatabase 
in Jetty's namespace
+          - Logout webtest checks for the specific JSPWikiAssertedName cookie
+          - build.xml was missing a lot of tasks and macros, required to 
properly startup hsqldb (don't know how/why)
+          - JDBCGroupDatabase : NamingExceptions do not have a cause, we now 
log the exception itself
+          - removed the semicolon from the License in .ddl files (they cause 
syntax errors)
+        
 2012-12-26  Juan Pablo Santos (juanpablo AT apache DOT org)
 
        * 2.9.1-svn-8

Modified: incubator/jspwiki/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.xml?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/build.xml (original)
+++ incubator/jspwiki/trunk/build.xml Sun Dec 30 11:57:09 2012
@@ -906,7 +906,7 @@
        - 'admin' with password 'myP@5sw0rd' and roles of 'Authenticated', 
'Admin'
        These are the same as the test users in 
tests/org.apache.wiki.auth.Users.
   -->
-  <target name="webtests" depends="jar,tests-init,jartests,tests-db-init,war">
+  <target name="webtests" 
depends="jar,tests-init,jartests,tests-db-init,db-setup,war">
     <mkdir dir="${webtests.temp}" />
     <mkdir dir="${webtests.build}" />
   
@@ -965,7 +965,8 @@
     <webtest-exec context="test-container" />
     <webtest-exec context="test-custom-jdbc" />
     <webtest-exec context="test-container-jdbc" />
-    <webtest-exec context="test-custom-absolute" />
+    <webtest-exec context="test-custom-absolute" />  
+    
     <echo>The web unit tests have finished. You can find the test reports in 
${webtests.reports}.
     
 If all of the tests ran successfully, the reports will all be "green."</echo>
@@ -1099,7 +1100,7 @@ If all of the tests ran successfully, th
         -->
         <arg line="@{context}=${webtests.build}/@{context}/webapp" />
       </java>
-
+        
       <!-- Start Selenium tests -->
       <echo message="Running web unit tests for context '@{context}'."/>
       <java jar="${selenium-rc.jar}" fork="true"
@@ -1516,11 +1517,22 @@ To automate the JAR signing processs, yo
 
     <!-- Set a flag that says all of our pre-conditions are met! -->
     <property name="db.props.exist" value="true" />
+    <echo message="All pre-conditions met for HSQLDB setup"/>
 
     <!-- Dump all of the JDBC properties where our test scripts can find them 
-->
     <echoproperties prefix="jdbc." 
destfile="${tests.src}/etc/db/jdbc.properties" />
   </target>
 
+  <target name="db-setup" depends="db-properties,hsql-init" 
if="db.props.exist">
+    <echo message="Setting up the database tables." />
+    <exec-sql file="${userdb.setup}" />
+  </target>
+
+  <target name="db-teardown" depends="db-properties,hsql-init" 
if="db.props.exist">
+    <echo message="Tearing down the database tables." />
+    <exec-sql file="${userdb.teardown}" />
+  </target>
+
   <!-- Some convenience macrodefs -->
   <macrodef name="check-property">
     <attribute name="prop"/>
@@ -1538,6 +1550,60 @@ To automate the JAR signing processs, yo
     </sequential>
   </macrodef>
 
+  <macrodef name="exec-sql">
+    <attribute name="file" />
+    <sequential>
+      <sql driver="${jdbc.driver.class}"
+        classpath="${jdbc.driver.jar}" url="${jdbc.driver.url}"
+        userid="${jdbc.admin.id}" password="${jdbc.admin.password}"
+        src="@{file}" onerror="continue" autocommit="true" />
+    </sequential>
+  </macrodef>
+
+  <!-- ============================================================== -->
+
+  <!-- Hypersonic embedded database startup/shutdown (for testing JDBC) -->
+
+  <!-- Special "init" target for Hypersonic -->
+  <target name="hsql-init" depends="hsql-check-start,hsql-start" />
+
+  <target name="hsql-check-start" depends="db-properties">
+    <echo message="Checking to see if Hypersonic JDBC server is running 
already." />
+    <property file="tests/etc/db/hsql/server.properties" prefix="hsql" />
+    <fail unless="hsql.server.port">Failed to load Hypersonic JDBC properties 
from tests/etc/db/hsql/server.properties</fail>
+    <condition property="hsql.up">
+      <socket server="localhost" port="${hsql.server.port}" />
+    </condition>
+  </target>
+
+  <target name="hsql-start" depends="hsql-check-start" unless="hsql.up"
+    description="Starts the Hypersonic database for testing.">
+    <echo message="Starting up Hypersonic JDBC server on localhost." />
+    <delete file="tests/etc/db/hsql/jspwiki.lck"/>
+    <java fork="yes" spawn="yes" classname="org.hsqldb.Server"
+      dir="tests/etc/db/hsql">
+      <classpath>
+        <pathelement location="${jdbc.driver.jar}" />
+      </classpath>
+    </java>
+    <sleep seconds="3" />
+  </target>
+
+  <target name="hsql-stop" depends="hsql-check-start" if="hsql.up"
+    description="Shuts down the Hypersonic database, if it's up.">
+    <echo message="Shutting down Hypersonic JDBC server on localhost." />
+    <sql driver="${jdbc.driver.class}"
+      classpath="${jdbc.driver.jar}" url="${jdbc.driver.url}"
+      onerror="continue" autocommit="true"
+      userid="${jdbc.admin.id}" password="${jdbc.admin.password}">
+      SHUTDOWN
+    </sql>
+    <!-- The lock file should be deleted automatically, but just in case... -->
+    <delete file="tests/etc/db/hsql/jspwiki.lck" />
+    <echo message="Done." />
+  </target>
+
+  
   <!-- ============================================================== -->
   <target name="i18n-create-template" description="Creates a given directory 
structure with all the needed files to make an i18n jar">
        <input message="i18n template code to generate (ie: es_ES):" 
addproperty="i18n.template" />

Modified: incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl (original)
+++ incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl Sun Dec 30 11:57:09 
2012
@@ -1,5 +1,5 @@
 /*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *

Modified: incubator/jspwiki/trunk/etc/db/hsql/userdb-teardown.ddl
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/db/hsql/userdb-teardown.ddl?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/db/hsql/userdb-teardown.ddl (original)
+++ incubator/jspwiki/trunk/etc/db/hsql/userdb-teardown.ddl Sun Dec 30 11:57:09 
2012
@@ -1,5 +1,5 @@
 /*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/Release.java?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/Release.java Sun Dec 30 
11:57:09 2012
@@ -75,7 +75,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "8";
+    public static final String     BUILD         = "9";
     
     /**
      *  This is the generic version string you should use

Modified: 
incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
 (original)
+++ 
incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
 Sun Dec 30 11:57:09 2012
@@ -520,9 +520,8 @@ public class JDBCGroupDatabase implement
         }
         catch( NamingException e )
         {
-            log.error( "JDBCGroupDatabase initialization error: " + 
e.getMessage() );
-            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: "
-                                                                            + 
e.getMessage() );
+            log.error( "JDBCGroupDatabase initialization error: " + e );
+            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: " + e);
         }
 
         // Test connection by doing a quickie select
@@ -536,9 +535,8 @@ public class JDBCGroupDatabase implement
         }
         catch( SQLException e )
         {
-            log.error( "JDBCGroupDatabase initialization error: " + 
e.getMessage() );
-            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: "
-                                                                            + 
e.getMessage() );
+            log.error( "JDBCGroupDatabase initialization error: " + e );
+            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: " + e );
         }
         finally
         {
@@ -566,9 +564,8 @@ public class JDBCGroupDatabase implement
         }
         catch( SQLException e )
         {
-            log.warn( "JDBCGroupDatabase warning: user database doesn't seem 
to support transactions. Reason: " + e.getMessage() );
-            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: "
-                                                                            + 
e.getMessage() );
+            log.warn( "JDBCGroupDatabase warning: user database doesn't seem 
to support transactions. Reason: " + e);
+            throw new NoRequiredPropertyException( PROP_GROUPDB_DATASOURCE, 
"JDBCGroupDatabase initialization error: " + e);
         }
         finally
         {

Modified: incubator/jspwiki/trunk/tests/etc/selenium/readme.txt
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/etc/selenium/readme.txt?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/etc/selenium/readme.txt (original)
+++ incubator/jspwiki/trunk/tests/etc/selenium/readme.txt Sun Dec 30 11:57:09 
2012
@@ -30,16 +30,14 @@ Here's a quick start to selenium web uni
 
     * Type 'ant webtests' from the command line
     
-    * You may find it useful to restart Tomcat before running webtests
-
-RUNNING SELENIUM TESTS IN FIREFOX
+RUNNING SELENIUM TESTS MANUALLY IN FIREFOX
 ---------------------------------
 
 Start Tomcat and deploy the test-custom WAR.
 
 Start the Selenium server...
 
-java -jar tests/lib/selenium-server-1.0-beta1.jar -interactive
+java -jar tests/lib/selenium-server-standalone-2.25.0.jar -interactive
 
 Open Firefox.
 Set the browser proxy to localhost:4444

Modified: incubator/jspwiki/trunk/tests/etc/selenium/tests/all/Logout.html
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/etc/selenium/tests/all/Logout.html?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/etc/selenium/tests/all/Logout.html (original)
+++ incubator/jspwiki/trunk/tests/etc/selenium/tests/all/Logout.html Sun Dec 30 
11:57:09 2012
@@ -33,7 +33,6 @@
        <tr><td>store</td>      <td>${baseUrl}/Login.jsp</td>                   
<td>loginurl</td></tr>
        <tr><td>store</td>      <td>janne</td>                  
<td>TestUsername</td></tr>
     <tr><td>store</td> <td>myP@5sw0rd</td>             
<td>TestPassword</td></tr>
-       <tr><td>store</td>      <td>Janne\+Jalkanen</td>        
<td>wikiname</td></tr>
 
        <!-- Start at front page: try to log in -->
     <tr><td>open</td>  <td>${loginurl}</td>    <td>&nbsp;</td></tr>
@@ -47,7 +46,7 @@
     <tr><td>verifyTextPresent</td>             <td>G&#8217;day</td>    
<td>&nbsp;</td></tr>
     <tr><td>verifyTextPresent</td>             
<td>(authenticated)</td><td>&nbsp;</td></tr>
 
-    <tr><td>assertCookie</td>  <td>regex:JSPWikiAssertedName=${wikiname}</td>  
<td></td></tr>
+    <tr><td>assertCookieByName</td>    <td>JSPWikiAssertedName</td>    
<td>"Janne+Jalkanen"</td></tr>
 
     <!-- Log out; we should NOT see any asserted identities -->
     <tr><td>assertElementPresent</td>  <td>link=Log out</td>   <td></td></tr>
@@ -56,7 +55,7 @@
     <tr><td>verifyTextPresent</td>     <td>G&#8217;day (anonymous guest)</td>  
<td>&nbsp;</td></tr>
     <tr><td>verifyTitle</td>           <td>JSPWiki: Main</td>  
<td>&nbsp;</td></tr>
 
-    <tr><td>assertNotCookie</td>       
<td>regex:JSPWikiAssertedName=${wikiname}</td>  <td></td></tr>
+    <tr><td>assertNotCookie</td>       <td>JSPWikiAssertedName</td>    
<td></td></tr>
     
        </tbody>
 </table>

Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/web/TestContainer.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/web/TestContainer.java?rev=1426919&r1=1426918&r2=1426919&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/org/apache/wiki/web/TestContainer.java 
(original)
+++ incubator/jspwiki/trunk/tests/org/apache/wiki/web/TestContainer.java Sun 
Dec 30 11:57:09 2012
@@ -68,9 +68,11 @@ public class TestContainer
     
     public static final String INITIAL_CONTEXT_FACTORY = 
"java.naming.factory.initial";
     public static final String INITIAL_CONTEXT_FACTORY_JETTY = 
"org.eclipse.jetty.jndi.InitialContextFactory";
+    public static final String JNDI_ENV_ROOT = "java:comp/env";
 
     private static final Logger log = Logger.getLogger( TestContainer.class );
-    
+
+    private static Context initCtx ;
     private static Resource userDB = null;        
     private static Resource groupDB = null;        
 
@@ -116,11 +118,12 @@ public class TestContainer
         // Configure and bind DataSource to JNDI for user database
         userDB = new Resource( "jdbc/UserDatabase", cpds );
         log.error( "Configured datasource " + userDB);
+        userDB.bindToENC("jdbc/UserDatabase");
         
         // Configure and bind DataSource to JNDI for group database
         groupDB = new Resource( "jdbc/GroupDatabase", cpds );        
         log.error( "Configured datasource " + groupDB);
-
+        userDB.bindToENC("jdbc/GroupDatabase");
         
         // Start the server
         try
@@ -210,18 +213,18 @@ public class TestContainer
         }
         log.error( "Initialized JNDI with context factory class=" + 
contextFactoryClass + "." );
         
-        // Bind the "java:comp" namespace if not bound already
-        Context initCtx = new InitialContext();
+        // Bind the "java:comp/env" namespace if not bound already
+        initCtx = new InitialContext();
         try 
         {
-            initCtx.lookup( "java:comp" );
+            initCtx.lookup( JNDI_ENV_ROOT );
         }
         catch ( NameNotFoundException e )
         {
-            initCtx.bind( "java:comp", new NamingContext(new Hashtable<String, 
Object>(), "java:comp", null, new InitialContextFactory.DefaultParser()) );
-            log.error( "No JNDI java:comp namespace found; creating it," );
+            initCtx.bind( JNDI_ENV_ROOT, new NamingContext(new 
Hashtable<String, Object>(), JNDI_ENV_ROOT, null, new 
InitialContextFactory.DefaultParser()) );
+            log.error( "No JNDI " + JNDI_ENV_ROOT + " namespace found; 
creating it," );
         }
-        log.info( "Initialized JNDI java:comp namespace.=" + 
contextFactoryClass );
+        log.info( "Initialized JNDI " + JNDI_ENV_ROOT + " namespace.=" + 
contextFactoryClass );
         
         // Initialize new Jetty server
         log.info( "Creating new test container." );


Reply via email to