HHH-2863 : isolate cache integration testing

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14216 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2007-12-06 20:28:10 +00:00
parent f3add4ddda
commit a15cab0911
30 changed files with 766 additions and 239 deletions

View File

@ -29,6 +29,69 @@
<artifactId>ehcache</artifactId>
<version>1.2.3</version>
</dependency>
<!-- testing deps -->
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-testing</artifactId>
<version>${version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>99.0-does-not-exist</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>99.0-does-not-exist</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl104-over-slf4j</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
</dependency>
<!-- these are optional on core... :( -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.4.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
<version>1.5.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,64 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import junit.framework.Test;
import org.hibernate.cfg.Environment;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.test.cache.BaseCacheProviderTestCase;
/**
* @author Emmanuel Bernard
*/
public class EhCacheTest extends BaseCacheProviderTestCase {
public EhCacheTest(String x) {
super( x );
}
public static Test suite() {
return new FunctionalTestClassTestSuite( EhCacheTest.class );
}
public String getCacheConcurrencyStrategy() {
return "read-write";
}
protected Class getCacheProvider() {
return EhCacheProvider.class;
}
protected String getConfigResourceKey() {
return Environment.CACHE_PROVIDER_CONFIG;
}
protected String getConfigResourceLocation() {
return "ehcache.xml";
}
protected boolean useTransactionManager() {
return false;
}
}

View File

@ -1,3 +1,26 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors.  All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~
~ 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, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY 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
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<ehcache>
<!-- Sets the path to the directory where cache .data files are created.

View File

@ -0,0 +1,32 @@
################################################################################
# Hibernate, Relational Persistence for Idiomatic Java #
# #
# Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as #
# indicated by the @author tags or express copyright attribution #
# statements applied by the authors.  All third-party contributions are #
# distributed under license by Red Hat Middleware LLC. #
# #
# 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, as published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY 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 #
# along with this distribution; if not, write to: #
# Free Software Foundation, Inc. #
# 51 Franklin Street, Fifth Floor #
# Boston, MA 02110-1301 USA #
################################################################################
hibernate.dialect org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.url jdbc:hsqldb:mem:/test
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.pool_size 5
hibernate.cache.region_prefix hibernate.test

View File

@ -0,0 +1,32 @@
################################################################################
# Hibernate, Relational Persistence for Idiomatic Java #
# #
# Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as #
# indicated by the @author tags or express copyright attribution #
# statements applied by the authors.  All third-party contributions are #
# distributed under license by Red Hat Middleware LLC. #
# #
# 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, as published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY 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 #
# along with this distribution; if not, write to: #
# Free Software Foundation, Inc. #
# 51 Franklin Street, Fifth Floor #
# Boston, MA 02110-1301 USA #
################################################################################
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info

View File

@ -60,6 +60,69 @@
<artifactId>jgroups-all</artifactId>
<version>2.2.7</version>
</dependency>
<!-- testing deps -->
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-testing</artifactId>
<version>${version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>99.0-does-not-exist</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>99.0-does-not-exist</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl104-over-slf4j</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
</dependency>
<!-- these are optional on core... :( -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.4.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
<version>1.5.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +1,26 @@
// $Id: JndiBoundTreeCacheProvider.java 6079 2005-03-16 06:01:18Z oneovthafew $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import java.util.Properties;

View File

@ -1,4 +1,26 @@
//$Id: OptimisticTreeCache.java 10118 2006-07-13 21:38:41Z steve.ebersole@jboss.com $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import java.util.HashMap;

View File

@ -1,4 +1,26 @@
//$Id: OptimisticTreeCacheProvider.java 9895 2006-05-05 19:27:17Z epbernard $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import java.util.Properties;
@ -26,10 +48,10 @@ import org.jboss.cache.PropertyConfigurator;
public class OptimisticTreeCacheProvider implements CacheProvider {
/**
* @deprecated use {@link Environment.CACHE_PROVIDER_CONFIG}
* @deprecated use {@link Environment#CACHE_PROVIDER_CONFIG}
*/
public static final String CONFIG_RESOURCE = "hibernate.cache.opt_tree_cache.config";
public static final String DEFAULT_CONFIG = "treecache.xml";
public static final String DEFAULT_CONFIG = "treecache-optimistic.xml";
private static final String NODE_LOCKING_SCHEME = "OPTIMISTIC";
private static final Logger log = LoggerFactory.getLogger( OptimisticTreeCacheProvider.class );

View File

@ -1,4 +1,26 @@
//$Id: TreeCache.java 9965 2006-05-30 18:00:28Z steve.ebersole@jboss.com $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import java.util.HashMap;

View File

@ -1,4 +1,26 @@
//$Id: TreeCacheProvider.java 11398 2007-04-10 14:54:07Z steve.ebersole@jboss.com $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import java.util.Properties;
@ -23,7 +45,7 @@ public class TreeCacheProvider implements CacheProvider {
* @deprecated use {@link org.hibernate.cfg.Environment#CACHE_PROVIDER_CONFIG}
*/
public static final String CONFIG_RESOURCE = "hibernate.cache.tree_cache.config";
public static final String DEFAULT_CONFIG = "treecache.xml";
public static final String DEFAULT_CONFIG = "treecache-optimistic.xml";
private static final Logger log = LoggerFactory.getLogger( TreeCacheProvider.class );

View File

@ -1,12 +1,35 @@
package org.hibernate.test.cache.treecache.optimistic;
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import junit.framework.Test;
import junit.framework.Assert;
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Option;
import org.jboss.cache.optimistic.DataVersion;
import org.hibernate.cache.OptimisticTreeCacheProvider;
import org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge;
import org.hibernate.cfg.Environment;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@ -17,11 +40,6 @@ import org.hibernate.test.tm.SimpleJtaTransactionManagerImpl;
* @author Steve Ebersole
*/
public class OptimisticTreeCacheTest extends BaseCacheProviderTestCase {
// note that a lot of the fucntionality here is intended to be used
// in creating specific tests for each CacheProvider that would extend
// from a base test case (this) for common requirement testing...
public OptimisticTreeCacheTest(String x) {
super( x );
}
@ -43,7 +61,7 @@ public class OptimisticTreeCacheTest extends BaseCacheProviderTestCase {
}
protected String getConfigResourceLocation() {
return "org/hibernate/test/cache/treecache/optimistic/treecache.xml";
return "treecache-optimistic.xml";
}
protected boolean useTransactionManager() {
@ -73,7 +91,7 @@ public class OptimisticTreeCacheTest extends BaseCacheProviderTestCase {
SimpleJtaTransactionManagerImpl.getInstance().begin();
treeCache.put( fqn, "ITEM", long1, ManualDataVersion.gen( 1 ) );
SimpleJtaTransactionManagerImpl.getInstance().commit();
fail( "stale write allowed" );
Assert.fail( "stale write allowed" );
}
catch( Throwable ignore ) {
// expected behavior
@ -81,7 +99,7 @@ public class OptimisticTreeCacheTest extends BaseCacheProviderTestCase {
}
Long current = ( Long ) treeCache.get( fqn, "ITEM" );
assertEquals( "unexpected current value", 2, current.longValue() );
Assert.assertEquals( "unexpected current value", 2, current.longValue() );
}
finally {
try {

View File

@ -0,0 +1,64 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache;
import junit.framework.Test;
import org.hibernate.cfg.Environment;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.test.cache.BaseCacheProviderTestCase;
/**
* @author Steve Ebersole
*/
public class PessimisticTreeCacheTest extends BaseCacheProviderTestCase {
public PessimisticTreeCacheTest(String x) {
super( x );
}
public static Test suite() {
return new FunctionalTestClassTestSuite( PessimisticTreeCacheTest.class );
}
public String getCacheConcurrencyStrategy() {
return "transactional";
}
protected Class getCacheProvider() {
return TreeCacheProvider.class;
}
protected String getConfigResourceKey() {
return Environment.CACHE_PROVIDER_CONFIG;
}
protected String getConfigResourceLocation() {
return "treecache-pessimistic.xml";
}
protected boolean useTransactionManager() {
return true;
}
}

View File

@ -0,0 +1,32 @@
################################################################################
# Hibernate, Relational Persistence for Idiomatic Java #
# #
# Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as #
# indicated by the @author tags or express copyright attribution #
# statements applied by the authors.  All third-party contributions are #
# distributed under license by Red Hat Middleware LLC. #
# #
# 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, as published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY 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 #
# along with this distribution; if not, write to: #
# Free Software Foundation, Inc. #
# 51 Franklin Street, Fifth Floor #
# Boston, MA 02110-1301 USA #
################################################################################
hibernate.dialect org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.url jdbc:hsqldb:mem:/test
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.pool_size 5
hibernate.cache.region_prefix hibernate.test

View File

@ -0,0 +1,32 @@
################################################################################
# Hibernate, Relational Persistence for Idiomatic Java #
# #
# Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as #
# indicated by the @author tags or express copyright attribution #
# statements applied by the authors.  All third-party contributions are #
# distributed under license by Red Hat Middleware LLC. #
# #
# 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, as published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY 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 #
# along with this distribution; if not, write to: #
# Free Software Foundation, Inc. #
# 51 Franklin Street, Fifth Floor #
# Boston, MA 02110-1301 USA #
################################################################################
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info

View File

@ -1,5 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors.  All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~
~ 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, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY 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
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<!-- ===================================================================== -->
<!-- -->
<!-- Sample TreeCache Service Configuration -->

View File

@ -1,5 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors.  All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~
~ 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, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY 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
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<!-- ===================================================================== -->
<!-- -->
<!-- Sample TreeCache Service Configuration -->

View File

@ -22,18 +22,16 @@
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>${antlrVersion}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<!-- YUCK, YUCK, YUCK!!!! -->
<groupId>javax.transaction</groupId>
@ -86,13 +84,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>antlr-maven-plugin</artifactId>
<version>${antlrPluginVersion}</version>
<dependencies>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>${antlrVersion}</version>
</dependency>
</dependencies>
<configuration>
<grammars>hql.g,hql-sql.g,sql-gen.g</grammars>
</configuration>
@ -150,8 +141,7 @@
</reporting>
<properties>
<antlrVersion>2.7.6</antlrVersion>
<antlrPluginVersion>2.0.0-SNAPSHOT</antlrPluginVersion>
<antlrPluginVersion>2.0-SNAPSHOT</antlrPluginVersion>
</properties>
</project>

View File

@ -32,4 +32,5 @@
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,3 +1,26 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.cache;
import java.util.Map;

View File

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors.  All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~
~ 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, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY 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
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<hibernate-mapping
package="org.hibernate.test.cache">
<class name="Item" table="Items">
<id name="id">
<generator class="increment"/>
</id>
<property name="name" not-null="true"/>
<property name="description" not-null="true"/>
</class>
<class name="VersionedItem" table="VersionedItems">
<id name="id">
<generator class="increment"/>
</id>
<version name="version" type="long"/>
<property name="name" not-null="true"/>
<property name="description" not-null="true"/>
</class>
</hibernate-mapping>

View File

@ -0,0 +1,53 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.cache;
/**
* @author Gavin King
*/
public class Item {
private Long id;
private String name;
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,39 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* 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, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY 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
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.cache;
/**
* @author Steve Ebersole
*/
public class VersionedItem extends Item {
private Long version;
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
}

View File

@ -29,26 +29,6 @@
<artifactId>hibernate-testing</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-jbosscache</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-oscache</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>hibernate-swarmcache</artifactId>
<version>${version}</version>
</dependency>
<!-- these are optional on core... :( -->
<dependency>
<groupId>javassist</groupId>

View File

@ -1,21 +0,0 @@
package org.hibernate.test.cache;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.hibernate.test.cache.treecache.optimistic.OptimisticTreeCacheTest;
import org.hibernate.test.cache.treecache.pessimistic.TreeCacheTest;
import org.hibernate.test.cache.ehcache.EhCacheTest;
/**
* @author Steve Ebersole
*/
public class CacheSuite {
public static Test suite() {
TestSuite suite = new TestSuite( "CacheProvider tests");
suite.addTest( OptimisticTreeCacheTest.suite() );
suite.addTest( TreeCacheTest.suite() );
suite.addTest( EhCacheTest.suite() );
return suite;
}
}

View File

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="org.hibernate.test.cache">
<class name="Item" table="Items">
<id name="id">
<generator class="increment"/>
</id>
<property name="name" not-null="true"/>
<property name="description" not-null="true"/>
</class>
<class name="VersionedItem" table="VersionedItems">
<id name="id">
<generator class="increment"/>
</id>
<version name="version" type="long"/>
<property name="name" not-null="true"/>
<property name="description" not-null="true"/>
</class>
</hibernate-mapping>

View File

@ -1,31 +0,0 @@
//$Id: Item.java 5686 2005-02-12 07:27:32Z steveebersole $
package org.hibernate.test.cache;
/**
* @author Gavin King
*/
public class Item {
private Long id;
private String name;
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -1,16 +0,0 @@
package org.hibernate.test.cache;
/**
* @author Steve Ebersole
*/
public class VersionedItem extends Item {
private Long version;
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
}

View File

@ -1,48 +0,0 @@
//$Id: $
package org.hibernate.test.cache.ehcache;
import junit.framework.Test;
import org.hibernate.cache.EhCacheProvider;
import org.hibernate.cfg.Environment;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.test.cache.BaseCacheProviderTestCase;
/**
* @author Emmanuel Bernard
*/
public class EhCacheTest extends BaseCacheProviderTestCase {
// note that a lot of the fucntionality here is intended to be used
// in creating specific tests for each CacheProvider that would extend
// from a base test case (this) for common requirement testing...
public EhCacheTest(String x) {
super( x );
}
public static Test suite() {
return new FunctionalTestClassTestSuite( EhCacheTest.class );
}
public String getCacheConcurrencyStrategy() {
return "read-write";
}
protected Class getCacheProvider() {
return EhCacheProvider.class;
}
protected String getConfigResourceKey() {
return Environment.CACHE_PROVIDER_CONFIG;
}
protected String getConfigResourceLocation() {
return "org/hibernate/test/cache/ehcache/ehcache.xml";
}
protected boolean useTransactionManager() {
return false;
}
}

View File

@ -1,47 +0,0 @@
package org.hibernate.test.cache.treecache.pessimistic;
import junit.framework.Test;
import org.hibernate.cache.TreeCacheProvider;
import org.hibernate.cfg.Environment;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.test.cache.BaseCacheProviderTestCase;
/**
* @author Steve Ebersole
*/
public class TreeCacheTest extends BaseCacheProviderTestCase {
// note that a lot of the fucntionality here is intended to be used
// in creating specific tests for each CacheProvider that would extend
// from a base test case (this) for common requirement testing...
public TreeCacheTest(String x) {
super( x );
}
public static Test suite() {
return new FunctionalTestClassTestSuite( TreeCacheTest.class );
}
public String getCacheConcurrencyStrategy() {
return "transactional";
}
protected Class getCacheProvider() {
return TreeCacheProvider.class;
}
protected String getConfigResourceKey() {
return Environment.CACHE_PROVIDER_CONFIG;
}
protected String getConfigResourceLocation() {
return "org/hibernate/test/cache/treecache/pessimistic/treecache.xml";
}
protected boolean useTransactionManager() {
return true;
}
}