Author: aadamchik Date: Fri Jan 5 05:21:23 2007 New Revision: 493024 URL: http://svn.apache.org/viewvc?view=rev&rev=493024 Log: enabling database test profiles
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneResources.java incubator/cayenne/main/trunk/other/pom.xml incubator/cayenne/main/trunk/pom.xml Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneResources.java URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneResources.java?view=diff&rev=493024&r1=493023&r2=493024 ============================================================================== --- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneResources.java (original) +++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/unit/CayenneResources.java Fri Jan 5 05:21:23 2007 @@ -85,16 +85,7 @@ "TestResources", CayenneResources.class); - String connectionKey = System.getProperty(CONNECTION_NAME_KEY); - if (connectionKey == null) { - logObj.info("No connection key property set '" - + CONNECTION_NAME_KEY - + "', using default: " - + DEFAULT_CONNECTION_KEY); - connectionKey = DEFAULT_CONNECTION_KEY; - } - - resources.setConnectionKey(connectionKey); + resources.setConnectionKey(System.getProperty(CONNECTION_NAME_KEY)); try { resources.rebuildSchema(); @@ -141,7 +132,7 @@ */ public static URL getResourceURL(String name) { URL in = Thread.currentThread().getContextClassLoader().getResource(name); - + // Fix for the issue described at https://issues.apache.org/struts/browse/SB-35 // Basically, spaces in filenames make maven cry. try { @@ -150,7 +141,7 @@ catch (MalformedURLException e) { throw new CayenneRuntimeException("Error constructing URL.", e); } - + if (in == null) { throw new CayenneRuntimeException("Resource not found: " + name); } @@ -204,12 +195,21 @@ } public void setConnectionKey(String connectionKey) { - if (connectionKey == null) { - throw new RuntimeException("Null connection key"); - } connectionInfo = ConnectionProperties.getInstance().getConnectionInfo( connectionKey); + + // attempt default if invalid key is specified + if (connectionInfo == null) { + + logObj.info("Invalid connection key '" + + connectionKey + + "', trying default: " + + DEFAULT_CONNECTION_KEY); + + connectionInfo = ConnectionProperties.getInstance().getConnectionInfo( + DEFAULT_CONNECTION_KEY); + } if (connectionInfo == null) { throw new RuntimeException("Null connection info for key: " + connectionKey); Modified: incubator/cayenne/main/trunk/other/pom.xml URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/pom.xml?view=diff&rev=493024&r1=493023&r2=493024 ============================================================================== --- incubator/cayenne/main/trunk/other/pom.xml (original) +++ incubator/cayenne/main/trunk/other/pom.xml Fri Jan 5 05:21:23 2007 @@ -34,7 +34,6 @@ <packaging>pom</packaging> <modules> - <module>cayenne-regression-profiler</module> <module>maven-cayenne-build-plugin</module> <module>maven-plugin</module> </modules> Modified: incubator/cayenne/main/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/pom.xml?view=diff&rev=493024&r1=493023&r2=493024 ============================================================================== --- incubator/cayenne/main/trunk/pom.xml (original) +++ incubator/cayenne/main/trunk/pom.xml Fri Jan 5 05:21:23 2007 @@ -28,8 +28,8 @@ <name>Cayenne</name> <description> - Apache Cayenne is a powerful, full-featured Java Object - Relational Mapping framework currently in incubation. + Apache Cayenne is a powerful, full-featured Java Object Relational Mapping framework + currently in incubation. </description> <url>http://incubator.apache.org/cayenne</url> @@ -54,52 +54,30 @@ <mailingList> <name>Cayenne User List</name> <post>cayenne-user@incubator.apache.org</post> - <subscribe> - [EMAIL PROTECTED] - </subscribe> - <unsubscribe> - [EMAIL PROTECTED] - </unsubscribe> - <archive> - http://mail-archives.apache.org/mod_mbox/incubator-cayenne-user - </archive> + <subscribe>[EMAIL PROTECTED]</subscribe> + <unsubscribe>[EMAIL PROTECTED]</unsubscribe> + <archive>http://mail-archives.apache.org/mod_mbox/incubator-cayenne-user</archive> <otherArchives> - <otherArchive> - http://objectstyle.org/cayenne/lists/cayenne-user - </otherArchive> + <otherArchive>http://objectstyle.org/cayenne/lists/cayenne-user</otherArchive> </otherArchives> </mailingList> <mailingList> <name>Cayenne Developer List</name> <post>cayenne-dev@incubator.apache.org</post> - <subscribe> - [EMAIL PROTECTED] - </subscribe> - <unsubscribe> - [EMAIL PROTECTED] - </unsubscribe> - <archive> - http://mail-archives.apache.org/mod_mbox/incubator-cayenne-dev - </archive> + <subscribe>[EMAIL PROTECTED]</subscribe> + <unsubscribe>[EMAIL PROTECTED]</unsubscribe> + <archive>http://mail-archives.apache.org/mod_mbox/incubator-cayenne-dev</archive> <otherArchives> - <otherArchive> - http://objectstyle.org/cayenne/lists/cayenne-devel - </otherArchive> + <otherArchive>http://objectstyle.org/cayenne/lists/cayenne-devel</otherArchive> </otherArchives> </mailingList> <mailingList> <name>Cayenne Commits</name> - <subscribe> - [EMAIL PROTECTED] - </subscribe> - <unsubscribe> - [EMAIL PROTECTED] - </unsubscribe> - <archive> - http://mail-archives.apache.org/mod_mbox/incubator-cayenne-commits - </archive> + <subscribe>[EMAIL PROTECTED]</subscribe> + <unsubscribe>[EMAIL PROTECTED]</unsubscribe> + <archive>http://mail-archives.apache.org/mod_mbox/incubator-cayenne-commits</archive> </mailingList> </mailingLists> @@ -157,9 +135,7 @@ <developerConnection> scm:svn:https://@svn.apache.org/repos/asf/incubator/cayenne/main/trunk/cayenne </developerConnection> - <url> - http://svn.apache.org/viewvc/incubator/cayenne/main/trunk - </url> + <url>http://svn.apache.org/viewvc/incubator/cayenne/main/trunk</url> </scm> <organization> @@ -209,13 +185,13 @@ <artifactId>ashwood</artifactId> <version>1.1</version> </dependency> - + <dependency> <groupId>asm</groupId> <artifactId>asm</artifactId> <version>2.2.3</version> </dependency> - + <dependency> <groupId>asm</groupId> <artifactId>asm-commons</artifactId> @@ -484,9 +460,7 @@ <repository> <id>apache-snapshots</id> <name>Apache Snapshots Repository</name> - <url> - http://people.apache.org/repo/m2-snapshot-repository/ - </url> + <url>http://people.apache.org/repo/m2-snapshot-repository/</url> <layout>default</layout> <snapshots> <enabled>true</enabled> @@ -514,7 +488,7 @@ <enabled>true</enabled> </releases> </pluginRepository> - + <pluginRepository> <id>objectstyle</id> <name>ObjectStyle Public Maven2 repo</name> @@ -534,6 +508,14 @@ <build> <defaultGoal>install</defaultGoal> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>-Dcayenne.test.connection=${cayenne.test.connection}</argLine> + </configuration> + </plugin> + </plugins> </build> <distributionManagement> @@ -584,43 +566,25 @@ <showProtected>true</showProtected> <showPackage>false</showPackage> <links> - <link> - http://java.sun.com/j2ee/1.4/docs/api - </link> - <link> - http://java.sun.com/j2se/1.5.0/docs/api - </link> + <link>http://java.sun.com/j2ee/1.4/docs/api</link> + <link>http://java.sun.com/j2se/1.5.0/docs/api</link> <link> http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/ </link> - <link> - http://jakarta.apache.org/commons/dbcp/apidocs/ - </link> - <link> - http://jakarta.apache.org/commons/fileupload/apidocs/ - </link> - <link> - http://jakarta.apache.org/commons/httpclient/apidocs/ - </link> - <link> - http://jakarta.apache.org/commons/logging/api/ - </link> - <link> - http://jakarta.apache.org/commons/pool/apidocs/ - </link> + <link>http://jakarta.apache.org/commons/dbcp/apidocs/</link> + <link>http://jakarta.apache.org/commons/fileupload/apidocs/</link> + <link>http://jakarta.apache.org/commons/httpclient/apidocs/</link> + <link>http://jakarta.apache.org/commons/logging/api/</link> + <link>http://jakarta.apache.org/commons/pool/apidocs/</link> <link>http://www.junit.org/junit/javadoc/</link> - <link> - http://jakarta.apache.org/regexp/apidocs/ - </link> + <link>http://jakarta.apache.org/regexp/apidocs/</link> </links> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId> - maven-project-info-reports-plugin - </artifactId> + <artifactId>maven-project-info-reports-plugin</artifactId> <reportSets> <reportSet> <reports> @@ -638,5 +602,86 @@ </plugins> </reporting> + <!-- Test Profiles (default is embedded HSQLDB) --> + <profiles> + <profile> + <id>default-db</id> + <activation> + <activeByDefault>true</activeByDefault> + <property> + <name>cayenne.test.connection</name> + <value>internal_embedded_datasource</value> + </property> + </activation> + </profile> + <profile> + <id>mysql</id> + <activation> + <property> + <name>cayenne.test.connection</name> + <value>mysql</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>3.1.11</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>oracle</id> + <activation> + <property> + <name>cayenne.test.connection</name> + <value>oracle</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>oracle-driver</artifactId> + <version>10</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>postgres</id> + <activation> + <property> + <name>cayenne.test.connection</name> + <value>postgres</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>8.1-404.jdbc3</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>derby</id> + <activation> + <property> + <name>cayenne.test.connection</name> + <value>derby</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.1.0</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + </profiles> </project>