[jboss-cvs] JBossAS SVN: r76298 - in projects/cluster/hibernate-jbc-cacheprovider/trunk: .settings and 51 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 28 07:57:55 EDT 2008
Author: galder.zamarreno at jboss.com
Date: 2008-07-28 07:57:54 -0400 (Mon, 28 Jul 2008)
New Revision: 76298
Added:
projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath
projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath.old
projects/cluster/hibernate-jbc-cacheprovider/trunk/.project
projects/cluster/hibernate-jbc-cacheprovider/trunk/.project.old
projects/cluster/hibernate-jbc-cacheprovider/trunk/.settings/
projects/cluster/hibernate-jbc-cacheprovider/trunk/.settings/org.eclipse.jdt.core.prefs
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedEntityManager.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContext.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContextPropagationInterceptor.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/HibernateSession.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedEntityManagerFactory.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedSessionFactory.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JBCCache.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JTATableIdGenerator.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory$SessionSynchronization.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$CircumventChecksDataVersion.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$DataVersionAdapter.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$NonLockingDataVersion.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticTreeCacheProviderHook.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitDeployment.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitInfoImpl.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader$ErrorLogger.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/SecondLevelCacheUtil.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManager.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManagerInterceptor.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TreeCacheProviderHook.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/ExtendedSessionInvocationHandler.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/TransactionScopedSessionInvocationHandler.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/SkipLog.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/TestSuiteVisitor.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/UnitTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/ExecutionEnvironment.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyConnectionProvider.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyJTAStyleTransationFactory.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransaction.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManager.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManagerLookup.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/resources/
projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/resources/hibernate.properties
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/JBCCache.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$CircumventChecksDataVersion.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$DataVersionAdapter.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$NonLockingDataVersion.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/mvn-eclipse-cache.properties
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/hibernate.properties
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/SkipLog.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor$Handler.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/UnitTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment$Settings.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestClassTestSuite.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyConnectionProvider.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory$DummyTransactionAdapter.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransaction.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManager.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManagerLookup.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase$SecondNodeSettings.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$IdContainer.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$MyListener.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager$TransactionManagerLookupAdaptor.class
projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.class
Log:
First Import
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,32 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hibernate/hibernate3/3.2.4.SP1/hibernate3-3.2.4.SP1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.2/hsqldb-1.8.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.8.1.GA/javassist-3.8.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss/4.2.2.GA/jboss-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common/4.2.2.GA/jboss-common-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-j2ee/4.2.2.GA/jboss-j2ee-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.2.GA/jboss-jmx-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-serialization/1.0.3.GA/jboss-serialization-1.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-system/4.2.2.GA/jboss-system-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-transaction/4.2.2.GA/jboss-transaction-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jgroups/jgroups/2.4.1/jgroups-2.4.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/trove/trove/1.0.2/trove-1.0.2.jar"/>
+</classpath>
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath.old
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath.old (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/.classpath.old 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,19 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/hibernate/hibernate3/3.2.4.SP1/hibernate3-3.2.4.SP1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hibernate-annotations/hibernate-annotations/3.2.1.GA/hibernate-annotations-3.2.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hibernate-entitymanager/hibernate-entitymanager/3.2.1.GA/hibernate-entitymanager-3.2.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common/4.2.2.GA/jboss-common-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-ejb3/4.2.2.GA/jboss-ejb3-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-j2ee/4.2.2.GA/jboss-j2ee-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.2.GA/jboss-jmx-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-system/4.2.2.GA/jboss-system-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-transaction/4.2.2.GA/jboss-transaction-4.2.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-jdk50/1.5.6.GA/jboss-aop-jdk50-1.5.6.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1-sources.jar"/>
+</classpath>
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/.project
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/.project (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/.project 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>hibernate-jbc-cacheprovider</name>
+ <comment></comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/.project.old
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/.project.old (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/.project.old 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>jboss-hibernate-cache-jbc</name>
+ <comment></comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/.settings/org.eclipse.jdt.core.prefs 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,5 @@
+#Thu Jul 17 23:29:03 CEST 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedEntityManager.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedEntityManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContext.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContextPropagationInterceptor.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ExtendedPersistenceContextPropagationInterceptor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/HibernateSession.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/HibernateSession.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedEntityManagerFactory.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedEntityManagerFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedSessionFactory.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/InjectedSessionFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JBCCache.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JBCCache.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JTATableIdGenerator.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/JTATableIdGenerator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory$SessionSynchronization.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory$SessionSynchronization.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/ManagedEntityManagerFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$CircumventChecksDataVersion.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$CircumventChecksDataVersion.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$DataVersionAdapter.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$DataVersionAdapter.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$NonLockingDataVersion.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache$NonLockingDataVersion.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticJBCCache.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticTreeCacheProviderHook.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/OptimisticTreeCacheProviderHook.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitDeployment.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitDeployment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitInfoImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceUnitInfoImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader$ErrorLogger.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader$ErrorLogger.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/PersistenceXmlLoader.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/SecondLevelCacheUtil.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/SecondLevelCacheUtil.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManager.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManagerInterceptor.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TransactionScopedEntityManagerInterceptor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TreeCacheProviderHook.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/cache/jbc/TreeCacheProviderHook.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/ExtendedSessionInvocationHandler.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/ExtendedSessionInvocationHandler.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/TransactionScopedSessionInvocationHandler.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/output/eclipse/org/jboss/hibernate/util/TransactionScopedSessionInvocationHandler.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,245 @@
+<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">
+ <parent>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-cluster</artifactId>
+ <version>1.1.0.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>hibernate-jbc-cacheprovider</artifactId>
+ <packaging>jar</packaging>
+ <version>0.0.1.Alpha1</version>
+ <name></name>
+ <url>http://www.jboss.org</url>
+ <description></description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss, a division of Red Hat, Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <scm>
+ <connection></connection>
+ </scm>
+
+ <properties>
+ <version.hibernate>3.2.4.SP1</version.hibernate>
+ <version.jboss.cache>1.4.1.SP9</version.jboss.cache>
+ <version.jboss.common>4.2.2.GA</version.jboss.common>
+ <version.jboss.jmx>4.2.2.GA</version.jboss.jmx>
+ <version.jboss.system>4.2.2.GA</version.jboss.system>
+ <version.jboss.j2ee>4.2.2.GA</version.jboss.j2ee>
+ <version.jboss.transaction>4.2.2.GA</version.jboss.transaction>
+ <!-- test versions -->
+ <version.junit>3.8.1</version.junit>
+ <version.commons.logging>1.1</version.commons.logging>
+ <version.dom4j>1.6.1</version.dom4j>
+ <version.commons.collections>3.1</version.commons.collections>
+ <version.hsqldb>1.8.0.2</version.hsqldb>
+ <version.jgroups>2.4.1</version.jgroups>
+ <version.concurrent>1.3.4</version.concurrent>
+ <version.jboss.jboss>4.2.2.GA</version.jboss.jboss>
+ <version.javassist>3.8.1.GA</version.javassist>
+ <version.jboss.javaee.persistence.api>3.0.0.CR1</version.jboss.javaee.persistence.api>
+ <version.jboss.serialization>1.0.3.GA</version.jboss.serialization>
+ <version.trove>1.0.2</version.trove>
+ <!--
+ <version.hibernate.testing>3.3.0.CR1</version.hibernate.testing>
+ <version.slf4j.log4j12>1.4.2</version.slf4j.log4j12>
+ <version.hibernate.annotations>3.2.1.GA</version.hibernate.annotations>
+ <version.hibernate.entitymanager>3.2.1.GA</version.hibernate.entitymanager>
+ <version.jboss.ejb3>4.2.2.GA</version.jboss.ejb3>
+ <version.jboss.aop>1.5.6.GA</version.jboss.aop>
+ -->
+
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The tagBase property is needed during the release process so that
+ the maven release plugin will create the release tag in the
+ appropriate location. -->
+ <tagBase></tagBase>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>hibernate</groupId>
+ <artifactId>hibernate3</artifactId>
+ <version>${version.hibernate}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-cache</artifactId>
+ <version>${version.jboss.cache}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>${version.jboss.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>${version.jboss.jmx}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ <version>${version.jboss.system}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <version>${version.jboss.j2ee}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-transaction</artifactId>
+ <version>${version.jboss.transaction}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>hibernate-annotations</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>${version.hibernate.annotations}</version>
+ </dependency>
+ <dependency>
+ <groupId>hibernate-entitymanager</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${version.hibernate.entitymanager}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>${version.jboss.ejb3}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.aop</groupId>
+ <artifactId>jboss-aop-jdk50</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ -->
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>${version.dom4j}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>${version.commons.collections}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${version.hsqldb}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>${version.jgroups}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>${version.concurrent}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss</artifactId>
+ <version>${version.jboss.jboss}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>${version.javassist}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-persistence-api</artifactId>
+ <version>${version.jboss.javaee.persistence.api}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-serialization</artifactId>
+ <version>${version.jboss.serialization}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>trove</groupId>
+ <artifactId>trove</artifactId>
+ <version>${version.trove}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-testing</artifactId>
+ <version>${version.hibernate.testing}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${version.slf4j.log4j12}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>test</scope>
+ </dependency>
+ -->
+
+ </dependencies>
+
+</project>
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,344 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.cache.Cache;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.StandardQueryCache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.lock.TimeoutException;
+import org.jboss.logging.Logger;
+
+/**
+ * Subclass of the standard <code>org.hibernate.cache.TreeCache</code> used as
+ * a workaround until issues related to JBCLUSTER-150 are resolved in Hibernate.
+ *
+ * @author Gavin King
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class JBCCache implements Cache {
+
+ private static final Logger log = Logger.getLogger(JBCCache.class);
+
+ private static final String ITEM = "item";
+
+ private org.jboss.cache.TreeCache cache;
+ private final String regionName;
+ private final Fqn regionFqn;
+ private final TransactionManager transactionManager;
+ private boolean localWritesOnly;
+
+ public JBCCache(org.jboss.cache.TreeCache cache, String regionName,
+ String regionPrefix, TransactionManager transactionManager)
+ throws CacheException {
+ this.cache = cache;
+ this.regionName = regionName;
+ this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, regionPrefix));
+ this.transactionManager = transactionManager;
+ if (cache.getUseRegionBasedMarshalling())
+ {
+ localWritesOnly = StandardQueryCache.class.getName().equals(regionName);
+
+ boolean fetchState = cache.getFetchInMemoryState();
+ try
+ {
+ // We don't want a state transfer for the StandardQueryCache,
+ // as it can include classes from multiple scoped classloaders
+ if (localWritesOnly)
+ cache.setFetchInMemoryState(false);
+
+ // We always activate
+ activateCacheRegion(regionFqn.toString());
+ }
+ finally
+ {
+ // Restore the normal state transfer setting
+ if (localWritesOnly)
+ cache.setFetchInMemoryState(fetchState);
+ }
+ }
+ else
+ {
+ log.debug("TreeCache is not configured for region based marshalling");
+ }
+ }
+
+ public Object get(Object key) throws CacheException {
+ Transaction tx = suspend();
+ try {
+ return read(key);
+ }
+ finally {
+ resume( tx );
+ }
+ }
+
+ public Object read(Object key) throws CacheException {
+ try {
+ return cache.get( new Fqn( regionFqn, key ), ITEM );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void update(Object key, Object value) throws CacheException {
+ try {
+ if (localWritesOnly) {
+ Option option = new Option();
+ option.setCacheModeLocal(true);
+ cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
+ }
+ else {
+ cache.put( new Fqn( regionFqn, key ), ITEM, value );
+ }
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void put(Object key, Object value) throws CacheException {
+ Transaction tx = suspend();
+ try {
+ if (localWritesOnly) {
+ Option option = new Option();
+ option.setCacheModeLocal(true);
+ // Overloaded method isn't available, so have to use InvocationContext
+ cache.getInvocationContext().setOptionOverrides(option);
+ try {
+ // do the failfast put outside the scope of the JTA txn
+ cache.putFailFast( new Fqn( regionFqn, key ), ITEM, value, 0 );
+ }
+ finally {
+ cache.getInvocationContext().setOptionOverrides(null);
+ }
+ }
+ else {
+ //do the failfast put outside the scope of the JTA txn
+ cache.putFailFast( new Fqn( regionFqn, key ), ITEM, value, 0 );
+ }
+ }
+ catch (TimeoutException te) {
+ //ignore!
+ log.debug("ignoring write lock acquisition failure");
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ finally {
+ resume( tx );
+ }
+ }
+
+ private void resume(Transaction tx) {
+ try {
+ if (tx!=null) transactionManager.resume(tx);
+ }
+ catch (Exception e) {
+ throw new CacheException("Could not resume transaction", e);
+ }
+ }
+
+ private Transaction suspend() {
+ Transaction tx = null;
+ try {
+ if ( transactionManager!=null ) {
+ tx = transactionManager.suspend();
+ }
+ }
+ catch (SystemException se) {
+ throw new CacheException("Could not suspend transaction", se);
+ }
+ return tx;
+ }
+
+ public void remove(Object key) throws CacheException {
+ try {
+ if (localWritesOnly) {
+ Option option = new Option();
+ option.setCacheModeLocal(true);
+ cache.remove( new Fqn( regionFqn, key ), option );
+ }
+ else {
+ cache.remove( new Fqn( regionFqn, key ) );
+ }
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void clear() throws CacheException {
+ try {
+ cache.remove( regionFqn );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void destroy() throws CacheException {
+ try {
+ // NOTE : Hibernate's class uses evict() but that isn't recursive!
+ //cache.evict( regionFqn );
+ Option opt = new Option();
+ opt.setCacheModeLocal(true);
+ cache.remove(regionFqn, opt);
+
+ if (cache.getUseRegionBasedMarshalling() && !SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
+ {
+ inactivateCacheRegion();
+ }
+ }
+ catch (CacheException e)
+ {
+ throw e;
+ }
+ catch( Exception e ) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void lock(Object key) throws CacheException {
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
+ }
+
+ public void unlock(Object key) throws CacheException {
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
+ }
+
+ public long nextTimestamp() {
+ return System.currentTimeMillis() / 100;
+ }
+
+ public int getTimeout() {
+ return 600; //60 seconds
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public long getSizeInMemory() {
+ return -1;
+ }
+
+ public long getElementCountInMemory() {
+ try {
+ Set children = cache.getChildrenNames( regionFqn );
+ return children == null ? 0 : children.size();
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public long getElementCountOnDisk() {
+ return 0;
+ }
+
+ public Map toMap() {
+ try {
+ Map result = new HashMap();
+ Set childrenNames = cache.getChildrenNames( regionFqn );
+ if (childrenNames != null) {
+ Iterator iter = childrenNames.iterator();
+ while ( iter.hasNext() ) {
+ Object key = iter.next();
+ result.put(
+ key,
+ cache.get( new Fqn( regionFqn, key ), ITEM )
+ );
+ }
+ }
+ return result;
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public String toString() {
+ return "JBCCache(" + regionName + ')';
+ }
+
+ private void activateCacheRegion(String regionName) throws CacheException
+ {
+ String fqnString = regionFqn.toString();
+ // FIXME -- find a way that doesn't involve this API
+ if (cache.getMarshaller().isInactive(fqnString))
+ {
+ try
+ {
+ // Only register the classloader if it's not a shared region.
+ // If it's shared, no single classloader is valid
+ if (!SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
+ {
+ cache.registerClassLoader(fqnString, Thread.currentThread().getContextClassLoader());
+ }
+ cache.activateRegion(fqnString);
+ }
+ catch (Exception e)
+ {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+ else
+ {
+ log.debug("activateCacheRegion(): Region " + fqnString + " is already active");
+ }
+ }
+
+ private void inactivateCacheRegion() throws CacheException
+ {
+ String fqnString = regionFqn.toString();
+ // FIXME -- find a way that doesn't involve this API
+ if (!cache.getMarshaller().isInactive(fqnString))
+ {
+ try
+ {
+ cache.inactivateRegion(fqnString);
+ cache.unregisterClassLoader(fqnString);
+ }
+ catch (Exception e)
+ {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+ else
+ {
+ log.debug("inactivateCacheRegion(): Region " + fqnString + " is already inactive");
+ }
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,456 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Comparator;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.OptimisticCache;
+import org.hibernate.cache.OptimisticCacheSource;
+import org.hibernate.cache.StandardQueryCache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.lock.TimeoutException;
+import org.jboss.logging.Logger;
+
+/**
+ * Represents a particular region within the given JBossCache TreeCache
+ * utilizing TreeCache's optimistic locking capabilities.
+ *
+ * @see org.hibernate.cache.OptimisticTreeCacheProvider for more details
+ *
+ * @author Steve Ebersole
+ * @author Brian Stansberry
+ */
+public class OptimisticJBCCache implements OptimisticCache {
+
+ // todo : eventually merge this with TreeCache and just add optional opt-lock support there.
+
+ private static final Logger log = Logger.getLogger(OptimisticJBCCache.class);
+
+ private static final String ITEM = "item";
+
+ private org.jboss.cache.TreeCache cache;
+ private final String regionName;
+ private final Fqn regionFqn;
+ private OptimisticCacheSource source;
+ private boolean localWritesOnly;
+
+ public OptimisticJBCCache(org.jboss.cache.TreeCache cache,
+ String regionName, String regionPrefix)
+ throws CacheException {
+ this.cache = cache;
+ this.regionName = regionName;
+ this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, regionPrefix));
+ if (cache.getUseRegionBasedMarshalling())
+ {
+ localWritesOnly = StandardQueryCache.class.getName().equals(regionName);
+
+ boolean fetchState = cache.getFetchInMemoryState();
+ try
+ {
+ // We don't want a state transfer for the StandardQueryCache,
+ // as it can include classes from multiple scoped classloaders
+ if (localWritesOnly)
+ cache.setFetchInMemoryState(false);
+
+ // We always activate
+ activateCacheRegion(regionFqn.toString());
+ }
+ finally
+ {
+ // Restore the normal state transfer setting
+ if (localWritesOnly)
+ cache.setFetchInMemoryState(fetchState);
+ }
+ }
+ else
+ {
+ log.debug("TreeCache is not configured for region based marshalling");
+ }
+ }
+
+
+ // OptimisticCache impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public void setSource(OptimisticCacheSource source) {
+ this.source = source;
+ }
+
+ public void writeInsert(Object key, Object value, Object currentVersion) {
+ writeUpdate( key, value, currentVersion, null );
+ }
+
+ public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) {
+ try {
+ Option option = new Option();
+ DataVersion dv = ( source != null && source.isVersioned() )
+ ? new DataVersionAdapter( currentVersion, previousVersion, source.getVersionComparator(), source.toString() )
+ : NonLockingDataVersion.INSTANCE;
+ option.setDataVersion( dv );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
+ }
+ catch ( Exception e ) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void writeLoad(Object key, Object value, Object currentVersion) {
+ try {
+ Option option = new Option();
+ option.setFailSilently( true );
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.remove( new Fqn( regionFqn, key ), "ITEM", option );
+
+ option = new Option();
+ option.setFailSilently( true );
+ DataVersion dv = ( source != null && source.isVersioned() )
+ ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
+ : NonLockingDataVersion.INSTANCE;
+ option.setDataVersion( dv );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+
+ // Cache impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public Object get(Object key) throws CacheException {
+ try {
+ Option option = new Option();
+ option.setFailSilently( true );
+// option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ return cache.get( new Fqn( regionFqn, key ), ITEM, option );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public Object read(Object key) throws CacheException {
+ try {
+ return cache.get( new Fqn( regionFqn, key ), ITEM );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void update(Object key, Object value) throws CacheException {
+ try {
+ Option option = new Option();
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void put(Object key, Object value) throws CacheException {
+ try {
+ log.trace( "performing put() into region [" + regionName + "]" );
+ // do the put outside the scope of the JTA txn
+ Option option = new Option();
+ option.setFailSilently( true );
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
+ }
+ catch (TimeoutException te) {
+ //ignore!
+ log.debug("ignoring write lock acquisition failure");
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void remove(Object key) throws CacheException {
+ try {
+ // tree cache in optimistic mode seems to have as very difficult
+ // time with remove calls on non-existent nodes (NPEs)...
+ if ( cache.get( new Fqn( regionFqn, key ), ITEM ) != null ) {
+ Option option = new Option();
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.remove( new Fqn( regionFqn, key ), option );
+ }
+ else {
+ log.trace( "skipping remove() call as the underlying node did not seem to exist" );
+ }
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void clear() throws CacheException {
+ try {
+ Option option = new Option();
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ option.setCacheModeLocal(localWritesOnly);
+ cache.remove( regionFqn, option );
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void destroy() throws CacheException {
+ try {
+ Option option = new Option();
+ option.setCacheModeLocal( true );
+ option.setFailSilently( true );
+ option.setDataVersion( NonLockingDataVersion.INSTANCE );
+ cache.remove( regionFqn, option );
+
+ if (cache.getUseRegionBasedMarshalling() && !SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
+ {
+ inactivateCacheRegion();
+ }
+ }
+ catch( Exception e ) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public void lock(Object key) throws CacheException {
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
+ }
+
+ public void unlock(Object key) throws CacheException {
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
+ }
+
+ public long nextTimestamp() {
+ return System.currentTimeMillis() / 100;
+ }
+
+ public int getTimeout() {
+ return 600; //60 seconds
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public long getSizeInMemory() {
+ return -1;
+ }
+
+ public long getElementCountInMemory() {
+ try {
+ Set children = cache.getChildrenNames( regionFqn );
+ return children == null ? 0 : children.size();
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public long getElementCountOnDisk() {
+ return 0;
+ }
+
+ public Map toMap() {
+ try {
+ Map result = new HashMap();
+ Set childrenNames = cache.getChildrenNames( regionFqn );
+ if (childrenNames != null) {
+ Iterator iter = childrenNames.iterator();
+ while ( iter.hasNext() ) {
+ Object key = iter.next();
+ result.put(
+ key,
+ cache.get( new Fqn( regionFqn, key ), ITEM )
+ );
+ }
+ }
+ return result;
+ }
+ catch (Exception e) {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+
+ public String toString() {
+ return "OptimisticJBCCache(" + regionName + ')';
+ }
+
+ private void activateCacheRegion(String regionName) throws CacheException
+ {
+ String fqnString = regionFqn.toString();
+ // FIXME -- find a way that doesn't involve this API
+ if (cache.getMarshaller().isInactive(fqnString))
+ {
+ try
+ {
+ // Only register the classloader if it's not a shared region.
+ // If it's shared, no single classloader is valid
+ if (!SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
+ {
+ cache.registerClassLoader(fqnString, Thread.currentThread().getContextClassLoader());
+ }
+ cache.activateRegion(fqnString);
+ }
+ catch (Exception e)
+ {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+ else
+ {
+ log.debug("activateCacheRegion(): Region " + fqnString + " is already active");
+ }
+ }
+
+ private void inactivateCacheRegion() throws CacheException
+ {
+ String fqnString = regionFqn.toString();
+ // FIXME -- find a way that doesn't involve this API
+ if (!cache.getMarshaller().isInactive(fqnString))
+ {
+ try
+ {
+ cache.inactivateRegion(fqnString);
+ cache.unregisterClassLoader(fqnString);
+ }
+ catch (Exception e)
+ {
+ throw SecondLevelCacheUtil.convertToHibernateException(e);
+ }
+ }
+ else
+ {
+ log.debug("inactivateCacheRegion(): Region " + fqnString + " is already inactive");
+ }
+ }
+
+ public static class DataVersionAdapter implements DataVersion
+ {
+ private static final long serialVersionUID = 5564692336076405571L;
+ private final Object currentVersion;
+ private final Object previousVersion;
+ private final Comparator versionComparator;
+ private final String sourceIdentifer;
+
+ public DataVersionAdapter(Object currentVersion, Object previousVersion, Comparator versionComparator, String sourceIdentifer) {
+ this.currentVersion = currentVersion;
+ this.previousVersion = previousVersion;
+ this.versionComparator = versionComparator;
+ this.sourceIdentifer = sourceIdentifer;
+ log.trace( "created " + this );
+ }
+
+ /**
+ * newerThan() call is dispatched against the DataVersion currently
+ * associated with the node; the passed dataVersion param is the
+ * DataVersion associated with the data we are trying to put into
+ * the node.
+ * <p/>
+ * we are expected to return true in the case where we (the current
+ * node DataVersion) are newer that then incoming value. Returning
+ * true here essentially means that a optimistic lock failure has
+ * occured (because conversely, the value we are trying to put into
+ * the node is "older than" the value already there...)
+ */
+ public boolean newerThan(DataVersion dataVersion) {
+ log.trace( "checking [" + this + "] against [" + dataVersion + "]" );
+ if ( dataVersion instanceof CircumventChecksDataVersion ) {
+ log.trace( "skipping lock checks..." );
+ return false;
+ }
+ else if ( dataVersion instanceof NonLockingDataVersion ) {
+ // can happen because of the multiple ways Cache.remove()
+ // can be invoked :(
+ log.trace( "skipping lock checks..." );
+ return false;
+ }
+ DataVersionAdapter other = ( DataVersionAdapter ) dataVersion;
+ if ( other.previousVersion == null ) {
+ log.warn( "Unexpected optimistic lock check on inserting data" );
+ // work around the "feature" where tree cache is validating the
+ // inserted node during the next transaction. no idea...
+ if ( this == dataVersion ) {
+ log.trace( "skipping lock checks due to same DV instance" );
+ return false;
+ }
+ }
+
+ if (currentVersion == null)
+ {
+ // If the workspace node has null as well, OK; if not we've
+ // been modified in a non-comparable manner, which we have to
+ // treat as us being newer
+ return (other.previousVersion != null);
+ }
+
+ return versionComparator.compare( currentVersion, other.previousVersion ) >= 1;
+ }
+
+ public String toString() {
+ return super.toString() + " [current=" + currentVersion + ", previous=" + previousVersion + ", src=" + sourceIdentifer + "]";
+ }
+ }
+
+ /**
+ * Used in regions where no locking should ever occur. This includes query-caches,
+ * update-timestamps caches, collection caches, and entity caches where the entity
+ * is not versioned.
+ */
+ public static class NonLockingDataVersion implements DataVersion
+ {
+ private static final long serialVersionUID = 7050722490368630553L;
+ public static final DataVersion INSTANCE = new NonLockingDataVersion();
+ public boolean newerThan(DataVersion dataVersion) {
+ log.trace( "non locking lock check...");
+ return false;
+ }
+ }
+
+ /**
+ * Used to signal to a DataVersionAdapter to simply not perform any checks. This
+ * is currently needed for proper handling of remove() calls for entity cache regions
+ * (we do not know the version info...).
+ */
+ public static class CircumventChecksDataVersion implements DataVersion
+ {
+ private static final long serialVersionUID = 7996980646166032369L;
+ public static final DataVersion INSTANCE = new CircumventChecksDataVersion();
+ public boolean newerThan(DataVersion dataVersion) {
+ throw new CacheException( "optimistic locking checks should never happen on CircumventChecksDataVersion" );
+ }
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import java.util.Properties;
+
+import org.hibernate.cache.CacheException;
+import org.jboss.logging.Logger;
+
+/**
+ * Trivial {@link TreeCacheProviderHook} subclass that logs a warning in
+ * {@link #start(Properties) start} if the underlying JBoss Cache
+ * is not configured for optimistic locking. Like the superclass,
+ * will provide working Cache implementations whether JBoss Cache is
+ * configured for optimistic locking or not; the only added behavior
+ * is the logging of the warning if the JBoss Cache configuration doesn't
+ * match the intent implied by the use of this class.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ * @author Brian Stansberry
+ */
+public class OptimisticTreeCacheProviderHook extends TreeCacheProviderHook
+{
+ private static final Logger log = Logger.getLogger(OptimisticTreeCacheProviderHook.class);
+
+ public void start(Properties properties) throws CacheException
+ {
+ super.start(properties);
+
+ if (isOptimistic() == false)
+ {
+ log.warn("JBoss Cache is not configured for optimistic locking; " +
+ "provided Cache implementations therefore will not implement OptimisticCache");
+ }
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.StandardQueryCache;
+import org.hibernate.cache.UpdateTimestampsCache;
+
+/**
+ * Utilities related to the Hibernate 2nd Level Cache
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class SecondLevelCacheUtil
+{
+ public static final String HIBERNATE_CACHE_REGION_PREFIX = "hibernate.cache.region_prefix";
+
+ public static String createRegionFqn(String regionName, String regionPrefix)
+ {
+ String escaped = null;
+ int idx = -1;
+ if (regionPrefix != null)
+ {
+ idx = regionName.indexOf(regionPrefix);
+ }
+
+ if (idx > -1)
+ {
+ int regionEnd = idx + regionPrefix.length();
+ String prefix = regionName.substring(0, regionEnd);
+ String suffix = regionName.substring(regionEnd);
+ suffix = suffix.replace('.', '/');
+ escaped = prefix + suffix;
+ }
+ else
+ {
+ escaped = regionName.replace('.', '/');
+ }
+ return escaped;
+ }
+
+ public static boolean isSharedClassLoaderRegion(String regionName)
+ {
+ return (StandardQueryCache.class.getName().equals(regionName)
+ || UpdateTimestampsCache.class.getName().equals(regionName));
+ }
+
+ /**
+ * Creates a CacheException, but doesn't pass JBC CacheException as the cause
+ * as it is a type that likely doesn't exist on a client.
+ * Instead creates a Hibernate CacheException with the original exception's
+ * stack trace.
+ */
+ public static CacheException convertToHibernateException(Exception e)
+ {
+ CacheException he = null;
+
+ if (e instanceof org.jboss.cache.CacheException)
+ {
+ he = new CacheException(e.getClass().getName() + " " + e.getMessage());
+ he.setStackTrace(e.getStackTrace());
+ }
+ else if (e instanceof CacheException)
+ {
+ he = (CacheException) e;
+ }
+ else
+ {
+ he = new CacheException(e);
+ }
+
+ return he;
+ }
+
+ // Prevent instantiation
+ private SecondLevelCacheUtil() {}
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import java.util.Properties;
+
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.cache.Cache;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.CacheProvider;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.TreeCacheMBean;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.tm.TransactionManagerLocator;
+
+/**
+ * Support for integration as a 2nd level cache with an already existing
+ * JBoss Cache (TreeCache) instance. The ObjectName of the cache is
+ * provided via the <code>hibernate.treecache.mbean.object_name</code>
+ * configuration property.
+ * <p/>
+ * This class supports both optimistic and pessimistic locking, providing
+ * instances of <code>org.hibernate.cache.OptimisticCache</code> if the
+ * underlying JBoss Cache is configured for optimistic locking.
+ *
+ * @author Gavin King
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TreeCacheProviderHook
+ extends org.hibernate.cache.TreeCacheProvider
+ implements CacheProvider
+{
+ /**
+ * Name of the Hibernate configuration property used to provide
+ * the ObjectName of the JBoss Cache instance.
+ */
+ public static final String HIBERNATE_CACHE_OBJECT_NAME_PROPERTY =
+ "hibernate.treecache.mbean.object_name";
+
+ /**
+ * Default ObjectName for the JBoss Cache instance that will be used
+ * if {@link HIBERNATE_CACHE_OBJECT_NAME_PROPERTY} is not provided.
+ */
+ public static final String DEFAULT_MBEAN_OBJECT_NAME = "jboss.cache:service=TreeCache";
+
+ private static final Logger log = Logger.getLogger(TreeCacheProviderHook.class);
+
+ private org.jboss.cache.TreeCache cache;
+ private boolean optimistic;
+
+ /**
+ * Construct and configure the Cache representation of a named cache region.
+ *
+ * @param regionName the name of the cache region
+ * @param properties configuration settings
+ * @return The Cache representation of the named cache region. If the
+ * underlying JBoss Cache is configured for optimistic locking,
+ * the returned object will also implement org.hibernate.cache.OptimisticCache.
+ * @throws org.hibernate.cache.CacheException
+ * Indicates an error building the cache region.
+ */
+ public Cache buildCache(String regionName, Properties properties) throws CacheException
+ {
+ String regionPrefix = properties.getProperty("hibernate.cache.region_prefix");
+
+ if (optimistic)
+ {
+ return new OptimisticJBCCache(cache, regionName, regionPrefix);
+ }
+ else
+ {
+ /* removed dependency on ejb3's TxUtil */
+ return new JBCCache(cache, regionName, regionPrefix, getTransactionManager(properties));
+ }
+ }
+
+ public boolean isMinimalPutsEnabledByDefault()
+ {
+ return true;
+ }
+
+ public long nextTimestamp()
+ {
+ return System.currentTimeMillis() / 100;
+ }
+
+ /**
+ * Find the underlying JBoss Cache TreeCache instance.
+ *
+ * @param properties All current config settings.
+ * If {@link #HIBERNATE_CACHE_OBJECT_NAME_PROPERTY} is provided,
+ * the value will be the expected name of the cache; otherwise
+ * {@link #DEFAULT_MBEAN_OBJECT_NAME} will be used.
+ * @throws org.hibernate.cache.CacheException
+ * Indicates a problem preparing cache for use.
+ */
+ public void start(Properties properties)
+ {
+ try
+ {
+ String cacheName = (String) properties.get(HIBERNATE_CACHE_OBJECT_NAME_PROPERTY);
+ if (cacheName == null)
+ {
+ cacheName = DEFAULT_MBEAN_OBJECT_NAME;
+ }
+ ObjectName mbeanObjectName = new ObjectName(cacheName);
+ TreeCacheMBean mbean = (TreeCacheMBean) MBeanProxyExt.create(TreeCacheMBean.class, mbeanObjectName, MBeanServerLocator.locateJBoss());
+ cache = mbean.getInstance();
+ if ("OPTIMISTIC".equals(cache.getNodeLockingScheme()))
+ {
+ optimistic = true;
+ log.debug("JBoss Cache is configured for optimistic locking; " +
+ "provided Cache implementations will also implement OptimisticCache");
+ }
+ }
+ catch (Exception e)
+ {
+ throw new CacheException(e);
+ }
+ }
+
+ public void stop()
+ {
+ }
+
+ public boolean isOptimistic()
+ {
+ return optimistic;
+ }
+
+ public TreeCache getUnderlyingCache()
+ {
+ return cache;
+ }
+
+ protected TransactionManager getTransactionManager(Properties properties)
+ {
+ return TransactionManagerLocator.getInstance().locate();
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,34 @@
+package org.hibernate.junit;
+
+/**
+ * A specialized TestCase for running tests in an isolated class-loader
+ *
+ * @author Steve Ebersole
+ */
+public abstract class AbstractClassLoaderIsolatedTestCase extends UnitTestCase {
+ private ClassLoader parentLoader;
+ private ClassLoader isolatedLoader;
+
+ public AbstractClassLoaderIsolatedTestCase(String string) {
+ super( string );
+ }
+
+ protected void setUp() throws Exception {
+ parentLoader = Thread.currentThread().getContextClassLoader();
+ isolatedLoader = buildIsolatedClassLoader( parentLoader );
+ Thread.currentThread().setContextClassLoader( isolatedLoader );
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ Thread.currentThread().setContextClassLoader( parentLoader );
+ releaseIsolatedClassLoader( isolatedLoader );
+ parentLoader = null;
+ isolatedLoader = null;
+ }
+
+ protected abstract ClassLoader buildIsolatedClassLoader(ClassLoader parent);
+
+ protected abstract void releaseIsolatedClassLoader(ClassLoader isolatedLoader);
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/SkipLog.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/SkipLog.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/SkipLog.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,13 @@
+package org.hibernate.junit;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Well-known-location lookup for the test-skip log...
+ *
+ * @author Steve Ebersole
+ */
+public class SkipLog {
+ public static final Log LOG = LogFactory.getLog( "org.hibernate.test.SKIPPED" );
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/TestSuiteVisitor.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/TestSuiteVisitor.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/TestSuiteVisitor.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,42 @@
+package org.hibernate.junit;
+
+import java.util.Enumeration;
+
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+/**
+ * Handles walking a TestSuite hierarchy for recognition of individual tests.
+ *
+ * @author Steve Ebersole
+ */
+public class TestSuiteVisitor {
+
+ private final TestSuiteVisitor.Handler handler;
+
+ public TestSuiteVisitor(TestSuiteVisitor.Handler handler) {
+ this.handler = handler;
+ }
+
+ public void visit(TestSuite testSuite) {
+ handler.startingTestSuite( testSuite );
+ Enumeration tests = testSuite.tests();
+ while ( tests.hasMoreElements() ) {
+ Test test = ( Test ) tests.nextElement();
+ if ( test instanceof TestSuite ) {
+ visit( ( TestSuite ) test );
+ }
+ else {
+ handler.handleTestCase( test );
+ }
+ }
+ handler.completedTestSuite( testSuite );
+ }
+
+ public static interface Handler {
+ public void handleTestCase(Test test);
+ public void startingTestSuite(TestSuite suite);
+ public void completedTestSuite(TestSuite suite);
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/UnitTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/UnitTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/UnitTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,84 @@
+package org.hibernate.junit;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import junit.framework.AssertionFailedError;
+
+
+/**
+ * A basic JUnit {@link junit.framework.TestCase} subclass for
+ * adding some Hibernate specific behavior and functionality.
+ *
+ * @author Steve Ebersole
+ */
+public abstract class UnitTestCase extends junit.framework.TestCase {
+
+ private static final Log log = LogFactory.getLog( UnitTestCase.class );
+
+ public UnitTestCase(String string) {
+ super( string );
+ }
+
+ /**
+ * runBare overridden in order to apply FailureExpected validations
+ * as well as start/complete logging
+ *
+ * @throws Throwable
+ */
+ public void runBare() throws Throwable {
+ final boolean doValidate = getName().endsWith( "FailureExpected" ) && Boolean.getBoolean( "hibernate.test.validatefailureexpected" );
+ try {
+ log.info( "Starting test [" + fullTestName() + "]" );
+ super.runBare();
+ if ( doValidate ) {
+ fail( "Test marked as FailureExpected, but did not fail!" );
+ }
+ }
+ catch( Throwable t ) {
+ if ( doValidate ) {
+ skipExpectedFailure( t );
+ }
+ else {
+ throw t;
+ }
+ }
+ finally {
+ log.info( "Completed test [" + fullTestName() + "]" );
+ }
+ }
+
+ protected void skipExpectedFailure(Throwable error) {
+ reportSkip( "ignoring *FailuredExpected methods", "Failed with: " + error.toString() );
+ }
+
+ // additional assertions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public static void assertElementTypeAssignability(java.util.Collection collection, Class clazz) throws AssertionFailedError {
+ Iterator itr = collection.iterator();
+ while ( itr.hasNext() ) {
+ assertClassAssignability( itr.next().getClass(), clazz );
+ }
+ }
+
+ public static void assertClassAssignability(Class source, Class target) throws AssertionFailedError {
+ if ( !target.isAssignableFrom( source ) ) {
+ throw new AssertionFailedError(
+ "Classes were not assignment-compatible : source<" + source.getName() +
+ "> target<" + target.getName() + ">"
+ );
+ }
+ }
+
+
+ // test skipping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public String fullTestName() {
+ return this.getClass().getName() + "#" + this.getName();
+ }
+
+ protected void reportSkip(String reason, String testDescription) {
+ SkipLog.LOG.warn( "*** skipping [" + fullTestName() + "] - " + testDescription + " : " + reason, new Exception() );
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,27 @@
+package org.hibernate.junit.functional;
+
+import org.hibernate.junit.SkipLog;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public abstract class DatabaseSpecificFunctionalTestCase extends FunctionalTestCase {
+ public DatabaseSpecificFunctionalTestCase(String string) {
+ super( string );
+ }
+
+ protected void runTest() throws Throwable {
+ // Note: this protection comes into play when running
+ // tests individually. The suite as a whole is already
+ // "protected" by the fact that these tests are actually
+ // filtered out of the suite
+ if ( appliesTo( getDialect() ) ) {
+ super.runTest();
+ }
+ else {
+ SkipLog.LOG.warn( "skipping database-specific test [" + fullTestName() + "] for dialect [" + getDialect().getClass().getName() + "]" );
+ }
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/ExecutionEnvironment.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/ExecutionEnvironment.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/ExecutionEnvironment.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,162 @@
+package org.hibernate.junit.functional;
+
+import java.util.Iterator;
+import java.sql.Blob;
+import java.sql.Clob;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.SessionFactory;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Collection;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class ExecutionEnvironment {
+
+ public static final Dialect DIALECT = Dialect.getDialect();
+
+ private final ExecutionEnvironment.Settings settings;
+
+ private Configuration configuration;
+ private SessionFactory sessionFactory;
+ private boolean allowRebuild;
+
+ public ExecutionEnvironment(ExecutionEnvironment.Settings settings) {
+ this.settings = settings;
+ }
+
+ public boolean isAllowRebuild() {
+ return allowRebuild;
+ }
+
+ public void setAllowRebuild(boolean allowRebuild) {
+ this.allowRebuild = allowRebuild;
+ }
+
+ public Dialect getDialect() {
+ return DIALECT;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ public SessionFactory getSessionFactory() {
+ return sessionFactory;
+ }
+
+ public void initialize() {
+ if ( sessionFactory != null ) {
+ throw new IllegalStateException( "attempt to initialize already initialized ExecutionEnvironment" );
+ }
+ if ( ! settings.appliesTo( getDialect() ) ) {
+ return;
+ }
+
+ Configuration configuration = new Configuration();
+ configuration.setProperty( Environment.CACHE_PROVIDER, "org.hibernate.cache.HashtableCacheProvider" );
+
+ settings.configure( configuration );
+
+ applyMappings( configuration );
+ applyCacheSettings( configuration );
+
+
+ if ( settings.createSchema() ) {
+ configuration.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ }
+
+ // make sure we use the same dialect...
+ configuration.setProperty( Environment.DIALECT, getDialect().getClass().getName() );
+
+ configuration.buildMappings();
+ settings.afterConfigurationBuilt( configuration.createMappings(), getDialect() );
+
+ SessionFactory sessionFactory = configuration.buildSessionFactory();
+ this.configuration = configuration;
+ this.sessionFactory = sessionFactory;
+
+ settings.afterSessionFactoryBuilt( ( SessionFactoryImplementor ) sessionFactory );
+ }
+
+ private void applyMappings(Configuration configuration) {
+ String[] mappings = settings.getMappings();
+ for ( int i = 0; i < mappings.length; i++ ) {
+ configuration.addResource( settings.getBaseForMappings() + mappings[i], ExecutionEnvironment.class.getClassLoader() );
+ }
+ }
+
+ private void applyCacheSettings(Configuration configuration) {
+ if ( settings.getCacheConcurrencyStrategy() != null ) {
+ Iterator iter = configuration.getClassMappings();
+ while ( iter.hasNext() ) {
+ PersistentClass clazz = (PersistentClass) iter.next();
+ Iterator props = clazz.getPropertyClosureIterator();
+ boolean hasLob = false;
+ while ( props.hasNext() ) {
+ Property prop = (Property) props.next();
+ if ( prop.getValue().isSimpleValue() ) {
+ String type = ( ( SimpleValue ) prop.getValue() ).getTypeName();
+ if ( "blob".equals(type) || "clob".equals(type) ) {
+ hasLob = true;
+ }
+ if ( Blob.class.getName().equals(type) || Clob.class.getName().equals(type) ) {
+ hasLob = true;
+ }
+ }
+ }
+ if ( !hasLob && !clazz.isInherited() && settings.overrideCacheStrategy() ) {
+ configuration.setCacheConcurrencyStrategy( clazz.getEntityName(), settings.getCacheConcurrencyStrategy() );
+ }
+ }
+ iter = configuration.getCollectionMappings();
+ while ( iter.hasNext() ) {
+ Collection coll = (Collection) iter.next();
+ configuration.setCollectionCacheConcurrencyStrategy( coll.getRole(), settings.getCacheConcurrencyStrategy() );
+ }
+ }
+ }
+
+ public void rebuild() {
+ if ( !allowRebuild ) {
+ return;
+ }
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ sessionFactory = null;
+ }
+ sessionFactory = configuration.buildSessionFactory();
+ settings.afterSessionFactoryBuilt( ( SessionFactoryImplementor ) sessionFactory );
+ }
+
+ public void complete() {
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ sessionFactory = null;
+ }
+
+ configuration = null;
+ }
+
+ public static interface Settings {
+ public String[] getMappings();
+ public String getBaseForMappings();
+ public boolean createSchema();
+ public boolean recreateSchemaAfterFailure();
+ public void configure(Configuration cfg);
+ public boolean overrideCacheStrategy();
+ public String getCacheConcurrencyStrategy();
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi);
+ public void afterConfigurationBuilt(Mappings mappings, Dialect dialect);
+ public boolean appliesTo(Dialect dialect);
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,505 @@
+package org.hibernate.junit.functional;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.DB2Dialect;
+import org.hibernate.dialect.DerbyDialect;
+import org.hibernate.SessionFactory;
+import org.hibernate.HibernateException;
+import org.hibernate.Interceptor;
+import org.hibernate.Session;
+import org.hibernate.junit.UnitTestCase;
+import org.hibernate.engine.SessionFactoryImplementor;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Most of the Hibernate test suite in fact is a series of functional tests, not
+ * unit tests. Here is a base class for these functional tests.
+ *
+ * @author Steve Ebersole
+ */
+public abstract class FunctionalTestCase extends UnitTestCase implements ExecutionEnvironment.Settings {
+
+ private static final Log log = LogFactory.getLog( FunctionalTestCase.class );
+
+ private ExecutionEnvironment environment;
+ private boolean isEnvironmentLocallyManaged;
+
+ private org.hibernate.classic.Session session;
+
+ public FunctionalTestCase(String string) {
+ super( string );
+ }
+
+ public ExecutionEnvironment getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(ExecutionEnvironment environment) {
+ this.environment = environment;
+ }
+
+ protected void prepareTest() throws Exception {
+ }
+
+ protected void cleanupTest() throws Exception {
+ }
+
+ // JUnit hooks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * Override {@link junit.framework.TestCase#setUp()} to check if we need
+ * to build a locally managed execution environment.
+ *
+ * @throws Exception
+ */
+ protected final void setUp() throws Exception {
+ if ( environment == null ) {
+ log.info( "Building locally managed execution env" );
+ isEnvironmentLocallyManaged = true;
+ environment = new ExecutionEnvironment( this );
+ environment.initialize();
+ }
+ prepareTest();
+ }
+
+ /**
+ * Override {@link junit.framework.TestCase#tearDown()} to tear down
+ * the execution environment if it is locally managed.
+ *
+ * @throws Exception
+ */
+ protected final void tearDown() throws Exception {
+ cleanupTest();
+ if ( isEnvironmentLocallyManaged ) {
+ log.info( "Destroying locally managed execution env" );
+ environment.complete();
+ environment = null;
+ }
+ }
+
+ /**
+ * runTest is overridden in order to apply session closure assertions.
+ *
+ * @throws Throwable
+ */
+ protected void runTest() throws Throwable {
+ final boolean stats = sfi().getStatistics().isStatisticsEnabled();
+ try {
+ if ( stats ) {
+ sfi().getStatistics().clear();
+ }
+
+ super.runTest();
+
+ if ( stats ) {
+ sfi().getStatistics().logSummary();
+ }
+
+ if ( session != null && session.isOpen() ) {
+ if ( session.isConnected() ) {
+ session.connection().rollback();
+ }
+ session.close();
+ session = null;
+ fail( "unclosed session" );
+ }
+ else {
+ session = null;
+ }
+ assertAllDataRemoved();
+ }
+ catch ( Throwable e ) {
+ log.trace( "test run resulted in error; attempting to cleanup", e );
+ try {
+ if ( session != null && session.isOpen() ) {
+ if ( session.isConnected() ) {
+ session.connection().rollback();
+ }
+ session.close();
+ }
+ }
+ catch ( Exception ignore ) {
+ }
+ try {
+ if ( recreateSchemaAfterFailure() && environment != null ) {
+ environment.rebuild();
+ }
+ }
+ catch ( Exception ignore ) {
+ }
+ throw e;
+ }
+ }
+
+ protected void assertAllDataRemoved() {
+ if ( !createSchema() ) {
+ return; // no tables were created...
+ }
+ if ( !Boolean.getBoolean( "hibernate.test.validateDataCleanup" ) ) {
+ return;
+ }
+
+ Session tmpSession = getSessions().openSession();
+ try {
+ List list = tmpSession.createQuery( "select o from java.lang.Object o" ).list();
+
+ Map items = new HashMap();
+ if ( !list.isEmpty() ) {
+ for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
+ Object element = iter.next();
+ Integer l = ( Integer ) items.get( tmpSession.getEntityName( element ) );
+ if ( l == null ) {
+ l = new Integer( 0 );
+ }
+ l = new Integer( l.intValue() + 1 );
+ items.put( tmpSession.getEntityName( element ), l );
+ System.out.println( "Data left: " + element );
+ }
+ fail( "Data is left in the database: " + items.toString() );
+ }
+ }
+ finally {
+ try {
+ tmpSession.close();
+ }
+ catch( Throwable t ) {
+ // intentionally empty
+ }
+ }
+ }
+
+ protected void skipExpectedFailure(Throwable error) {
+ super.skipExpectedFailure( error );
+ try {
+ if ( recreateSchemaAfterFailure() && environment != null ) {
+ environment.rebuild();
+ }
+ }
+ catch ( Exception ignore ) {
+ }
+ }
+
+ // ExecutionEnvironment.Settings implementation ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public String getBaseForMappings() {
+ return "org/hibernate/test/";
+ }
+
+ public boolean createSchema() {
+ return true;
+ }
+
+ public boolean recreateSchemaAfterFailure() {
+ return true;
+ }
+
+ public void configure(Configuration cfg) {
+ }
+
+ public boolean overrideCacheStrategy() {
+ return true;
+ }
+
+ public String getCacheConcurrencyStrategy() {
+ return "nonstrict-read-write";
+ }
+
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
+ }
+
+ public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
+ }
+
+ /**
+ * Intended to indicate that this test class as a whole is intended for
+ * a dialect or series of dialects. Skips here (appliesTo = false) therefore
+ * simply indicate that the given tests target a particular feature of the
+ * checked database and none of the tests on this class should be run for the
+ * checked dialect.
+ *
+ * @param dialect The dialect to be checked.
+ * @return False if the test class as a whole is specifically targetting
+ * a dialect (or series of dialects) other than the indicated dialect
+ * and the test should therefore be skipped in its entirety;
+ * true otherwise.
+ */
+ public boolean appliesTo(Dialect dialect) {
+ return true;
+ }
+
+
+ // methods for subclasses to access environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * Get the factory for this test environment.
+ *
+ * @return The factory.
+ */
+ protected SessionFactory getSessions() {
+ return environment.getSessionFactory();
+ }
+
+ /**
+ * Get the factory for this test environment, casted to {@link org.hibernate.engine.SessionFactoryImplementor}.
+ * <p/>
+ * Shorthand for ( {@link org.hibernate.engine.SessionFactoryImplementor} ) {@link #getSessions()}...
+ *
+ * @return The factory
+ */
+ protected SessionFactoryImplementor sfi() {
+ return ( SessionFactoryImplementor ) getSessions();
+ }
+
+ protected Dialect getDialect() {
+ return ExecutionEnvironment.DIALECT;
+ }
+
+ protected Configuration getCfg() {
+ return environment.getConfiguration();
+ }
+
+ public org.hibernate.classic.Session openSession() throws HibernateException {
+ session = getSessions().openSession();
+ return session;
+ }
+
+ public org.hibernate.classic.Session openSession(Interceptor interceptor) throws HibernateException {
+ session = getSessions().openSession(interceptor);
+ return session;
+ }
+
+
+
+
+ /**
+ * Is connection at least read committed?
+ * <p/>
+ * Not, that this skip check relies on the JDBC driver reporting
+ * the true isolation level correctly. HSQLDB, for example, will
+ * report whatever you specify as the isolation
+ * (Connection.setTransationIsolation()), even though it only supports
+ * read-uncommitted.
+ *
+ * @param scenario text description of the scenario being tested.
+ * @return true if read-committed isolation is maintained.
+ */
+ protected boolean readCommittedIsolationMaintained(String scenario) {
+ int isolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
+ Session testSession = null;
+ try {
+ testSession = openSession();
+ isolation = testSession.connection().getTransactionIsolation();
+ }
+ catch( Throwable ignore ) {
+ }
+ finally {
+ if ( testSession != null ) {
+ try {
+ testSession.close();
+ }
+ catch( Throwable ignore ) {
+ }
+ }
+ }
+ if ( isolation < java.sql.Connection.TRANSACTION_READ_COMMITTED ) {
+ reportSkip( "environment does not support at least read committed isolation", scenario );
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ /**
+ * Does the db/dialect support using a column's physical name in the order-by clause
+ * even after it has been aliased in the select clause. This is not actually
+ * required by the SQL spec, although virtually ever DB in the world supports this
+ * (the most glaring omission here being IBM-variant DBs ala DB2 and Derby).
+ *
+ * @param testDescription description of the scenario being tested.
+ * @return true if is allowed
+ */
+ protected boolean allowsPhysicalColumnNameInOrderby(String testDescription) {
+ if ( DB2Dialect.class.isInstance( getDialect() ) ) {
+ // https://issues.apache.org/jira/browse/DERBY-1624
+ reportSkip( "Dialect does not support physical column name in order-by clause after it is aliased", testDescription );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Does the db/dialect support using a column's physical name in the having clause
+ * even after it has been aliased in the select/group-by clause. This is not actually
+ * required by the SQL spec, although virtually ever DB in the world supports this.
+ *
+ * @param testDescription description of the scenario being tested.
+ * @return true if is allowed
+ */
+ protected boolean allowsPhysicalColumnNameInHaving(String testDescription) {
+ // I only *know* of this being a limitation on Derby, although I highly suspect
+ // it is a limitation on any IBM/DB2 variant
+ if ( DerbyDialect.class.isInstance( getDialect() ) ) {
+ // https://issues.apache.org/jira/browse/DERBY-1624
+ reportSkip( "Dialect does not support physical column name in having clause after it is aliased", testDescription );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Does the db/dialect support empty lists in the IN operator?
+ * <p/>
+ * For example, is "... a.b IN () ..." supported?
+ *
+ * @param testDescription description of the scenario being tested.
+ * @return true if is allowed
+ */
+ protected boolean dialectSupportsEmptyInList(String testDescription) {
+ if ( ! getDialect().supportsEmptyInList() ) {
+ reportSkip( "Dialect does not support SQL empty in list : x in ()", testDescription );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Is the db/dialect sensitive in terms of string comparisons?
+ * @param testDescription description of the scenario being tested.
+ * @return true if sensitive
+ */
+ protected boolean dialectIsCaseSensitive(String testDescription) {
+ if ( ! getDialect().areStringComparisonsCaseInsensitive() ) {
+ reportSkip( "Dialect is case sensitive. ", testDescription );
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean supportsRowValueConstructorSyntaxInInList() {
+ if ( ! getDialect().supportsRowValueConstructorSyntaxInInList() ) {
+ reportSkip( "Dialect does not support 'tuple' syntax as part of an IN value list", "query support" );
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ if ( ! getDialect().supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() ) {
+ reportSkip( "Driver does not support 'position query' methods on forward-only cursors", "query support" );
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean supportsCircularCascadeDelete() {
+ if ( ! getDialect().supportsCircularCascadeDeleteConstraints() ) {
+ reportSkip( "db/dialect does not support 'circular' cascade delete constraints", "cascade delete constraint support" );
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean supportsSubselectOnLeftSideIn() {
+ if ( ! getDialect().supportsSubselectAsInPredicateLHS() ) {
+ reportSkip( "Database does not support (<subselect>) in ( ... ) ", "query support" );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Expected LOB usage pattern is such that I can perform an insert
+ * via prepared statement with a parameter binding for a LOB value
+ * without crazy casting to JDBC driver implementation-specific classes...
+ * <p/>
+ * Part of the trickiness here is the fact that this is largely
+ * driver dependent. For Oracle, which is notoriously bad with
+ * LOB support in their drivers actually does a pretty good job with
+ * LOB support as of the 10.2.x versions of their drivers...
+ *
+ * @return True if expected usage pattern is support; false otherwise.
+ */
+ protected boolean supportsExpectedLobUsagePattern() {
+ if ( ! getDialect().supportsExpectedLobUsagePattern() ) {
+ reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Does the current dialect support propogating changes to LOB
+ * values back to the database? Talking about mutating the
+ * underlying value as opposed to supplying a new
+ * LOB instance...
+ *
+ * @return True if the changes are propogated back to the
+ * database; false otherwise.
+ */
+ protected boolean supportsLobValueChangePropogation() {
+ if ( ! getDialect().supportsLobValueChangePropogation() ) {
+ reportSkip( "database/driver does not support propogating LOB value change back to database", "LOB support" );
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Is it supported to materialize a LOB locator outside the transaction in
+ * which it was created?
+ * <p/>
+ * Again, part of the trickiness here is the fact that this is largely
+ * driver dependent.
+ * <p/>
+ * NOTE: all database I have tested which {@link #supportsExpectedLobUsagePattern()}
+ * also support the ability to materialize a LOB outside the owning transaction...
+ *
+ * @return True if unbounded materialization is supported; false otherwise.
+ */
+ protected boolean supportsUnboundedLobLocatorMaterialization() {
+ if ( !getDialect().supportsUnboundedLobLocatorMaterialization() ) {
+ reportSkip( "database/driver does not support materializing a LOB locator outside the 'owning' transaction", "LOB support" );
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean supportsSubqueryOnMutatingTable() {
+ if ( !getDialect().supportsSubqueryOnMutatingTable() ) {
+ reportSkip( "database/driver does not support referencing mutating table in subquery", "bulk DML support" );
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean dialectIs(Class dialectClass) {
+ return dialectClass.isInstance( getDialect() );
+ }
+
+ protected boolean dialectIsOneOf(Class[] dialectClasses) {
+ for ( int i = 0; i < dialectClasses.length; i++ ) {
+ if ( dialectClasses[i].isInstance( getDialect() ) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean dialectIsNot(Class dialectClass) {
+ return ! dialectIs( dialectClass );
+ }
+
+ protected boolean dialectIsNot(Class[] dialectClasses) {
+ return ! dialectIsOneOf( dialectClasses );
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,129 @@
+package org.hibernate.junit.functional;
+
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import junit.framework.TestResult;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A specialized {@link junit.framework.TestSuite} implementation intended
+ * for use as an aggregate for a single test class specifically for the purpose
+ * of maintaing a single {@link org.hibernate.SessionFactory} for executings all
+ * tests defined as part of the given functional test class.
+ *
+ * @author Steve Ebersole
+ */
+public class FunctionalTestClassTestSuite extends TestSuite {
+
+ private static final Log log = LogFactory.getLog( FunctionalTestClassTestSuite.class );
+
+ private ExecutionEnvironment.Settings settings;
+ private ExecutionEnvironment environment;
+ private Throwable environmentSetupError;
+ private int testCount;
+ private int testPosition;
+
+ public FunctionalTestClassTestSuite(Class testClass, String name) {
+ super( testClass, name );
+ }
+
+ public FunctionalTestClassTestSuite(Class testClass) {
+ this( testClass, testClass.getName() );
+ }
+
+ /**
+ * Constructor form used during {@link org.hibernate.test.AllTests} filtering...
+ *
+ * @param name The name.
+ */
+ private FunctionalTestClassTestSuite(String name) {
+ super( name );
+ }
+
+ public void addTest(Test test) {
+ log.trace( "adding test [" + test + "]" );
+ if ( settings == null ) {
+ if ( test instanceof ExecutionEnvironment.Settings ) {
+ settings = ( ExecutionEnvironment.Settings ) test;
+ // todo : we could also centralize the skipping of "database specific" tests here
+ // instead of duplicating this notion in AllTests and DatabaseSpecificFunctionalTestCase.
+ // as a test gets added, simply check to see if we should really add it via
+ // DatabaseSpecificFunctionalTestCase.appliesTo( ExecutionEnvironment.DIALECT )...
+ }
+ }
+ testCount++;
+ super.addTest( test );
+ }
+
+ public void run(TestResult testResult) {
+ if ( testCount == 0 ) {
+ // might be zero if database-specific...
+ return;
+ }
+ try {
+ log.info( "Starting test-suite [" + getName() + "]" );
+ setUp();
+ testPosition = 0;
+ super.run( testResult );
+ }
+ finally {
+ try {
+ tearDown();
+ }
+ catch( Throwable ignore ) {
+ }
+ log.info( "Completed test-suite [" + getName() + "]" );
+ }
+ }
+
+ public void runTest(Test test, TestResult testResult) {
+ testPosition++;
+ if ( environmentSetupError != null ) {
+ testResult.startTest( test );
+ testResult.addError( test, environmentSetupError );
+ testResult.endTest( test );
+ return;
+ }
+ if ( ! ( test instanceof FunctionalTestCase ) ) {
+ super.runTest( test, testResult );
+ }
+ else {
+ FunctionalTestCase functionalTest = ( ( FunctionalTestCase ) test );
+ try {
+ // disallow rebuilding the schema because this is the last test
+ // in this suite, thus it is about to get dropped immediately
+ // afterwards anyway...
+ environment.setAllowRebuild( testPosition < testCount );
+ functionalTest.setEnvironment( environment );
+ super.runTest( functionalTest, testResult );
+ }
+ finally {
+ functionalTest.setEnvironment( null );
+ }
+ }
+ }
+
+ protected void setUp() {
+ if ( settings == null ) {
+ return;
+ }
+ log.info( "Building aggregated execution environment" );
+ try {
+ environment = new ExecutionEnvironment( settings );
+ environment.initialize();
+ }
+ catch( Throwable t ) {
+ environmentSetupError = t;
+ }
+ }
+
+ protected void tearDown() {
+ if ( environment != null ) {
+ log.info( "Destroying aggregated execution environment" );
+ environment.complete();
+ this.environment = null;
+ }
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyConnectionProvider.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyConnectionProvider.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyConnectionProvider.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,48 @@
+//$Id: DummyConnectionProvider.java 6501 2005-04-24 00:18:28Z oneovthafew $
+package org.hibernate.test.tm;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.hibernate.HibernateException;
+import org.hibernate.connection.ConnectionProvider;
+import org.hibernate.connection.ConnectionProviderFactory;
+
+/**
+ * @author Gavin King
+ */
+public class DummyConnectionProvider implements ConnectionProvider {
+
+ ConnectionProvider cp;
+ boolean isTransaction;
+
+ public void configure(Properties props) throws HibernateException {
+ cp = ConnectionProviderFactory.newConnectionProvider();
+ }
+
+ public Connection getConnection() throws SQLException {
+ DummyTransactionManager dtm = DummyTransactionManager.INSTANCE;
+ if ( dtm!=null && dtm.getCurrent()!=null && dtm.getCurrent().getConnection()!=null ) {
+ isTransaction = true;
+ return dtm.getCurrent().getConnection();
+ }
+ else {
+ isTransaction = false;
+ return cp.getConnection();
+ }
+ }
+
+ public void closeConnection(Connection conn) throws SQLException {
+ if (!isTransaction) conn.close();
+ }
+
+ public void close() throws HibernateException {
+
+ }
+
+ public boolean supportsAggressiveRelease() {
+ return true;
+ }
+
+}
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyConnectionProvider.java
___________________________________________________________________
Name: svn:executable
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyJTAStyleTransationFactory.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyJTAStyleTransationFactory.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyJTAStyleTransationFactory.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,138 @@
+package org.hibernate.test.tm;
+
+import org.hibernate.transaction.TransactionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.HibernateException;
+import org.hibernate.ConnectionReleaseMode;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.util.JTAHelper;
+import org.hibernate.jdbc.JDBCContext;
+
+import javax.transaction.SystemException;
+import javax.transaction.Synchronization;
+import java.util.Properties;
+
+/**
+ * todo: describe DummyJTAStyleTransationFactory
+ *
+ * @author Steve Ebersole
+ */
+public class DummyJTAStyleTransationFactory implements TransactionFactory {
+ public Transaction createTransaction(
+ JDBCContext jdbcContext,
+ Context context) throws HibernateException {
+ return new DummyTransactionAdapter();
+ }
+
+ public void configure(Properties props) throws HibernateException {
+ }
+
+ public ConnectionReleaseMode getDefaultReleaseMode() {
+ return ConnectionReleaseMode.AFTER_STATEMENT;
+ }
+
+ public boolean isTransactionManagerRequired() {
+ return true;
+ }
+
+ public boolean areCallbacksLocalToHibernateTransactions() {
+ return false;
+ }
+
+ public boolean isTransactionInProgress(
+ JDBCContext jdbcContext,
+ Context transactionContext,
+ Transaction transaction) {
+ try {
+ return JTAHelper.isTransactionInProgress( DummyTransactionManager.INSTANCE.getCurrent() )
+ && ! JTAHelper.isMarkedForRollback( DummyTransactionManager.INSTANCE.getCurrent() );
+ }
+ catch( SystemException e ) {
+ throw new HibernateException( e );
+ }
+ }
+
+ private static class DummyTransactionAdapter implements Transaction {
+
+ private boolean started;
+ private boolean committed;
+ private boolean rolledback;
+
+ public void begin() throws HibernateException {
+ started = true;
+ committed = false;
+ rolledback = false;
+ try {
+ DummyTransactionManager.INSTANCE.begin();
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "error on begin()", t );
+ }
+ }
+
+ public void commit() throws HibernateException {
+ if ( !started ) {
+ throw new HibernateException( "not yet started!" );
+ }
+ started = false;
+ rolledback = false;
+ committed = false;
+ try {
+ DummyTransactionManager.INSTANCE.commit();
+ committed = true;
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "error on commit()", t );
+ }
+ }
+
+ public void rollback() throws HibernateException {
+ if ( !started ) {
+ throw new HibernateException( "not yet started!" );
+ }
+ started = false;
+ rolledback = false;
+ committed = false;
+ try {
+ DummyTransactionManager.INSTANCE.rollback();
+ rolledback = true;
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "error on rollback()", t );
+ }
+ }
+
+ public boolean wasRolledBack() throws HibernateException {
+ return rolledback;
+ }
+
+ public boolean wasCommitted() throws HibernateException {
+ return committed;
+ }
+
+ public boolean isActive() throws HibernateException {
+ return started;
+ }
+
+ public void registerSynchronization(Synchronization synchronization) throws HibernateException {
+ try {
+ DummyTransactionManager.INSTANCE.getCurrent().registerSynchronization( synchronization );
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "error on registerSynchronization()", t );
+ }
+ }
+
+ public void setTimeout(int seconds) {
+ // ignore...
+ }
+ }
+
+ public static void setup(Configuration cfg) {
+ cfg.setProperty( Environment.CONNECTION_PROVIDER, DummyConnectionProvider.class.getName() );
+ cfg.setProperty( Environment.TRANSACTION_MANAGER_STRATEGY, DummyTransactionManagerLookup.class.getName() );
+ cfg.setProperty( Environment.TRANSACTION_STRATEGY, DummyJTAStyleTransationFactory.class.getName() );
+ cfg.setProperty( Environment.FLUSH_BEFORE_COMPLETION, "true" );
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransaction.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransaction.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransaction.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,146 @@
+//$Id: DummyTransaction.java 8411 2005-10-14 23:29:04Z maxcsaucdk $
+package org.hibernate.test.tm;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.xa.XAResource;
+
+/**
+ * @author Gavin King
+ */
+public class DummyTransaction implements Transaction {
+
+ int status;
+ private Connection connection;
+ List synchronizations = new ArrayList();
+ private DummyTransactionManager transactionManager;
+
+ DummyTransaction(DummyTransactionManager transactionManager) {
+ status = Status.STATUS_NO_TRANSACTION;
+ this.transactionManager = transactionManager;
+ }
+
+ public void begin() throws SystemException {
+ try {
+ connection = transactionManager.connections.getConnection();
+ }
+ catch (SQLException sqle) {
+
+ sqle.printStackTrace();
+ throw new SystemException(sqle.toString());
+ }
+ status = Status.STATUS_ACTIVE;
+ }
+
+ public void commit() throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, SecurityException,
+ IllegalStateException, SystemException {
+
+ if (status == Status.STATUS_MARKED_ROLLBACK) {
+ rollback();
+ }
+ else {
+ status = Status.STATUS_PREPARING;
+
+ for ( int i=0; i<synchronizations.size(); i++ ) {
+ Synchronization s = (Synchronization) synchronizations.get(i);
+ s.beforeCompletion();
+ }
+
+ status = Status.STATUS_COMMITTING;
+
+ try {
+ connection.commit();
+ connection.close();
+ }
+ catch (SQLException sqle) {
+ status = Status.STATUS_UNKNOWN;
+ throw new SystemException();
+ }
+
+ status = Status.STATUS_COMMITTED;
+
+ for ( int i=0; i<synchronizations.size(); i++ ) {
+ Synchronization s = (Synchronization) synchronizations.get(i);
+ s.afterCompletion(status);
+ }
+
+ //status = Status.STATUS_NO_TRANSACTION;
+ transactionManager.endCurrent(this);
+ }
+
+ }
+
+ public boolean delistResource(XAResource arg0, int arg1)
+ throws IllegalStateException, SystemException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean enlistResource(XAResource arg0) throws RollbackException,
+ IllegalStateException, SystemException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public int getStatus() throws SystemException {
+ return status;
+ }
+
+ public void registerSynchronization(Synchronization sync)
+ throws RollbackException, IllegalStateException, SystemException {
+ synchronizations.add(sync);
+ }
+
+ public void rollback() throws IllegalStateException, SystemException {
+
+ status = Status.STATUS_ROLLING_BACK;
+
+// Synch.beforeCompletion() should *not* be called for rollbacks
+// for ( int i=0; i<synchronizations.size(); i++ ) {
+// Synchronization s = (Synchronization) synchronizations.get(i);
+// s.beforeCompletion();
+// }
+
+ status = Status.STATUS_ROLLEDBACK;
+
+ try {
+ connection.rollback();
+ connection.close();
+ }
+ catch (SQLException sqle) {
+ status = Status.STATUS_UNKNOWN;
+ throw new SystemException();
+ }
+
+ for ( int i=0; i<synchronizations.size(); i++ ) {
+ Synchronization s = (Synchronization) synchronizations.get(i);
+ s.afterCompletion(status);
+ }
+
+ //status = Status.STATUS_NO_TRANSACTION;
+ transactionManager.endCurrent(this);
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ status = Status.STATUS_MARKED_ROLLBACK;
+ }
+
+ void setConnection(Connection connection) {
+ this.connection = connection;
+ }
+
+ public Connection getConnection() {
+ return connection;
+ }
+}
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransaction.java
___________________________________________________________________
Name: svn:executable
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManager.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManager.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManager.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,84 @@
+//$Id: DummyTransactionManager.java 7003 2005-06-03 16:09:59Z steveebersole $
+package org.hibernate.test.tm;
+
+import java.util.Properties;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.connection.ConnectionProvider;
+import org.hibernate.connection.ConnectionProviderFactory;
+
+/**
+ * @author Gavin King
+ */
+public class DummyTransactionManager implements TransactionManager {
+
+ public static DummyTransactionManager INSTANCE;
+
+ private DummyTransaction current;
+ ConnectionProvider connections;
+
+ public DummyTransactionManager(Properties props) {
+ connections = ConnectionProviderFactory.newConnectionProvider();
+ }
+
+ public void begin() throws NotSupportedException, SystemException {
+ current = new DummyTransaction(this);
+ current.begin();
+ }
+
+ public void commit() throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, SecurityException,
+ IllegalStateException, SystemException {
+ current.commit();
+ }
+
+
+ public int getStatus() throws SystemException {
+ return current.getStatus();
+ }
+
+ public Transaction getTransaction() throws SystemException {
+ return current;
+ }
+
+ public void resume(Transaction tx) throws InvalidTransactionException,
+ IllegalStateException, SystemException {
+ current = (DummyTransaction) tx;
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException,
+ SystemException {
+ current.rollback();
+
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ current.setRollbackOnly();
+ }
+
+ public void setTransactionTimeout(int t) throws SystemException {
+ }
+
+ public Transaction suspend() throws SystemException {
+ Transaction result = current;
+ current = null;
+ return result;
+ }
+
+ public DummyTransaction getCurrent() {
+ return current;
+ }
+
+ void endCurrent(DummyTransaction tx) {
+ if (current==tx) current=null;
+ }
+
+}
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManager.java
___________________________________________________________________
Name: svn:executable
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManagerLookup.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManagerLookup.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManagerLookup.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,28 @@
+//$Id: DummyTransactionManagerLookup.java 5693 2005-02-13 01:59:07Z oneovthafew $
+package org.hibernate.test.tm;
+
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+
+import org.hibernate.HibernateException;
+import org.hibernate.transaction.TransactionManagerLookup;
+
+/**
+ * @author Gavin King
+ */
+public class DummyTransactionManagerLookup implements TransactionManagerLookup {
+
+ public TransactionManager getTransactionManager(Properties props)
+ throws HibernateException {
+ if ( DummyTransactionManager.INSTANCE == null ) {
+ DummyTransactionManager.INSTANCE = new DummyTransactionManager(props);
+ }
+ return DummyTransactionManager.INSTANCE;
+ }
+
+ public String getUserTransactionName() {
+ throw new UnsupportedOperationException();
+ }
+
+}
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/hibernate/test/tm/DummyTransactionManagerLookup.java
___________________________________________________________________
Name: svn:executable
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.hibernate.jbc.cacheprovider;
+
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+
+import org.hibernate.transaction.TransactionManagerLookup;
+import org.hibernate.transaction.TransactionManagerLookupFactory;
+
+/**
+ * NonJndiTmTreeCacheProviderHook.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class NonJndiTmTreeCacheProviderHook extends TreeCacheProviderHook
+{
+ protected TransactionManager getTransactionManager(Properties properties)
+ {
+ TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
+ return transactionManagerLookup.getTransactionManager(properties);
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,126 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cache.ReadWriteCache;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+import org.hibernate.stat.Statistics;
+
+/**
+ * Common requirement entity caching testing for each
+ * {@link org.hibernate.cache.RegionFactory} impl.
+ *
+ * @author Steve Ebersole
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public abstract class AbstractEntityCacheFunctionalTestCase extends CacheTestCaseBase {
+
+ // note that a lot of the functionality 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 AbstractEntityCacheFunctionalTestCase(String x, int cacheMode) {
+ super(x, cacheMode);
+ }
+
+ protected boolean getUseQueryCache() {
+ return false;
+ }
+
+ public void testEmptySecondLevelCacheEntry() throws Exception {
+ getSessions().evictEntity(Item.class.getName());
+ Statistics stats = getSessions().getStatistics();
+ stats.clear();
+ SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics(getPrefixedRegionName(Item.class.getName()));
+ Map cacheEntries = statistics.getEntries();
+ assertEquals(0, cacheEntries.size());
+ }
+
+ public void testStaleWritesLeaveCacheConsistent() {
+ Session s = openSession();
+ Transaction txn = s.beginTransaction();
+ VersionedItem item = new VersionedItem();
+ item.setName("steve");
+ item.setDescription("steve's item");
+ s.save(item);
+ txn.commit();
+ s.close();
+
+ Long initialVersion = item.getVersion();
+
+ // manually revert the version property
+ item.setVersion(new Long(item.getVersion().longValue() - 1));
+
+ try {
+ s = openSession();
+ txn = s.beginTransaction();
+ s.update(item);
+ txn.commit();
+ s.close();
+ fail("expected stale write to fail");
+ } catch (Throwable expected) {
+ // expected behavior here
+ if (txn != null) {
+ try {
+ txn.rollback();
+ } catch (Throwable ignore) {
+ }
+ }
+ } finally {
+ if (s != null && s.isOpen()) {
+ try {
+ s.close();
+ } catch (Throwable ignore) {
+ }
+ }
+ }
+
+ // check the version value in the cache...
+ SecondLevelCacheStatistics slcs = sfi().getStatistics().getSecondLevelCacheStatistics(
+ getPrefixedRegionName(VersionedItem.class.getName()));
+
+ Object entry = slcs.getEntries().get(item.getId());
+ Long cachedVersionValue;
+ if (entry instanceof ReadWriteCache.Lock) {
+ // FIXME don't know what to test here
+ cachedVersionValue = new Long(((ReadWriteCache.Lock) entry).getUnlockTimestamp());
+ } else {
+ cachedVersionValue = (Long) ((Map) entry).get("_version");
+ assertEquals(initialVersion.longValue(), cachedVersionValue.longValue());
+ }
+
+ // cleanup
+ s = openSession();
+ txn = s.beginTransaction();
+ item = (VersionedItem) s.load(VersionedItem.class, item.getId());
+ s.delete(item);
+ txn.commit();
+ s.close();
+
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,103 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cache.ReadWriteCache;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+
+/**
+ * A QueryCacheEnabledCacheProviderTestCase.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public abstract class AbstractQueryCacheFunctionalTestCase extends AbstractEntityCacheFunctionalTestCase {
+
+ /**
+ * Create a new QueryCacheEnabledCacheProviderTestCase.
+ *
+ * @param x
+ */
+ public AbstractQueryCacheFunctionalTestCase(String x, int cacheMode) {
+ super(x, cacheMode);
+ }
+
+ protected boolean getUseQueryCache() {
+ return true;
+ }
+
+ public void testQueryCacheInvalidation() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ Item i = new Item();
+ i.setName("widget");
+ i.setDescription("A really top-quality, full-featured widget.");
+ s.persist(i);
+ t.commit();
+ s.close();
+
+ SecondLevelCacheStatistics slcs = s.getSessionFactory().getStatistics().getSecondLevelCacheStatistics(
+ getPrefixedRegionName(Item.class.getName()));
+
+ assertEquals(slcs.getPutCount(), 1);
+ assertEquals(slcs.getElementCountInMemory(), 1);
+ assertEquals(slcs.getEntries().size(), 1);
+
+ s = openSession();
+ t = s.beginTransaction();
+ i = (Item) s.get(Item.class, i.getId());
+
+ assertEquals(slcs.getHitCount(), 1);
+ assertEquals(slcs.getMissCount(), 0);
+
+ i.setDescription("A bog standard item");
+
+ t.commit();
+ s.close();
+
+ assertEquals(slcs.getPutCount(), 2);
+
+ Object entry = slcs.getEntries().get(i.getId());
+ Map map;
+ if (entry instanceof ReadWriteCache.Item) {
+ map = (Map) ((ReadWriteCache.Item) entry).getValue();
+ } else {
+ map = (Map) entry;
+ }
+ assertTrue(map.get("description").equals("A bog standard item"));
+ assertTrue(map.get("name").equals("widget"));
+
+ // cleanup
+ s = openSession();
+ t = s.beginTransaction();
+ s.delete(i);
+ t.commit();
+ s.close();
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,189 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.transaction.TransactionManagerLookup;
+import org.hibernate.transaction.TransactionManagerLookupFactory;
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
+import org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.TestCacheInstanceManager;
+import org.jboss.logging.Logger;
+
+/**
+ * Provides common configuration setups for cache testing.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public abstract class CacheTestCaseBase extends FunctionalTestCase {
+
+ private static final Logger log = Logger.getLogger(CacheTestCaseBase.class);
+
+ private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
+
+ private String preferIPv4Stack;
+
+ protected TestCacheInstanceManager cacheInstanceManager;
+
+ // note that a lot of the functionality 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 CacheTestCaseBase(String x, int cacheMode)
+ {
+ super(x);
+ cacheInstanceManager = new TestCacheInstanceManager(cacheMode);
+ }
+
+ public String[] getMappings() {
+ return new String[] { "Item.hbm.xml", "Customer.hbm.xml", "Contact.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ super.configure(cfg);
+
+ if (getRegionPrefix() != null) {
+ cfg.setProperty(Environment.CACHE_REGION_PREFIX, getRegionPrefix());
+ }
+
+ cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "true");
+ cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
+ cfg.setProperty(Environment.USE_STRUCTURED_CACHE, "true");
+
+ // cfg.setProperty(Environment.CACHE_REGION_FACTORY, getCacheRegionFactory().getName());
+
+ cfg.setProperty(Environment.USE_QUERY_CACHE, String.valueOf(getUseQueryCache()));
+ cfg.setProperty(Environment.CONNECTION_PROVIDER, getConnectionProviderClass().getName());
+ cfg.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, getTransactionManagerLookupClass().getName());
+
+ Class transactionFactory = getTransactionFactoryClass();
+ if (transactionFactory != null)
+ cfg.setProperty( Environment.TRANSACTION_STRATEGY, transactionFactory.getName() );
+
+ configureCacheFactory(cfg);
+
+ cacheInstanceManager.start(cfg);
+ }
+
+ protected String getRegionPrefix() {
+ return "test";
+ }
+
+ protected String getPrefixedRegionName(String regionName)
+ {
+ String prefix = getRegionPrefix() == null ? "" : getRegionPrefix() + ".";
+ return prefix + regionName;
+ }
+
+ public String getCacheConcurrencyStrategy() {
+ return "transactional";
+ }
+
+ /**
+ * Apply any region-factory specific configurations.LoggerFactory.getLogger(
+ *
+ * @param the Configuration to update.
+ */
+ protected void configureCacheFactory(Configuration cfg)
+ {
+ cfg.setProperty(TreeCacheProviderHook.HIBERNATE_CACHE_OBJECT_NAME_PROPERTY,
+ TestCacheInstanceManager.CACHE_MBEAN_NAME_STARTS_WITH + TestCacheInstanceManager.SINGLE);;
+ }
+
+ // protected abstract Class getCacheRegionFactory();
+
+ protected abstract boolean getUseQueryCache();
+
+ protected Class getConnectionProviderClass() {
+ // return org.hibernate.test.tm.ConnectionProviderImpl.class;
+ return org.hibernate.test.tm.DummyConnectionProvider.class;
+ }
+
+ protected Class getTransactionManagerLookupClass() {
+ // return org.hibernate.test.tm.TransactionManagerLookupImpl.class;
+ return org.hibernate.test.tm.DummyTransactionManagerLookup.class;
+ }
+
+ protected Class getTransactionFactoryClass() {
+ return null;
+ }
+
+ public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
+
+ super.afterConfigurationBuilt(mappings, dialect);
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
+ System.setProperty(PREFER_IPV4STACK, "true");
+ }
+
+// protected void prepareTest() throws Exception
+// {
+// super.prepareTest();
+// }
+
+ protected void cleanupTest() throws Exception
+ {
+ try
+ {
+ super.cleanupTest();
+ // TestCacheInstanceManager.getTreeCache(TestCacheInstanceManager.SINGLE).remove("/");
+ }
+ finally
+ {
+ if (preferIPv4Stack == null)
+ System.getProperties().remove(PREFER_IPV4STACK);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ }
+ }
+
+ protected void sleep(long ms) {
+ try {
+ Thread.sleep(ms);
+ }
+ catch (InterruptedException e) {
+ log.warn("Interrupted during sleep", e);
+ }
+ }
+
+ public String getBaseForMappings()
+ {
+ return "org/jboss/hibernate/jbc/cacheprovider/functional/";
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,48 @@
+<?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) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <class name="Contact" table="Contacts">
+
+ <cache usage="transactional"/>
+
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+ <property name="tlf" not-null="true"/>
+
+ <many-to-one name="customer"
+ class="org.jboss.hibernate.jbc.cacheprovider.functional.Customer"
+ column="CUSTOMER_ID"/>
+ </class>
+
+</hibernate-mapping>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,92 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.io.Serializable;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+/**
+ * Entity that has a many-to-one relationship to a Customer
+ */
+public class Contact implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ Integer id;
+ String name;
+ String tlf;
+ Customer customer;
+
+ public Contact()
+ {
+
+ }
+
+ @Id
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getTlf()
+ {
+ return tlf;
+ }
+
+ public void setTlf(String tlf)
+ {
+ this.tlf = tlf;
+ }
+
+ @ManyToOne
+ @JoinColumn(name="CUST_ID")
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer)
+ {
+ this.customer = customer;
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,50 @@
+<?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) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <class name="Customer" table="Customers">
+
+ <cache usage="transactional"/>
+
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+
+ <set name="contacts" cascade="all" lazy="false">
+ <cache usage="transactional"/>
+ <key column="CUSTOMER_ID"/>
+ <one-to-many class="org.jboss.hibernate.jbc.cacheprovider.functional.Contact"/>
+ </set>
+
+ </class>
+
+</hibernate-mapping>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,81 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Id;
+
+/**
+ * Company customer
+ *
+ * @author Emmanuel Bernard
+ * @author Kabir Khan
+ */
+public class Customer implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+ Integer id;
+ String name;
+
+ private transient Set<Contact> contacts;
+
+ public Customer()
+ {
+ }
+
+ @Id
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String string)
+ {
+ name = string;
+ }
+
+ public Set<Contact> getContacts()
+ {
+ return contacts;
+ }
+
+ public void setContacts(Set<Contact> contacts)
+ {
+ this.contacts = contacts;
+ }
+}
+
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2008, 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): Brian Stansberry
+ */
+
+package org.jboss.hibernate.jbc.cacheprovider.functional;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.junit.functional.ExecutionEnvironment;
+import org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeConnectionProviderImpl;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeJtaTransactionManagerImpl;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTransactionManagerLookup;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.TestCacheInstanceManager;
+import org.hibernate.transaction.CMTTransactionFactory;
+import org.jboss.logging.Logger;
+
+/**
+ * Base class for tests that need to create two separate SessionFactory
+ * instances to simulate a two-node cluster.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public abstract class DualNodeTestCaseBase extends CacheTestCaseBase
+{
+ private static final Logger log = Logger.getLogger(CacheTestCaseBase.class);
+
+ public static final String CACHE_MANAGER_NAME_PROP = "hibernate.test.cluster.node.id";
+
+ private ExecutionEnvironment secondNodeEnvironment;
+ private org.hibernate.classic.Session secondNodeSession;
+
+ /**
+ * Create a new DualNodeTestCaseBase.
+ *
+ * @param x
+ */
+ public DualNodeTestCaseBase(String x, int cacheMode)
+ {
+ super(x, cacheMode);
+ }
+
+ @Override
+ public void configure(Configuration cfg)
+ {
+ configureFirstNode(cfg);
+ standardConfigure(cfg);
+ }
+
+ private void standardConfigure(Configuration cfg) {
+ super.configure(cfg);
+ }
+
+ /**
+ * Apply any node-specific configurations to our first node.
+ *
+ * @param the Configuration to update.
+ */
+ protected void configureFirstNode(Configuration cfg)
+ {
+ cfg.setProperty(DualNodeTestUtil.NODE_ID_PROP,
+ DualNodeTestUtil.LOCAL);
+ cfg.setProperty(TreeCacheProviderHook.HIBERNATE_CACHE_OBJECT_NAME_PROPERTY,
+ TestCacheInstanceManager.CACHE_MBEAN_NAME_STARTS_WITH + DualNodeTestUtil.LOCAL);
+ }
+ /**
+ * Apply any node-specific configurations to our second node.
+ *
+ * @param the Configuration to update.
+ */
+ protected void configureSecondNode(Configuration cfg)
+ {
+ cfg.setProperty(DualNodeTestUtil.NODE_ID_PROP,
+ DualNodeTestUtil.REMOTE);
+ cfg.setProperty(TreeCacheProviderHook.HIBERNATE_CACHE_OBJECT_NAME_PROPERTY,
+ TestCacheInstanceManager.CACHE_MBEAN_NAME_STARTS_WITH + DualNodeTestUtil.REMOTE);
+ }
+
+ @Override
+ protected Class getConnectionProviderClass() {
+ return DualNodeConnectionProviderImpl.class;
+ }
+
+ @Override
+ protected Class getTransactionManagerLookupClass() {
+ return DualNodeTransactionManagerLookup.class;
+ }
+
+ @Override
+ protected Class getTransactionFactoryClass() {
+ return CMTTransactionFactory.class;
+ }
+
+ @Override
+ protected void prepareTest() throws Exception
+ {
+ log.info( "Building second node locally managed execution env" );
+ secondNodeEnvironment = new ExecutionEnvironment( new SecondNodeSettings() );
+ secondNodeEnvironment.initialize();
+
+ super.prepareTest();
+ }
+
+ @Override
+ protected void runTest() throws Throwable
+ {
+ try {
+ super.runTest();
+ }
+ finally {
+
+ if ( secondNodeSession != null && secondNodeSession.isOpen() ) {
+ if ( secondNodeSession.isConnected() ) {
+ secondNodeSession.connection().rollback();
+ }
+ secondNodeSession.close();
+ secondNodeSession = null;
+ fail( "unclosed session" );
+ }
+ else {
+ secondNodeSession = null;
+ }
+
+ }
+ }
+
+ @Override
+ protected void cleanupTest() throws Exception
+ {
+ try {
+ super.cleanupTest();
+
+ log.info( "Destroying second node locally managed execution env" );
+ secondNodeEnvironment.complete();
+ secondNodeEnvironment = null;
+ }
+ finally {
+ cleanupTransactionManagement();
+ }
+ }
+
+ protected void cleanupTransactionManagement() {
+ DualNodeJtaTransactionManagerImpl.cleanupTransactions();
+ DualNodeJtaTransactionManagerImpl.cleanupTransactionManagers();
+ }
+
+ public ExecutionEnvironment getSecondNodeEnvironment() {
+ return secondNodeEnvironment;
+ }
+
+ /**
+ * Settings impl that delegates most calls to the DualNodeTestCase itself,
+ * but overrides the configure method to allow separate cache settings
+ * for the second node.
+ */
+ public class SecondNodeSettings implements ExecutionEnvironment.Settings {
+
+ private DualNodeTestCaseBase delegate;
+
+ public SecondNodeSettings() {
+ this.delegate = DualNodeTestCaseBase.this;
+ }
+
+ /**
+ * This is the important one -- we extend the delegate's work by
+ * adding second-node specific settings
+ */
+ public void configure(Configuration arg0)
+ {
+ configureSecondNode(arg0);
+ delegate.standardConfigure(arg0);
+ }
+
+ /**
+ * Disable creating of schemas; we let the primary session factory
+ * do that to our shared database.
+ */
+ public boolean createSchema()
+ {
+ return false;
+ }
+
+ /**
+ * Disable creating of schemas; we let the primary session factory
+ * do that to our shared database.
+ */
+ public boolean recreateSchemaAfterFailure()
+ {
+ return false;
+ }
+
+ public void afterConfigurationBuilt(Mappings arg0, Dialect arg1)
+ {
+ delegate.afterConfigurationBuilt(arg0, arg1);
+ }
+
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor arg0)
+ {
+ delegate.afterSessionFactoryBuilt(arg0);
+ }
+
+ public boolean appliesTo(Dialect arg0)
+ {
+ return delegate.appliesTo(arg0);
+ }
+
+ public String getBaseForMappings()
+ {
+ return delegate.getBaseForMappings();
+ }
+
+ public String getCacheConcurrencyStrategy()
+ {
+ return delegate.getCacheConcurrencyStrategy();
+ }
+
+ public String[] getMappings()
+ {
+ return delegate.getMappings();
+ }
+
+ public boolean overrideCacheStrategy()
+ {
+ return delegate.overrideCacheStrategy();
+ }
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <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>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Item.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,57 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+/**
+ * @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;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,59 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+
+
+
+/**
+ * Executes the superclass tests, but with Hibernate and JBoss Cache
+ * configured for optimistic locking.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class OptimisticEntityReplicationTest extends PessimisticEntityReplicationTest
+{
+ public OptimisticEntityReplicationTest(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void configureCacheFactory(Configuration cfg)
+ {
+ cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, OptimisticJBossCacheTest.JBC_CONFIG);
+ cfg.setProperty(Environment.CACHE_PROVIDER, OptimisticJBossCacheTest.JBC_CACHE_PROVIDER);
+ }
+
+// @Override
+// protected String getEntityCacheConfigName()
+// {
+// return "optimistic-shared";
+// }
+
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,73 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import junit.framework.Test;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.jboss.cache.TreeCache;
+
+/**
+ * Basic functional test of a optimistic locking entity + query cache.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class OptimisticJBossCacheTest extends AbstractQueryCacheFunctionalTestCase
+{
+ public static final String JBC_CONFIG = "org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml";
+
+ public static final String JBC_CACHE_PROVIDER = "org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook";
+
+ public OptimisticJBossCacheTest(String x)
+ {
+ super(x, TreeCache.LOCAL);
+ }
+
+ public static Test suite()
+ {
+ return new FunctionalTestClassTestSuite(OptimisticJBossCacheTest.class);
+ }
+
+// protected Class<? extends RegionFactory> getCacheRegionFactory() {
+// return JBossCacheRegionFactory.class;
+// }
+
+ /**
+ * Apply any region-factory specific configurations.
+ *
+ * @param the Configuration to update.
+ */
+ @Override
+ protected void configureCacheFactory(Configuration cfg)
+ {
+ super.configureCacheFactory(cfg);
+
+ cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, JBC_CONFIG);
+ cfg.setProperty(Environment.CACHE_PROVIDER, JBC_CACHE_PROVIDER);
+ }
+
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,365 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.transaction.CMTTransactionFactory;
+import org.hibernate.transaction.TransactionManagerLookup;
+import org.hibernate.transaction.TransactionManagerLookupFactory;
+import org.jboss.cache.AbstractTreeCacheListener;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
+import org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
+import org.jboss.hibernate.jbc.cacheprovider.functional.util.TestCacheInstanceManager;
+import org.jboss.logging.Logger;
+
+/**
+ * Port of the earlier JBoss EJB3 project's
+ * org.jboss.ejb3.test.clusteredentity.unit.EntityUnitTestCase
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class PessimisticEntityReplicationTest extends DualNodeTestCaseBase
+{
+ private static final Logger log = Logger.getLogger(PessimisticEntityReplicationTest.class);
+
+ private static final long SLEEP_TIME = 50l;
+
+ private static final Integer CUSTOMER_ID = new Integer(1);
+
+ static int test = 0;
+
+ public PessimisticEntityReplicationTest(String name)
+ {
+ super(name, TreeCache.REPL_SYNC);
+ }
+
+// @Override
+// protected Class getCacheRegionFactory()
+// {
+// return TestJBossCacheRegionFactory.class;
+// }
+
+ @Override
+ protected boolean getUseQueryCache()
+ {
+ return false;
+ }
+
+ @Override
+ protected void configureCacheFactory(Configuration cfg)
+ {
+// cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP,
+// getEntityCacheConfigName());
+ cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, PessimisticJBossCacheTest.JBC_CONFIG);
+ cfg.setProperty(Environment.CACHE_PROVIDER, PessimisticJBossCacheTest.JBC_CACHE_PROVIDER);
+ }
+
+// /**
+// * Configure the local cache overriding this method.
+// * */
+// @Override
+// protected TreeCache createRegisterStartTreeCache(Configuration cfg, String location, int cacheMode)
+// {
+// super.createRegisterStartTreeCache(cfg, "Local", TreeCache.REPL_SYNC);
+// }
+//
+// protected TreeCache createRegisterStartRemoteTreeCache(Configuration cfg, String location, int cacheMode)
+// {
+// super.createRegisterStartTreeCache(cfg, "Remote", TreeCache.REPL_SYNC);
+// }
+
+// protected String getEntityCacheConfigName() {
+// return "pessimistic-shared";
+// }
+
+ public void testAll() throws Exception
+ {
+ System.out.println("*** " + getName());
+
+// CacheManager localManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.LOCAL);
+// Cache localCache = localManager.getCache(getEntityCacheConfigName(), true);
+ // Bind a listener to the "local" cache
+ // Our region factory makes its CacheManager available to us
+ TreeCache localCache = TestCacheInstanceManager.getTreeCache(DualNodeTestUtil.LOCAL);
+ MyListener localListener = new MyListener();
+ localCache.addTreeCacheListener(localListener);
+ TransactionManager localTM = localCache.getTransactionManager();
+
+// CacheManager remoteManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.REMOTE);
+// Cache remoteCache = remoteManager.getCache(getEntityCacheConfigName(), true);
+ // Bind a listener to the "remote" cache
+ TreeCache remoteCache = TestCacheInstanceManager.getTreeCache(DualNodeTestUtil.REMOTE);
+ MyListener remoteListener = new MyListener();
+ remoteCache.addTreeCacheListener(remoteListener);
+
+ TransactionManager remoteTM = remoteCache.getTransactionManager();
+
+ SessionFactory localFactory = getEnvironment().getSessionFactory();
+ SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
+
+ try
+ {
+ System.out.println("Create node 0");
+ IdContainer ids = createCustomer(localFactory, localTM);
+
+ // Sleep a bit to let async commit propagate. Really just to
+ // help keep the logs organized for debugging any issues
+ sleep(SLEEP_TIME);
+
+ System.out.println("Find node 0");
+ // This actually brings the collection into the cache
+ getCustomer(ids.customerId, localFactory, localTM);
+
+ sleep(SLEEP_TIME);
+
+ // Now the collection is in the cache so, the 2nd "get"
+ // should read everything from the cache
+ System.out.println("Find(2) node 0");
+ localListener.clear();
+ getCustomer(ids.customerId, localFactory, localTM);
+
+ //Check the read came from the cache
+ System.out.println("Check cache 0");
+ assertLoadedFromCache(localListener, ids.customerId, ids.contactIds);
+
+ System.out.println("Find node 1");
+ getCustomer(ids.customerId, remoteFactory, remoteTM);
+
+ //Check everything was in cache
+ System.out.println("Check cache 1");
+ assertLoadedFromCache(remoteListener, ids.customerId, ids.contactIds);
+ }
+ finally
+ {
+ // cleanup the db
+ System.out.println("Cleaning up");
+ cleanup(localFactory, localTM);
+ }
+ }
+
+ private IdContainer createCustomer(SessionFactory sessionFactory, TransactionManager tm)
+ throws Exception
+ {
+ System.out.println("CREATE CUSTOMER");
+
+ tm.begin();
+
+ try
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Customer customer = new Customer();
+ customer.setName("JBoss");
+ Set<Contact> contacts = new HashSet<Contact>();
+
+ Contact kabir = new Contact();
+ kabir.setCustomer(customer);
+ kabir.setName("Kabir");
+ kabir.setTlf("1111");
+ contacts.add(kabir);
+
+ Contact bill = new Contact();
+ bill.setCustomer(customer);
+ bill.setName("Bill");
+ bill.setTlf("2222");
+ contacts.add(bill);
+
+ customer.setContacts(contacts);
+
+ session.save(customer);
+ tm.commit();
+
+ IdContainer ids = new IdContainer();
+ ids.customerId = customer.getId();
+ Set contactIds = new HashSet();
+ contactIds.add(kabir.getId());
+ contactIds.add(bill.getId());
+ ids.contactIds = contactIds;
+
+ return ids;
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception creating customer", e);
+ try {
+ tm.rollback();
+ }
+ catch (Exception e1) {
+ log.error("Exception rolling back txn", e1);
+ }
+ throw e;
+ }
+ finally
+ {
+ System.out.println("CREATE CUSTOMER - END");
+ }
+ }
+
+ private Customer getCustomer(Integer id, SessionFactory sessionFactory, TransactionManager tm)
+ throws Exception
+ {
+ System.out.println("FIND CUSTOMER");
+
+ tm.begin();
+ try
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Customer customer = (Customer) session.get(Customer.class, id);
+ // Access all the contacts
+ for (Iterator it = customer.getContacts().iterator(); it.hasNext();) {
+ ((Contact) it.next()).getName();
+ }
+ tm.commit();
+ return customer;
+ }
+ catch (Exception e)
+ {
+ try {
+ tm.rollback();
+ }
+ catch (Exception e1) {
+ log.error("Exception rolling back txn", e1);
+ }
+ throw e;
+ }
+ finally
+ {
+ System.out.println("FIND CUSTOMER - END");
+ }
+ }
+
+ private void cleanup(SessionFactory sessionFactory, TransactionManager tm) throws Exception
+ {
+ tm.begin();
+ try
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Customer c = (Customer) session.get(Customer.class, CUSTOMER_ID);
+ if (c != null)
+ {
+ Set contacts = c.getContacts();
+ for (Iterator it = contacts.iterator(); it.hasNext();)
+ session.delete(it.next());
+ c.setContacts(null);
+ session.delete(c);
+ }
+
+ tm.commit();
+ }
+ catch (Exception e)
+ {
+ try {
+ tm.rollback();
+ }
+ catch (Exception e1) {
+ log.error("Exception rolling back txn", e1);
+ }
+ log.error("Caught exception in cleanup", e);
+ }
+ }
+
+ private void assertLoadedFromCache(MyListener listener, Integer custId, Set contactIds)
+ {
+ assertTrue("Customer#" + custId + " was in cache", listener.visited.contains("Customer#" + custId));
+ for (Iterator it = contactIds.iterator(); it.hasNext();) {
+ Integer contactId = (Integer) it.next();
+ assertTrue("Contact#"+ contactId + " was in cache", listener.visited.contains("Contact#"+ contactId));
+ assertTrue("Contact#"+ contactId + " was in cache", listener.visited.contains("Contact#"+ contactId));
+ }
+ assertTrue("Customer.contacts" + custId + " was in cache",
+ listener.visited.contains("Customer.contacts#" + custId));
+ }
+
+ //@CacheListener
+ public class MyListener extends AbstractTreeCacheListener
+ {
+ HashSet<String> visited = new HashSet<String>();
+
+ public void clear()
+ {
+ visited.clear();
+ }
+
+// @NodeVisited
+// public void nodeVisited(NodeVisitedEvent event)
+// {
+// System.out.println(event);
+//
+// if (!event.isPre())
+// {
+// Fqn fqn = event.getFqn();
+// System.out.println("MyListener - Visiting node " + fqn.toString());
+// String name = fqn.toString();
+// String token = ".functional.";
+// int index = name.indexOf(token);
+// if (index > -1)
+// {
+// index += token.length();
+// name = name.substring(index);
+// System.out.println("MyListener - recording visit to " + name);
+// visited.add(name);
+// }
+// }
+// }
+
+ @Override
+ public void nodeVisited(Fqn fqn)
+ {
+ super.nodeVisited(fqn);
+
+ log.info("MyListener - Visiting node " + fqn.toString());
+ String name = fqn.toString();
+ String token = ".functional.";
+ int index = name.indexOf(token);
+ if (index > -1)
+ {
+ index += token.length();
+ name = name.substring(index);
+ log.info("MyListener - recording visit to " + name);
+ visited.add(name);
+ }
+ }
+ }
+
+ private class IdContainer
+ {
+ Integer customerId;
+ Set contactIds;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,70 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional;
+
+import junit.framework.Test;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.jboss.cache.TreeCache;
+import org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook;
+
+/**
+ * Basic functional test of a pessimistic locking entity + query cache.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class PessimisticJBossCacheTest extends AbstractQueryCacheFunctionalTestCase
+{
+ public static final String JBC_CONFIG = "org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml";
+
+ /** Use an overriden version TreeCacheProviderHook that does not lookup the
+ * transaction manager on the JNDI but instead use same as passed to Hibernate */
+ public static final String JBC_CACHE_PROVIDER = "org.jboss.hibernate.jbc.cacheprovider.NonJndiTmTreeCacheProviderHook";
+
+ public PessimisticJBossCacheTest(String x)
+ {
+ super(x, TreeCache.LOCAL);
+ }
+
+ public static Test suite()
+ {
+ return new FunctionalTestClassTestSuite(PessimisticJBossCacheTest.class);
+ }
+
+ /**
+ * Apply any region-factory specific configurations.
+ *
+ * @param the Configuration to update.
+ */
+ protected void configureCacheFactory(Configuration cfg)
+ {
+ super.configureCacheFactory(cfg);
+
+ cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, JBC_CONFIG);
+ cfg.setProperty(Environment.CACHE_PROVIDER, JBC_CACHE_PROVIDER);
+ }
+}
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -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.jboss.hibernate.jbc.cacheprovider.functional;
+
+/**
+ * @author Steve Ebersole
+ */
+public class VersionedItem extends Item {
+ private Long version;
+
+ public Long getVersion() {
+ return version;
+ }
+
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,179 @@
+<?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 JBoss Cache Service Configuration -->
+<!-- Recommended for use as Hibernate's 2nd Level Cache -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.TreeCache"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ TransactionManager configuration not required for Hibernate!
+ Hibernate will plug in its own transaction manager integration.
+ -->
+
+
+ <!--
+ Node locking scheme:
+ OPTIMISTIC
+ PESSIMISTIC (default)
+ -->
+ <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
+
+ <!--
+ Note that this attribute is IGNORED if your NodeLockingScheme above is OPTIMISTIC.
+
+ Isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+
+ INVALIDATION_ASYNC is highly recommended as the mode for use
+ with clustered second-level caches.
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order
+ to find each other
+ -->
+ <attribute name="ClusterName">TreeCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="230.1.2.3"
+ mcast_port="43333" tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000" loopback="false"
+ discard_incompatible_packets="true"
+ enable_bundling="true" max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ use_outgoing_packet_handler="false"
+ ip_ttl="2" down_thread="false"
+ up_thread="false" />
+ <PING timeout="2000" down_thread="false" up_thread="false"
+ num_initial_members="3" />
+ <MERGE2 max_interval="100000" down_thread="false"
+ up_thread="false" min_interval="20000" />
+ <FD_SOCK down_thread="false" up_thread="false" />
+ <FD timeout="10000" max_tries="5" down_thread="false"
+ up_thread="false" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" down_thread="false"
+ up_thread="false" />
+ <pbcast.NAKACK max_xmit_size="60000" use_mcast_xmit="false"
+ gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ down_thread="false" up_thread="false"
+ discard_delivered_msgs="true" />
+ <UNICAST timeout="300,600,1200,2400,3600"
+ down_thread="false" up_thread="false" />
+ <pbcast.STABLE stability_delay="1000"
+ desired_avg_gossip="50000" down_thread="false"
+ up_thread="false" max_bytes="400000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ down_thread="false" up_thread="false"
+ join_retry_timeout="2000" shun="true"
+ view_bundling="true" />
+ <FRAG2 frag_size="60000" down_thread="false"
+ up_thread="false" />
+ <pbcast.STATE_TRANSFER down_thread="false" up_thread="false"
+ use_flush="false" />
+ </config>
+ </attribute>
+
+ <!--
+ Whether or not to fetch state on joining a cluster
+ NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+ -->
+ <attribute name="FetchInMemoryState">false</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!--
+ Indicate whether to use marshalling or not. Set this to true if you are running under a scoped
+ class loader, e.g., inside an application server. Default is "false".
+ -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <attribute name="InactiveOnStartup">true</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <!-- Don't ever evict modification timestamps -->
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,161 @@
+<?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 -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.TreeCache"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ TransactionManager configuration not required for Hibernate!
+ Hibernate will plug in its own transaction manager integration.
+ -->
+
+ <!--
+ Node isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order
+ to find each other
+ -->
+ <attribute name="ClusterName">TreeCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="230.1.2.3"
+ mcast_port="43333" tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000" loopback="false"
+ discard_incompatible_packets="true"
+ enable_bundling="true" max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ use_outgoing_packet_handler="false"
+ ip_ttl="2" down_thread="false"
+ up_thread="false" />
+ <PING timeout="2000" down_thread="false" up_thread="false"
+ num_initial_members="3" />
+ <MERGE2 max_interval="100000" down_thread="false"
+ up_thread="false" min_interval="20000" />
+ <FD_SOCK down_thread="false" up_thread="false" />
+ <FD timeout="10000" max_tries="5" down_thread="false"
+ up_thread="false" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" down_thread="false"
+ up_thread="false" />
+ <pbcast.NAKACK max_xmit_size="60000" use_mcast_xmit="false"
+ gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ down_thread="false" up_thread="false"
+ discard_delivered_msgs="true" />
+ <UNICAST timeout="300,600,1200,2400,3600"
+ down_thread="false" up_thread="false" />
+ <pbcast.STABLE stability_delay="1000"
+ desired_avg_gossip="50000" down_thread="false"
+ up_thread="false" max_bytes="400000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ down_thread="false" up_thread="false"
+ join_retry_timeout="2000" shun="true"
+ view_bundling="true" />
+ <FRAG2 frag_size="60000" down_thread="false"
+ up_thread="false" />
+ <pbcast.STATE_TRANSFER down_thread="false" up_thread="false"
+ use_flush="false" />
+ </config>
+ </attribute>
+
+ <!-- Must be true if any entity deployment uses a scoped classloader -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <attribute name="InactiveOnStartup">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <!-- Don't ever evict modification timestamps -->
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,86 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.hibernate.HibernateException;
+import org.hibernate.connection.ConnectionProvider;
+import org.hibernate.connection.ConnectionProviderFactory;
+
+/**
+ * A {@link ConnectionProvider} implementation adding JTA-style transactionality
+ * around the returned connections using the {@link DualNodeJtaTransactionManagerImpl}.
+ *
+ * @author Brian Stansberry
+ */
+public class DualNodeConnectionProviderImpl implements ConnectionProvider {
+ private static ConnectionProvider actualConnectionProvider = ConnectionProviderFactory.newConnectionProvider();
+
+ private String nodeId;
+ private boolean isTransactional;
+
+ public static ConnectionProvider getActualConnectionProvider() {
+ return actualConnectionProvider;
+ }
+
+ public void configure(Properties props) throws HibernateException {
+ nodeId = props.getProperty(DualNodeTestUtil.NODE_ID_PROP);
+ if (nodeId == null)
+ throw new HibernateException(DualNodeTestUtil.NODE_ID_PROP + " not configured");
+ }
+
+ public Connection getConnection() throws SQLException {
+ DualNodeJtaTransactionImpl currentTransaction = DualNodeJtaTransactionManagerImpl.getInstance(nodeId).getCurrentTransaction();
+ if ( currentTransaction == null ) {
+ isTransactional = false;
+ return actualConnectionProvider.getConnection();
+ }
+ else {
+ isTransactional = true;
+ Connection connection = currentTransaction.getEnlistedConnection();
+ if ( connection == null ) {
+ connection = actualConnectionProvider.getConnection();
+ currentTransaction.enlistConnection( connection );
+ }
+ return connection;
+ }
+ }
+
+ public void closeConnection(Connection conn) throws SQLException {
+ if ( !isTransactional ) {
+ conn.close();
+ }
+ }
+
+ public void close() throws HibernateException {
+ actualConnectionProvider.close();
+ }
+
+ public boolean supportsAggressiveRelease() {
+ return true;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,162 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.LinkedList;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * SimpleJtaTransactionImpl variant that works with DualNodeTransactionManagerImpl.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class DualNodeJtaTransactionImpl implements Transaction {
+ private static final Logger log = Logger.getLogger( DualNodeJtaTransactionImpl.class );
+
+ private int status;
+ private LinkedList synchronizations;
+ private Connection connection; // the only resource we care about is jdbc connection
+ private final DualNodeJtaTransactionManagerImpl jtaTransactionManager;
+
+ public DualNodeJtaTransactionImpl(DualNodeJtaTransactionManagerImpl jtaTransactionManager) {
+ this.jtaTransactionManager = jtaTransactionManager;
+ this.status = Status.STATUS_ACTIVE;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void commit()
+ throws RollbackException, HeuristicMixedException, HeuristicRollbackException, IllegalStateException, SystemException {
+
+ if ( status == Status.STATUS_MARKED_ROLLBACK ) {
+ log.trace( "on commit, status was marked for rollback-only" );
+ rollback();
+ }
+ else {
+ status = Status.STATUS_PREPARING;
+
+ for ( int i = 0; i < synchronizations.size(); i++ ) {
+ Synchronization s = ( Synchronization ) synchronizations.get( i );
+ s.beforeCompletion();
+ }
+
+ status = Status.STATUS_COMMITTING;
+
+ if ( connection != null ) {
+ try {
+ connection.commit();
+ connection.close();
+ }
+ catch ( SQLException sqle ) {
+ status = Status.STATUS_UNKNOWN;
+ throw new SystemException();
+ }
+ }
+
+ status = Status.STATUS_COMMITTED;
+
+ for ( int i = 0; i < synchronizations.size(); i++ ) {
+ Synchronization s = ( Synchronization ) synchronizations.get( i );
+ s.afterCompletion( status );
+ }
+
+ //status = Status.STATUS_NO_TRANSACTION;
+ jtaTransactionManager.endCurrent( this );
+ }
+ }
+
+ public void rollback() throws IllegalStateException, SystemException {
+ status = Status.STATUS_ROLLEDBACK;
+
+ if ( connection != null ) {
+ try {
+ connection.rollback();
+ connection.close();
+ }
+ catch ( SQLException sqle ) {
+ status = Status.STATUS_UNKNOWN;
+ throw new SystemException();
+ }
+ }
+
+ if (synchronizations != null) {
+ for ( int i = 0; i < synchronizations.size(); i++ ) {
+ Synchronization s = ( Synchronization ) synchronizations.get( i );
+ s.afterCompletion( status );
+ }
+ }
+
+ //status = Status.STATUS_NO_TRANSACTION;
+ jtaTransactionManager.endCurrent( this );
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ status = Status.STATUS_MARKED_ROLLBACK;
+ }
+
+ public void registerSynchronization(Synchronization synchronization)
+ throws RollbackException, IllegalStateException, SystemException {
+ // todo : find the spec-allowable statuses during which synch can be registered...
+ if ( synchronizations == null ) {
+ synchronizations = new LinkedList();
+ }
+ synchronizations.add( synchronization );
+ }
+
+ public void enlistConnection(Connection connection) {
+ if ( this.connection != null ) {
+ throw new IllegalStateException( "Connection already registered" );
+ }
+ this.connection = connection;
+ }
+
+ public Connection getEnlistedConnection() {
+ return connection;
+ }
+
+
+ public boolean enlistResource(XAResource xaResource)
+ throws RollbackException, IllegalStateException, SystemException {
+ return false;
+ }
+
+ public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException, SystemException {
+ return false;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,158 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+import java.util.Hashtable;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Variant of SimpleJtaTransactionManagerImpl that doesn't use a VM-singleton,
+ * but rather a set of impls keyed by a node id.
+ *
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class DualNodeJtaTransactionManagerImpl implements TransactionManager {
+
+ private static final Logger log = Logger.getLogger(DualNodeJtaTransactionManagerImpl.class);
+
+ private static final Hashtable INSTANCES = new Hashtable();
+
+ private ThreadLocal currentTransaction = new ThreadLocal();
+ private String nodeId;
+
+ public synchronized static DualNodeJtaTransactionManagerImpl getInstance(String nodeId) {
+ DualNodeJtaTransactionManagerImpl tm = (DualNodeJtaTransactionManagerImpl) INSTANCES.get(nodeId);
+ if (tm == null) {
+ tm = new DualNodeJtaTransactionManagerImpl(nodeId);
+ INSTANCES.put(nodeId, tm);
+ }
+ return tm;
+ }
+
+ public synchronized static void cleanupTransactions() {
+ for (java.util.Iterator it = INSTANCES.values().iterator(); it.hasNext();) {
+ TransactionManager tm = (TransactionManager) it.next();
+ try
+ {
+ tm.suspend();
+ }
+ catch (Exception e)
+ {
+ log.error("Exception cleaning up TransactionManager " + tm);
+ }
+ }
+ }
+
+ public synchronized static void cleanupTransactionManagers() {
+ INSTANCES.clear();
+ }
+
+ private DualNodeJtaTransactionManagerImpl(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public int getStatus() throws SystemException {
+ Transaction tx = getCurrentTransaction();
+ return tx == null ? Status.STATUS_NO_TRANSACTION : tx.getStatus();
+ }
+
+ public Transaction getTransaction() throws SystemException {
+ return (Transaction) currentTransaction.get();
+ }
+
+ public DualNodeJtaTransactionImpl getCurrentTransaction() {
+ return (DualNodeJtaTransactionImpl) currentTransaction.get();
+ }
+
+ public void begin() throws NotSupportedException, SystemException {
+ currentTransaction.set(new DualNodeJtaTransactionImpl( this ));
+ }
+
+ public Transaction suspend() throws SystemException {
+ DualNodeJtaTransactionImpl suspended = getCurrentTransaction();
+ log.trace(nodeId + ": Suspending " + suspended + " for thread " + Thread.currentThread().getName());
+ currentTransaction.set(null);
+ return suspended;
+ }
+
+ public void resume(Transaction transaction)
+ throws InvalidTransactionException, IllegalStateException, SystemException {
+ currentTransaction.set(( DualNodeJtaTransactionImpl ) transaction);
+ log.trace(nodeId + ": Resumed " + transaction + " for thread " + Thread.currentThread().getName());
+ }
+
+ public void commit()
+ throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
+ Transaction tx = getCurrentTransaction();
+ if ( tx == null ) {
+ throw new IllegalStateException( "no current transaction to commit" );
+ }
+ tx.commit();
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException {
+ Transaction tx = getCurrentTransaction();
+ if ( tx == null ) {
+ throw new IllegalStateException( "no current transaction" );
+ }
+ tx.rollback();
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ Transaction tx = getCurrentTransaction();
+ if ( tx == null ) {
+ throw new IllegalStateException( "no current transaction" );
+ }
+ tx.setRollbackOnly();
+ }
+
+ public void setTransactionTimeout(int i) throws SystemException {
+ }
+
+ void endCurrent(DualNodeJtaTransactionImpl transaction) {
+ if ( transaction == currentTransaction.get() ) {
+ currentTransaction.set(null);
+ }
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(getClass().getName());
+ sb.append("[nodeId=");
+ sb.append(nodeId);
+ sb.append("]");
+ return sb.toString();
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,31 @@
+/*
+ * 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): Brian Stansberry
+ */
+
+package org.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+/**
+ * A DualNodeTestUtil.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class DualNodeTestUtil
+{
+ public static final String NODE_ID_PROP = "hibernate.test.cluster.node.id";
+
+ public static final String LOCAL = "local";
+ public static final String REMOTE = "remote";
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,56 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+import java.util.Properties;
+import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
+
+import org.hibernate.transaction.TransactionManagerLookup;
+import org.hibernate.HibernateException;
+
+/**
+ * SimpleJtaTransactionManagerLookupImpl subclass that finds a different
+ * DualNodeTransactionManager based on the value of property
+ * {@link DualNodeTestUtil#NODE_ID_PROP}.
+ *
+ * @author Brian Stansberry
+ */
+public class DualNodeTransactionManagerLookup implements TransactionManagerLookup {
+
+ public TransactionManager getTransactionManager(Properties props) throws HibernateException {
+ String nodeId = props.getProperty(DualNodeTestUtil.NODE_ID_PROP);
+ if (nodeId == null)
+ throw new HibernateException(DualNodeTestUtil.NODE_ID_PROP + " not configured");
+ return DualNodeJtaTransactionManagerImpl.getInstance(nodeId);
+ }
+
+ public String getUserTransactionName() {
+ throw new UnsupportedOperationException( "jndi currently not implemented for these tests" );
+ }
+
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,202 @@
+/*
+ * 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.jboss.hibernate.jbc.cacheprovider.functional.util;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.transaction.TransactionManagerLookup;
+import org.hibernate.transaction.TransactionManagerLookupFactory;
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
+import org.jboss.hibernate.jbc.cacheprovider.TreeCacheProviderHook;
+import org.jboss.logging.Logger;
+
+/**
+ * A {@link MultiplexingCacheInstanceManager} that exposes its
+ * CacheManager via a static getter so the test fixture can get ahold
+ * of it.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TestCacheInstanceManager
+{
+ private static final Logger log = Logger.getLogger(TestCacheInstanceManager.class);
+
+ private static final Hashtable<String, TreeCache> cacheInstances = new Hashtable<String, TreeCache>();
+
+ private static final MBeanServer mbs = MBeanServerFactory.createMBeanServer("jboss");
+
+ public static final String SINGLE = "single";
+
+ public static final String CACHE_MBEAN_NAME_STARTS_WITH = TreeCacheProviderHook.DEFAULT_MBEAN_OBJECT_NAME + ",id=";
+
+ public static TreeCache getTreeCache(String name)
+ {
+ return cacheInstances.get(name);
+ }
+
+ public static void clearCacheManagers()
+ {
+ while(cacheInstances.keys().hasMoreElements())
+ {
+ String id = cacheInstances.keys().nextElement();
+ TreeCache cache = null;
+ try
+ {
+ cache = cacheInstances.get(id);
+ cache.stopService();
+ mbs.unregisterMBean(new ObjectName(CACHE_MBEAN_NAME_STARTS_WITH + id));
+ }
+ catch (Exception e)
+ {
+ log.error("Exception cleaning up CacheManager " + cache);
+ }
+ }
+
+ cacheInstances.clear();
+ }
+
+ private String cacheNodeId;
+
+// private boolean locallyAdded;
+
+ private int cacheMode;
+
+ /**
+ * Create a new TestCacheInstanceManager.
+ */
+ public TestCacheInstanceManager(int cacheMode)
+ {
+ this.cacheMode = cacheMode;
+ }
+
+ public void start(Configuration cfg) throws CacheException
+ {
+ cacheNodeId = cfg.getProperty(DualNodeTestUtil.NODE_ID_PROP);
+ if (cacheNodeId == null)
+ {
+ cacheNodeId = SINGLE;
+ }
+
+ /* Create TreeCache instance, register cache within the jboss mbean server and finally start it. */
+ TreeCache cache = createRegisterStartTreeCache(cfg, cacheNodeId, cacheMode);
+
+// super.start(settings, properties);
+
+ cacheInstances.put(cacheNodeId, cache);
+
+// TreeCache existing = getTreeCache(cacheNodeId);
+// locallyAdded = (existing == null);
+// if (!locallyAdded)
+// {
+// /* Create TreeCache instance, register cache within the jboss mbean server and finally start it. */
+// existing = createRegisterStartTreeCache(cfg, cacheNodeId, cacheMode);
+// }
+//
+//// super.start(settings, properties);
+//
+// if (locallyAdded)
+// cacheInstances.put(cacheNodeId, existing);
+ }
+
+ public void stop()
+ {
+ stopUnregisterTreeCache(getTreeCache(cacheNodeId));
+
+// if (locallyAdded)
+ cacheInstances.remove(cacheNodeId);
+ }
+
+ protected TreeCache createRegisterStartTreeCache(Configuration cfg, String id, int cacheMode)
+ {
+ try
+ {
+ TreeCache cache = new TreeCache();
+ PropertyConfigurator config = new PropertyConfigurator();
+ config.configure(cache, cfg.getProperty(Environment.CACHE_PROVIDER_CONFIG));
+ cache.setCacheMode(cacheMode);
+ /* Get hibernate's transaction manager lookup instance */
+ TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(cfg.getProperties());
+ if (transactionManagerLookup != null)
+ {
+ /* Set JBC's transaction manager lookup to an adaptor class that
+ * will return the transaction manager that Hibernate will use */
+ cache.setTransactionManagerLookup(new TransactionManagerLookupAdaptor(transactionManagerLookup, cfg.getProperties()));
+ }
+ mbs.registerMBean(cache, new ObjectName(CACHE_MBEAN_NAME_STARTS_WITH + id));
+ cache.startService();
+ return cache;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException("Unable to create/configure/register TreeCache instance", e);
+ }
+ }
+
+ protected void stopUnregisterTreeCache(TreeCache cache)
+ {
+ try
+ {
+ cache.stopService();
+ mbs.unregisterMBean(new ObjectName(CACHE_MBEAN_NAME_STARTS_WITH + cacheNodeId));
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException("Unable to stop/unregister TreeCache instance", e);
+ }
+ }
+
+ /**
+ * JBoss Cache transaction manager lookup class that returns the transaction
+ * manager used by Hibernate. This enables both Hibernate and the 2nd level
+ * JBoss Cache instance to use the same transaction manager.
+ */
+ static final class TransactionManagerLookupAdaptor implements org.jboss.cache.TransactionManagerLookup
+ {
+ private final TransactionManagerLookup tml;
+
+ private final Properties props;
+
+ TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props)
+ {
+ this.tml=tml;
+ this.props=props;
+ }
+
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return tml.getTransactionManager(props);
+ }
+ }
+}
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/resources/hibernate.properties
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/resources/hibernate.properties (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/resources/hibernate.properties 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,36 @@
+################################################################################
+# 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.format_sql true
+
+hibernate.max_fetch_depth 5
+
+hibernate.bytecode.provider javassist
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/JBCCache.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/JBCCache.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$CircumventChecksDataVersion.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$CircumventChecksDataVersion.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$DataVersionAdapter.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$DataVersionAdapter.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$NonLockingDataVersion.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache$NonLockingDataVersion.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/OptimisticTreeCacheProviderHook.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/SecondLevelCacheUtil.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/classes/org/jboss/hibernate/jbc/cacheprovider/TreeCacheProviderHook.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/mvn-eclipse-cache.properties
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/mvn-eclipse-cache.properties (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/mvn-eclipse-cache.properties 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,2 @@
+#Temporary index for unavailable sources and javadocs
+#Sun Jul 27 23:03:41 CEST 2008
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/hibernate.properties
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/hibernate.properties (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/hibernate.properties 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,36 @@
+################################################################################
+# 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.format_sql true
+
+hibernate.max_fetch_depth 5
+
+hibernate.bytecode.provider javassist
\ No newline at end of file
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/AbstractClassLoaderIsolatedTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/SkipLog.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/SkipLog.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor$Handler.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor$Handler.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/TestSuiteVisitor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/UnitTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/UnitTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/DatabaseSpecificFunctionalTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment$Settings.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment$Settings.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/ExecutionEnvironment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestClassTestSuite.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/junit/functional/FunctionalTestClassTestSuite.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyConnectionProvider.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyConnectionProvider.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory$DummyTransactionAdapter.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory$DummyTransactionAdapter.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyJTAStyleTransationFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransaction.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransaction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManager.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManagerLookup.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/hibernate/test/tm/DummyTransactionManagerLookup.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/NonJndiTmTreeCacheProviderHook.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractEntityCacheFunctionalTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/AbstractQueryCacheFunctionalTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,48 @@
+<?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) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <class name="Contact" table="Contacts">
+
+ <cache usage="transactional"/>
+
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+ <property name="tlf" not-null="true"/>
+
+ <many-to-one name="customer"
+ class="org.jboss.hibernate.jbc.cacheprovider.functional.Customer"
+ column="CUSTOMER_ID"/>
+ </class>
+
+</hibernate-mapping>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,50 @@
+<?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) 2008, 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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <class name="Customer" table="Customers">
+
+ <cache usage="transactional"/>
+
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+
+ <set name="contacts" cascade="all" lazy="false">
+ <cache usage="transactional"/>
+ <key column="CUSTOMER_ID"/>
+ <one-to-many class="org.jboss.hibernate.jbc.cacheprovider.functional.Contact"/>
+ </set>
+
+ </class>
+
+</hibernate-mapping>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase$SecondNodeSettings.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase$SecondNodeSettings.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/Item.hbm.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -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.jboss.hibernate.jbc.cacheprovider.functional">
+
+ <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>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$IdContainer.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$IdContainer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$MyListener.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest$MyListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/VersionedItem.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/optimistic-treecache.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,179 @@
+<?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 JBoss Cache Service Configuration -->
+<!-- Recommended for use as Hibernate's 2nd Level Cache -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.TreeCache"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ TransactionManager configuration not required for Hibernate!
+ Hibernate will plug in its own transaction manager integration.
+ -->
+
+
+ <!--
+ Node locking scheme:
+ OPTIMISTIC
+ PESSIMISTIC (default)
+ -->
+ <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
+
+ <!--
+ Note that this attribute is IGNORED if your NodeLockingScheme above is OPTIMISTIC.
+
+ Isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+
+ INVALIDATION_ASYNC is highly recommended as the mode for use
+ with clustered second-level caches.
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order
+ to find each other
+ -->
+ <attribute name="ClusterName">TreeCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="230.1.2.3"
+ mcast_port="43333" tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000" loopback="false"
+ discard_incompatible_packets="true"
+ enable_bundling="true" max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ use_outgoing_packet_handler="false"
+ ip_ttl="2" down_thread="false"
+ up_thread="false" />
+ <PING timeout="2000" down_thread="false" up_thread="false"
+ num_initial_members="3" />
+ <MERGE2 max_interval="100000" down_thread="false"
+ up_thread="false" min_interval="20000" />
+ <FD_SOCK down_thread="false" up_thread="false" />
+ <FD timeout="10000" max_tries="5" down_thread="false"
+ up_thread="false" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" down_thread="false"
+ up_thread="false" />
+ <pbcast.NAKACK max_xmit_size="60000" use_mcast_xmit="false"
+ gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ down_thread="false" up_thread="false"
+ discard_delivered_msgs="true" />
+ <UNICAST timeout="300,600,1200,2400,3600"
+ down_thread="false" up_thread="false" />
+ <pbcast.STABLE stability_delay="1000"
+ desired_avg_gossip="50000" down_thread="false"
+ up_thread="false" max_bytes="400000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ down_thread="false" up_thread="false"
+ join_retry_timeout="2000" shun="true"
+ view_bundling="true" />
+ <FRAG2 frag_size="60000" down_thread="false"
+ up_thread="false" />
+ <pbcast.STATE_TRANSFER down_thread="false" up_thread="false"
+ use_flush="false" />
+ </config>
+ </attribute>
+
+ <!--
+ Whether or not to fetch state on joining a cluster
+ NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+ -->
+ <attribute name="FetchInMemoryState">false</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!--
+ Indicate whether to use marshalling or not. Set this to true if you are running under a scoped
+ class loader, e.g., inside an application server. Default is "false".
+ -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <attribute name="InactiveOnStartup">true</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <!-- Don't ever evict modification timestamps -->
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml (rev 0)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/pessimistic-treecache.xml 2008-07-28 11:57:54 UTC (rev 76298)
@@ -0,0 +1,161 @@
+<?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 -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.TreeCache"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ TransactionManager configuration not required for Hibernate!
+ Hibernate will plug in its own transaction manager integration.
+ -->
+
+ <!--
+ Node isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order
+ to find each other
+ -->
+ <attribute name="ClusterName">TreeCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="230.1.2.3"
+ mcast_port="43333" tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000" loopback="false"
+ discard_incompatible_packets="true"
+ enable_bundling="true" max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ use_outgoing_packet_handler="false"
+ ip_ttl="2" down_thread="false"
+ up_thread="false" />
+ <PING timeout="2000" down_thread="false" up_thread="false"
+ num_initial_members="3" />
+ <MERGE2 max_interval="100000" down_thread="false"
+ up_thread="false" min_interval="20000" />
+ <FD_SOCK down_thread="false" up_thread="false" />
+ <FD timeout="10000" max_tries="5" down_thread="false"
+ up_thread="false" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" down_thread="false"
+ up_thread="false" />
+ <pbcast.NAKACK max_xmit_size="60000" use_mcast_xmit="false"
+ gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ down_thread="false" up_thread="false"
+ discard_delivered_msgs="true" />
+ <UNICAST timeout="300,600,1200,2400,3600"
+ down_thread="false" up_thread="false" />
+ <pbcast.STABLE stability_delay="1000"
+ desired_avg_gossip="50000" down_thread="false"
+ up_thread="false" max_bytes="400000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ down_thread="false" up_thread="false"
+ join_retry_timeout="2000" shun="true"
+ view_bundling="true" />
+ <FRAG2 frag_size="60000" down_thread="false"
+ up_thread="false" />
+ <pbcast.STATE_TRANSFER down_thread="false" up_thread="false"
+ use_flush="false" />
+ </config>
+ </attribute>
+
+ <!-- Must be true if any entity deployment uses a scoped classloader -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <attribute name="InactiveOnStartup">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <!-- Don't ever evict modification timestamps -->
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeConnectionProviderImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeJtaTransactionManagerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTestUtil.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/DualNodeTransactionManagerLookup.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager$TransactionManagerLookupAdaptor.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager$TransactionManagerLookupAdaptor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.class
===================================================================
(Binary files differ)
Property changes on: projects/cluster/hibernate-jbc-cacheprovider/trunk/target/test-classes/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-cvs-commits
mailing list