Author: hardy.ferentschik
Date: 2009-04-23 10:51:05 -0400 (Thu, 23 Apr 2009)
New Revision: 16423
Removed:
search/trunk/src/main/filters/
search/trunk/src/test/java/org/hibernate/search/test/HANTestCase.java
Modified:
search/trunk/pom.xml
search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java
search/trunk/src/test/resources/hibernate.properties
Log:
JBPAPP-1679
Aligned with hibernate.properties from Core and cleaned up the test harness.
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2009-04-23 12:38:22 UTC (rev 16422)
+++ search/trunk/pom.xml 2009-04-23 14:51:05 UTC (rev 16423)
@@ -224,13 +224,12 @@
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>release</releaseProfiles>
- <goals>package javadoc:javadoc
org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources
org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate
assembly:assembly</goals>
+ <goals>package javadoc:javadoc
org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources
+ org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate
assembly:assembly
+ </goals>
</configuration>
</plugin>
</plugins>
- <filters>
- <filter>${filter.file}</filter>
- </filters>
<testResources>
<testResource>
<filtering>true</filtering>
@@ -261,7 +260,12 @@
</dependency>
</dependencies>
<properties>
- <filter.file>src/main/filters/hsqldb.filter</filter.file>
+ <db.dialect>org.hibernate.dialect.HSQLDialect</db.dialect>
+ <jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
+ <jdbc.url>jdbc:hsqldb:.</jdbc.url>
+ <jdbc.user>sa</jdbc.user>
+ <jdbc.pass/>
+ <jdbc.isolation/>
</properties>
</profile>
<profile>
@@ -274,7 +278,12 @@
</dependency>
</dependencies>
<properties>
-
<filter.file>src/main/filters/postgresql.filter</filter.file>
+
<db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
+ <jdbc.driver>org.postgresql.Driver</jdbc.driver>
+
<jdbc.url>jdbc:postgresql://localhost:5432/hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
</properties>
</profile>
<profile>
@@ -287,7 +296,12 @@
</dependency>
</dependencies>
<properties>
- <filter.file>src/main/filters/mysql.filter</filter.file>
+
<db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
+ <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:mysql://localhost/hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
</properties>
</profile>
@@ -328,27 +342,27 @@
<version>1.3.0</version>
<optional>true</optional>
<exclusions>
- <exclusion>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-solrj</artifactId>
- </exclusion>
- <exclusion>
- <groupId>woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.java.dev.stax-utils</groupId>
- <artifactId>stax-utils</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-solrj</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.java.dev.stax-utils</groupId>
+ <artifactId>stax-utils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
@@ -434,11 +448,11 @@
</build>
</profile>
</profiles>
-
+
<properties>
<slf4jVersion>1.5.6</slf4jVersion>
<luceneVersion>2.4.1</luceneVersion>
<hibernateVersion>3.5.0-SNAPSHOT</hibernateVersion>
</properties>
-
+
</project>
Deleted: search/trunk/src/test/java/org/hibernate/search/test/HANTestCase.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/HANTestCase.java 2009-04-23
12:38:22 UTC (rev 16422)
+++ search/trunk/src/test/java/org/hibernate/search/test/HANTestCase.java 2009-04-23
14:51:05 UTC (rev 16423)
@@ -1,67 +0,0 @@
-//$Id$
-package org.hibernate.search.test;
-
-import java.io.InputStream;
-
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Originally a copy from Hibernate Annotations.
- *
- * @author Emmanuel Bernard
- * @author Hardy Ferentschik
- */
-public abstract class HANTestCase extends TestCase {
-
- public HANTestCase() {
- super();
- }
-
- public HANTestCase(String x) {
- super( x );
- }
-
- protected void buildSessionFactory(Class[] classes, String[] packages, String[]
xmlFiles) throws Exception {
- if ( getSessions() != null ) {
- getSessions().close();
- }
- try {
- setCfg( new AnnotationConfiguration() );
- configure( cfg );
- if ( recreateSchema() ) {
- cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
- }
- for ( String aPackage : packages ) {
- ( ( AnnotationConfiguration ) getCfg() ).addPackage( aPackage );
- }
- for ( Class aClass : classes ) {
- ( ( AnnotationConfiguration ) getCfg() ).addAnnotatedClass( aClass );
- }
- for ( String xmlFile : xmlFiles ) {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(
xmlFile );
- getCfg().addInputStream( is );
- }
- setDialect( Dialect.getDialect() );
- setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
- }
- catch ( Exception e ) {
- e.printStackTrace();
- throw e;
- }
- }
-
- protected void setUp() throws Exception {
- if ( getSessions() == null || getSessions().isClosed() || lastTestClass != getClass() )
{
- buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
- lastTestClass = getClass();
- }
- }
-
- protected abstract Class[] getMappings();
-
- protected String[] getAnnotatedPackages() {
- return new String[] { };
- }
-}
Modified: search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java 2009-04-23
12:38:22 UTC (rev 16422)
+++ search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java 2009-04-23
14:51:05 UTC (rev 16423)
@@ -2,12 +2,16 @@
package org.hibernate.search.test;
import java.io.File;
+import java.io.InputStream;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.store.Directory;
+import org.slf4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.dialect.Dialect;
import org.hibernate.event.PostInsertEventListener;
import org.hibernate.impl.SessionFactoryImpl;
import org.hibernate.search.Environment;
@@ -16,15 +20,14 @@
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.event.FullTextIndexEventListener;
import org.hibernate.search.store.RAMDirectoryProvider;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
-import org.slf4j.Logger;
-
/**
* Base class for Hibernate Search unit tests.
*
* @author Emmanuel Bernard
*/
-public abstract class SearchTestCase extends HANTestCase {
+public abstract class SearchTestCase extends TestCase {
private static final Logger log = org.hibernate.search.util.LoggerFactory.make();
@@ -45,6 +48,11 @@
ensureIndexesAreEmpty();
}
+ protected void tearDown() throws Exception {
+ SchemaExport export = new SchemaExport( cfg );
+ export.drop( false, true );
+ }
+
@SuppressWarnings("unchecked")
protected Directory getDirectory(Class clazz) {
return getLuceneEventListener().getSearchFactoryImplementor().getDirectoryProviders(
clazz )[0].getDirectory();
@@ -95,4 +103,39 @@
protected File getBaseIndexDir() {
return indexDir;
}
+
+ protected void buildSessionFactory(Class[] classes, String[] packages, String[]
xmlFiles) throws Exception {
+ if ( getSessions() != null ) {
+ getSessions().close();
+ }
+ try {
+ setCfg( new AnnotationConfiguration() );
+ configure( cfg );
+ if ( recreateSchema() ) {
+ cfg.setProperty( org.hibernate.cfg.Environment.HBM2DDL_AUTO, "create-drop"
);
+ }
+ for ( String aPackage : packages ) {
+ ( ( AnnotationConfiguration ) getCfg() ).addPackage( aPackage );
+ }
+ for ( Class aClass : classes ) {
+ ( ( AnnotationConfiguration ) getCfg() ).addAnnotatedClass( aClass );
+ }
+ for ( String xmlFile : xmlFiles ) {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(
xmlFile );
+ getCfg().addInputStream( is );
+ }
+ setDialect( Dialect.getDialect() );
+ setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
+ }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ protected abstract Class[] getMappings();
+
+ protected String[] getAnnotatedPackages() {
+ return new String[] { };
+ }
}
Modified: search/trunk/src/test/resources/hibernate.properties
===================================================================
--- search/trunk/src/test/resources/hibernate.properties 2009-04-23 12:38:22 UTC (rev
16422)
+++ search/trunk/src/test/resources/hibernate.properties 2009-04-23 14:51:05 UTC (rev
16423)
@@ -1,313 +1,31 @@
-######################
-### Query Language ###
-######################
+################################################################################
+# Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved. #
+# #
+# This copyrighted material is made available to anyone wishing to use, modify,#
+# copy, or redistribute it subject to the terms and conditions of the GNU #
+# Lesser General Public License, v. 2.1. This program is distributed in the #
+# hope that it will be useful, but WITHOUT A WARRANTY; without even the implied#
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
+# Lesser General Public License for more details. You should have received a #
+# copy of the GNU Lesser General Public License, v.2.1 along with this #
+# distribution; if not, write to the Free Software Foundation, Inc., #
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
+# #
+# Red Hat Author(s): Steve Ebersole #
+################################################################################
+hibernate.dialect ${db.dialect}
+hibernate.connection.driver_class ${jdbc.driver}
+hibernate.connection.url ${jdbc.url}
+hibernate.connection.username ${jdbc.user}
+hibernate.connection.password ${jdbc.pass}
+hibernate.connection.isolation ${jdbc.isolation}
-## define query language constants / function names
+hibernate.connection.pool_size 5
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-
-## select the classic query parser
-
-#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-
+hibernate.show_sql true
hibernate.format_sql true
+hibernate.max_fetch_depth 5
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-hibernate.dialect @hibernate.dialect@
-hibernate.connection.driver_class @hibernate.connection.driver_class@
-hibernate.connection.username @hibernate.connection.username@
-hibernate.connection.password @hibernate.connection.password@
-hibernate.connection.url @hibernate.connection.url@
-
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 1
-
-
-
-###########################
-### C3P0 Connection Pool###
-###########################
-
-#hibernate.c3p0.max_size 2
-#hibernate.c3p0.min_size 2
-#hibernate.c3p0.timeout 5000
-#hibernate.c3p0.max_statements 100
-#hibernate.c3p0.idle_test_period 3000
-#hibernate.c3p0.acquire_increment 2
-#hibernate.c3p0.validate false
-
-
-
-##############################
-### Proxool Connection Pool###
-##############################
-
-## Properties for external configuration of Proxool
-
-hibernate.proxool.pool_alias pool1
-
-## Only need one of the following
-
-#hibernate.proxool.existing_pool true
-#hibernate.proxool.xml proxool.xml
-#hibernate.proxool.properties proxool.properties
-
-
-
-#################################
-### Plugin ConnectionProvider ###
-#################################
-
-## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in
ConnectionProvider using hueristics)
-
-#hibernate.connection.provider_class
org.hibernate.connection.DriverManagerConnectionProvider
-#hibernate.connection.provider_class
org.hibernate.connection.DatasourceConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
-
-
-
-#######################
-### Transaction API ###
-#######################
-
-## Enable automatic flush during the JTA beforeCompletion() callback
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.flush_before_completion
-
-
-## Enable automatic session close at the end of transaction
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.auto_close_session
-
-
-## the Transaction API abstracts application code from the underlying JTA or JDBC
transactions
-
-#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
-#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
-
-
-## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in
JNDI
-## default is java:comp/UserTransaction
-## you do NOT need this setting if you specify
hibernate.transaction.manager_lookup_class
-
-#jta.UserTransaction jta/usertransaction
-#jta.UserTransaction javax.transaction.UserTransaction
-#jta.UserTransaction UserTransaction
-
-
-## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA
TransactionManager
-
-#hibernate.transaction.manager_lookup_class
org.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class
org.hibernate.transaction.WeblogicTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class
org.hibernate.transaction.WebSphereTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class
org.hibernate.transaction.OrionTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class
org.hibernate.transaction.ResinTransactionManagerLookup
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-#hibernate.show_sql true
-
-
-## add comments to the generated SQL
-
-#hibernate.use_sql_comments true
-
-
-## generate statistics
-
-#hibernate.generate_statistics true
-
-
-## auto schema export
-
-#hibernate.hbm2ddl.auto create-drop
-#hibernate.hbm2ddl.auto create
-#hibernate.hbm2ddl.auto update
-
-
-## specify a default schema and catalog for unqualified tablenames
-
-#hibernate.default_schema test
-#hibernate.default_catalog test
-
-
-## enable ordering of SQL UPDATEs by primary key
-
-hibernate.order_updates true
-
-
-## set the maximum depth of the outer join fetch tree
-
-hibernate.max_fetch_depth 1
-
-
-## set the default batch size for batch fetching
-
-hibernate.default_batch_fetch_size 100
-
-
-## rollback generated identifier values of deleted entities to default values
-
-#hibernate.use_identifer_rollback true
-
-
-## enable CGLIB reflection optimizer (enabled by default)
-
-#hibernate.cglib.use_reflection_optimizer false
-
-
-
-#####################
-### JDBC Settings ###
-#####################
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## enable JDBC autocommit (not recommended!)
-
-#hibernate.connection.autocommit true
-
-
-## set the JDBC fetch size
-
-#hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-#hibernate.jdbc.batch_size 0
-
-
-## enable batch updates even for versioned data
-
-hibernate.jdbc.batch_versioned_data true
-
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate
to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted
row
-
-#hibernate.jdbc.use_get_generated_keys false
-
-
-## choose a custom JDBC batcher
-
-# hibernate.jdbc.factory_class
-
-
-## enable JDBC result set column alias caching
-## (minor performance enhancement for broken JDBC drivers)
-
-# hibernate.jdbc.wrap_result_sets
-
-
-## choose a custom SQL exception converter
-
-#hibernate.jdbc.sql_exception_converter
-
-
-
-##########################
-### Second-level Cache ###
-##########################
-
-## optimize chache for minimal "puts" instead of minimal "gets" (good
for clustered cache)
-
-#hibernate.cache.use_minimal_puts true
-
-
-## set a prefix for cache region names
-
hibernate.cache.region_prefix hibernate.test
-
-
-## disable the second-level cache
-
-#hibernate.cache.use_second_level_cache false
-
-
-## enable the query cache
-
-hibernate.cache.use_query_cache true
-
-
-## store the second-level cache entries in a more human-friendly format
-
-#hibernate.cache.use_structured_entries true
-
-
-## choose a cache implementation
-
-#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
-
-
-## choose a custom query cache implementation
-
-#hibernate.cache.query_cache_factory
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA
UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext()
which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
-