You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2010/01/23 13:50:26 UTC
svn commit: r902399 - in /cayenne/main/trunk: build-tools/
build-tools/cayenne-test-utilities/
build-tools/cayenne-test-utilities/.settings/
build-tools/cayenne-test-utilities/src/
build-tools/cayenne-test-utilities/src/main/ build-tools/cayenne-test-u...
Author: aadamchik
Date: Sat Jan 23 12:50:24 2010
New Revision: 902399
URL: http://svn.apache.org/viewvc?rev=902399&view=rev
Log:
CAY-1373 Make itest-common available to regular unit tests
Added:
cayenne/main/trunk/build-tools/cayenne-test-utilities/
cayenne/main/trunk/build-tools/cayenne-test-utilities/.classpath
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/.classpath
cayenne/main/trunk/build-tools/cayenne-test-utilities/.project
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/.project
cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/
cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.core.prefs
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.core.prefs
cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.ui.prefs
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.ui.prefs
cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.maven.ide.eclipse.prefs
cayenne/main/trunk/build-tools/cayenne-test-utilities/pom.xml
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/pom.xml
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/DBHelper.java
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestDBUtils.java
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/ResultSetTemplate.java
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ResultSetTemplate.java
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/RowTemplate.java
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/RowTemplate.java
cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/TableHelper.java
- copied, changed from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestTableUtils.java
Removed:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextNoPkTest.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextOuterJoinsTest.xml
cayenne/main/trunk/itests/itest-common/.classpath
cayenne/main/trunk/itests/itest-common/.project
cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.core.prefs
cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.ui.prefs
cayenne/main/trunk/itests/itest-common/pom.xml
cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestDBUtils.java
cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestTableUtils.java
cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ResultSetTemplate.java
cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/RowTemplate.java
Modified:
cayenne/main/trunk/build-tools/pom.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/pom.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextNoPkTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextOuterJoinsTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/CayenneCase.java
cayenne/main/trunk/framework/cayenne-tools/pom.xml
cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/DataMapGeneratedQueryRunTest.java
cayenne/main/trunk/itests/cayenne-di-stack/pom.xml
cayenne/main/trunk/itests/cayenne-di-stack/src/main/java/org/apache/cayenne/runtime/CayenneServerRuntimeCase.java
cayenne/main/trunk/itests/cayenne-di-stack/src/test/java/org/apache/cayenne/runtime/CayenneServerRuntimeIntegrationTest.java
cayenne/main/trunk/itests/pom.xml
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/.classpath (from r902391, cayenne/main/trunk/itests/itest-common/.classpath)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/.classpath?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/.classpath&p1=cayenne/main/trunk/itests/itest-common/.classpath&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
(empty)
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/.project (from r902391, cayenne/main/trunk/itests/itest-common/.project)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/.project?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/.project&p1=cayenne/main/trunk/itests/itest-common/.project&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/.project (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/.project Sat Jan 23 12:50:24 2010
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>itest-common</name>
+ <name>cayenne-test-utilities</name>
<comment></comment>
<projects>
</projects>
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.core.prefs (from r902391, cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.core.prefs)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.core.prefs?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.core.prefs&p1=cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.core.prefs&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
(empty)
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.ui.prefs (from r902391, cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.ui.prefs)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.ui.prefs?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.eclipse.jdt.ui.prefs&p1=cayenne/main/trunk/itests/itest-common/.settings/org.eclipse.jdt.ui.prefs&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
(empty)
Added: cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.maven.ide.eclipse.prefs?rev=902399&view=auto
==============================================================================
--- cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.maven.ide.eclipse.prefs (added)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/.settings/org.maven.ide.eclipse.prefs Sat Jan 23 12:50:24 2010
@@ -0,0 +1,9 @@
+#Sat Jan 23 11:55:55 EET 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/pom.xml (from r902391, cayenne/main/trunk/itests/itest-common/pom.xml)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/pom.xml?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/pom.xml&p1=cayenne/main/trunk/itests/itest-common/pom.xml&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/pom.xml (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/pom.xml Sat Jan 23 12:50:24 2010
@@ -24,14 +24,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.cayenne.itests</groupId>
- <artifactId>cayenne-itests-parent</artifactId>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-parent</artifactId>
<version>3.1-SNAPSHOT</version>
</parent>
- <description>Integration Tests Commons</description>
- <artifactId>itest-common</artifactId>
- <name>Integration Tests Commons</name>
+ <description>Common Unit Test Utilities</description>
+ <groupId>org.apache.cayenne.build-tools</groupId>
+ <artifactId>cayenne-test-utilities</artifactId>
+ <name>Common Unit Test Utilities</name>
<packaging>jar</packaging>
<dependencies>
@@ -40,24 +41,6 @@
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
-
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-transaction</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
<build>
@@ -69,20 +52,6 @@
<target>1.5</target>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>bundle-source-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/DBHelper.java (from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestDBUtils.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/DBHelper.java?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/DBHelper.java&p1=cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestDBUtils.java&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestDBUtils.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/DBHelper.java Sat Jan 23 12:50:24 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
-package org.apache.cayenne.itest;
+package org.apache.cayenne.test;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -29,14 +29,14 @@
import javax.sql.DataSource;
/**
- * JDBC utilities for integration testing that bypass Cayenne for DB access.
- *
+ * JDBC utilities class for setting up and analyzing the DB data sets. DBHelper
+ * intentionally bypasses Cayenne stack.
*/
-public class ItestDBUtils {
+public class DBHelper {
protected DataSource dataSource;
- public ItestDBUtils(DataSource dataSource) {
+ public DBHelper(DataSource dataSource) {
this.dataSource = dataSource;
}
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/ResultSetTemplate.java (from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ResultSetTemplate.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/ResultSetTemplate.java?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/ResultSetTemplate.java&p1=cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ResultSetTemplate.java&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ResultSetTemplate.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/ResultSetTemplate.java Sat Jan 23 12:50:24 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
-package org.apache.cayenne.itest;
+package org.apache.cayenne.test;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -25,9 +25,9 @@
abstract class ResultSetTemplate<T> {
- ItestDBUtils parent;
+ DBHelper parent;
- public ResultSetTemplate(ItestDBUtils parent) {
+ public ResultSetTemplate(DBHelper parent) {
this.parent = parent;
}
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/RowTemplate.java (from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/RowTemplate.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/RowTemplate.java?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/RowTemplate.java&p1=cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/RowTemplate.java&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/RowTemplate.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/RowTemplate.java Sat Jan 23 12:50:24 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
-package org.apache.cayenne.itest;
+package org.apache.cayenne.test;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -27,7 +27,7 @@
*/
abstract class RowTemplate<T> extends ResultSetTemplate<T> {
- public RowTemplate(ItestDBUtils parent) {
+ public RowTemplate(DBHelper parent) {
super(parent);
}
Copied: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/TableHelper.java (from r902391, cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestTableUtils.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/TableHelper.java?p2=cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/TableHelper.java&p1=cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestTableUtils.java&r1=902391&r2=902399&rev=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/ItestTableUtils.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/TableHelper.java Sat Jan 23 12:50:24 2010
@@ -16,35 +16,41 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
-package org.apache.cayenne.itest;
+package org.apache.cayenne.test;
import java.sql.SQLException;
/**
- * JDBC utilities for integration testing that bypass Cayenne for DB access.
+ * JDBC utilities class for setting up and analyzing the DB data sets for a single table.
+ * TableHelper intentionally bypasses Cayenne stack.
*/
-public class ItestTableUtils {
+public class TableHelper {
protected String tableName;
- protected ItestDBUtils dbUtils;
+ protected DBHelper dbHelper;
protected String[] columns;
- public ItestTableUtils(ItestDBUtils dbUtils, String tableName) {
- this.dbUtils = dbUtils;
+ public TableHelper(DBHelper dbHelper, String tableName) {
+ this.dbHelper = dbHelper;
this.tableName = tableName;
}
- public ItestTableUtils deleteAll() throws SQLException {
- dbUtils.deleteAll(tableName);
+ public TableHelper(DBHelper dbHelper, String tableName, String... columns) {
+ this(dbHelper, tableName);
+ setColumns(columns);
+ }
+
+ public TableHelper deleteAll() throws SQLException {
+ dbHelper.deleteAll(tableName);
return this;
}
- public ItestTableUtils setColumns(String... columns) {
+ public TableHelper setColumns(String... columns) {
this.columns = columns;
return this;
}
- public ItestTableUtils insert(Object... values) throws SQLException {
+ public TableHelper insert(Object... values) throws SQLException {
if (this.columns == null) {
throw new IllegalStateException("Call 'setColumns' to prepare insert");
}
@@ -54,7 +60,7 @@
"Columns and values arrays are of different size");
}
- dbUtils.insert(tableName, columns, values);
+ dbHelper.insert(tableName, columns, values);
return this;
}
Modified: cayenne/main/trunk/build-tools/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/pom.xml?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/build-tools/pom.xml (original)
+++ cayenne/main/trunk/build-tools/pom.xml Sat Jan 23 12:50:24 2010
@@ -35,6 +35,7 @@
<packaging>pom</packaging>
<modules>
+ <module>cayenne-test-utilities</module>
<module>maven-cayenne-build-plugin</module>
<module>maven-cayenne-doc-plugin</module>
</modules>
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/pom.xml?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/pom.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/pom.xml Sat Jan 23 12:50:24 2010
@@ -32,6 +32,12 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.cayenne.build-tools</groupId>
+ <artifactId>cayenne-test-utilities</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.cayenne.unpublished</groupId>
<artifactId>cayenne-di-unpublished</artifactId>
<version>${version}</version>
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextNoPkTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextNoPkTest.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextNoPkTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextNoPkTest.java Sat Jan 23 12:50:24 2010
@@ -25,19 +25,27 @@
import org.apache.art.NoPkTestEntity;
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.TableHelper;
import org.apache.cayenne.unit.CayenneCase;
public class DataContextNoPkTest extends CayenneCase {
@Override
protected void setUp() throws Exception {
- super.setUp();
- createTestData("prepare");
+ TableHelper noPkTestTable = new TableHelper(
+ getDbHelper(),
+ "NO_PK_TEST",
+ "ATTRIBUTE1");
+ noPkTestTable.deleteAll();
+
+ noPkTestTable.insert(1);
+ noPkTestTable.insert(2);
}
public void testNoPkFetchObjects() throws Exception {
try {
- List objects = createDataContext().performQuery(new SelectQuery(NoPkTestEntity.class));
+ List objects = createDataContext().performQuery(
+ new SelectQuery(NoPkTestEntity.class));
fail("Query for entity with no primary key must have failed, instead we got "
+ objects.size()
+ " rows.");
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextOuterJoinsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextOuterJoinsTest.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextOuterJoinsTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextOuterJoinsTest.java Sat Jan 23 12:50:24 2010
@@ -27,18 +27,52 @@
import org.apache.cayenne.map.Entity;
import org.apache.cayenne.query.SelectQuery;
import org.apache.cayenne.query.SortOrder;
+import org.apache.cayenne.test.DBHelper;
+import org.apache.cayenne.test.TableHelper;
import org.apache.cayenne.unit.CayenneCase;
public class DataContextOuterJoinsTest extends CayenneCase {
+ protected TableHelper artistHelper;
+ protected TableHelper paintingHelper;
+ protected TableHelper artgroupHelper;
+ protected TableHelper artistGroupHelper;
+
@Override
protected void setUp() throws Exception {
- super.setUp();
- deleteTestData();
+ DBHelper dbHelper = getDbHelper();
+ artistHelper = new TableHelper(dbHelper, "ARTIST", "ARTIST_ID", "ARTIST_NAME");
+ paintingHelper = new TableHelper(
+ dbHelper,
+ "PAINTING",
+ "PAINTING_ID",
+ "ARTIST_ID",
+ "PAINTING_TITLE");
+ artgroupHelper = new TableHelper(dbHelper, "ARTGROUP", "GROUP_ID", "NAME");
+ artistGroupHelper = new TableHelper(
+ dbHelper,
+ "ARTIST_GROUP",
+ "GROUP_ID",
+ "ARTIST_ID");
+
+ artistGroupHelper.deleteAll();
+ artgroupHelper.deleteAll();
+ paintingHelper.deleteAll();
+ artistHelper.deleteAll();
}
-
+
public void testSelectWithOuterJoinFlattened() throws Exception {
- createTestData("testSelectWithOuterJoinFlattened");
+
+ artistHelper.insert(33001, "AA1");
+ artistHelper.insert(33002, "AA2");
+ artistHelper.insert(33003, "BB1");
+ artistHelper.insert(33004, "BB2");
+
+ artgroupHelper.insert(1, "G1");
+
+ artistGroupHelper.insert(1, 33001);
+ artistGroupHelper.insert(1, 33002);
+ artistGroupHelper.insert(1, 33004);
SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
missingToManyQuery.andQualifier(ExpressionFactory.matchExp(
@@ -53,7 +87,13 @@
public void testSelectWithOuterJoin() throws Exception {
- createTestData("testSelectWithOuterJoin");
+ artistHelper.insert(33001, "AA1");
+ artistHelper.insert(33002, "AA2");
+ artistHelper.insert(33003, "BB1");
+ artistHelper.insert(33004, "BB2");
+
+ paintingHelper.insert(33001, 33001, "P1");
+ paintingHelper.insert(33002, 33002, "P2");
SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
missingToManyQuery.andQualifier(ExpressionFactory.matchExp(
@@ -83,7 +123,13 @@
public void testSelectWithOuterJoinFromString() throws Exception {
- createTestData("testSelectWithOuterJoin");
+ artistHelper.insert(33001, "AA1");
+ artistHelper.insert(33002, "AA2");
+ artistHelper.insert(33003, "BB1");
+ artistHelper.insert(33004, "BB2");
+
+ paintingHelper.insert(33001, 33001, "P1");
+ paintingHelper.insert(33002, 33002, "P2");
SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
missingToManyQuery.andQualifier(Expression.fromString("paintingArray+ = null"));
@@ -111,7 +157,12 @@
public void testSelectWithOuterOrdering() throws Exception {
- createTestData("testSelectWithOuterOrdering");
+ artistHelper.insert(33001, "AA1");
+ artistHelper.insert(33002, "AA2");
+
+ paintingHelper.insert(33001, 33001, "P1");
+ paintingHelper.insert(33002, 33002, "P2");
+ paintingHelper.insert(33003, null, "P3");
SelectQuery query = new SelectQuery(Painting.class);
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/CayenneCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/CayenneCase.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/CayenneCase.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/CayenneCase.java Sat Jan 23 12:50:24 2010
@@ -33,6 +33,7 @@
import org.apache.cayenne.map.DataMap;
import org.apache.cayenne.map.DbEntity;
import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.test.DBHelper;
import org.apache.cayenne.unit.util.SQLTemplateCustomizer;
/**
@@ -92,6 +93,10 @@
protected DataSourceInfo getConnectionInfo() throws Exception {
return CayenneResources.getResources().getConnectionInfo();
}
+
+ protected DBHelper getDbHelper() {
+ return new DBHelper(getNode().getDataSource());
+ }
protected Connection getConnection() throws Exception {
return getNode().getDataSource().getConnection();
Modified: cayenne/main/trunk/framework/cayenne-tools/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/pom.xml?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/pom.xml (original)
+++ cayenne/main/trunk/framework/cayenne-tools/pom.xml Sat Jan 23 12:50:24 2010
@@ -38,6 +38,13 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.cayenne.build-tools</groupId>
+ <artifactId>cayenne-test-utilities</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>ant</groupId>
Modified: cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/DataMapGeneratedQueryRunTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/DataMapGeneratedQueryRunTest.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/DataMapGeneratedQueryRunTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/DataMapGeneratedQueryRunTest.java Sat Jan 23 12:50:24 2010
@@ -18,31 +18,30 @@
****************************************************************/
package org.apache.cayenne.gen;
+import java.sql.SQLException;
import java.util.List;
import org.apache.art.Artist;
import org.apache.art.Testmap;
-import org.apache.cayenne.query.QueryChain;
-import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.test.DBHelper;
+import org.apache.cayenne.test.TableHelper;
import org.apache.cayenne.unit.CayenneCase;
public class DataMapGeneratedQueryRunTest extends CayenneCase {
+ protected TableHelper artistHelper;
+
@Override
protected void setUp() throws Exception {
- super.setUp();
- deleteTestData();
+ DBHelper dbHelper = getDbHelper();
+ artistHelper = new TableHelper(dbHelper, "ARTIST", "ARTIST_ID", "ARTIST_NAME");
+ artistHelper.deleteAll();
}
- public void testPerformGeneratedQuery() {
- QueryChain chain = new QueryChain();
- chain.addQuery(new SQLTemplate(
- Artist.class,
- "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'A2')"));
- chain.addQuery(new SQLTemplate(
- Artist.class,
- "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'A1')"));
- createDataContext().performGenericQuery(chain);
+ public void testPerformGeneratedQuery() throws SQLException {
+ artistHelper.insert(1, "A2");
+ artistHelper.insert(2, "A1");
+
List<Artist> result = Testmap.getInstance().performQueryWithQualifier(
createDataContext(),
"A1");
Modified: cayenne/main/trunk/itests/cayenne-di-stack/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-di-stack/pom.xml?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/cayenne-di-stack/pom.xml (original)
+++ cayenne/main/trunk/itests/cayenne-di-stack/pom.xml Sat Jan 23 12:50:24 2010
@@ -1,24 +1,20 @@
<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ <!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -42,20 +38,27 @@
</dependency>
<dependency>
- <groupId>org.apache.cayenne.unpublished</groupId>
- <artifactId>cayenne-di-unpublished</artifactId>
+ <groupId>org.apache.cayenne.build-tools</groupId>
+ <artifactId>cayenne-test-utilities</artifactId>
<version>${version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cayenne.unpublished</groupId>
- <artifactId>cayenne-jdk1.5-unpublished</artifactId>
+ <artifactId>cayenne-di-unpublished</artifactId>
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.apache.cayenne.itests</groupId>
- <artifactId>itest-common</artifactId>
+ <groupId>org.apache.cayenne.unpublished</groupId>
+ <artifactId>cayenne-jdk1.5-unpublished</artifactId>
<version>${version}</version>
</dependency>
@@ -70,7 +73,7 @@
<target>1.5</target>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Modified: cayenne/main/trunk/itests/cayenne-di-stack/src/main/java/org/apache/cayenne/runtime/CayenneServerRuntimeCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-di-stack/src/main/java/org/apache/cayenne/runtime/CayenneServerRuntimeCase.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/cayenne-di-stack/src/main/java/org/apache/cayenne/runtime/CayenneServerRuntimeCase.java (original)
+++ cayenne/main/trunk/itests/cayenne-di-stack/src/main/java/org/apache/cayenne/runtime/CayenneServerRuntimeCase.java Sat Jan 23 12:50:24 2010
@@ -27,8 +27,8 @@
import org.apache.cayenne.access.DataNode;
import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy;
import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy;
-import org.apache.cayenne.itest.ItestDBUtils;
-import org.apache.cayenne.itest.ItestTableUtils;
+import org.apache.cayenne.test.DBHelper;
+import org.apache.cayenne.test.TableHelper;
public abstract class CayenneServerRuntimeCase extends TestCase {
@@ -66,13 +66,13 @@
protected abstract RuntimeName getRuntimeName();
- protected ItestDBUtils getDbUtils() {
+ protected DBHelper getDbUtils() {
- return new ItestDBUtils(getDataNode().getDataSource());
+ return new DBHelper(getDataNode().getDataSource());
}
- protected ItestTableUtils getTableHelper(String tableName) {
- return new ItestTableUtils(getDbUtils(), tableName);
+ protected TableHelper getTableHelper(String tableName) {
+ return new TableHelper(getDbUtils(), tableName);
}
private DataNode getDataNode() {
Modified: cayenne/main/trunk/itests/cayenne-di-stack/src/test/java/org/apache/cayenne/runtime/CayenneServerRuntimeIntegrationTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-di-stack/src/test/java/org/apache/cayenne/runtime/CayenneServerRuntimeIntegrationTest.java?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/cayenne-di-stack/src/test/java/org/apache/cayenne/runtime/CayenneServerRuntimeIntegrationTest.java (original)
+++ cayenne/main/trunk/itests/cayenne-di-stack/src/test/java/org/apache/cayenne/runtime/CayenneServerRuntimeIntegrationTest.java Sat Jan 23 12:50:24 2010
@@ -21,9 +21,9 @@
import org.apache.cayenne.Cayenne;
import org.apache.cayenne.ObjectContext;
import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.itest.ItestDBUtils;
import org.apache.cayenne.itest.di_stack.Table1;
import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.DBHelper;
public class CayenneServerRuntimeIntegrationTest extends
CayenneServerRuntimeCase {
@@ -56,7 +56,7 @@
}
public void testNewContext_separateObjects() throws Exception {
- ItestDBUtils dbUtils = getDbUtils();
+ DBHelper dbUtils = getDbUtils();
dbUtils.deleteAll("TABLE1");
dbUtils.insert("TABLE1", new String[] { "ID", "NAME" }, new Object[] {
1, "Abc" });
Modified: cayenne/main/trunk/itests/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/pom.xml?rev=902399&r1=902398&r2=902399&view=diff
==============================================================================
--- cayenne/main/trunk/itests/pom.xml (original)
+++ cayenne/main/trunk/itests/pom.xml Sat Jan 23 12:50:24 2010
@@ -37,7 +37,6 @@
<packaging>pom</packaging>
<modules>
- <module>itest-common</module>
<module>cayenne-di-stack</module>
</modules>
<build>