You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2008/05/05 06:07:28 UTC
svn commit: r653295 - in /db/ddlutils/trunk: ./ src/antdoc/ src/check/
src/doc/ src/java/ src/java/org/ src/main/ src/main/antdoc/
src/main/checkstyle/ src/main/doc/ src/main/java/ src/main/java/org/
src/main/misc/ src/main/resources/ src/schema/ src/t...
Author: tomdz
Date: Sun May 4 21:07:26 2008
New Revision: 653295
URL: http://svn.apache.org/viewvc?rev=653295&view=rev
Log:
First part of directory reorganization to make DdlUtils more Maven-friendly; Started updating the pom.xml; Some testcase fixes
Added:
db/ddlutils/trunk/src/main/
db/ddlutils/trunk/src/main/antdoc/
- copied from r650023, db/ddlutils/trunk/src/antdoc/
db/ddlutils/trunk/src/main/checkstyle/
- copied from r650023, db/ddlutils/trunk/src/check/
db/ddlutils/trunk/src/main/doc/
- copied from r650023, db/ddlutils/trunk/src/doc/
db/ddlutils/trunk/src/main/java/
db/ddlutils/trunk/src/main/java/org/
- copied from r650023, db/ddlutils/trunk/src/java/org/
db/ddlutils/trunk/src/main/misc/
- copied from r650023, db/ddlutils/trunk/src/xml/
db/ddlutils/trunk/src/main/resources/
db/ddlutils/trunk/src/main/resources/database.dtd
- copied unchanged from r650023, db/ddlutils/trunk/src/java/database.dtd
db/ddlutils/trunk/src/main/resources/database.xsd
- copied unchanged from r650023, db/ddlutils/trunk/src/java/database.xsd
db/ddlutils/trunk/src/main/resources/mapping.xml
- copied unchanged from r650023, db/ddlutils/trunk/src/java/mapping.xml
db/ddlutils/trunk/src/test/org/apache/ddlutils/TestAgainstLiveDatabaseBase.java
- copied, changed from r650023, db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java
Removed:
db/ddlutils/trunk/src/antdoc/
db/ddlutils/trunk/src/check/
db/ddlutils/trunk/src/doc/
db/ddlutils/trunk/src/java/database.dtd
db/ddlutils/trunk/src/java/database.xsd
db/ddlutils/trunk/src/java/mapping.xml
db/ddlutils/trunk/src/java/org/
db/ddlutils/trunk/src/schema/
db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
db/ddlutils/trunk/src/xml/
Modified:
db/ddlutils/trunk/.classpath
db/ddlutils/trunk/.project
db/ddlutils/trunk/pom.xml
db/ddlutils/trunk/src/test/jdbc.properties.db2
db/ddlutils/trunk/src/test/jdbc.properties.firebird
db/ddlutils/trunk/src/test/jdbc.properties.hsqldb
db/ddlutils/trunk/src/test/jdbc.properties.mysql50
db/ddlutils/trunk/src/test/jdbc.properties.oracle10
db/ddlutils/trunk/src/test/jdbc.properties.postgresql
db/ddlutils/trunk/src/test/jdbc.properties.sqlserver2005
db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAddColumn.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestChangeColumn.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDropColumn.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestInsertColumn.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestMisc.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestDropTablesCommand.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestTaskBase.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestWriteSchemaToFileCommand.java
Modified: db/ddlutils/trunk/.classpath
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/.classpath?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/.classpath (original)
+++ db/ddlutils/trunk/.classpath Sun May 4 21:07:26 2008
@@ -1,19 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" output="target/test" path="src/test"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.0.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/dom4j-1.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-digester-1.7.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-codec-1.3.jar"/>
- <classpathentry kind="lib" path="lib/build-only/ant-1.6.5.jar"/>
- <classpathentry kind="lib" path="lib/build-only/junit-3.8.2.jar"/>
- <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.8.jar"/>
+ <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test"/>
+ <classpathentry including="**/*.java" kind="src" path="src/java"/>
+ <classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: db/ddlutils/trunk/.project
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/.project?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/.project (original)
+++ db/ddlutils/trunk/.project Sun May 4 21:07:26 2008
@@ -1,36 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. 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.
--->
<projectDescription>
- <name>DdlUtils</name>
- <comment>
+ <name>DdlUtils</name>
+ <comment>
</comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
+ </natures>
+</projectDescription>
Modified: db/ddlutils/trunk/pom.xml
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/pom.xml?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/pom.xml (original)
+++ db/ddlutils/trunk/pom.xml Sun May 4 21:07:26 2008
@@ -30,7 +30,7 @@
<groupId>org.apache.ddlutils</groupId>
<artifactId>ddlutils</artifactId>
<packaging>jar</packaging>
- <version>1.0</version>
+ <version>1.1</version>
<name>Apache DdlUtils</name>
<description>
DdlUtils is a small, easy-to-use component for working with Database Definition (DDL) files.
@@ -118,11 +118,6 @@
<version>1.7.0</version>
</dependency>
<dependency>
- <groupId>commons-betwixt</groupId>
- <artifactId>commons-betwixt</artifactId>
- <version>0.8</version>
- </dependency>
- <dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
@@ -185,18 +180,13 @@
<version>1.0.1</version>
</dependency>
<dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- <version>2.0.8</version>
- </dependency>
- <dependency>
<groupId>woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.0.2</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
-
+<!--
<dependency>
<groupId>axion</groupId>
<artifactId>axion</artifactId>
@@ -233,13 +223,10 @@
<version>8.1-404.jdbc3</version>
<scope>test</scope>
</dependency>
+ -->
<!-- NB: No public driver for DB2, interbase, sapdb, oracle, sqlserver -->
</dependencies>
- <properties>
- <jdbc.properties.file>/jdbc.properties.hsqldb</jdbc.properties.file>
- </properties>
-
<build>
<sourceDirectory>src/java</sourceDirectory>
<resources>
@@ -248,6 +235,7 @@
<includes>
<include>**.dtd</include>
<include>**.xml</include>
+ <include>**.xsd</include>
</includes>
</resource>
</resources>
@@ -260,21 +248,40 @@
</includes>
</testResource>
</testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- TODO Need user configuration and review all tests for all platforms -->
- <skip>true</skip>
- <systemProperties>
- <property>
- <name>jdbc.properties.file</name>
- <value>${jdbc.properties.file}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
</build>
+
+ <profiles>
+ <profile>
+ <activation>
+ <property>
+ <name>testDb</name>
+ <value>hsqldb</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>jdbc.properties.file</name>
+ <value>/jdbc.properties.hsqldb</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: db/ddlutils/trunk/src/test/jdbc.properties.db2
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.db2?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.db2 (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.db2 Sun May 4 21:07:26 2008
@@ -18,14 +18,14 @@
# under the License.
# Use this property if ddlutils does not recognize the platform from the settings
-#ddlutils.platform=Db2
+ddlutils.platform=Db2v8
# Properties starting with "datasource." will be fed into the datasource instance of the
# class configured via the datasource.class property
datasource.class=org.apache.commons.dbcp.BasicDataSource
-datasource.driverClassName=COM.ibm.db2.jdbc.net.DB2Driver
-datasource.url=jdbc:db2://localhost:6789/ddlutils
+datasource.driverClassName=com.ibm.db2.jcc.DB2Driver
+datasource.url=jdbc:db2://192.168.55.129:50000/ddlutils
datasource.username=ddlutils
datasource.password=ddlutils
Modified: db/ddlutils/trunk/src/test/jdbc.properties.firebird
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.firebird?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.firebird (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.firebird Sun May 4 21:07:26 2008
@@ -29,7 +29,7 @@
datasource.class=org.apache.commons.dbcp.BasicDataSource
datasource.driverClassName=org.firebirdsql.jdbc.FBDriver
-datasource.url=jdbc:firebirdsql://localhost/C:/Programme/Firebird/Firebird_1_5/data/ddlutils.fdb
+datasource.url=jdbc:firebirdsql://192.168.55.129/C:/Program Files/Firebird/Firebird_2_0/data/ddlutils.fdb
datasource.username=SYSDBA
datasource.password=masterkey
Modified: db/ddlutils/trunk/src/test/jdbc.properties.hsqldb
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.hsqldb?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.hsqldb (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.hsqldb Sun May 4 21:07:26 2008
@@ -33,6 +33,6 @@
# Server mode
-datasource.url=jdbc:hsqldb:hsql://localhost
+datasource.url=jdbc:hsqldb:hsql://localhost/ddlutils
datasource.username=sa
datasource.password=
Modified: db/ddlutils/trunk/src/test/jdbc.properties.mysql50
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.mysql50?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.mysql50 (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.mysql50 Sun May 4 21:07:26 2008
@@ -29,9 +29,9 @@
datasource.class=org.apache.commons.dbcp.BasicDataSource
datasource.driverClassName=com.mysql.jdbc.Driver
-datasource.url=jdbc:mysql://localhost/ddlutils
-datasource.username=root
-datasource.password=
+datasource.url=jdbc:mysql://192.168.55.129/ddlutils
+datasource.username=ddlutils
+datasource.password=ddlutils
# We want to test against InnoDB tables (so that we get e.g. foreign keys)
ddlutils.tableCreation.ENGINE=InnoDB
Modified: db/ddlutils/trunk/src/test/jdbc.properties.oracle10
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.oracle10?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.oracle10 (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.oracle10 Sun May 4 21:07:26 2008
@@ -27,21 +27,21 @@
# Using the plain DBCP datasource
#
-#datasource.class=org.apache.commons.dbcp.BasicDataSource
-#datasource.driverClassName=oracle.jdbc.driver.OracleDriver
-#datasource.url=jdbc:oracle:thin:@localhost:1521:test
-#datasource.username=ddlutils
-#datasource.password=ddlutils
+datasource.class=org.apache.commons.dbcp.BasicDataSource
+datasource.driverClassName=oracle.jdbc.driver.OracleDriver
+datasource.url=jdbc:oracle:thin:@192.168.55.129:1521:XE
+datasource.username=ddlutils
+datasource.password=ddlutils
#
# Or the Oracle datasource
#
-datasource.class=oracle.jdbc.pool.OracleDataSource
-datasource.URL=jdbc:oracle:thin:@localhost:1521:test
-datasource.user=ddlutils
-datasource.password=ddlutils
-datasource.connectionCachingEnabled=true
+#datasource.class=oracle.jdbc.pool.OracleDataSource
+#datasource.URL=jdbc:oracle:thin:@192.168.55.129:1521:XE
+#datasource.user=ddlutils
+#datasource.password=ddlutils
+#datasource.connectionCachingEnabled=true
# For oracle, we should limit the schema to the one of the user
Modified: db/ddlutils/trunk/src/test/jdbc.properties.postgresql
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.postgresql?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.postgresql (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.postgresql Sun May 4 21:07:26 2008
@@ -29,7 +29,7 @@
datasource.class=org.apache.commons.dbcp.BasicDataSource
datasource.driverClassName=org.postgresql.Driver
-datasource.url=jdbc:postgresql://localhost/ddlutils
+datasource.url=jdbc:postgresql://192.168.55.129/ddlutils
datasource.username=ddlutils
datasource.password=ddlutils
Modified: db/ddlutils/trunk/src/test/jdbc.properties.sqlserver2005
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/jdbc.properties.sqlserver2005?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.sqlserver2005 (original)
+++ db/ddlutils/trunk/src/test/jdbc.properties.sqlserver2005 Sun May 4 21:07:26 2008
@@ -26,7 +26,7 @@
datasource.class=org.apache.commons.dbcp.BasicDataSource
datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
-datasource.url=jdbc:sqlserver://localhost;databaseName=ddlutils;selectMethod=cursor
+datasource.url=jdbc:sqlserver://192.168.55.129;databaseName=ddlutils;selectMethod=cursor
datasource.username=ddlutils
datasource.password=ddlutils
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java Sun May 4 21:07:26 2008
@@ -82,7 +82,7 @@
*
* @param args The invocation arguments
*/
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
junit.textui.TestRunner.run(suite());
}
@@ -92,7 +92,7 @@
*
* @return The test suite
*/
- public static Test suite()
+ public static Test suite() throws Exception
{
TestSuite suite = new TestSuite("DdlUtils tests");
@@ -123,21 +123,16 @@
suite.addTestSuite(TestSybasePlatform.class);
suite.addTestSuite(TestModelComparison.class);
suite.addTestSuite(TestAlterationAlgorithm.class);
-
- // tests that need a live database
- if (System.getProperty(TestDatabaseWriterBase.JDBC_PROPERTIES_PROPERTY) != null)
- {
- suite.addTestSuite(TestDynaSqlQueries.class);
- suite.addTestSuite(TestDatatypes.class);
- suite.addTestSuite(TestConstraints.class);
- suite.addTestSuite(TestAlteration.class);
- suite.addTestSuite(TestAddColumn.class);
- suite.addTestSuite(TestChangeColumn.class);
- suite.addTestSuite(TestDropColumn.class);
- suite.addTestSuite(TestMisc.class);
- suite.addTestSuite(TestDropTablesCommand.class);
- suite.addTestSuite(TestWriteSchemaToFileCommand.class);
- }
+ suite.addTest(TestDynaSqlQueries.suite());
+ suite.addTest(TestDatatypes.suite());
+ suite.addTest(TestConstraints.suite());
+ suite.addTest(TestAlteration.suite());
+ suite.addTest(TestAddColumn.suite());
+ suite.addTest(TestChangeColumn.suite());
+ suite.addTest(TestDropColumn.suite());
+ suite.addTest(TestMisc.suite());
+ suite.addTest(TestDropTablesCommand.suite());
+ suite.addTest(TestWriteSchemaToFileCommand.suite());
return suite;
}
Copied: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestAgainstLiveDatabaseBase.java (from r650023, db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java)
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestAgainstLiveDatabaseBase.java?p2=db/ddlutils/trunk/src/test/org/apache/ddlutils/TestAgainstLiveDatabaseBase.java&p1=db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java&r1=650023&r2=653295&rev=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestAgainstLiveDatabaseBase.java Sun May 4 21:07:26 2008
@@ -24,6 +24,8 @@
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@ -37,11 +39,13 @@
import javax.sql.DataSource;
import junit.framework.AssertionFailedError;
+import junit.framework.TestSuite;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaProperty;
import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.commons.logging.LogFactory;
import org.apache.ddlutils.dynabean.SqlDynaBean;
import org.apache.ddlutils.dynabean.SqlDynaClass;
import org.apache.ddlutils.dynabean.SqlDynaProperty;
@@ -66,11 +70,11 @@
import org.apache.ddlutils.util.StringUtilsExt;
/**
- * Base class for database writer tests.
+ * Base class tests that are executed against a live database.
*
* @version $Revision: 289996 $
*/
-public abstract class TestDatabaseWriterBase extends TestPlatformBase
+public abstract class TestAgainstLiveDatabaseBase extends TestPlatformBase
{
/** The name of the property that specifies properties file with the settings for the connection to test against. */
public static final String JDBC_PROPERTIES_PROPERTY = "jdbc.properties.file";
@@ -87,97 +91,141 @@
/** The prefix for table creation properties. */
public static final String DDLUTILS_TABLE_CREATION_PREFIX = DDLUTILS_PROPERTY_PREFIX + "tableCreation.";
- /** The test properties as defined by an external properties file. */
- private static Properties _testProps;
- /** The data source to test against. */
- private static DataSource _dataSource;
- /** The database name. */
- private static String _databaseName;
- /** The database model. */
- private Database _model;
-
/**
- * Creates a new test case instance.
+ * Creates the test suite for the given test class which must be a sub class of
+ * {@link RoundtripTestBase}. If the platform supports it, it will be tested
+ * with both delimited and undelimited identifiers.
+ *
+ * @param testedClass The tested class
+ * @return The tests
*/
- public TestDatabaseWriterBase()
+ protected static TestSuite getTests(Class testedClass)
{
- super();
- init();
+ if (!TestAgainstLiveDatabaseBase.class.isAssignableFrom(testedClass) ||
+ Modifier.isAbstract(testedClass.getModifiers()))
+ {
+ throw new DdlUtilsException("Cannot create parameterized tests for class "+testedClass.getName());
+ }
+
+ TestSuite suite = new TestSuite();
+ Properties props = readTestProperties();
+
+ if (props == null)
+ {
+ return suite;
+ }
+
+ DataSource dataSource = initDataSourceFromProperties(props);
+ String databaseName = determineDatabaseName(props, dataSource);
+
+ try
+ {
+ Method[] methods = testedClass.getMethods();
+ PlatformInfo info = null;
+ TestAgainstLiveDatabaseBase newTest;
+
+ for (int idx = 0; (methods != null) && (idx < methods.length); idx++)
+ {
+ if (methods[idx].getName().startsWith("test") &&
+ ((methods[idx].getParameterTypes() == null) || (methods[idx].getParameterTypes().length == 0)))
+ {
+ newTest = (TestAgainstLiveDatabaseBase)testedClass.newInstance();
+ newTest.setName(methods[idx].getName());
+ newTest.setTestProperties(props);
+ newTest.setDataSource(dataSource);
+ newTest.setDatabaseName(databaseName);
+ newTest.setUseDelimitedIdentifiers(false);
+ suite.addTest(newTest);
+
+ if (info == null)
+ {
+ info = PlatformFactory.createNewPlatformInstance(newTest.getDatabaseName()).getPlatformInfo();
+ }
+ if (info.isDelimitedIdentifiersSupported())
+ {
+ newTest = (TestAgainstLiveDatabaseBase)testedClass.newInstance();
+ newTest.setName(methods[idx].getName());
+ newTest.setTestProperties(props);
+ newTest.setDataSource(dataSource);
+ newTest.setDatabaseName(databaseName);
+ newTest.setUseDelimitedIdentifiers(true);
+ suite.addTest(newTest);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new DdlUtilsException(ex);
+ }
+
+ return suite;
}
/**
- * Returns the test properties.
+ * Reads the test properties as specified by the property.
*
- * @return The properties
+ * @return The properties or <code>null</code> if no properties have been specified
*/
- protected Properties getTestProperties()
+ protected static Properties readTestProperties()
{
- if (_testProps == null)
- {
- String propFile = System.getProperty(JDBC_PROPERTIES_PROPERTY);
-
- if (propFile == null)
- {
- throw new RuntimeException("Please specify the properties file via the jdbc.properties.file environment variable");
- }
-
- InputStream propStream = null;
-
- try
- {
- propStream = TestDatabaseWriterBase.class.getResourceAsStream(propFile);
-
- if (propStream == null)
- {
- propStream = new FileInputStream(propFile);
- }
-
- Properties props = new Properties();
-
- props.load(propStream);
- _testProps = props;
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
- finally
- {
- if (propStream != null)
- {
- try
- {
- propStream.close();
- }
- catch (IOException ex)
- {
- getLog().error("Could not close the stream used to read the test jdbc properties", ex);
- }
- }
- }
- }
- return _testProps;
+ String propFile = System.getProperty(JDBC_PROPERTIES_PROPERTY);
+
+ if (propFile == null)
+ {
+ return null;
+ }
+
+ InputStream propStream = null;
+
+ try
+ {
+ propStream = TestAgainstLiveDatabaseBase.class.getResourceAsStream(propFile);
+
+ if (propStream == null)
+ {
+ propStream = new FileInputStream(propFile);
+ }
+
+ Properties props = new Properties();
+
+ props.load(propStream);
+ return props;
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ finally
+ {
+ if (propStream != null)
+ {
+ try
+ {
+ propStream.close();
+ }
+ catch (IOException ex)
+ {
+ LogFactory.getLog(TestAgainstLiveDatabaseBase.class).error("Could not close the stream used to read the test jdbc properties", ex);
+ }
+ }
+ }
}
-
+
/**
* Initializes the test datasource and the platform.
*/
- private void init()
+ private static DataSource initDataSourceFromProperties(Properties props)
{
- // the data source won't change during the tests, hence
- // it is static and needs to be initialized only once
- if (_dataSource != null)
+ if (props == null)
{
- return;
+ return null;
}
- Properties props = getTestProperties();
-
try
{
- String dataSourceClass = props.getProperty(DATASOURCE_PROPERTY_PREFIX + "class", BasicDataSource.class.getName());
-
- _dataSource = (DataSource)Class.forName(dataSourceClass).newInstance();
+ String dataSourceClass = props.getProperty(DATASOURCE_PROPERTY_PREFIX + "class", BasicDataSource.class.getName());
+ DataSource dataSource = (DataSource)Class.forName(dataSourceClass).newInstance();
for (Iterator it = props.entrySet().iterator(); it.hasNext();)
{
@@ -186,27 +234,73 @@
if (propName.startsWith(DATASOURCE_PROPERTY_PREFIX) && !propName.equals(DATASOURCE_PROPERTY_PREFIX +"class"))
{
- BeanUtils.setProperty(_dataSource,
+ BeanUtils.setProperty(dataSource,
propName.substring(DATASOURCE_PROPERTY_PREFIX.length()),
entry.getValue());
}
}
+ return dataSource;
}
catch (Exception ex)
{
throw new DatabaseOperationException(ex);
}
+ }
+
+ /**
+ * Determines the name of the platform to use from the properties or the data source if no
+ * platform is specified in the properties.
+ *
+ * @param props The test properties
+ * @param dataSource The data source
+ * @return The name of the platform
+ */
+ private static String determineDatabaseName(Properties props, DataSource dataSource)
+ {
+ String platformName = props.getProperty(DDLUTILS_PLATFORM_PROPERTY);
- _databaseName = props.getProperty(DDLUTILS_PLATFORM_PROPERTY);
- if (_databaseName == null)
+ if (platformName == null)
{
// property not set, then try to determine
- _databaseName = new PlatformUtils().determineDatabaseType(_dataSource);
- if (_databaseName == null)
+ platformName = new PlatformUtils().determineDatabaseType(dataSource);
+ if (platformName == null)
{
throw new DatabaseOperationException("Could not determine platform from datasource, please specify it in the jdbc.properties via the ddlutils.platform property");
}
}
+ return platformName;
+ }
+
+
+ /** The test properties as defined by an external properties file. */
+ private Properties _testProps;
+ /** The data source to test against. */
+ private DataSource _dataSource;
+ /** The database name. */
+ private String _databaseName;
+ /** The database model. */
+ private Database _model;
+ /** Whether to use delimited identifiers for the test. */
+ private boolean _useDelimitedIdentifiers;
+
+ /**
+ * Returns the test properties.
+ *
+ * @return The properties
+ */
+ protected Properties getTestProperties()
+ {
+ return _testProps;
+ }
+
+ /**
+ * Sets the test properties.
+ *
+ * @param props The properties
+ */
+ private void setTestProperties(Properties props)
+ {
+ _testProps = props;
}
/**
@@ -238,6 +332,16 @@
}
/**
+ * Specifies whether the test shall use delimited identifiers.
+ *
+ * @param useDelimitedIdentifiers Whether to use delimited identifiers
+ */
+ protected void setUseDelimitedIdentifiers(boolean useDelimitedIdentifiers)
+ {
+ _useDelimitedIdentifiers = useDelimitedIdentifiers;
+ }
+
+ /**
* Returns the data source.
*
* @return The data source
@@ -248,6 +352,16 @@
}
/**
+ * Sets the data source.
+ *
+ * @param dataSource The data source
+ */
+ private void setDataSource(DataSource dataSource)
+ {
+ _dataSource = dataSource;
+ }
+
+ /**
* {@inheritDoc}
*/
protected String getDatabaseName()
@@ -256,6 +370,16 @@
}
/**
+ * Sets the database name.
+ *
+ * @param databaseName The name of the database
+ */
+ private void setDatabaseName(String databaseName)
+ {
+ _databaseName = databaseName;
+ }
+
+ /**
* Returns the database model.
*
* @return The model
@@ -272,6 +396,7 @@
{
super.setUp();
getPlatform().setDataSource(getDataSource());
+ getPlatform().setDelimitedIdentifierModeOn(_useDelimitedIdentifiers);
}
/**
@@ -302,10 +427,10 @@
*/
protected Database createDatabase(String schemaXml) throws DatabaseOperationException
{
- Database model = parseDatabaseFromString(schemaXml);
+ Database model = parseDatabaseFromString(schemaXml);
- createDatabase(model);
- return model;
+ createDatabase(model);
+ return model;
}
/**
@@ -399,6 +524,135 @@
}
/**
+ * Inserts a row into the designated table.
+ *
+ * @param tableName The name of the table (case insensitive)
+ * @param columnValues The values for the columns in order of definition
+ */
+ protected void insertRow(String tableName, Object[] columnValues)
+ {
+ Table table = getModel().findTable(tableName);
+ DynaBean bean = getModel().createDynaBeanFor(table);
+
+ for (int idx = 0; (idx < table.getColumnCount()) && (idx < columnValues.length); idx++)
+ {
+ Column column = table.getColumn(idx);
+
+ bean.set(column.getName(), columnValues[idx]);
+ }
+ getPlatform().insert(getModel(), bean);
+ }
+
+ /**
+ * Updates the row in the designated table.
+ *
+ * @param tableName The name of the table (case insensitive)
+ * @param oldBean The bean representing the current row
+ * @param columnValues The values for the columns in order of definition
+ */
+ protected void updateRow(String tableName, DynaBean oldBean, Object[] columnValues)
+ {
+ Table table = getModel().findTable(tableName);
+ DynaBean bean = getModel().createDynaBeanFor(table);
+
+ for (int idx = 0; (idx < table.getColumnCount()) && (idx < columnValues.length); idx++)
+ {
+ Column column = table.getColumn(idx);
+
+ bean.set(column.getName(), columnValues[idx]);
+ }
+ getPlatform().update(getModel(), oldBean, bean);
+ }
+
+ /**
+ * Deletes the specified row from the table.
+ *
+ * @param tableName The name of the table (case insensitive)
+ * @param pkColumnValues The values for the pk columns in order of definition
+ */
+ protected void deleteRow(String tableName, Object[] pkColumnValues)
+ {
+ Table table = getModel().findTable(tableName);
+ DynaBean bean = getModel().createDynaBeanFor(table);
+ Column[] pkColumns = table.getPrimaryKeyColumns();
+
+ for (int idx = 0; (idx < pkColumns.length) && (idx < pkColumnValues.length); idx++)
+ {
+ bean.set(pkColumns[idx].getName(), pkColumnValues[idx]);
+ }
+ getPlatform().delete(getModel(), bean);
+ }
+
+ /**
+ * Returns a "SELECT * FROM [table name]" statement. It also takes
+ * delimited identifier mode into account if enabled.
+ *
+ * @param table The table
+ * @param orderColumn The column to order the rows by (can be <code>null</code>)
+ * @return The statement
+ */
+ protected String getSelectQueryForAllString(Table table, String orderColumn)
+ {
+ StringBuffer query = new StringBuffer();
+
+ query.append("SELECT * FROM ");
+ if (getPlatform().isDelimitedIdentifierModeOn())
+ {
+ query.append(getPlatformInfo().getDelimiterToken());
+ }
+ query.append(table.getName());
+ if (getPlatform().isDelimitedIdentifierModeOn())
+ {
+ query.append(getPlatformInfo().getDelimiterToken());
+ }
+ if (orderColumn != null)
+ {
+ query.append(" ORDER BY ");
+ if (getPlatform().isDelimitedIdentifierModeOn())
+ {
+ query.append(getPlatformInfo().getDelimiterToken());
+ }
+ query.append(orderColumn);
+ if (getPlatform().isDelimitedIdentifierModeOn())
+ {
+ query.append(getPlatformInfo().getDelimiterToken());
+ }
+ }
+ return query.toString();
+ }
+
+ /**
+ * Retrieves all rows from the given table.
+ *
+ * @param tableName The table
+ * @return The rows
+ */
+ protected List getRows(String tableName)
+ {
+ Table table = getModel().findTable(tableName, getPlatform().isDelimitedIdentifierModeOn());
+
+ return getPlatform().fetch(getModel(),
+ getSelectQueryForAllString(table, null),
+ new Table[] { table });
+ }
+
+ /**
+ * Retrieves all rows from the given table.
+ *
+ * @param tableName The table
+ * @param orderColumn The column to order the rows by
+ * @return The rows
+ */
+ protected List getRows(String tableName, String orderColumn)
+ {
+ Table table = getModel().findTable(tableName, getPlatform().isDelimitedIdentifierModeOn());
+
+ return getPlatform().fetch(getModel(),
+ getSelectQueryForAllString(table, orderColumn),
+ new Table[] { table });
+ }
+
+ /**
* Checks that the database is clear, and if not clears it (no tables, sequences etc. left) and
* throws an {@link AssertionFailedError}.
*/
@@ -721,6 +975,83 @@
}
}
+ /**
+ * Asserts that the two given database models are equal, and if not, writes both of them
+ * in XML form to <code>stderr</code>.
+ *
+ * @param expected The expected model
+ * @param actual The actual model
+ */
+ protected void assertEquals(Database expected, Database actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given database tables are equal.
+ *
+ * @param expected The expected table
+ * @param actual The actual table
+ */
+ protected void assertEquals(Table expected, Table actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given columns are equal.
+ *
+ * @param expected The expected column
+ * @param actual The actual column
+ */
+ protected void assertEquals(Column expected, Column actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given foreign keys are equal.
+ *
+ * @param expected The expected foreign key
+ * @param actual The actual foreign key
+ */
+ protected void assertEquals(ForeignKey expected, ForeignKey actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given references are equal.
+ *
+ * @param expected The expected reference
+ * @param actual The actual reference
+ */
+ protected void assertEquals(Reference expected, Reference actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given indices are equal.
+ *
+ * @param expected The expected index
+ * @param actual The actual index
+ */
+ protected void assertEquals(Index expected, Index actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
+
+ /**
+ * Asserts that the two given index columns are equal.
+ *
+ * @param expected The expected index column
+ * @param actual The actual index column
+ */
+ protected void assertEquals(IndexColumn expected, IndexColumn actual)
+ {
+ assertEquals(expected, actual, _useDelimitedIdentifiers);
+ }
/**
* Compares the specified attribute value of the given bean with the expected object.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java Sun May 4 21:07:26 2008
@@ -285,7 +285,7 @@
try
{
- String dataSourceClass = props.getProperty(TestDatabaseWriterBase.DATASOURCE_PROPERTY_PREFIX + "class", BasicDataSource.class.getName());
+ String dataSourceClass = props.getProperty(TestAgainstLiveDatabaseBase.DATASOURCE_PROPERTY_PREFIX + "class", BasicDataSource.class.getName());
DataSource dataSource = (DataSource)Class.forName(dataSourceClass).newInstance();
for (Iterator it = props.entrySet().iterator(); it.hasNext();)
@@ -293,15 +293,15 @@
Map.Entry entry = (Map.Entry)it.next();
String propName = (String)entry.getKey();
- if (propName.startsWith(TestDatabaseWriterBase.DATASOURCE_PROPERTY_PREFIX) && !propName.equals(TestDatabaseWriterBase.DATASOURCE_PROPERTY_PREFIX +"class"))
+ if (propName.startsWith(TestAgainstLiveDatabaseBase.DATASOURCE_PROPERTY_PREFIX) && !propName.equals(TestAgainstLiveDatabaseBase.DATASOURCE_PROPERTY_PREFIX +"class"))
{
BeanUtils.setProperty(dataSource,
- propName.substring(TestDatabaseWriterBase.DATASOURCE_PROPERTY_PREFIX.length()),
+ propName.substring(TestAgainstLiveDatabaseBase.DATASOURCE_PROPERTY_PREFIX.length()),
entry.getValue());
}
}
- String platformName = props.getProperty(TestDatabaseWriterBase.DDLUTILS_PLATFORM_PROPERTY);
+ String platformName = props.getProperty(TestAgainstLiveDatabaseBase.DDLUTILS_PLATFORM_PROPERTY);
if (platformName == null)
{
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java Sun May 4 21:07:26 2008
@@ -22,9 +22,12 @@
import java.util.ArrayList;
import java.util.List;
+import junit.framework.Test;
+
import org.apache.commons.beanutils.DynaBean;
-import org.apache.ddlutils.TestDatabaseWriterBase;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.io.DatabaseIO;
+import org.apache.ddlutils.io.TestAlteration;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.ModelBasedResultSetIterator;
import org.apache.ddlutils.platform.sybase.SybasePlatform;
@@ -34,15 +37,34 @@
*
* @version $Revision: 289996 $
*/
-public class TestDynaSqlQueries extends TestDatabaseWriterBase
+public class TestDynaSqlQueries extends TestAgainstLiveDatabaseBase
{
/**
- * {@inheritDoc}
+ * Parameterized test case pattern.
+ *
+ * @return The tests
*/
- protected void setUp() throws Exception
+ public static Test suite() throws Exception
{
- super.setUp();
- getPlatform().setDelimitedIdentifierModeOn(false);
+ return getTests(TestAlteration.class);
+ }
+
+ /**
+ * Returns the SQL to select all rows from the indicated table.
+ *
+ * @param tableName The name of the table to query
+ * @return The SQL
+ */
+ private String asIdentifier(String name)
+ {
+ if (getPlatform().isDelimitedIdentifierModeOn())
+ {
+ return getPlatformInfo().getDelimiterToken() + name + getPlatformInfo().getDelimiterToken();
+ }
+ else
+ {
+ return name;
+ }
}
/**
@@ -68,7 +90,7 @@
"</data>");
ModelBasedResultSetIterator it = (ModelBasedResultSetIterator)getPlatform().query(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertTrue(it.hasNext());
@@ -127,7 +149,7 @@
"</data>");
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(3,
@@ -223,7 +245,7 @@
}
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(3,
@@ -297,8 +319,23 @@
" <TestTable2 Id='3' Avalue='Text 3'/>"+
"</data>");
+ StringBuffer sql = new StringBuffer();
+
+ sql.append("SELECT ");
+ sql.append(asIdentifier("Id1"));
+ sql.append(",");
+ sql.append(asIdentifier("Avalue"));
+ sql.append(" FROM ");
+ sql.append(asIdentifier("TestTable1"));
+ sql.append(",");
+ sql.append(asIdentifier("TestTable2"));
+ sql.append(" WHERE ");
+ sql.append(asIdentifier("Id2"));
+ sql.append("=");
+ sql.append(asIdentifier("Id"));
+
ModelBasedResultSetIterator it = (ModelBasedResultSetIterator)getPlatform().query(getModel(),
- "SELECT Id1, Avalue FROM TestTable1, TestTable2 WHERE Id2 = Id",
+ sql.toString(),
new Table[] { getModel().getTable(0), getModel().getTable(1) });
assertTrue(it.hasNext());
@@ -337,7 +374,7 @@
getPlatform().insert(getModel(), dynaBean);
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(1,
@@ -386,7 +423,7 @@
getPlatform().insert(getModel(), dynaBeans);
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(3,
@@ -443,7 +480,7 @@
getPlatform().update(getModel(), dynaBean);
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(1,
@@ -519,7 +556,7 @@
getPlatform().store(getModel(), dynaBean);
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(1,
@@ -562,7 +599,7 @@
getPlatform().store(getModel(), dynaBean);
List beans = getPlatform().fetch(getModel(),
- "SELECT * FROM TestTable",
+ "SELECT * FROM " + asIdentifier("TestTable"),
new Table[] { getModel().getTable(0) });
assertEquals(1,
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAddColumn.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAddColumn.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAddColumn.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAddColumn.java Sun May 4 21:07:26 2008
@@ -25,6 +25,7 @@
import junit.framework.Test;
import org.apache.commons.beanutils.DynaBean;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.platform.firebird.FirebirdPlatform;
import org.apache.ddlutils.platform.hsqldb.HsqlDbPlatform;
import org.apache.ddlutils.platform.interbase.InterbasePlatform;
@@ -38,7 +39,7 @@
*
* @version $Revision: $
*/
-public class TestAddColumn extends RoundtripTestBase
+public class TestAddColumn extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java Sun May 4 21:07:26 2008
@@ -24,6 +24,7 @@
import junit.framework.Test;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.platform.firebird.FirebirdPlatform;
import org.apache.ddlutils.platform.mckoi.MckoiPlatform;
@@ -42,7 +43,7 @@
* - ...
* @version $Revision: $
*/
-public class TestAlteration extends RoundtripTestBase
+public class TestAlteration extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestChangeColumn.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestChangeColumn.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestChangeColumn.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestChangeColumn.java Sun May 4 21:07:26 2008
@@ -28,6 +28,7 @@
import junit.framework.Test;
import org.apache.commons.beanutils.DynaBean;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.platform.sybase.SybasePlatform;
/**
@@ -39,7 +40,7 @@
*
* @version $Revision: $
*/
-public class TestChangeColumn extends RoundtripTestBase
+public class TestChangeColumn extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java Sun May 4 21:07:26 2008
@@ -21,21 +21,22 @@
import java.util.List;
+import junit.framework.Test;
+
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.lang.StringUtils;
import org.apache.ddlutils.DdlUtilsException;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.platform.derby.DerbyPlatform;
import org.apache.ddlutils.platform.sybase.SybasePlatform;
-import junit.framework.Test;
-
/**
* Performs the constraint tests.
*
* @version $Revision: 289996 $
*/
-public class TestConstraints extends RoundtripTestBase
+public class TestConstraints extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java Sun May 4 21:07:26 2008
@@ -33,6 +33,7 @@
import junit.framework.Test;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.platform.interbase.InterbasePlatform;
@@ -41,7 +42,7 @@
*
* @version $Revision: $
*/
-public class TestDatatypes extends RoundtripTestBase
+public class TestDatatypes extends TestAgainstLiveDatabaseBase
{
// TODO: special columns (java_object, array, distinct, ...)
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDropColumn.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDropColumn.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDropColumn.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDropColumn.java Sun May 4 21:07:26 2008
@@ -25,12 +25,14 @@
import junit.framework.Test;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
+
/**
* Tests database alterations that drop columns.
*
* @version $Revision: $
*/
-public class TestDropColumn extends RoundtripTestBase
+public class TestDropColumn extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestInsertColumn.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestInsertColumn.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestInsertColumn.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestInsertColumn.java Sun May 4 21:07:26 2008
@@ -25,6 +25,7 @@
import junit.framework.Test;
import org.apache.commons.beanutils.DynaBean;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.platform.sybase.SybasePlatform;
/**
@@ -32,7 +33,7 @@
*
* @version $Revision: $
*/
-public class TestInsertColumn extends RoundtripTestBase
+public class TestInsertColumn extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestMisc.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestMisc.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestMisc.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestMisc.java Sun May 4 21:07:26 2008
@@ -32,6 +32,7 @@
import junit.framework.Test;
import org.apache.commons.beanutils.DynaBean;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.platform.hsqldb.HsqlDbPlatform;
import org.apache.ddlutils.platform.sybase.SybasePlatform;
@@ -45,7 +46,7 @@
*
* @version $Revision: $
*/
-public class TestMisc extends RoundtripTestBase
+public class TestMisc extends TestAgainstLiveDatabaseBase
{
/**
* Parameterized test case pattern.
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestDropTablesCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestDropTablesCommand.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestDropTablesCommand.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestDropTablesCommand.java Sun May 4 21:07:26 2008
@@ -19,6 +19,8 @@
* under the License.
*/
+import junit.framework.Test;
+
import org.apache.ddlutils.io.DatabaseIO;
import org.apache.ddlutils.model.Database;
@@ -30,6 +32,16 @@
public class TestDropTablesCommand extends TestTaskBase
{
/**
+ * Parameterized test case pattern.
+ *
+ * @return The tests
+ */
+ public static Test suite() throws Exception
+ {
+ return getTests(TestDropTablesCommand.class);
+ }
+
+ /**
* Tests the task against an empty database.
*/
public void testEmptyDatabase()
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestTaskBase.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestTaskBase.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestTaskBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestTaskBase.java Sun May 4 21:07:26 2008
@@ -24,7 +24,7 @@
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.ddlutils.TestDatabaseWriterBase;
+import org.apache.ddlutils.TestAgainstLiveDatabaseBase;
import org.apache.tools.ant.Project;
/**
@@ -32,18 +32,9 @@
*
* @version $Revision: $
*/
-public abstract class TestTaskBase extends TestDatabaseWriterBase
+public abstract class TestTaskBase extends TestAgainstLiveDatabaseBase
{
/**
- * {@inheritDoc}
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- getPlatform().setDelimitedIdentifierModeOn(false);
- }
-
- /**
* Returns an instance of the {@link DatabaseToDdlTask}, already configured with
* a project and the tested database.
*
@@ -65,6 +56,7 @@
task.addConfiguredDatabase((BasicDataSource)getDataSource());
task.setCatalogPattern(catalog);
task.setSchemaPattern(schema);
+ task.setUseDelimitedSqlIdentifiers(getPlatform().isDelimitedIdentifierModeOn());
return task;
}
}
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestWriteSchemaToFileCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestWriteSchemaToFileCommand.java?rev=653295&r1=653294&r2=653295&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestWriteSchemaToFileCommand.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/task/TestWriteSchemaToFileCommand.java Sun May 4 21:07:26 2008
@@ -22,6 +22,8 @@
import java.io.File;
import java.io.IOException;
+import junit.framework.Test;
+
import org.apache.ddlutils.io.DatabaseIO;
import org.apache.ddlutils.model.Database;
import org.apache.tools.ant.BuildException;
@@ -34,6 +36,16 @@
public class TestWriteSchemaToFileCommand extends TestTaskBase
{
/**
+ * Parameterized test case pattern.
+ *
+ * @return The tests
+ */
+ public static Test suite() throws Exception
+ {
+ return getTests(TestWriteSchemaToFileCommand.class);
+ }
+
+ /**
* Adds the writeSchemaToFile sub task to the given task, executes it, and checks its output.
*
* @param task The task