roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r479652 - in /incubator/roller/trunk: ./ testdata/ tests/org/apache/roller/ant/ tools/buildtime/
Date Mon, 27 Nov 2006 15:11:14 GMT
Author: snoopdave
Date: Mon Nov 27 07:11:13 2006
New Revision: 479652

URL: http://svn.apache.org/viewvc?view=rev&rev=479652
Log:
Moving from HSQLDB to Derby for JUnit tests

Added:
    incubator/roller/trunk/tests/org/apache/roller/ant/StartDerbyTask.java
    incubator/roller/trunk/tests/org/apache/roller/ant/StopDerbyTask.java
    incubator/roller/trunk/tools/buildtime/derby.jar   (with props)
    incubator/roller/trunk/tools/buildtime/derbyclient.jar   (with props)
    incubator/roller/trunk/tools/buildtime/derbynet.jar   (with props)
Removed:
    incubator/roller/trunk/tests/org/apache/roller/ant/StartHsqldbTask.java
    incubator/roller/trunk/tests/org/apache/roller/ant/StopHsqldbTask.java
Modified:
    incubator/roller/trunk/build.xml
    incubator/roller/trunk/properties.xmlf
    incubator/roller/trunk/testdata/roller-custom.properties

Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/build.xml?view=diff&rev=479652&r1=479651&r2=479652
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Mon Nov 27 07:11:13 2006
@@ -893,10 +893,10 @@
     </copy>
     
     <!-- register Ant tasks that were just built -->
-    <taskdef name="startdb" classname="org.apache.roller.ant.StartHsqldbTask" 
-        classpath="${ro.tools}/buildtime/hsqldb.jar;${build.compile.tests}" />
-    <taskdef name="stopdb" classname="org.apache.roller.ant.StopHsqldbTask" 
-        classpath="${ro.tools}/buildtime/hsqldb.jar;${build.compile.tests}" />
+    <taskdef name="startdb" classname="org.apache.roller.ant.StartDerbyTask" 
+        classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}"
/>
+    <taskdef name="stopdb" classname="org.apache.roller.ant.StopDerbyTask" 
+        classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}"
/>
     
     <!-- 
     Copy web config files to ${build.tests} to make them available for testing.
@@ -1168,22 +1168,23 @@
 <target name="init-db" description=
     "Initializes built-in database by running drop table and create table">
     &custom-post-dbtest;
-    <sql driver="org.hsqldb.jdbcDriver"
-         url="jdbc:hsqldb:hsql://localhost:3219"
-         userid="sa" password=""
+    <sql driver="org.apache.derby.jdbc.ClientDriver"
+         url="jdbc:derby://localhost:3219/roller;create=true"
+         userid="app" password="app"
          src="${build.webapp}/WEB-INF/dbscripts/droptables.sql" onerror="continue"
-         classpath="${ro.tools}/buildtime/hsqldb.jar" />    
-    <sql driver="org.hsqldb.jdbcDriver"
-         url="jdbc:hsqldb:hsql://localhost:3219"
-         userid="sa" password=""
-         src="${build.webapp}/WEB-INF/dbscripts/hsqldb/createdb.sql"
-         classpath="${ro.tools}/buildtime/hsqldb.jar" />    
+         classpath="${ro.tools}/buildtime/derbyclient.jar" />    
+    <sql driver="org.apache.derby.jdbc.ClientDriver" onerror="continue"
+         url="jdbc:derby://localhost:3219/roller"
+         userid="app" password="app"
+         src="${build.webapp}/WEB-INF/dbscripts/derby/createdb.sql"
+         classpath="${ro.tools}/buildtime/derbyclient.jar" /> 
     &custom-pre-dbtest;
 </target>
 
 <target name="start-db" description="Starts built-in database">  
-    <startdb database="${build.tests}/testdb" port="3219" />
+    <startdb database="${build.tests}/derby-system/roller" port="3219" />
     <!-- 
+    <delete dir="${build.tests}/derby-system/roller" />
     Not sure we need that custom 'startdb' task if this plain old Ant works:
     <java classname="org.hsqldb.Server"  
         fork="yes" spawn="true" classpath="./tools/buildtime/hsqldb.jar">
@@ -1192,12 +1193,13 @@
         <arg value="-port"/>
         <arg value="3219"/>
     </java>
-    -->
+    -->    
 </target>
         
 <target name="stop-db" description="Drop tables and stops the built-in database"> 
 
     <stopdb port="3219"/>
     <!--
+    <delete dir="${build.tests}/derby-system/roller" />
     This below code does the same thing as 'stopdb' but the 'sql' task throws 
     an exception when HSQLDB disconnects and that causes a build failure, so 
     for now I'm keeping the custom 'startdb' and 'stopdb' Ant tasks.

Modified: incubator/roller/trunk/properties.xmlf
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/properties.xmlf?view=diff&rev=479652&r1=479651&r2=479652
==============================================================================
--- incubator/roller/trunk/properties.xmlf (original)
+++ incubator/roller/trunk/properties.xmlf Mon Nov 27 07:11:13 2006
@@ -198,7 +198,9 @@
     <pathelement location="${ro.tools}/buildtime/ant-1.6.2/ant.jar"/>
     <pathelement location="${ro.tools}/buildtime/strutstest-2.0.0.jar"/>
     <pathelement location="${ro.tools}/buildtime/junit-3.8.1.jar"/>
-    <pathelement location="${ro.tools}/buildtime/hsqldb.jar"/>
+    <pathelement location="${ro.tools}/buildtime/derby.jar"/>
+    <pathelement location="${ro.tools}/buildtime/derbyclient.jar"/>
+    <pathelement location="${ro.tools}/buildtime/derbynet.jar"/>
 
     <!-- plus normal jars -->
     <path refid="business.path"/>

Modified: incubator/roller/trunk/testdata/roller-custom.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/testdata/roller-custom.properties?view=diff&rev=479652&r1=479651&r2=479652
==============================================================================
--- incubator/roller/trunk/testdata/roller-custom.properties (original)
+++ incubator/roller/trunk/testdata/roller-custom.properties Mon Nov 27 07:11:13 2006
@@ -11,9 +11,14 @@
 
 search.index.dir=search-index
 
-jdbc.driverClass=org.hsqldb.jdbcDriver
-jdbc.connectionURL=jdbc:hsqldb:hsql://localhost:3219
-jdbc.username=sa
-jdbc.password=
+jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
+jdbc.connectionURL=jdbc:derby://localhost:3219/roller
+jdbc.username=APP
+jdbc.password=APP
+hibernate.dialect=org.hibernate.dialect.DerbyDialect
 
-hibernate.dialect=org.hibernate.dialect.HSQLDialect
+#jdbc.driverClass=org.hsqldb.jdbcDriver
+#jdbc.connectionURL=jdbc:hsqldb:hsql://localhost:3219
+#jdbc.username=sa
+#jdbc.password=
+#hibernate.dialect=org.hibernate.dialect.HSQLDialect

Added: incubator/roller/trunk/tests/org/apache/roller/ant/StartDerbyTask.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/ant/StartDerbyTask.java?view=auto&rev=479652
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/ant/StartDerbyTask.java (added)
+++ incubator/roller/trunk/tests/org/apache/roller/ant/StartDerbyTask.java Mon Nov 27 07:11:13
2006
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.ant;
+
+import java.io.PrintWriter;
+import org.apache.derby.drda.NetworkServerControl;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Ant Task to start Derby
+ * @author Dave Johnson
+ */
+public class StartDerbyTask extends Task {
+    private String database = null;
+    private String port = null;
+    
+    public void execute() throws BuildException {
+        try {
+            System.out.println("Stopping Derby");
+            System.setProperty("derby.system.home", database);
+            System.setProperty("derby.drda.portNumber", port);
+            System.setProperty("derby.drda.host", "localhost");
+            NetworkServerControl server = new NetworkServerControl();
+            server.start(new PrintWriter(System.out));
+            try {Thread.sleep(2000);} catch (Exception ignored) {}
+        } catch (Exception e) {
+            throw new BuildException("Unable to load Derby driver");
+        }
+        
+    }
+    /**
+     * @return Returns the database.
+     */
+    public String getDatabase() {
+        return database;
+    }
+    /**
+     * @param database The database to set.
+     */
+    public void setDatabase(String database) {
+        this.database = database;
+    }
+    /**
+     * @return Returns the port.
+     */
+    public String getPort() {
+        return port;
+    }
+    /**
+     * @param port The port to set.
+     */
+    public void setPort(String port) {
+        this.port = port;
+    }
+}

Added: incubator/roller/trunk/tests/org/apache/roller/ant/StopDerbyTask.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/ant/StopDerbyTask.java?view=auto&rev=479652
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/ant/StopDerbyTask.java (added)
+++ incubator/roller/trunk/tests/org/apache/roller/ant/StopDerbyTask.java Mon Nov 27 07:11:13
2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.ant;
+
+import org.apache.derby.drda.NetworkServerControl;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Ant Task to stop Derby
+ * @author Dave Johnson
+ */
+public class StopDerbyTask extends Task {
+    private String port = null;
+    public void execute() throws BuildException {
+        try {
+            System.out.println("Stopping Derby");
+            System.setProperty("derby.drda.portNumber", port);
+            System.setProperty("derby.drda.host", "localhost");
+            NetworkServerControl server = new NetworkServerControl();
+            server.shutdown();
+            try {Thread.sleep(2000);} catch (Exception ignored) {}
+
+        } catch (Exception e) {
+            throw new BuildException(e.getMessage());
+        }
+    }
+    /**
+     * @return Returns the port.
+     */
+    public String getPort() {
+        return port;
+    }
+    /**
+     * @param port The port to set.
+     */
+    public void setPort(String port) {
+        this.port = port;
+    }
+}

Added: incubator/roller/trunk/tools/buildtime/derby.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tools/buildtime/derby.jar?view=auto&rev=479652
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/derby.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/derbyclient.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tools/buildtime/derbyclient.jar?view=auto&rev=479652
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/derbyclient.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/derbynet.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tools/buildtime/derbynet.jar?view=auto&rev=479652
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/derbynet.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message