[jbosscache-commits] JBoss Cache SVN: r7284 - in core/trunk/src/test/java/org/jboss/cache: api and 43 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Dec 12 00:00:03 EST 2008
Author: mircea.markus
Date: 2008-12-12 00:00:02 -0500 (Fri, 12 Dec 2008)
New Revision: 7284
Added:
core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java
core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
Removed:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
Modified:
core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
core/trunk/src/test/java/org/jboss/cache/FqnTest.java
core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java
core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java
core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java
core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java
core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java
core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java
core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java
core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java
core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java
core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java
core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java
core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java
core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java
Log:
test improvements
Added: core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,35 @@
+package org.jboss.cache;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ */
+public class AbstractCacheTest<K, V>
+{
+ public void clearContent(CacheSPI<K, V> cache)
+ {
+ clearRunningTx(cache);
+ if (!cache.getCacheStatus().allowInvocations()) return;
+ cache.getRoot().clearDataDirect();
+ cache.getRoot().removeChildrenDirect();
+ RegionManager regionManager = cache.getRegionManager();
+ if (regionManager != null) regionManager.reset();
+ //impoortant!!! keep invocation ctxt cleanup as the last line in the cleanup process, prev calls modify
+ // OptionOverrides
+ cache.getInvocationContext().reset();
+ }
+
+ private void clearRunningTx(CacheSPI<K, V> cache)
+ {
+ if (cache != null && cache.getTransactionManager() != null)
+ {
+ try
+ {
+ cache.getTransactionManager().rollback();
+ }
+ catch (Exception e)
+ {
+ // don't care
+ }
+ }
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,48 @@
+package org.jboss.cache;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeTest;
+import org.jboss.cache.util.TestingUtil;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ */
+public abstract class AbstractMultipleCachesTest<K, V> extends AbstractCacheTest<K,V>
+{
+ protected Set<CacheSPI<K, V>> caches = new HashSet<CacheSPI<K,V>>();
+
+ @BeforeTest
+ public void create() throws Throwable
+ {
+ createCaches();
+ }
+
+ @AfterClass
+ public void destroy()
+ {
+ TestingUtil.killCaches(caches.toArray(new Cache[caches.size()]));
+ }
+
+ @AfterMethod
+ public void clearContent() throws Throwable
+ {
+ for (CacheSPI<K, V> cache : caches)
+ {
+ super.clearContent(cache);
+ }
+ }
+
+ protected abstract void createCaches() throws Throwable;
+
+ public void registerCaches(Cache... caches)
+ {
+ for (Cache c: caches) this.caches.add((CacheSPI<K, V>) c);
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,34 @@
+package org.jboss.cache;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterClass;
+import org.jboss.cache.util.TestingUtil;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ */
+public abstract class AbstractSingleCacheTest<K, V> extends AbstractCacheTest<K, V>
+{
+ protected CacheSPI<K, V> cache;
+
+ @BeforeClass
+ public void create()
+ {
+ cache = createCache();
+ }
+
+ @AfterClass
+ public void destroy()
+ {
+ TestingUtil.killCaches(cache);
+ }
+
+ @AfterMethod
+ public void clearContent()
+ {
+ super.clearContent(cache);
+ }
+
+ public abstract CacheSPI<K, V> createCache();
+}
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -48,13 +48,13 @@
public void testLoadOldConfig()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/conf2x/buddy-replication-cache.xml");
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/conf2x/buddy-replication-cache.xml", getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
}
public void testFromConfigFileStarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, getClass());
// can't test for this anymore since the RuntimeConfig is attached to the running cache
//assertEquals(expected, cache.getConfiguration());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -63,7 +63,7 @@
public void testFromConfigFileUnstarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, false, getClass());
// can't test for this anymore since the RuntimeConfig is attached to the running cache
// assertEquals(expected, cache.getConfiguration());
@@ -74,7 +74,7 @@
public void testFromConfigObjStarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -83,7 +83,7 @@
public void testFromConfigObjUnstarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
@@ -102,7 +102,7 @@
public void testLifecycle() throws Exception
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
cache.start();
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -113,8 +113,8 @@
public void testCreationFromStreamStarted() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI) cf.createCache(is);
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI) cf.createCache(is, getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
doSimpleConfTests(cache.getConfiguration());
}
@@ -122,19 +122,19 @@
public void testCreationFromStream() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI) cf.createCache(is, false);
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI) cf.createCache(is, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
doSimpleConfTests(cache.getConfiguration());
}
public void testComponentsInjected() throws Exception
{
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache = (CacheSPI) cf.createCache(c);
+ cache = (CacheSPI) cf.createCache(c, getClass());
assert TestingUtil.extractField(cache, "regionManager") != null;
assert TestingUtil.extractField(cache, "notifier") != null;
Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -107,7 +107,7 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setIsolationLevel(level);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
private TransactionManager startTransaction()
Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -308,7 +308,7 @@
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
cache.put(f, "key", "value");
Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
@Test(groups = {"functional"})
public void testGetKeys() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", "name", "Bela Ban");
cache.put("/a/b/c", "age", 40);
cache.put("/a/b/c", "city", "Kreuzlingen");
@@ -55,7 +55,7 @@
@Test(groups = {"functional"})
public void testGetChildren() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", null);
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -74,7 +74,7 @@
@Test(groups = {"functional"})
public void testGetKeysOnNode()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", "key", "value");
Node<Object, Object> node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
Set<Object> keySet = node.getKeys();
Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified: core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -20,7 +20,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,23 +15,27 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
/**
* @author <a href="mailto:dpospisi at redhat.com">Dominik Pospisil (dpospisi at redhat.com)</a>
*/
-public class UnitTestCacheFactory<K, V> implements CacheFactory<K, V>
+public class UnitTestCacheFactory<K, V>
{
+ public UnitTestCacheFactory()
+ {
+ }
+
private final Log log = LogFactory.getLog(UnitTestCacheFactory.class);
@@ -81,26 +85,26 @@
/**
* For each thread holds the name of the test class which executed createCache factory method.
*/
- private static final ThreadLocal<String> threadTestName = new ThreadLocal<String>();
+ private static final ThreadLocal<Class> threadTestName = new ThreadLocal<Class>();
// factory methods
- public Cache<K, V> createCache() throws ConfigurationException
+ public Cache<K, V> createCache(Class ownerClass) throws ConfigurationException
{
- return createCache(true);
+ return createCache(true, getClass());
}
- public Cache<K, V> createCache(boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(boolean start, Class ownerClass) throws ConfigurationException
{
- return createCache(new Configuration(), start);
+ return createCache(new Configuration(), start, getClass());
}
- public Cache<K, V> createCache(String configFileName) throws ConfigurationException
+ public Cache<K, V> createCache(String configFileName, Class ownerClass) throws ConfigurationException
{
- return createCache(configFileName, true);
+ return createCache(configFileName, true, getClass());
}
- public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(String configFileName, boolean start, Class ownerClass) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c;
@@ -114,27 +118,27 @@
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseFile(configFileName);
}
- return createCache(c, start);
+ return createCache(c, start, getClass());
}
- public Cache<K, V> createCache(Configuration configuration) throws ConfigurationException
+ public Cache<K, V> createCache(Configuration configuration, Class ownerClass) throws ConfigurationException
{
- return createCache(configuration, true);
+ return createCache(configuration, true, ownerClass);
}
- public Cache<K, V> createCache(InputStream is) throws ConfigurationException
+ public Cache<K, V> createCache(InputStream is, Class ownerClass) throws ConfigurationException
{
- return createCache(is, true);
+ return createCache(is, true, ownerClass);
}
- public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(InputStream is, boolean start, Class ownerClass) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseStream(is);
- return createCache(c, start);
+ return createCache(c, start, ownerClass);
}
- public Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(Configuration configuration, boolean start, Class ownerClass) throws ConfigurationException
{
// - Do not print out this exception - since tests are ALSO run from IDEs on the main thread. - MANIK
// if (!Thread.currentThread().getName().contains("pool"))
@@ -142,7 +146,7 @@
// System.out.println("CreateCache called from wrong thread: " + Thread.currentThread().getName());
// }
- checkCaches();
+ checkCaches(ownerClass);
tryMCastAddress();
switch (configuration.getCacheMode())
@@ -324,12 +328,11 @@
// return "[" + Thread.currentThread().getName() + "]";
// }
- private void checkCaches()
+ private void checkCaches(Class ownerClass)
{
- String lastTestName = threadTestName.get();
- String currentTestName = extractTestName();
+ Class lastTestClass = threadTestName.get();
- if ((lastTestName != null) && (!lastTestName.equals(currentTestName)))
+ if ((lastTestClass != null) && (!lastTestClass.equals(ownerClass)))
{
String threadId = "[" + Thread.currentThread().getName() + "] ";
@@ -340,12 +343,12 @@
if (cleanUp())
{
System.out.print(threadId + "WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ");
- System.out.print(threadId + " A test method in " + lastTestName + " did not clean all cache instances properly. ");
+ System.out.print(threadId + " A test method in " + lastTestClass + " did not clean all cache instances properly. ");
System.out.println(threadId + " Use UnitTestCacheFactory.cleanUp() or TestngUtil.killCaches(...) ");
}
}
- threadTestName.set(currentTestName);
+ threadTestName.set(ownerClass);
}
private String extractTestName()
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,12 +1,6 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.Region;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.config.ConfigurationException;
@@ -34,21 +28,21 @@
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.CacheAPITest")
-public class CacheAPITest
+public class CacheAPITest extends AbstractSingleCacheTest
{
private CacheSPI<String, String> cache;
private List<String> events;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
// start a single cache instance
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setEvictionConfig(null);
configure(cache.getConfiguration());
cache.start();
events = new ArrayList<String>();
+ return cache;
}
protected void configure(Configuration c)
@@ -56,13 +50,10 @@
c.setNodeLockingScheme(getNodeLockingScheme());
}
-
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- TestingUtil.killCaches(cache);
- cache = null;
- events = null;
+ events.clear();
}
protected NodeLockingScheme getNodeLockingScheme()
@@ -178,8 +169,6 @@
n = cache.peek(fqn, true, true);
assert n == null;
- System.out.println("Cache: " + CachePrinter.printCacheDetails(cache));
-
// Check that it's removed if it has a child
Fqn child = Fqn.fromString("/test/fqn/child");
cache.getRoot().addChild(child);
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,38 +34,14 @@
conf1.setNodeLockingScheme(nodeLockingScheme);
conf2.setNodeLockingScheme(nodeLockingScheme);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- if (cache1 != null)
- {
- try
- {
- cache1.stop();
- cache1.destroy();
- cache1 = null;
- }
- catch (Exception e)
- {
- }
- }
-
- if (cache2 != null)
- {
- try
- {
- cache2.stop();
- cache2.destroy();
- cache2 = null;
- }
- catch (Exception e)
- {
- }
- }
+ TestingUtil.killCaches(cache1, cache2);
}
public void testGetMembers() throws Exception
@@ -93,12 +69,6 @@
public void testIsCoordinator() throws Exception
{
- Configuration conf1 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
- Configuration conf2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
-
- //cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf1, false);
- //cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf2, false);
-
cache1.start();
assertTrue("Cache1 is coordinator", cache1.getRPCManager().isCoordinator());
Modified: core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,8 +1,5 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -12,8 +9,9 @@
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
+
/**
* Tests whether, in a single tx, deleting a parent node with an pre-existing
* child and then re-adding a node with the parent Fqn results
@@ -23,7 +21,7 @@
* @since 2.1.0
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.DeletedChildResurrectionTest")
-public class DeletedChildResurrectionTest
+public class DeletedChildResurrectionTest extends AbstractSingleCacheTest
{
private CacheSPI<Object, Object> cache;
private static final Fqn A_B = Fqn.fromString("/a/b");
@@ -37,10 +35,9 @@
protected NodeSPI root;
protected TransactionManager txManager;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+ public CacheSPI createCache()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true), false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true), false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setCacheLoaderConfig(null);
cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -48,17 +45,9 @@
cache.start();
root = cache.getRoot();
txManager = cache.getTransactionManager();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- TestingUtil.killCaches(cache);
- cache = null;
- txManager = null;
- root = null;
- }
-
protected void configure(Configuration c)
{
// to be overridden
Modified: core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,10 +1,5 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheStatus;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeCreated;
@@ -16,7 +11,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.cache.UnitTestCacheFactory;
+
+import org.jboss.cache.*;
import org.testng.annotations.AfterMethod;
/**
@@ -27,7 +23,7 @@
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.DestroyedCacheAPITest")
-public class DestroyedCacheAPITest
+public class DestroyedCacheAPITest extends AbstractSingleCacheTest
{
private Cache<String, String> cache;
protected boolean optimistic;
@@ -36,12 +32,11 @@
private String version;
private Node<String, String> root;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
// start a single cache instance
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
version = cache.getVersion();
@@ -50,18 +45,9 @@
root = cache.getRoot();
cache.stop();
cache.destroy();
+ return (CacheSPI) cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- if (cache != null) {
- cache.destroy();
- cache = null;
- }
- root = null;
- }
-
/**
* Tests that the configuration contains the values expected, as well as immutability of certain elements
*/
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,9 +1,6 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import static org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
@@ -14,17 +11,11 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* Tests {@link org.jboss.cache.Node}-centric operations
@@ -33,24 +24,20 @@
* @since 2.0.0
*/
@Test(groups = {"functional", "pessimistic"}, testName = "api.NodeAPITest")
-public class NodeAPITest
+public class NodeAPITest extends AbstractSingleCacheTest
{
- protected ThreadLocal<CacheSPI<Object, Object>> cacheTL = new ThreadLocal<CacheSPI<Object, Object>>();
-
protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn
.fromString("/d");
protected Fqn A_B = Fqn.fromRelativeFqn(A, B);
protected Fqn A_C = Fqn.fromRelativeFqn(A, C);
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
- // start a single cache instance
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
- cacheTL.set(cache);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(getNodeLockingScheme());
configure(cache.getConfiguration());
cache.start();
+ return cache;
}
protected void configure(Configuration c)
@@ -58,29 +45,6 @@
// to be overridden
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- CacheSPI<Object, Object> cache = cacheTL.get();
-
- if (cache != null)
- {
- if (cache.getTransactionManager() != null)
- {
- try
- {
- cache.getTransactionManager().rollback();
- }
- catch (Exception e)
- {
- // don't care
- }
- }
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
- }
-
protected NodeLockingScheme getNodeLockingScheme()
{
return PESSIMISTIC;
@@ -88,11 +52,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assert cache.getConfiguration().getNodeLockingScheme() == PESSIMISTIC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) interceptorChainOK = true;
if (i instanceof OptimisticNodeInterceptor) assert false : "Not a pessimistic locking chain!!";
@@ -104,7 +68,6 @@
public void testAddingData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertNodeLockingScheme();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -115,7 +78,7 @@
public void testAddingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
tm.begin();
@@ -128,7 +91,7 @@
public void testOverwritingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -149,7 +112,7 @@
*/
public void testParentsAndChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -194,7 +157,7 @@
public void testLocking() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -219,7 +182,7 @@
public void testImmutabilityOfData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("key", "value");
@@ -247,7 +210,7 @@
public void testDefensiveCopyOfData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("key", "value");
@@ -274,7 +237,7 @@
public void testDefensiveCopyOfChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
Fqn childFqn = Fqn.fromString("/child");
@@ -303,7 +266,7 @@
public void testImmutabilityOfChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.addChild(A);
@@ -321,15 +284,15 @@
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
assertEquals(3, cache.getNumberOfNodes());
assertEquals(4, cache.getNumberOfLocksHeld());
}
public void testGetChildrenUnderTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
tm.begin();
@@ -344,14 +307,14 @@
@SuppressWarnings("unchecked")
protected TransactionWorkspace<Object, Object> getTransactionWorkspace() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
return ((OptimisticTransactionContext) cache.getTransactionTable().get(cache.getTransactionTable().get(tm.getTransaction()))).getTransactionWorkSpace();
}
public void testGetChildAPI()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
// creates a Node<Object, Object> with fqn /a/b/c
@@ -371,7 +334,7 @@
public void testClearingData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("k", "v");
@@ -384,7 +347,7 @@
public void testClearingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -401,7 +364,7 @@
public void testPutData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
assertTrue(rootNode.getData().isEmpty());
@@ -437,7 +400,7 @@
public void testGetChildrenNames() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -462,7 +425,7 @@
public void testDoubleRemovalOfData() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
cache.put("/foo/1/2/3", "item", 1);
@@ -483,7 +446,7 @@
public void testDoubleRemovalOfData2() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
cache.put("/foo/1/2", "item", 1);
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,11 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -15,8 +11,6 @@
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
@@ -32,7 +26,7 @@
* @since 2.0.0
*/
@Test(groups = {"functional", "pessimistic"}, testName = "api.NodeMoveAPITest")
-public class NodeMoveAPITest
+public class NodeMoveAPITest extends AbstractSingleCacheTest
{
protected final Log log = LogFactory.getLog(getClass());
@@ -41,33 +35,21 @@
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
- protected ThreadLocal<CacheSPI<Object, Object>> cacheTL = new ThreadLocal<CacheSPI<Object, Object>>();
- protected ThreadLocal<TransactionManager> tmTL = new ThreadLocal<TransactionManager>();
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ private TransactionManager tm;
+
+ public CacheSPI createCache()
{
-
// start a single cache instance
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache.getConfiguration().setFetchInMemoryState(false);
cache.getConfiguration().setEvictionConfig(null);
configure(cache.getConfiguration());
cache.start();
-
- cacheTL.set(cache);
- tmTL.set(cache.getTransactionManager());
+ tm = cache.getTransactionManager();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- CacheSPI<Object, Object> cache = cacheTL.get();
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
-
protected void configure(Configuration c)
{
// to be overridden
@@ -75,8 +57,6 @@
public void testBasicMove()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -143,8 +123,6 @@
public void testMoveWithChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -182,8 +160,6 @@
// move
log.info("move " + nodeC + " to " + nodeB);
cache.move(nodeC.getFqn(), nodeB.getFqn());
- //System.out.println("nodeB " + nodeB);
- //System.out.println("nodeC " + nodeC);
// child nodes will need refreshing, since existing pointers will be stale.
nodeC = nodeB.getChild(C);
@@ -215,8 +191,6 @@
public void testTxCommit() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -246,8 +220,6 @@
public void testTxRollback() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -308,8 +280,6 @@
protected void doCacheLoaderTest(boolean pasv, boolean useTx) throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
cache.destroy();
@@ -389,8 +359,6 @@
public void testLocksDeepMove() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -413,8 +381,6 @@
public void testLocks() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -433,29 +399,25 @@
protected void checkLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL", 4, cache.getNumberOfLocksHeld());
}
protected void checkLocksDeep()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL", 6, cache.getNumberOfLocksHeld());
}
protected void assertNoLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals(0, cache.getNumberOfLocksHeld());
}
public void testConcurrency() throws InterruptedException
{
- final CacheSPI<Object, Object> cache = cacheTL.get();
Node<Object, Object> rootNode = cache.getRoot();
final int N = 3;// number of threads
- final int loops = 1 << 6;// number of loops
+ final int loops = 1 << 4;// number of loops
// tests a tree structure as such:
// /a
// /b
@@ -499,7 +461,6 @@
for (int counter = 0; counter < loops; counter++)
{
- System.out.println(getName() + ": Attempt " + counter);
try
{
cache.move(NODE_X.getFqn(), NODES[r.nextInt(NODES.length)].getFqn());
@@ -508,7 +469,7 @@
{
// this may happen ...
}
- TestingUtil.sleepRandom(250);
+ TestingUtil.sleepRandom(50);
try
{
cache.move(NODE_Y.getFqn(), NODES[r.nextInt(NODES.length)].getFqn());
@@ -517,7 +478,7 @@
{
// this may happen ...
}
- TestingUtil.sleepRandom(250);
+ TestingUtil.sleepRandom(50);
}
}
};
@@ -567,7 +528,6 @@
public void testMoveInSamePlace()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
Node<Object, Object> rootNode = cache.getRoot();
final Fqn FQN_X = Fqn.fromString("/x");
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -6,70 +6,52 @@
*/
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
+import java.util.HashSet;
+import java.util.Set;
@Test(groups = {"functional", "jgroups", "pessimistic"}, testName = "api.NodeReplicatedMoveTest")
-public class NodeReplicatedMoveTest
+public class NodeReplicatedMoveTest extends AbstractMultipleCachesTest
{
- private class NodeReplicatedMoveTestTL {
- protected CacheSPI<Object, Object> cache1;
- protected CacheSPI<Object, Object> cache2;
- protected TransactionManager tm;
- }
- protected ThreadLocal<NodeReplicatedMoveTestTL> threadLocal = new ThreadLocal<NodeReplicatedMoveTestTL>();
-
+
protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d"), E = Fqn.fromString("/e");
protected static final Object k = "key", vA = "valueA", vB = "valueB", vC = "valueC", vD = "valueD", vE = "valueE";
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
+ private CacheSPI<Object, Object> cache1;
+ private TransactionManager tm;
+ private CacheSPI<Object, Object> cache2;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ protected void createCaches()
{
- NodeReplicatedMoveTestTL tl = new NodeReplicatedMoveTestTL();
- threadLocal.set(tl);
// start a single cache instance
- tl.cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- tl.cache1.getConfiguration().setSyncCommitPhase(true);
- tl.cache1.getConfiguration().setSyncRollbackPhase(true);
- tl.cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- configure(tl.cache1.getConfiguration());
- tl.cache1.start();
- tl.tm = tl.cache1.getTransactionManager();
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache1.getConfiguration().setSyncCommitPhase(true);
+ cache1.getConfiguration().setSyncRollbackPhase(true);
+ cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ configure(cache1.getConfiguration());
+ cache1.start();
+ tm = cache1.getTransactionManager();
// start second instance
- tl.cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- tl.cache2.getConfiguration().setSyncCommitPhase(true);
- tl.cache2.getConfiguration().setSyncRollbackPhase(true);
- tl.cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- configure(tl.cache2.getConfiguration());
- tl.cache2.start();
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2.getConfiguration().setSyncCommitPhase(true);
+ cache2.getConfiguration().setSyncRollbackPhase(true);
+ cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ cache2.start();
+ configure(cache2.getConfiguration());
+ registerCaches(cache1, cache2);
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- TestingUtil.killCaches(tl.cache1, tl.cache2);
- threadLocal.set(null);
- }
protected void configure(Configuration c)
{
@@ -78,10 +60,7 @@
public void testReplicatability()
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+ Node<Object, Object> rootNode = cache1.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -105,76 +84,9 @@
assertEquals(vB, cache2.getRoot().getChild(B).get(k));
}
- public void testInvalidations() throws Exception
- {
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
- cache1.stop();
- cache2.stop();
- cache1.destroy();
- cache2.destroy();
- if (isOptimistic())
- {
- cache1.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- cache2.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- }
- cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- cache1.start();
- cache2.start();
-
- Node<Object, Object> nodeA = rootNode.addChild(A);
- Node<Object, Object> nodeB = nodeA.addChild(B);
-
- nodeA.put(k, vA);
- nodeB.put(k, vB);
-
- assertEquals(vA, cache1.getRoot().getChild(A).get(k));
- assertEquals(vB, cache1.getRoot().getChild(A).getChild(B).get(k));
-
- assertInvalidated(cache2, A, "Should be invalidated");
- assertInvalidated(cache2, Fqn.fromRelativeElements(A, B.getLastElement()), "Should be invalidated");
-
- // now move...
- cache1.move(nodeB.getFqn(), Fqn.ROOT);
-
- assertEquals(vA, cache1.getRoot().getChild(A).get(k));
- assertEquals(vB, cache1.getRoot().getChild(B).get(k));
-
- assertInvalidated(cache2, A, "Should be invalidated");
- assertInvalidated(cache2, B, "Should be invalidated");
-
- // now make sure a node exists on cache 2
- cache2.getRoot().addChild(A).put("k2", "v2");
-
- // te invalidation will happen in afterCompletion, hence no exception!
- try
- {
- cache1.move(B, A);// should throw an NPE
- if (!isOptimistic()) assert false : "Should throw an exception!";
- }
- catch (Exception expected)
- {
- if (isOptimistic()) assert false : "Should not have thrown an exception!";
- }
- }
-
- private void assertInvalidated(Cache cache, Fqn fqn, String msg)
- {
- assert cache.getRoot().getChild(fqn) == null : msg;
- NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
- assert n == null || isOptimistic() : msg;
- assert !isOptimistic() || !n.isValid() : msg;
- }
-
public void testReplTxCommit() throws Exception
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+ Node<Object, Object> rootNode = cache1.getRoot();
Fqn A_B = Fqn.fromRelativeFqn(A, B);
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -189,13 +101,13 @@
assertEquals(vB, cache2.getRoot().getChild(A).getChild(B).get(k));
// now move...
- tl.tm.begin();
+ tm.begin();
cache1.move(nodeB.getFqn(), Fqn.ROOT);
assertEquals(vA, cache1.get(A, k));
assertNull(cache1.get(A_B, k));
assertEquals(vB, cache1.get(B, k));
- tl.tm.commit();
+ tm.commit();
assertEquals(vA, cache1.getRoot().getChild(A).get(k));
assertEquals(vB, cache1.getRoot().getChild(B).get(k));
@@ -206,10 +118,8 @@
public void testReplTxRollback() throws Exception
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+
+ Node<Object, Object> rootNode = cache1.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -222,13 +132,13 @@
assertEquals(vB, cache2.getRoot().getChild(A).getChild(B).get(k));
// now move...
- tl.tm.begin();
+ tm.begin();
cache1.move(nodeB.getFqn(), Fqn.ROOT);
assertEquals(vA, cache1.get(A, k));
assertEquals(vB, cache1.get(B, k));
- tl.tm.rollback();
+ tm.rollback();
assertEquals(vA, cache1.getRoot().getChild(A).get(k));
assertEquals(vB, cache1.getRoot().getChild(A).getChild(B).get(k));
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,44 +1,30 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Set;
-import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
/**
* Tests NodeSPI specific APIs.
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.NodeSPITest")
-public class NodeSPITest
+public class NodeSPITest extends AbstractSingleCacheTest
{
- private CacheSPI<Object, Object> cache;
private NodeSPI<Object, Object> root;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+
+ public CacheSPI createCache()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
root = cache.getRoot();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- if (cache != null) TestingUtil.killCaches(cache);
- root = null;
- cache = null;
- }
-
public void testDeepOperations() throws Exception
{
Fqn A = Fqn.fromString("/a");
Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false, getClass());
cache.getConfiguration().getEvictionConfig().setWakeupInterval(1000);
createNewRegion();
cache.start();
@@ -175,7 +175,7 @@
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
cache.put(Fqn.fromString("/a/b"), "key", "value");
TransactionManager txManager = cache.getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,12 +7,7 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -25,22 +20,23 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
/**
* @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
*/
@Test(groups = {"functional", "jgroups", "pessimistic"}, sequential = true, testName = "api.SyncReplTest")
-public class SyncReplTest
+public class SyncReplTest extends AbstractMultipleCachesTest
{
private CacheSPI<Object, Object> cache1, cache2;
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+
+ protected void createCaches()
{
- System.out.println("*** In setUp()");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -50,17 +46,9 @@
cache1.start();
cache2.start();
-
TestingUtil.blockUntilViewsReceived(new Cache[]{cache1, cache2}, 5000);
- System.out.println("*** Finished setUp()");
- }
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- TestingUtil.killCaches(cache1, cache2);
- cache1 = null;
- cache2 = null;
+ registerCaches(cache1, cache2);
}
protected void configure(Configuration c)
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,9 +46,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws CloneNotSupportedException
{
- System.out.println("*** In setUp()");
caches = new ArrayList<CacheSPI<Object, Object>>();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache1.getConfiguration().setSyncCommitPhase(true);
@@ -59,7 +58,7 @@
cache1.start();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache2.start();
@@ -67,46 +66,12 @@
caches.add(cache2);
TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), 10000);
- System.out.println("*** Finished setUp()");
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- System.out.println("*** In tearDown()");
- if (caches != null)
- {
- for (CacheSPI c : caches)
- {
- if (c != null)
- {
- Transaction t;
-
- try
- {
- if ((t = c.getTransactionManager().getTransaction()) != null)
- {
- try
- {
- if (t.getStatus() == Status.STATUS_ACTIVE)
- c.getTransactionManager().rollback();
- }
- catch (SystemException e)
- {
- // do nothing
- }
- }
- }
- catch (SystemException e)
- {
- // do nothing
- }
- c.stop();
- }
- }
- caches = null;
- }
- System.out.println("*** Finished tearDown()");
+ TestingUtil.killCaches(caches.toArray(new Cache[caches.size()]));
}
protected void configure(Configuration c)
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,10 +1,11 @@
package org.jboss.cache.api.batch;
import org.jboss.cache.Cache;
+import org.jboss.cache.AbstractSingleCacheTest;
import java.util.concurrent.atomic.AtomicReference;
-public abstract class AbstractBatchTest
+public abstract class AbstractBatchTest extends AbstractSingleCacheTest<String, String>
{
protected String getOnDifferentThread(final Cache<String, String> cache, final String fqn, final String key) throws InterruptedException
{
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -10,104 +10,76 @@
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
+
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.CacheSPI;
@Test(groups = {"functional", "transaction"}, testName = "api.batch.BatchWithTM")
public class BatchWithTM extends AbstractBatchTest
{
public void testBatchWithOngoingTM() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- tm.begin();
- cache.put("/a/b/c", "k", "v");
- cache.startBatch();
- cache.put("/a/b/c", "k2", "v2");
- tm.commit();
+ TransactionManager tm = getTransactionManager(cache);
+ tm.begin();
+ cache.put("/a/b/c", "k", "v");
+ cache.startBatch();
+ cache.put("/a/b/c", "k2", "v2");
+ tm.commit();
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
- cache.endBatch(false); // should be a no op
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ cache.endBatch(false); // should be a no op
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
}
public void testBatchWithoutOngoingTMSuspension() throws Exception
{
- Cache<String, String> cache = null;
+ TransactionManager tm = getTransactionManager(cache);
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.put("/a/b/c", "k2", "v2");
+
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+
try
{
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- assert tm.getTransaction() == null : "Should have no ongoing txs";
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- assert tm.getTransaction() == null : "Should have no ongoing txs";
- cache.put("/a/b/c", "k2", "v2");
+ tm.commit(); // should have no effect
+ }
+ catch (Exception e)
+ {
+ // the TM may barf here ... this is OK.
+ }
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
- try
- {
- tm.commit(); // should have no effect
- }
- catch (Exception e)
- {
- // the TM may barf here ... this is OK.
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.endBatch(true); // should be a no op
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
-
- cache.endBatch(true); // should be a no op
-
- assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
- assert "v2".equals(getOnDifferentThread(cache, "/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
+ assert "v2".equals(getOnDifferentThread(cache, "/a/b/c", "k2"));
}
public void testBatchRollback() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.put("/a/b/c", "k2", "v2");
+ TransactionManager tm = getTransactionManager(cache);
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.put("/a/b/c", "k2", "v2");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- cache.endBatch(false);
+ cache.endBatch(false);
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
}
private TransactionManager getTransactionManager(Cache<String, String> c)
@@ -115,13 +87,15 @@
return c.getConfiguration().getRuntimeConfig().getTransactionManager();
}
- private Cache<String, String> createCache()
+ @Override
+ public CacheSPI<String, String> createCache()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL); // this should pick up any configured TM for the test
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setInvocationBatchingEnabled(true);
assert c.getTransactionManagerLookupClass() != null : "Should have a transaction manager lookup class attached!!";
- return cf.createCache(c);
+ return (CacheSPI<String, String>) cf.createCache(c, getClass());
}
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -3,6 +3,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.config.ConfigurationException;
@@ -12,15 +13,16 @@
@Test(groups = "functional", testName = "api.batch.BatchWithoutTM")
public class BatchWithoutTM extends AbstractBatchTest
{
+
+ @Test (enabled = true)
public void testBatchWithoutCfg()
{
- Cache<String, String> cache = null;
+ Cache<String, String> localCache = createCache(false);
try
{
- cache = createCache(false);
try
{
- cache.startBatch();
+ localCache.startBatch();
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -30,7 +32,7 @@
try
{
- cache.endBatch(true);
+ localCache.endBatch(true);
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -40,7 +42,7 @@
try
{
- cache.endBatch(false);
+ localCache.endBatch(false);
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -50,101 +52,59 @@
}
finally
{
- TestingUtil.killCaches(cache);
- cache = null;
+ TestingUtil.killCaches(localCache);
}
}
- public void testEndBatchWithoutStartBatch()
- {
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.endBatch(true);
- cache.endBatch(false);
- // should not fail.
- }
- finally
- {
- TestingUtil.killCaches(cache);
- }
- }
-
public void testStartBatchIdempotency()
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.startBatch(); // again
- cache.put("/a/b/c", "k2", "v2");
- cache.endBatch(true);
+ assert cache.getCacheStatus().allowInvocations();
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.startBatch(); // again
+ cache.put("/a/b/c", "k2", "v2");
+ cache.endBatch(true);
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
}
public void testBatchVisibility() throws InterruptedException
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null : "Other thread should not see batch update till batch completes!";
-
- cache.endBatch(true);
-
- assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ cache = createCache(true);
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null : "Other thread should not see batch update till batch completes!";
+ cache.endBatch(true);
+ assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
}
public void testBatchRollback() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.put("/a/b/c", "k2", "v2");
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.put("/a/b/c", "k2", "v2");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- cache.endBatch(false);
+ cache.endBatch(false);
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
}
- private Cache<String, String> createCache(boolean enableBatch)
+ public CacheSPI<String, String> createCache()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ return createCache(true);
+ }
+
+ private CacheSPI<String, String> createCache(boolean enableBatch)
+ {
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setInvocationBatchingEnabled(enableBatch);
- return cf.createCache(c);
+ return (CacheSPI<String, String>) cf.createCache(c, getClass());
}
}
Deleted: core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,41 +0,0 @@
-package org.jboss.cache.api.mvcc;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
-import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.Test;
-
- at Test(groups = {"functional", "mvcc"}, testName = "api.mvcc.BuddyReplicationConcurrencyTest")
-public class BuddyReplicationConcurrencyTest extends BuddyReplicationTestsBase
-{
- public static final Fqn f = Fqn.fromString("/a/b/c");
- public static final String k = "k";
- public static final String v = "v";
-
- public void testConcurrency() throws Exception
- {
- Cache<Object, Object> cache1 = null, cache2 = null;
-
- try
- {
- cache1 = createCache(1, null, true, true);
- cache2 = createCache(1, null, true, true);
-
- TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
-
- // put stuff in cache 1. And ensure they exist in cache 2.
-
- for (int i = 0; i < 10; i++)
- {
- cache1.put(Fqn.fromRelativeElements(f, i), k, v);
- assert v.equals(cache1.get(Fqn.fromRelativeElements(f, i), k));
- assert v.equals(cache2.get(Fqn.fromRelativeElements(f, i), k));
- }
- }
- finally
- {
- TestingUtil.killCaches(cache1, cache2);
- }
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,8 +1,6 @@
package org.jboss.cache.api.mvcc;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -12,8 +10,6 @@
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.Transaction;
@@ -25,7 +21,7 @@
* @since 3.0
*/
@Test(groups = {"functional", "mvcc"})
-public abstract class LockTestBase
+public abstract class LockTestBase extends AbstractSingleCacheTest
{
protected Fqn A = Fqn.fromString("/a");
protected Fqn AB = Fqn.fromString("/a/b");
@@ -34,65 +30,47 @@
protected boolean repeatableRead = true;
protected boolean lockParentForChildInsertRemove = false;
- protected class LockTestBaseTL {
- public Cache<String, String> cache;
- public TransactionManager tm;
- public LockManager lockManager;
- public InvocationContextContainer icc;
- }
-
- protected ThreadLocal<LockTestBaseTL> threadLocal = new ThreadLocal<LockTestBaseTL>();
+ public Cache<String, String> cache;
+ public TransactionManager tm;
+ public LockManager lockManager;
+ public InvocationContextContainer icc;
- @BeforeMethod
- public void setUp()
+
+ public CacheSPI createCache()
{
- LockTestBaseTL tl = new LockTestBaseTL();
-
- tl.cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false);
- tl.cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
- tl.cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- tl.cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
- tl.cache.getConfiguration().setLockParentForChildInsertRemove(lockParentForChildInsertRemove);
+ cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false, getClass());
+ cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
+ cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
+ cache.getConfiguration().setLockParentForChildInsertRemove(lockParentForChildInsertRemove);
// reduce lock acquisition timeout so this doesn't take forever to run
- tl.cache.getConfiguration().setLockAcquisitionTimeout(200); // 200 ms
- tl.cache.start();
- tl.lockManager = TestingUtil.extractComponentRegistry(tl.cache).getComponent(LockManager.class);
- tl.icc = TestingUtil.extractComponentRegistry(tl.cache).getComponent(InvocationContextContainer.class);
- tl.tm = TestingUtil.extractComponentRegistry(tl.cache).getComponent(TransactionManager.class);
- threadLocal.set(tl);
+ cache.getConfiguration().setLockAcquisitionTimeout(200); // 200 ms
+ cache.start();
+ lockManager = TestingUtil.extractComponentRegistry(cache).getComponent(LockManager.class);
+ icc = TestingUtil.extractComponentRegistry(cache).getComponent(InvocationContextContainer.class);
+ tm = TestingUtil.extractComponentRegistry(cache).getComponent(TransactionManager.class);
+ return (CacheSPI) cache;
}
- @AfterMethod
- public void tearDown()
- {
- LockTestBaseTL tl = threadLocal.get();
- TestingUtil.killCaches(tl.cache);
- threadLocal.set(null);
- }
-
protected void assertLocked(Fqn fqn)
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertLocked(fqn, tl.lockManager, tl.icc);
+ LockAssert.assertLocked(fqn, lockManager, icc);
}
protected void assertNotLocked(Fqn fqn)
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertNotLocked(fqn, tl.lockManager, tl.icc);
+ LockAssert.assertNotLocked(fqn, lockManager, icc);
}
protected void assertNoLocks()
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertNoLocks(tl.lockManager, tl.icc);
+ LockAssert.assertNoLocks(lockManager, icc);
}
public void testLocksOnPutKeyVal() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
+ tm.begin();
+ cache.put(AB, "k", "v");
if (lockParentForChildInsertRemove)
assertLocked(Fqn.ROOT);
else
@@ -100,22 +78,22 @@
assertLocked(A);
assertLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.get(AB, "k").equals("v");
+ tm.begin();
+ assert cache.get(AB, "k").equals("v");
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
assertNotLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
+ tm.begin();
+ cache.put(ABC, "k", "v");
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
if (lockParentForChildInsertRemove)
@@ -123,16 +101,16 @@
else
assertNotLocked(AB);
assertLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnPutData() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+
+ tm.begin();
+ cache.put(AB, Collections.singletonMap("k", "v"));
if (lockParentForChildInsertRemove)
assertLocked(Fqn.ROOT);
else
@@ -140,23 +118,23 @@
assertLocked(A);
assertLocked(AB);
assertNotLocked(ABC);
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.commit();
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ tm.commit();
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
assertNotLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- tl.cache.put(ABC, Collections.singletonMap("k", "v"));
+ tm.begin();
+ cache.put(ABC, Collections.singletonMap("k", "v"));
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
if (lockParentForChildInsertRemove)
@@ -164,67 +142,67 @@
else
assertNotLocked(AB);
assertLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnRemoveNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
- tl.tm.begin();
- tl.cache.removeNode(AB);
+ tm.begin();
+ cache.removeNode(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
- tl.tm.begin();
- tl.cache.evict(AB);
+ tm.begin();
+ cache.evict(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictRecursiveNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
- tl.cache.put(ABC, Collections.singletonMap("k", "v"));
- tl.cache.put(ABCD, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(ABC, Collections.singletonMap("k", "v"));
+ cache.put(ABCD, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(ABCD, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(ABCD, "k"));
- tl.tm.begin();
- tl.cache.evict(AB, true);
+ tm.begin();
+ cache.evict(AB, true);
assertLocked(AB);
assertLocked(ABC);
assertLocked(ABCD);
@@ -233,481 +211,481 @@
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnRemoveNonexistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.removeNode(AB);
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.removeNode(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictNonexistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.evict(AB);
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.evict(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnRemoveData() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, "k", "v");
- tl.cache.put(AB, "k2", "v2");
+ cache.put(AB, "k", "v");
+ cache.put(AB, "k2", "v2");
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v2".equals(tl.cache.get(AB, "k2"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v2".equals(cache.get(AB, "k2"));
// remove
- tl.tm.begin();
- Object x = tl.cache.remove(AB, "k");
+ tm.begin();
+ Object x = cache.remove(AB, "k");
assert x.equals("v");
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.get(AB, "k") == null : "Should not exist";
- assert "v2".equals(tl.cache.get(AB, "k2"));
+ tm.commit();
+ assert cache.get(AB, "k") == null : "Should not exist";
+ assert "v2".equals(cache.get(AB, "k2"));
assertNoLocks();
// clearData
- tl.tm.begin();
- tl.cache.clearData(AB);
+ tm.begin();
+ cache.clearData(AB);
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
+ tm.commit();
- assert tl.cache.get(AB, "k") == null : "Should not exist";
- assert tl.cache.get(AB, "k2") == null : "Should not exist";
+ assert cache.get(AB, "k") == null : "Should not exist";
+ assert cache.get(AB, "k2") == null : "Should not exist";
assertNoLocks();
// nonexistent key
- assert tl.cache.get(AB, "k3") == null : "Should not exist";
- tl.tm.begin();
- tl.cache.remove(AB, "k3");
+ assert cache.get(AB, "k3") == null : "Should not exist";
+ tm.begin();
+ cache.remove(AB, "k3");
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnRemoveDataNonExistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.remove(AB, "k");
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.remove(AB, "k");
assertNotLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
}
public void testReadMethods() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
+ cache.put(AB, "k", "v");
+
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getData(AB).containsKey("k");
+ tm.begin();
+ assert cache.getData(AB).containsKey("k");
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getKeys(AB).contains("k");
+ tm.begin();
+ assert cache.getKeys(AB).contains("k");
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getNode(AB) != null;
+ tm.begin();
+ assert cache.getNode(AB) != null;
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getNode(A) != null;
- assert !(tl.cache.getNode(A).getChildrenNames().isEmpty());
- assert tl.cache.getNode(A).getChildrenNames().contains(AB.getLastElement());
+ tm.begin();
+ assert cache.getNode(A) != null;
+ assert !(cache.getNode(A).getChildrenNames().isEmpty());
+ assert cache.getNode(A).getChildrenNames().contains(AB.getLastElement());
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testWriteDoesntBlockRead() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
+ cache.put(AB, "k", "v");
+
// start a write.
- tl.tm.begin();
- tl.cache.put(AB, "k2", "v2");
+ tm.begin();
+ cache.put(AB, "k2", "v2");
assertLocked(AB);
- Transaction write = tl.tm.suspend();
+ Transaction write = tm.suspend();
// now start a read and confirm that the write doesn't block it.
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(AB, "k2") : "Should not see uncommitted changes";
- Transaction read = tl.tm.suspend();
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ assert null == cache.get(AB, "k2") : "Should not see uncommitted changes";
+ Transaction read = tm.suspend();
// commit the write
- tl.tm.resume(write);
- tl.tm.commit();
+ tm.resume(write);
+ tm.commit();
assertNoLocks();
- tl.tm.resume(read);
+ tm.resume(read);
if (repeatableRead)
- assert null == tl.cache.get(AB, "k2") : "Should have repeatable read";
+ assert null == cache.get(AB, "k2") : "Should have repeatable read";
else
- assert "v2".equals(tl.cache.get(AB, "k2")) : "Read committed should see committed changes";
- tl.tm.commit();
+ assert "v2".equals(cache.get(AB, "k2")) : "Read committed should see committed changes";
+ tm.commit();
assertNoLocks();
}
public void testWriteDoesntBlockReadNonexistent() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// start a write.
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
+ tm.begin();
+ cache.put(AB, "k", "v");
assertLocked(AB);
- Transaction write = tl.tm.suspend();
+ Transaction write = tm.suspend();
// now start a read and confirm that the write doesn't block it.
- tl.tm.begin();
- assert null == tl.cache.get(AB, "k") : "Should not see uncommitted changes";
- assert null == tl.cache.getNode(AB);
- Transaction read = tl.tm.suspend();
+ tm.begin();
+ assert null == cache.get(AB, "k") : "Should not see uncommitted changes";
+ assert null == cache.getNode(AB);
+ Transaction read = tm.suspend();
// commit the write
- tl.tm.resume(write);
- tl.tm.commit();
+ tm.resume(write);
+ tm.commit();
assertNoLocks();
- tl.tm.resume(read);
+ tm.resume(read);
if (repeatableRead)
{
- assert null == tl.cache.get(AB, "k") : "Should have repeatable read";
- assert null == tl.cache.getNode(AB);
+ assert null == cache.get(AB, "k") : "Should have repeatable read";
+ assert null == cache.getNode(AB);
}
else
{
- assert "v".equals(tl.cache.get(AB, "k")) : "Read committed should see committed changes";
- assert null != tl.cache.getNode(AB);
+ assert "v".equals(cache.get(AB, "k")) : "Read committed should see committed changes";
+ assert null != cache.getNode(AB);
}
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testConcurrentWriters() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
- Transaction t1 = tl.tm.suspend();
- tl.tm.begin();
+ tm.begin();
+ cache.put(AB, "k", "v");
+ Transaction t1 = tm.suspend();
+
+ tm.begin();
try
{
- tl.cache.put(AB, "k", "v");
+ cache.put(AB, "k", "v");
assert false : "Should fail lock acquisition";
}
catch (TimeoutException expected)
{
// expected.printStackTrace(); // for debugging
}
- tl.tm.commit();
- tl.tm.resume(t1);
- tl.tm.commit();
+ tm.commit();
+ tm.resume(t1);
+ tm.commit();
assertNoLocks();
}
public void testRollbacks() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction reader = tl.tm.suspend();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- tl.tm.rollback();
+ cache.put(AB, "k", "v");
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction reader = tm.suspend();
- tl.tm.resume(reader);
- assert "v".equals(tl.cache.get(AB, "k")) : "Expecting 'v' but was " + tl.cache.get(AB, "k");
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ tm.rollback();
+ tm.resume(reader);
+ assert "v".equals(cache.get(AB, "k")) : "Expecting 'v' but was " + cache.get(AB, "k");
+ tm.commit();
+
// even after commit
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
}
public void testRollbacksOnNullNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- assert null == tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
- Transaction reader = tl.tm.suspend();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
- assert null != tl.cache.getNode(AB);
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.rollback();
+ tm.begin();
+ assert null == cache.get(AB, "k");
+ assert null == cache.getNode(AB);
+ Transaction reader = tm.suspend();
- tl.tm.resume(reader);
- assert null == tl.cache.get(AB, "k") : "Expecting null but was " + tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v");
+ assert null != cache.getNode(AB);
+ assert "v".equals(cache.get(AB, "k"));
+ tm.rollback();
+ tm.resume(reader);
+ assert null == cache.get(AB, "k") : "Expecting null but was " + cache.get(AB, "k");
+ assert null == cache.getNode(AB);
+ tm.commit();
+
// even after commit
- assert null == tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
+ assert null == cache.get(AB, "k");
+ assert null == cache.getNode(AB);
assertNoLocks();
}
public void testPhantomChildren() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert tl.cache.getRoot().hasChild(ABC);
- assert tl.cache.getNode(ABC) != null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) != null;
- assert tl.cache.getNode(AB).getChildren().size() == 1;
- Transaction t = tl.tm.suspend();
+ cache.put(AB, "k", "v");
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert cache.getRoot().hasChild(ABC);
+ assert cache.getNode(ABC) != null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) != null;
+ assert cache.getNode(AB).getChildren().size() == 1;
+ Transaction t = tm.suspend();
- assert tl.cache.getNode(ABC) == null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) == null;
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- tl.tm.resume(t);
- assert tl.cache.getRoot().hasChild(ABC);
- assert tl.cache.getNode(ABC) != null;
- tl.tm.commit();
+ assert cache.getNode(ABC) == null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) == null;
+ assert cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(ABC) != null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) != null;
- assert tl.cache.getNode(AB).getChildren().size() == 1;
+ tm.resume(t);
+ assert cache.getRoot().hasChild(ABC);
+ assert cache.getNode(ABC) != null;
+ tm.commit();
+
+ assert cache.getNode(ABC) != null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) != null;
+ assert cache.getNode(AB).getChildren().size() == 1;
}
public void testChildCount() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.begin();
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.cache.removeNode(AB);
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
- Transaction t = tl.tm.suspend();
+ cache.put(AB, "k", "v");
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ tm.begin();
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ cache.removeNode(AB);
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
+ Transaction t = tm.suspend();
- assert tl.cache.getNode(AB) != null;
- assert tl.cache.getNode(A).getChild(AB.getLastElement()) != null;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.resume(t);
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
- tl.tm.commit();
+ assert cache.getNode(AB) != null;
+ assert cache.getNode(A).getChild(AB.getLastElement()) != null;
+ assert cache.getNode(A).getChildren().size() == 1;
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
+ tm.resume(t);
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
+ tm.commit();
+
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
}
public void testOverwritingOnInsert() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t2 = tl.tm.suspend();
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction t1 = tm.suspend();
- tl.tm.resume(t1);
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t2 = tm.suspend();
+
+ tm.resume(t1);
t1.commit();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
- tl.tm.resume(t2);
+ tm.resume(t2);
t2.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testOverwritingOnInsert2() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction t2 = tl.tm.suspend();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t1 = tm.suspend();
- tl.tm.resume(t1);
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction t2 = tm.suspend();
+
+ tm.resume(t1);
t1.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
- tl.tm.resume(t2);
+ tm.resume(t2);
t2.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testOverwritingOnInsert3() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t1 = tm.suspend();
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ tm.commit();
- tl.tm.resume(t1);
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+
+ tm.resume(t1);
t1.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testConcurrentInsertRemove1() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.removeNode(AB);
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
- tl.tm.commit();
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+ Transaction t1 = tm.suspend();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ tm.commit();
- tl.tm.resume(t1);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+
+ tm.resume(t1);
t1.commit();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
}
public void testConcurrentInsertRemove2() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.removeNode(AB);
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- tl.tm.commit();
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ Transaction t1 = tm.suspend();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ tm.commit();
- tl.tm.resume(t1);
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+
+ tm.resume(t1);
t1.commit();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,6 @@
@Override
protected void checkLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -45,7 +44,6 @@
@Override
protected void checkLocksDeep()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -65,7 +63,6 @@
@Override
protected void assertNoLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -74,7 +71,6 @@
public void testNonexistentSource()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
cache.put(A_B_C, "k", "v");
assert "v".equals(cache.get(A_B_C, "k"));
assert 1 == cache.getNode(A_B).getChildren().size();
@@ -91,7 +87,6 @@
public void testNonexistentTarget()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
cache.put(A_B_C, "k", "v");
assert "v".equals(cache.get(A_B_C, "k"));
assert 1 == cache.getNode(A_B).getChildren().size();
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -13,6 +13,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* An MVCC version of {@link org.jboss.cache.api.NodeAPITest}
*/
@@ -32,13 +34,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = cache.getTransactionManager();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an MVCC locking chain!!";
if (i instanceof OptimisticNodeInterceptor) assert false : "Not an MVCC locking chain!!";
@@ -58,8 +58,6 @@
@Override
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getNode(A_B) != null;
assert cache.getNode(A_C) != null;
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,10 +25,4 @@
{
c.setIsolationLevel(IsolationLevel.READ_COMMITTED);
}
-
- @Override
- public void testInvalidations() throws Exception
- {
- // TODO: Think about how this test should be written for MVCC
- }
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -11,6 +11,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* An MVCC version of {@link org.jboss.cache.api.NodeAPITest}
*/
@@ -31,12 +33,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an MVCC locking chain!!";
if (i instanceof OptimisticNodeInterceptor) assert false : "Not an MVCC locking chain!!";
@@ -56,8 +57,6 @@
@Override
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getNode(A_B) != null;
assert cache.getNode(A_C) != null;
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,9 +26,4 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
}
- @Override
- public void testInvalidations() throws Exception
- {
- // TODO: Think about how this test should be written for MVCC
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -17,10 +17,6 @@
public void testRepeatableReadWithRemove() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
cache.put(AB, "k", "v");
tm.begin();
@@ -45,10 +41,6 @@
public void testRepeatableReadWithEvict() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
cache.put(AB, "k", "v");
tm.begin();
@@ -73,10 +65,6 @@
public void testRepeatableReadWithNull() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
assert cache.getNode(AB) == null;
tm.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
@BeforeMethod
public void setUp()
{
- cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -22,9 +22,6 @@
public void testTombstoneRevival()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
modifier.put(parent, K, V);
modifier.removeNode(parent);
@@ -48,16 +45,12 @@
public void testTombstoneVersioningFailure() throws Exception
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
modifier.put(parent, K, V);
- DummyInMemoryCacheLoader loader = loaderTL.get();
-
+
// test that this exists in the (shared) loader
assert loader.get(parent) != null;
assert loader.get(parent).size() > 0;
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -11,6 +11,8 @@
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.AfterClass;
import java.util.Properties;
@@ -21,7 +23,7 @@
@Test(groups = {"functional", "pessimistic"}, testName = "api.nodevalidity.InvalidatedPessNodeValidityTest")
public class InvalidatedPessNodeValidityTest extends NodeValidityTestBase
{
- protected ThreadLocal<DummyInMemoryCacheLoader> loaderTL = new ThreadLocal<DummyInMemoryCacheLoader>();
+ protected DummySharedInMemoryCacheLoader loader;
public InvalidatedPessNodeValidityTest()
{
@@ -39,20 +41,18 @@
return newCache();
}
- @AfterMethod
+ @AfterClass
public void emptyCacheLoader()
{
- DummySharedInMemoryCacheLoader loader = (DummySharedInMemoryCacheLoader) loaderTL.get();
- if (loader != null) loader.wipeBin();
- loaderTL.set(null);
+ loader.wipeBin();
}
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- Cache<String, String> cache = f.createCache(c, false);
+ Cache<String, String> cache = f.createCache(c, false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
// need a cache loader as a shared data source between the 2 instances
@@ -71,8 +71,7 @@
CacheSPI spi = (CacheSPI) cache;
- DummyInMemoryCacheLoader loader = (DummyInMemoryCacheLoader) spi.getCacheLoaderManager().getCacheLoader();
- loaderTL.set(loader);
+ loader = (DummySharedInMemoryCacheLoader) spi.getCacheLoaderManager().getCacheLoader();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,23 +15,12 @@
@Test(groups = {"functional", "pessimistic"}, testName = "api.nodevalidity.LocalPessNodeValidityTest")
public class LocalPessNodeValidityTest extends NodeValidityTestBase
{
- private ThreadLocal<Cache<String, String>> cacheTL = new ThreadLocal<Cache<String, String>>();
-
public LocalPessNodeValidityTest()
{
clustered = false;
nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
}
- @AfterMethod
- public void tearDown()
- {
- Cache<String, String> cache = cacheTL.get();
- super.tearDown();
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
-
protected Cache<String, String> createObserver()
{
return createModifier();
@@ -39,17 +28,10 @@
protected Cache<String, String> createModifier()
{
- Cache<String, String> cache = cacheTL.get();
-
- if (cache == null)
- {
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
- cache = f.createCache(false);
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ Cache<String, String> cache = f.createCache(false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
cache.start();
- cacheTL.set(cache);
return cache;
- }
- return cache;
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,11 +1,6 @@
package org.jboss.cache.api.nodevalidity;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeNotValidException;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -24,7 +19,7 @@
* @since 2.1.0
*/
@Test(groups = {"functional"})
-public abstract class NodeValidityTestBase
+public abstract class NodeValidityTestBase extends AbstractMultipleCachesTest
{
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
@@ -34,12 +29,12 @@
// needed to test tombstones
protected boolean invalidation = false;
- protected ThreadLocal<Cache<String, String>> observerTL = new ThreadLocal<Cache<String, String>>();
- protected ThreadLocal<Cache<String, String>> modifierTL = new ThreadLocal<Cache<String, String>>();
-
+
protected static final Fqn parent = Fqn.fromString("/parent");
protected static final Fqn child = Fqn.fromString("/parent/child");
protected static final String K = "k", V = "v";
+ protected Cache<String, String> observer;
+ protected Cache<String, String> modifier;
protected abstract Cache<String, String> createObserver();
@@ -61,31 +56,16 @@
return nodeLockingScheme == NodeLockingScheme.OPTIMISTIC;
}
- @BeforeMethod
- public void setUp()
+ protected void createCaches()
{
- Cache<String, String> observer = createObserver();
- Cache<String, String> modifier = createModifier();
- observerTL.set(observer);
- modifierTL.set(modifier);
+ observer = createObserver();
+ modifier = createModifier();
+ registerCaches(observer, modifier);
if (clustered) TestingUtil.blockUntilViewsReceived(60000, observer, modifier);
}
- @AfterMethod
- public void tearDown()
- {
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
- TestingUtil.killCaches(observer, modifier);
- observerTL.set(null);
- modifierTL.set(null);
- }
-
public void testRemoval()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-// observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -100,9 +80,6 @@
public void testRemovalWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-// observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
observer.put(child, K, V);
Node<String, String> obsParentNode = observer.getRoot().getChild(parent);
@@ -120,9 +97,6 @@
public void testMove()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
Fqn newParent = Fqn.fromString("/newParent/parent");
//observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -147,9 +121,6 @@
public void testMoveWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
Fqn newParent = Fqn.fromString("/newParent/parent");
Fqn newChild = Fqn.fromString("/newParent/parent/child");
@@ -181,9 +152,6 @@
public void testEvict()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
// eviction should affect validity
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -199,9 +167,6 @@
public void testOperationsOnInvalidNode()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -317,9 +282,6 @@
public void testExistenceOfTombstones()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
@@ -352,9 +314,6 @@
public void testExistenceOfTombstonesWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,11 +25,11 @@
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- Cache<String, String> cache = f.createCache(c, false);
+ Cache<String, String> cache = f.createCache(c, false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
cache.start();
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,12 +26,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an optimistic locking chain!!";
if (i instanceof OptimisticNodeInterceptor) interceptorChainOK = true;
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -6,6 +6,9 @@
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.lock.NodeLock;
import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.transaction.Transaction;
@@ -31,16 +34,25 @@
}
}
+ private static Log log = LogFactory.getLog(PFERPessimisticTestBase.class);
+
/**
* Locks could only occur on the parent node is write locked since if the child node exists it is a no-op anyway.
* If the parent node is read locked as well, there is no issue.
*/
public void testNoOpWhenLockedAnd0msTimeout() throws Exception
{
+ log.warn("******** Here is where it is not going to happen");
// create the parent node first ...
replListener2.expect(PutKeyValueCommand.class);
cache1.put(parentFqn, key, value);
- replListener2.waitForReplicationToOccur(10000);
+ try
+ {
+ replListener2.waitForReplicationToOccur(10000);
+ } finally
+ {
+ log.warn("******** Here is where it did not happen!!!");
+ }
replListener2.expectWithTx(PutKeyValueCommand.class);
tm1.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -18,8 +18,6 @@
import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.jgroups.Address;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.SystemException;
@@ -29,7 +27,7 @@
import java.util.Vector;
@Test(groups = {"functional", "jgroups", "transaction"})
-public abstract class PutForExternalReadTestBase
+public abstract class PutForExternalReadTestBase extends AbstractMultipleCachesTest
{
protected Configuration.CacheMode cacheMode;
protected NodeLockingScheme nodeLockingScheme;
@@ -46,14 +44,11 @@
protected boolean useTx;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+ protected void createCaches()
{
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
-
- cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false, getClass());
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache1.getConfiguration().setSerializationExecutorPoolSize(0);//this is very important for async tests!
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -61,7 +56,7 @@
cache1.start();
tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
- cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false, getClass());
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache2.getConfiguration().setSerializationExecutorPoolSize(0); //this is very important for async tests!
cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -72,14 +67,9 @@
replListener2 = ReplicationListener.getReplicationListener(cache2);
TestingUtil.blockUntilViewsReceived(10000, cache1, cache2);
+ registerCaches(cache1, cache2);
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- TestingUtil.killCaches(cache1, cache2);
- }
-
public void testNoOpWhenNodePresent()
{
replListener2.expect(PutForExternalReadCommand.class);
@@ -148,6 +138,7 @@
// cleanup
TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
+ TestingUtil.extractComponentRegistry(cache1).rewire();
cache1.removeNode(fqn);
}
@@ -236,6 +227,7 @@
finally
{
TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
+ TestingUtil.extractComponentRegistry(cache1).rewire();
}
}
@@ -300,7 +292,6 @@
assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
- System.out.println("PutForExternalReadTestBase.testMemLeakOnSuspendedTransactions");
//do not expectWithTx a PFER replication, as the node already exists so this is a no-op
replListener2.expectWithTx(PutKeyValueCommand.class);
tm1.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -130,7 +130,7 @@
{
CacheMode mode = CacheMode.REPL_SYNC;
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setUseRegionBasedMarshalling(true);
cache.getConfiguration().setInactiveOnStartup(true);
cache.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,6 +2,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Cache;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.CacheBlocked;
import org.jboss.cache.notifications.annotation.CacheUnblocked;
@@ -466,6 +467,22 @@
assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) == null : "Should NOT have backup data";
}
+
+ public void testConcurrency() throws Exception
+ {
+ Fqn f = Fqn.fromString("/a/b/c");
+ String k = "k";
+ String v = "v";
+
+ for (int i = 0; i < 10; i++)
+ {
+ caches.get(0).put(Fqn.fromRelativeElements(f, i), k, v);
+ assert v.equals(caches.get(1).get(Fqn.fromRelativeElements(f, i), k));
+ assert v.equals(caches.get(1).get(Fqn.fromRelativeElements(f, i), k));
+ }
+ }
+
+
@CacheListener
public static class CacheBlockListener
{
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,7 +41,7 @@
public void testNullConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(null);
assertNull(cache.getBuddyManager());
}
@@ -50,7 +50,7 @@
{
String xmlConfig = "<buddy enabled=\"false\"/>";
BuddyReplicationConfig config = getBuddyReplicationConfig(xmlConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(config);
assertNull(cache.getBuddyManager());
}
@@ -62,7 +62,7 @@
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setBuddyReplicationConfig(config);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
assertNotNull(cache.getBuddyManager());
@@ -86,7 +86,7 @@
public void testXmlConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(new XmlConfigurationParser().parseFile("configs/buddy-replication-cache.xml"), false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(new XmlConfigurationParser().parseFile("configs/buddy-replication-cache.xml"), false, getClass());
cache.create();
cache.start();
BuddyManager bm = cache.getBuddyManager();
@@ -116,7 +116,7 @@
{
String xmlConfig = "<buddy enabled=\"true\"/>";
BuddyReplicationConfig config = getBuddyReplicationConfig(xmlConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(config);
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,8 +54,8 @@
// Cache1 will be used only for recovery.
// Cache2 will perform some updates on the objects and then fail.
- cache1 = new UnitTestCacheFactory<String, Integer>().createCache(c, false);
- cache2 = new UnitTestCacheFactory<String, Integer>().createCache(c.clone(), false);
+ cache1 = new UnitTestCacheFactory<String, Integer>().createCache(c, false, getClass());
+ cache2 = new UnitTestCacheFactory<String, Integer>().createCache(c.clone(), false, getClass());
}
@AfterMethod
@@ -144,7 +144,7 @@
checkRecoveredData(cache1, 1);
printCacheDetails("DATA GRAVITATED BACK TO CACHE1");
- cache2 = new UnitTestCacheFactory<String, Integer>().createCache(cfg);
+ cache2 = new UnitTestCacheFactory<String, Integer>().createCache(cfg, getClass());
printCacheDetails("BUDDY BACK");
runBuddyUpdatesAndFail();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -134,7 +134,7 @@
protected CacheSPI<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, false, false, true), false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, false, false, true), false, getClass());
String threadId = Thread.currentThread().getName();
//c.getConfiguration().setClusterName("BuddyReplicationTest-" + threadId);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -247,7 +247,7 @@
Configuration cfg1 = cache1.getConfiguration();
configureEviction(cfg1);
Configuration cfg0 = cfg1.clone();
- CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg0, false);
+ CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg0, false, getClass());
// Store them for the teardown method
List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
@@ -297,9 +297,9 @@
Configuration cfg0 = cache0.getConfiguration();
configureEviction(cfg0);
Configuration cfg1 = cfg0.clone();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg1, false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg1, false, getClass());
Configuration cfg2 = cfg0.clone();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false, getClass());
// Store them for the teardown method
List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -36,7 +36,7 @@
c1 = createCache(1, null, false, false, false);
c1.getConfiguration().setUseRegionBasedMarshalling(true);
c1.getConfiguration().setFetchInMemoryState(true);
- c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), false, getClass());
c1.start();
region = c1.getRegion(regionFqn, true);
region2 = c1.getRegion(region2Fqn, true);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
cache1.getConfiguration().setEvictionConfig(getEvictionConfig());
cache1.start();
- cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone());
+ cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), getClass());
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
}
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,26 +2,27 @@
import org.easymock.EasyMock;
import static org.easymock.EasyMock.*;
+import org.jboss.cache.AbstractMultipleCachesTest;
import org.jboss.cache.Cache;
import org.jboss.cache.RPCManager;
+import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.ReplicationQueueNotifier;
import org.jgroups.Address;
+import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Collections;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
-import org.jboss.cache.UnitTestCacheFactory;
@Test(groups = "functional", sequential = true, testName = "cluster.ReplicationQueueTest")
-public class ReplicationQueueTest
+public class ReplicationQueueTest extends AbstractMultipleCachesTest
{
private static final int COUNT = 10;
Cache cache, cache2;
@@ -29,21 +30,20 @@
ComponentRegistry registry;
RPCManager originalRpcManager;
- @BeforeMethod
- public void setUp() throws CloneNotSupportedException
+ protected void createCaches() throws Throwable
{
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_ASYNC);
c.setUseReplQueue(true);
c.setReplQueueMaxElements(COUNT);
c.setReplQueueInterval(-1);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
registry = TestingUtil.extractComponentRegistry(cache);
replQ = registry.getComponent(ReplicationQueue.class);
originalRpcManager = cache.getConfiguration().getRuntimeConfig().getRPCManager();
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
-
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone(), getClass());
+ registerCaches(cache, cache2);
TestingUtil.blockUntilViewsReceived(60000, cache, cache2);
}
@@ -52,9 +52,7 @@
{
// reset the original RPCManager
injectRpcManager(originalRpcManager);
- TestingUtil.killCaches(cache, cache2);
- cache = null;
- cache2 = null;
+ registry.rewire();
}
private void injectRpcManager(RPCManager manager)
@@ -76,7 +74,7 @@
// check that nothing on the RPCManager will be called until we hit the replication queue threshold.
for (int i = 0; i < COUNT - 1; i++) cache.put("/a/b/c/" + i, "k", "v");
- assert replQ.elements.size() == COUNT - 1;
+ assertEquals(replQ.elements.size(), COUNT - 1);
// verify that no calls have been made on the mockRpcManager
verify(mockRpcManager);
@@ -99,8 +97,8 @@
public void testFlushConcurrency() throws Exception
{
// will create multiple threads to constantly perform a cache update, and measure the number of expected invocations on the RPC manager.
- final int numThreads = 25;
- final int numLoopsPerThread = 1000;
+ final int numThreads = 5;
+ final int numLoopsPerThread = 200;
int totalInvocations = numThreads * numLoopsPerThread;
@@ -153,7 +151,6 @@
ReplicationQueueNotifier notifier = new ReplicationQueueNotifier(cache);
notifier.waitUntillAllReplicated(250);
-// TestingUtil.sleepThread(250); // make sure the queue flushes
assert replQ.elements.size() == 0;
}
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -24,12 +24,12 @@
public void setUp() throws CloneNotSupportedException
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setUseReplQueue(true);
cache.getConfiguration().setReplQueueInterval(100);
cache.getConfiguration().setReplQueueMaxElements(10);
cache.start();
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone(), getClass());
TestingUtil.blockUntilViewsReceived(60000, cache, cache2);
txManager = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false, getClass());
cache.start();
txMgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, getClass());
txMgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -67,8 +67,8 @@
{
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- Cache<String, String> cache = instance.createCache(config, false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ Cache<String, String> cache = instance.createCache(config, false, getClass());
caches.add(cache);
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -93,7 +93,7 @@
{
System.out.println("Processing file: " + aConfFile);
assert !appender.isFoundUnknownWarning();
- Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true);
+ Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true, getClass());
cache.stop();
assert !appender.isFoundUnknownWarning();
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -56,12 +56,12 @@
void initCaches() throws Exception
{
TestingUtil.recursiveFileRemove(tmpDir + cacheLoaderDir);
- CacheFactory<Integer, String> factory = new UnitTestCacheFactory<Integer, String>();
+ UnitTestCacheFactory<Integer, String> factory = new UnitTestCacheFactory<Integer, String>();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
conf.setEvictionConfig(buildEvictionConfig());
conf.setCacheLoaderConfig(buildCacheLoaderConfig());
conf.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache = factory.createCache(conf, true);// read in generic local xml
+ cache = factory.createCache(conf, true, getClass());// read in generic local xml
}
private CacheLoaderConfig buildCacheLoaderConfig()
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -20,7 +20,7 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
cfg.getEvictionConfig().setWakeupInterval(0);
- c = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
RegionManager rm = cr.getComponent(RegionManager.class);
EvictionTimerTask ett = rm.getEvictionTimerTask();
@@ -39,7 +39,7 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
cfg.getEvictionConfig().setWakeupInterval(10);
- c = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
RegionManager rm = cr.getComponent(RegionManager.class);
EvictionTimerTask ett = rm.getEvictionTimerTask();
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new ElementSizeAlgorithmConfig(-1, 5)));
evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/test/"), new ElementSizeAlgorithmConfig(5000, 1)));
conf.setEvictionConfig(evConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -196,7 +196,7 @@
try
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
regionManager = cache.getRegionManager();
assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
}
@@ -208,7 +208,7 @@
private CacheSPI<Object, Object> setupCache(String configurationName)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(configurationName, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(configurationName, false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
EvictionConfig econf = new EvictionConfig(eRC);
econf.setWakeupInterval(100);
conf.setEvictionConfig(econf);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
cache.start();
future = System.currentTimeMillis() + 500;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.EvictionController;
-import org.jboss.cache.util.internals.EvictionWatcher;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -24,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
+
import org.jboss.cache.UnitTestCacheFactory;
/**
@@ -66,7 +65,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());// read in generic local xml
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
evController = new EvictionController(cache);
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -58,7 +58,7 @@
evConfig.setEvictionRegionConfigs(regionConfigs);
conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
conf.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
System.out.println("-- wakeupInterval is " + wakeupIntervalMillis);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.EvictionController;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -72,7 +71,7 @@
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
}
public void testEviction() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -56,7 +56,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
String dfltRootStr = "/a/";
String testRootStr = "/test/";
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
config.setEvictionConfig(buildEvictionConfig());
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
}
private EvictionConfig buildEvictionConfig() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -70,8 +70,8 @@
private void initCaches()
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Object> instance = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI<Object, Object>) instance.createCache(conf, false);
+ UnitTestCacheFactory<Object, Object> instance = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI<Object, Object>) instance.createCache(conf, false, getClass());
EvictionConfig erc = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new LRUAlgorithmConfig(0, 0, 10)), 200);
conf.setEvictionConfig(erc);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false, getClass());
cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.getConfiguration().getEvictionConfig().setWakeupInterval(wakeupIntervalMillis);
@@ -41,7 +41,7 @@
cache1.getNotifier().addCacheListener(listener);
listener.resetCounter();
- cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache3.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache3.getConfiguration().setUseRegionBasedMarshalling(true);
cache3.getConfiguration().getEvictionConfig().setWakeupInterval(wakeupIntervalMillis);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -211,7 +211,7 @@
Cache cache = null;
try
{
- cache = new UnitTestCacheFactory().createCache(c);
+ cache = new UnitTestCacheFactory().createCache(c, getClass());
EvictionRegionConfig erc = cache.getRegion(Fqn.ROOT, false).getEvictionRegionConfig();
assert erc.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
ec.setWakeupInterval(200);
ec.addEvictionRegionConfig(regionCfg);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setEvictionConfig(ec);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,7 +15,7 @@
{
public void testConstruction()
{
- Cache c = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
+ Cache c = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), getClass());
c.put("/a", "b", "c");
TestingUtil.killCaches(c);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
public void setUp() throws Exception
{
Configuration c = new Configuration();
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
cache.create();
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -157,14 +157,14 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
- CacheFactory cacheFactory2 = new UnitTestCacheFactory<Object, Object>();
- CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config);
+ UnitTestCacheFactory cacheFactory2 = new UnitTestCacheFactory<Object, Object>();
+ CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config, getClass());
defaultInterceptroCount = tmpCacheSPI.getInterceptorChain().size();
tmpCacheSPI.stop();
- CacheFactory cacheFactory = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cacheFactory = new UnitTestCacheFactory<Object, Object>();
config.setCustomInterceptors(interceptorConfig);
- cache = (CacheSPI) cacheFactory.createCache(config, true);
+ cache = (CacheSPI) cacheFactory.createCache(config, true, getClass());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
configuration.setCacheMode(LOCAL);
configuration.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
configuration.setUseLazyDeserialization(false);
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configuration,false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configuration,false, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -428,7 +428,7 @@
Configuration c = new Configuration();
c.setCacheMode(cache_mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
return retval;
}
Modified: core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -73,7 +73,7 @@
@Override
protected Cache<Object, Object> createCache(Configuration config)
{
- return new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ return new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
}
Modified: core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -55,8 +55,8 @@
private Cache<String, Object> createCache(boolean optimistic)
{
- CacheFactory<String, Object> cf = new UnitTestCacheFactory<String, Object>();
- Cache<String, Object> cache = cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, Object> cf = new UnitTestCacheFactory<String, Object>();
+ Cache<String, Object> cache = cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
caches.add(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
@BeforeMethod
public void createLatches()
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(getClass());
testInterceptor = new TestInterceptor();
((CacheSPI) cache).addInterceptor(testInterceptor, TxInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,13 +32,13 @@
public void testDefaultInterceptorStack()
{
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
TestingUtil.killCaches(c);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setUseLazyDeserialization(true);
c.start();
@@ -49,7 +49,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(true);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg, getClass());
System.out.println(CachePrinter.printCacheInterceptors(c));
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) != null;
@@ -59,7 +59,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(false);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg, getClass());
System.out.println(CachePrinter.printCacheInterceptors(c));
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -876,7 +876,7 @@
if (optimistic) c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
toClean.add(cache);
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -66,8 +66,8 @@
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setEvictionConfig(ec);
- c1 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
- c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), false);
+ c1 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
+ c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), false, getClass());
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -45,8 +45,8 @@
c1.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c2.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml");
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", getClass());
tm = cache.getTransactionManager();
}
@@ -151,7 +151,7 @@
cache = null;
}
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/replSync.xml", false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/replSync.xml", false, getClass());
cache.getConfiguration().setCacheMode(CacheMode.REPL_ASYNC);
cache.start();
tm = cache.getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.jmx;
-import com.mchange.v2.c3p0.util.TestUtils;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
@@ -35,9 +34,8 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import org.jboss.cache.CacheSPI;
+
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
/**
* Tester class for {@link JmxRegistrationManager}.
@@ -67,7 +65,7 @@
{
Configuration localConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL);
localConfig.setExposeManagementStatistics(true);
- Cache cache = cacheFactory.createCache(localConfig);
+ Cache cache = cacheFactory.createCache(localConfig, getClass());
JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.LOCAL_CACHE_PREFIX) == 0;
regManager.registerAllMBeans();
@@ -82,7 +80,7 @@
{
Configuration localConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
localConfig.setExposeManagementStatistics(true);
- Cache cache = cacheFactory.createCache(localConfig);
+ Cache cache = cacheFactory.createCache(localConfig, getClass());
JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.REPLICATED_CACHE_PREFIX) == 0;
regManager.registerAllMBeans();
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -111,8 +111,8 @@
protected Cache<String, String> createCache(Configuration config)
{
- CacheFactory<String, String> factory = new UnitTestCacheFactory<String, String>();
- cache = factory.createCache(config, false);
+ UnitTestCacheFactory<String, String> factory = new UnitTestCacheFactory<String, String>();
+ cache = factory.createCache(config, false, getClass());
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -280,8 +280,8 @@
private CacheSPI<Object, Object> createCache(String clusterName) throws Exception
{
Configuration config = createConfiguration(clusterName);
- CacheFactory<Object, Object> factory = new UnitTestCacheFactory<Object, Object>();
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) factory.createCache(config, false);
+ UnitTestCacheFactory<Object, Object> factory = new UnitTestCacheFactory<Object, Object>();
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) factory.createCache(config, false, getClass());
cache.create();
// start the cache after the listener has been registered
Modified: core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -68,8 +68,8 @@
{
newImpl = getNewCacheLoader((Properties) props.clone());
oldImpl = getOldLoader((Properties) props.clone());
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
- cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
+ cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
newImpl.setCache(cache);//this is needed for marshaller
oldImpl.setCache(cache2);
oldImpl.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
protected void configureCache(String props) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
// cache.setCacheLoaderConfiguration(buildSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader",
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", props, true, false, true));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -130,7 +130,7 @@
* name and TransactionManagerLookupClass (transactional) propertes only.
* the CacheSPI object is not used otherwise during testing.
*/
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setClusterName("myCluster");
if (transactional)
{
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
public void setUp() throws Exception
{
if (cache != null) tearDown();
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, false));
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,7 +42,7 @@
public void testSingleLoaderNoPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
String s = "bin=" + getClass().getName();
@@ -67,7 +67,7 @@
public void testSingleLoaderPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
String s = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), s, false, false, false, true));
@@ -94,7 +94,7 @@
public void testTwoLoadersPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
String xml =
" <loaders passivation=\"false\">\n" +
" <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"true\"\n" +
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
@BeforeMethod
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -10,8 +10,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -44,11 +42,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "debug=true", false, true, false));
cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "debug=true", false, true, false));
cache2.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(ignoreMods1, ignoreMods2));
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -65,8 +65,8 @@
c2.setUseRegionBasedMarshalling(useRegionBasedMarshalling);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.getConfiguration().setSerializationExecutorPoolSize(0);
cache2.getConfiguration().setSerializationExecutorPoolSize(0);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
CacheLoaderConfig cacheLoaderConfig = getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false);
Configuration cfg = new Configuration();
cfg.setCacheLoaderConfig(cacheLoaderConfig);
- cache = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ cache = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
cache.put(fqn, key, "value");
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -75,7 +75,7 @@
// expected
}
props = TestDbPropertiesFactory.getTestDbProperties();
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(props));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
public void testBlockingProblem() throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
//setCacheLoader(new TestSlowCacheLoader());
CacheLoaderConfig clc = new CacheLoaderConfig();
IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,7 +27,7 @@
public void setUp() throws Exception
{
props = TestDbPropertiesFactory.getTestDbProperties();
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", JDBCCacheLoader.class.getName(), props, false, false, true));
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -93,11 +93,11 @@
public void testSimpleStateTransfer() throws Exception
{
- first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1));
+ first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
first.put("/a/b/c", "key", "value");
first.put("/a/b/d", "key", "value");
first.put("/a/b/e", "key", "value");
- second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2));
+ second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());
assert second.get("/a/b/c","key").equals("value");
assert second.get("/a/b/d","key").equals("value");
assert second.get("/a/b/e","key").equals("value");
@@ -111,7 +111,7 @@
{
long startTime = System.currentTimeMillis();
- first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1));
+ first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
long cacheStartTime = System.currentTimeMillis() - startTime;
System.out.println("cacheStartTime = " + cacheStartTime);
for (int i = 0; i < 5012; i++)
@@ -120,7 +120,7 @@
if (i%1000 == 0) System.out.println(i + " operations executed so far");
}
startTime = System.currentTimeMillis();
- second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2));
+ second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());
long stateTranferTime = System.currentTimeMillis() - startTime - cacheStartTime;
for (int i = 0; i < 5012; i+=100)
Modified: core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -14,7 +14,7 @@
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -29,13 +29,13 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL);
String props = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/a", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
cache.put(fqn, key, value);
assertExists();
cache.destroy();
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
}
@@ -44,22 +44,22 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL);
String props = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/a", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
cache.put(fqn, key, value);
assertExists();
cache.destroy();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/c,/a,/b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/c, /a, /b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig(" /c, /a, /b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,8 +46,8 @@
c1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, true));
c2.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, true));
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,9 +46,9 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache2.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setCacheLoaderConfig(getCacheLoaderConfig());
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
cache.start();
loader = cache.getCacheLoaderManager().getCacheLoader();
@@ -121,7 +121,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -133,7 +133,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -145,7 +145,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
wrapper.start();
cache_server.setCacheJmxWrapper(wrapper);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
c1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
// cache1.setReplQueueInterval(3000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
cache1.create();
cache1.start();
@@ -51,7 +51,7 @@
c2.setLockAcquisitionTimeout(2000);
// cache2.setReplQueueInterval(3000);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache2.create();
cache2.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -17,7 +17,6 @@
import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -44,7 +43,7 @@
private void setUp(NodeLockingScheme locking) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
clc.addIndividualCacheLoaderConfig(iclc);
@@ -146,8 +145,8 @@
assertEquals(m0, cache.peek(parent, false).getData());
verify(mockCacheLoader);
- CachePrinter.printCacheDetails(cache);
- cache.toString();
+ CachePrinter.printCacheDetails(cache);
+ cache.toString();
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
clc.addIndividualCacheLoaderConfig(iclc);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -124,7 +124,7 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -154,7 +154,7 @@
throw new IllegalStateException(cacheID + " already created");
}
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -69,7 +69,7 @@
Cache c = null;
try
{
- c = new UnitTestCacheFactory().createCache(false);
+ c = new UnitTestCacheFactory().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(nls);
c.getConfiguration().setLockParentForChildInsertRemove(set);
if (nls.isVersionedScheme())
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -78,7 +78,7 @@
CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -83,7 +83,7 @@
private CacheSPI<Object, Object> createCache(Configuration.CacheMode mode, IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.getConfiguration().setCacheMode(mode);
c.getConfiguration().setIsolationLevel(level);
Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -91,7 +91,7 @@
private CacheSPI<Object, Object> createCache(IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
Modified: core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -24,7 +24,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
// reduce LAT so the test runs faster
Modified: core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -42,7 +41,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c = cache.getConfiguration();
c.setUseRegionBasedMarshalling(true);
c.setFetchInMemoryState(false);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -80,7 +80,7 @@
// Use marshaller
c.setUseLazyDeserialization(useMarshalledValues);
c.setUseRegionBasedMarshalling(!useMarshalledValues);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -99,7 +99,7 @@
// ensure cleanup after each test
prop.setProperty("cache.jdbc.table.drop", "true");
- Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration config = cache.getConfiguration();
config.setUseRegionBasedMarshalling(useRegionBased);
config.setInactiveOnStartup(useRegionBased);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,7 +15,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
@@ -128,7 +127,7 @@
Configuration config = new Configuration();
config.setUseRegionBasedMarshalling(useRegionBased);
config.setInactiveOnStartup(useRegionBased);
- Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
EvictionConfig ec = new EvictionConfig();
ec.setWakeupInterval(1000000); // a long time; really disabled
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -281,7 +281,7 @@
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- Cache<Object, Object> cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ Cache<Object, Object> cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- c1 = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false);
+ c1 = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false, getClass());
c1.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
String jgroupsCfg = c1.getConfiguration().getClusterConfig();
@@ -50,7 +50,7 @@
c1.getConfiguration().setUseRegionBasedMarshalling(true);
c1.start();
- c2 = new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone());
+ c2 = new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), getClass());
replListener2 = ReplicationListener.getReplicationListener(c2);
TestingUtil.blockUntilViewsReceived(60000, c1, c2);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,12 +49,12 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false, getClass());
if (cache1.getConfiguration().getBuddyReplicationConfig() != null)
cache1.getConfiguration().setBuddyReplicationConfig(null);
cache1.getConfiguration().setUseLazyDeserialization(true);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache1.start();
cache2.start();
@@ -259,8 +259,8 @@
public void testCacheLoaders() throws CloneNotSupportedException
{
tearDown();
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -48,7 +48,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
r = cache.getRegionManager();
c = cache.getConfiguration();
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
Configuration c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setUseRegionBasedMarshalling(true);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
c1.setUseRegionBasedMarshalling(!useMarshalledValues);
c1.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c1.setSyncReplTimeout(60000);// to aid with debugging
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
cache1.start();
Configuration c2 = new Configuration();
@@ -58,7 +58,7 @@
c2.setUseRegionBasedMarshalling(!useMarshalledValues);
c2.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c2.setSyncReplTimeout(60000);// to aid with debugging
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache2.start();
classLoader = getClassLoader();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,8 +27,8 @@
Configuration c = new Configuration();
c.setCacheMode(CacheMode.REPL_SYNC);
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
- cache1 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone());
- cache2 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone());
+ cache1 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());
+ cache2 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -76,7 +76,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setClusterName(name + "-" + Thread.currentThread().getName());
// Use marshaller
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -152,6 +152,6 @@
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,7 +34,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setExposeManagementStatistics(true);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -92,14 +92,14 @@
private CacheSPI<String, Object> createCache() throws Exception
{
- CacheFactory<String, Object> instance = new UnitTestCacheFactory<String, Object>();
+ UnitTestCacheFactory<String, Object> instance = new UnitTestCacheFactory<String, Object>();
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setCacheLoaderConfig(getCacheLoaderConfig());
c.setExposeManagementStatistics(true);
- CacheSPI<String, Object> cache = (CacheSPI<String, Object>) instance.createCache(c, false);
+ CacheSPI<String, Object> cache = (CacheSPI<String, Object>) instance.createCache(c, false, getClass());
cache.create();
cache.start();
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -217,7 +217,7 @@
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
- new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK));
- cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
cacheStarted = false;
}
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,7 +34,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK));
- cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
cacheStarted = false;
}
Modified: core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -29,7 +29,7 @@
public void testDefaultConfiguration()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
assert TestingUtil.findInterceptor(cache, MVCCLockingInterceptor.class) != null : "MVCC interceptor should be in stack";
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
@@ -65,7 +65,7 @@
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setIsolationLevel(configuredWith);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
assert cache.getConfiguration().getIsolationLevel() == expected : "Expected to change isolation level from " + configuredWith + " to " + expected + " but was " + cache.getConfiguration().getIsolationLevel();
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -18,7 +18,7 @@
Cache<String, String> c = null;
try
{
- c = new UnitTestCacheFactory<String, String>().createCache();
+ c = new UnitTestCacheFactory<String, String>().createCache(getClass());
CountDownLatch latch = new CountDownLatch(2);
AbstractListener syncListener = new Listener(latch);
AbstractListener asyncListener = new AsyncListener(latch);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,16 +34,16 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
Configuration conf = new Configuration();
conf.setCacheMode(Configuration.CacheMode.REPL_SYNC);
BuddyReplicationConfig brc = new BuddyReplicationConfig();
brc.setEnabled(true);
conf.setBuddyReplicationConfig(brc);
- c1 = cf.createCache(conf, false);
- c2 = cf.createCache(conf.clone(), false);
- c3 = cf.createCache(conf.clone(), false);
+ c1 = cf.createCache(conf, false, getClass());
+ c2 = cf.createCache(conf.clone(), false, getClass());
+ c3 = cf.createCache(conf.clone(), false, getClass());
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
clc.setPassivation(true);
c.setCacheLoaderConfig(clc);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
eventLog.events.clear();
cache.addCacheListener(eventLog);
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,7 +59,7 @@
if (optLocking)
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
eventLog.events.clear();
cache.addCacheListener(eventLog);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(getClass());
listener = new Listener();
cache.addCacheListener(listener);
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
{
// need 2 caches to test viewChange notifications
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration conf1 = new Configuration();
Configuration conf2 = new Configuration();
@@ -54,8 +54,8 @@
conf2.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
conf1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), (Properties)null, false, false, false));
- cache1 = instance.createCache(conf1, false);
- cache2 = instance.createCache(conf2, false);
+ cache1 = instance.createCache(conf1, false, getClass());
+ cache2 = instance.createCache(conf2, false, getClass());
listener = new TestCacheListener();
cache1.addCacheListener(listener);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,8 +26,8 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.INVALIDATION_SYNC, false);
cfg.setNodeLockingScheme(NodeLockingScheme.MVCC);
- c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone());
- c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone());
+ c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
+ c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
EventLog eventLog = new EventLog();
c2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
c2.put("/a/b/c", "x", "y");
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -86,9 +86,9 @@
// more time to help with debugging
c.setSyncReplTimeout(60000);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache1 = instance.createCache(c);
- cache2 = instance.createCache(c.clone());
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache1 = instance.createCache(c, getClass());
+ cache2 = instance.createCache(c.clone(), getClass());
eventLog1.events.clear();
eventLog2.events.clear();
@@ -649,8 +649,8 @@
cache1.put(fqnB, data);
// create cache2
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache2 = instance.createCache(cache1.getConfiguration().clone(), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache2 = instance.createCache(cache1.getConfiguration().clone(), false, getClass());
cache2.create();
eventLog2.events.clear();
cache2.addCacheListener(eventLog2);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,7 +60,7 @@
protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL), false, getClass());
if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
return cache;
}
@@ -140,7 +140,7 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
@@ -159,7 +159,7 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.create();
cache.start();
@@ -193,7 +193,7 @@
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setSerializationExecutorPoolSize(0);
if (start)
@@ -231,7 +231,7 @@
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setCacheLoaderConfig(getCacheLoaderConfig(shared, false));
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
@BeforeMethod
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
public void setUp() throws IOException
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,14 +33,14 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
caches = new ArrayList<Cache<Object, Object>>(2);
- caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false));
+ caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass()));
caches.get(0).start();
c = new Configuration();
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false));
+ caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass()));
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,12 +35,12 @@
Configuration c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cacheModeLocal = new Option();
cacheModeLocal.setCacheModeLocal(true);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -52,7 +52,7 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,8 +40,8 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,14 +60,14 @@
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
Configuration c = new Configuration();
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setNodeLockingScheme(nodeLockingScheme);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(c);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(c, getClass());
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,8 +41,8 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(false, getClass());
// very short acquisition timeout
cache.getConfiguration().setLockAcquisitionTimeout(100);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -43,9 +43,9 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
config.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI<String, String>) instance.createCache(config);
+ cache = (CacheSPI<String, String>) instance.createCache(config, getClass());
m = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -62,7 +62,7 @@
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setClusterName("test");
@@ -72,7 +72,7 @@
c.setCacheMode(cacheMode);
c.setSerializationExecutorPoolSize(0);
- cache1 = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache1 = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache1.start();
c = new Configuration();
@@ -83,7 +83,7 @@
c.setCacheMode(cacheMode);
c.setSerializationExecutorPoolSize(0);
- cache2 = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache2 = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,17 +7,68 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.*;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationOptLocksTest")
public class SyncInvalidationOptLocksTest extends CacheModeLocalTestBase
{
+
public SyncInvalidationOptLocksTest()
{
cacheMode = Configuration.CacheMode.INVALIDATION_SYNC;
nodeLockingScheme = "OPTIMISTIC";
isInvalidation = true;
}
+
+
+ private void assertInvalidated(Cache cache, Fqn fqn, String msg)
+ {
+ assert cache.getRoot().getChild(fqn) == null : msg;
+ NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
+ assert true : msg;
+ assert !n.isValid() : msg;
+ }
+
+ public void testMoveInvalidations() throws Exception
+ {
+
+ Node rootNode = cache1.getRoot();
+
+ Node<Object, Object> nodeA = rootNode.addChild(Fqn.fromString("/a"));
+ Node<Object, Object> nodeB = nodeA.addChild(Fqn.fromString("/b"));
+
+ nodeA.put("key", "valueA");
+ nodeB.put("key", "valueB");
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/a")).getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromRelativeElements(Fqn.fromString("/a"), Fqn.fromString("/b").getLastElement()), "Should be invalidated");
+
+ // now move...
+ cache1.move(nodeB.getFqn(), Fqn.ROOT);
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromString("/b"), "Should be invalidated");
+
+ // now make sure a node exists on cache 2
+ cache2.getRoot().addChild(Fqn.fromString("/a")).put("k2", "v2");
+
+ // te invalidation will happen in afterCompletion, hence no exception!
+ try
+ {
+ cache1.move(Fqn.fromString("/b"), Fqn.fromString("/a"));// should throw an NPE
+ }
+ catch (Exception expected)
+ {
+ assert false : "Should not have thrown an exception!";
+ }
+ }
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,17 +7,66 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.*;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationPessLocksTest")
public class SyncInvalidationPessLocksTest extends CacheModeLocalTestBase
{
- public SyncInvalidationPessLocksTest()
+
+ public SyncInvalidationPessLocksTest()
{
cacheMode = Configuration.CacheMode.INVALIDATION_SYNC;
nodeLockingScheme = "PESSIMISTIC";
isInvalidation = true;
}
+
+ public void testMoveInvalidations() throws Exception
+ {
+
+ Node rootNode = cache1.getRoot();
+
+ Node<Object, Object> nodeA = rootNode.addChild(Fqn.fromString("/a"));
+ Node<Object, Object> nodeB = nodeA.addChild(Fqn.fromString("/b"));
+
+ nodeA.put("key", "valueA");
+ nodeB.put("key", "valueB");
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/a")).getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromRelativeElements(Fqn.fromString("/a"), Fqn.fromString("/b").getLastElement()), "Should be invalidated");
+
+ // now move...
+ cache1.move(nodeB.getFqn(), Fqn.ROOT);
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromString("/b"), "Should be invalidated");
+
+ // now make sure a node exists on cache 2
+ cache2.getRoot().addChild(Fqn.fromString("/a")).put("k2", "v2");
+
+ // te invalidation will happen in afterCompletion, hence no exception!
+ try
+ {
+ cache1.move(Fqn.fromString("/b"), Fqn.fromString("/a"));// should throw an NPE
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ private void assertInvalidated(Cache cache, Fqn fqn, String msg)
+ {
+ assert cache.getRoot().getChild(fqn) == null : msg;
+ NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
+ }
+
+
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -58,8 +58,8 @@
private void initCaches()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Object listener = new TestCacheListener();
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -47,8 +47,8 @@
private void initCaches()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -43,8 +43,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -51,8 +51,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
configureEviction();
configureCacheLoader();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,7 +42,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
configureCache();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -4,7 +4,6 @@
import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.LocalDelegatingCacheLoaderConfig;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
@@ -24,7 +23,7 @@
protected void configureCache() throws Exception
{
- CacheSPI delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,7 +27,6 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -38,8 +37,6 @@
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.Test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.util.HashSet;
import java.util.Set;
@@ -99,8 +96,8 @@
nameSet.add("b");
nameSet.add("c");
- cache1 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", true, false, true));
- cache2 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", true, false, true));
+ cache1 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", true, false, true), getClass());
+ cache2 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", true, false, true), getClass());
Region r1 = cache1.getRegionManager().getRegion(subtree, true);
Region r2 = cache2.getRegionManager().getRegion(subtree, true);
@@ -140,7 +137,7 @@
nameSet.add(B.getLastElement());
nameSet.add(C.getLastElement());
- cache1 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", false, useBR, true));
+ cache1 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", false, useBR, true), getClass());
cache1.put(A, "k", "v");
cache1.put(B, "k", "v");
@@ -149,7 +146,7 @@
cache1.evict(A);
- cache2 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", false, useBR, true));
+ cache2 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", false, useBR, true), getClass());
if (useBR)
{
Set backupNameSet = new HashSet(nameSet);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -68,12 +68,12 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache1 = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache1 = (CacheSPI<String, String>) instance.createCache(getCfg(), false, getClass());
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.start();
- cache2 = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
+ cache2 = (CacheSPI<String, String>) instance.createCache(getCfg(), false, getClass());
cache2.getConfiguration().setUseRegionBasedMarshalling(true);
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -23,7 +23,7 @@
public void setUp()
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(cfg, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(cfg, false, getClass());
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -19,7 +19,7 @@
public void testConstruction() throws InterruptedException
{
- for (int i = 0; i < WARMUP; i++) new UnitTestCacheFactory<Object, Object>().createCache();
+ for (int i = 0; i < WARMUP; i++) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
System.out.println("Finished warmup.");
System.gc();
Thread.sleep(1000);
@@ -31,7 +31,7 @@
{
for (int i = 0; i < LOOPS; i++)
{
- new UnitTestCacheFactory<Object, Object>().createCache();
+ new UnitTestCacheFactory<Object, Object>().createCache(getClass());
if (i % 100 == 0) System.out.println("In loop num " + i);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -19,7 +19,7 @@
public void testLocal() throws IOException
{
- Cache<String, String> c = new UnitTestCacheFactory<String, String>().createCache(false);
+ Cache<String, String> c = new UnitTestCacheFactory<String, String>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
c.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
// c.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL);
cfg.setNodeLockingScheme(NodeLockingScheme.MVCC);
cfg.setConcurrencyLevel(500);
- cache = new UnitTestCacheFactory<String, String>().createCache(cfg, false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(cfg, false, getClass());
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,7 +60,7 @@
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
c.setClusterName(name);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
// Call the hook that allows mux integration
configureMultiplexer(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -36,14 +36,14 @@
c.setSyncRollbackPhase(true);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setSyncCommitPhase(true);
c.setSyncRollbackPhase(true);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -100,8 +100,8 @@
c1.setLockAcquisitionTimeout(5000);
c2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
configureMultiplexer(cache1);
configureMultiplexer(cache2);
@@ -610,8 +610,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- final CacheSPI<Object, Object> c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- final CacheSPI<Object, Object> c2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ final CacheSPI<Object, Object> c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ final CacheSPI<Object, Object> c2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -73,7 +73,7 @@
private void initCaches(Configuration.CacheMode caching_mode)
{
- CacheFactory<String, ContainerData> instance = new UnitTestCacheFactory<String, ContainerData>();
+ UnitTestCacheFactory<String, ContainerData> instance = new UnitTestCacheFactory<String, ContainerData>();
Configuration conf1 = new Configuration();
Configuration conf2 = new Configuration();
@@ -91,8 +91,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<String, ContainerData>) instance.createCache(conf1, false);
- cache2 = (CacheSPI<String, ContainerData>) instance.createCache(conf2, false);
+ cache1 = (CacheSPI<String, ContainerData>) instance.createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<String, ContainerData>) instance.createCache(conf2, false, getClass());
cache1.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -95,8 +95,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,8 +34,8 @@
{
System.out.println("*** In setUp()");
Cache<Object, Object>[] caches = new Cache[2];
- caches[0] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
- caches[1] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[0] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
+ caches[1] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
cachesTL.set(caches);
TestingUtil.blockUntilViewsReceived(caches, 5000);
System.out.println("*** Finished setUp()");
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,7 +59,7 @@
c.setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
c.setStateRetrievalTimeout(60000);
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
// Put the cache in the map before starting, so if it fails in
// start it can still be destroyed later
@@ -79,7 +79,7 @@
c.setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
c.setStateRetrievalTimeout(60000);
- CacheSPI recipient = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI recipient = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
//Put the cache in the map before starting, so if it fails in
// start it can still be destroyed later
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
Cache<String, String> c1 = null, c2 = null;
try
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration cfg = new Configuration();
cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cfg.setCacheMode(CacheMode.REPL_SYNC);
@@ -52,13 +52,13 @@
cfg.setCacheLoaderConfig(clc);
cfg.setNodeLockingScheme(nls);
- c1 = cf.createCache(cfg.clone());
+ c1 = cf.createCache(cfg.clone(), getClass());
c1.put(fqn, k, v);
assert c1.get(fqn, k).equals(v);
assert getLoader(c1).get(fqn).get(k).equals(v);
- c2 = cf.createCache(cfg.clone());
+ c2 = cf.createCache(cfg.clone(), getClass());
assert c2.get(fqn, k).equals(v);
assert getLoader(c2).get(fqn).get(k).equals(v);
}
@@ -73,7 +73,7 @@
Cache<String, String> c1 = null, c2 = null;
try
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration cfg = new Configuration();
cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cfg.setCacheMode(CacheMode.REPL_SYNC);
@@ -89,13 +89,13 @@
cfg.setCacheLoaderConfig(clc);
cfg.setNodeLockingScheme(nls);
- c1 = cf.createCache(cfg.clone());
+ c1 = cf.createCache(cfg.clone(), getClass());
c1.put(fqn, k, v);
assert c1.get(fqn, k).equals(v);
assert getLoader(c1).get(fqn).get(k).equals(v);
- c2 = cf.createCache(cfg.clone());
+ c2 = cf.createCache(cfg.clone(), getClass());
assert c2.get(fqn, k).equals(v);
assert getLoader(c2).get(fqn) == null;
}
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -476,14 +476,14 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict1", cache1);
cache1.put(Fqn.fromString("/a/b/c"), "key", "value");
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict2", cache2);
RegionImpl region = (RegionImpl) cache2.getRegion(Fqn.ROOT, false);
@@ -507,7 +507,7 @@
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
Map<String, Cache> caches = cachesTL.get();
caches.put("evict1", cache1);
@@ -531,7 +531,7 @@
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- final Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ final Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict2", cache2);
Node<Object, Object> parent;// = cache2.getRoot().getChild(Fqn.fromString("/org/jboss/test/data"));
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -152,7 +152,7 @@
}
additionalConfiguration(c);
- CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
configureMultiplexer(tree);
// Put the cache in the map before starting, so if it fails in
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -99,8 +99,8 @@
cfg1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cfg2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(cfg1, true);
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(cfg1, true, getClass());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false, getClass());
UserTransaction tx1 = (UserTransaction) new InitialContext(p).lookup("UserTransaction");
writer = new Writer(cache1, tx1);
try
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,8 +53,8 @@
public void setUp() throws Exception
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Integer> instance = new UnitTestCacheFactory<Object, Integer>();
- cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false);
+ UnitTestCacheFactory<Object, Integer> instance = new UnitTestCacheFactory<Object, Integer>();
+ cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false, getClass());
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setStateRetrievalTimeout(10000);
c.setClusterName("test");
@@ -59,7 +59,7 @@
c.setLockParentForChildInsertRemove(true);
c.setLockAcquisitionTimeout(3000);
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.create();
cache.start();
thread_ex = null;
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,7 +41,7 @@
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setLockAcquisitionTimeout(2000);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,12 +54,12 @@
writerError = null;
readerError = null;
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setIsolationLevel(IsolationLevel.READ_COMMITTED);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -55,8 +55,8 @@
config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache(config);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(config, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,13 +42,13 @@
writerFailed = false;
writerError = null;
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setLockAcquisitionTimeout(1000);
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,8 +49,8 @@
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache(config);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(config, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,7 +46,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(REPL_SYNC));
+ c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(REPL_SYNC), getClass());
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -51,7 +51,7 @@
configuration.setCacheMode(Configuration.CacheMode.LOCAL);
configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
configuration.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI) new UnitTestCacheFactory().createCache(configuration);
+ cache = (CacheSPI) new UnitTestCacheFactory().createCache(configuration, getClass());
dataContainer = (DataContainerImpl) cache.getComponentRegistry().getComponent(DataContainer.class);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -102,14 +102,14 @@
public void setUp() throws Exception
{
exception = null;
- CacheFactory<Boolean, Boolean> instance = new UnitTestCacheFactory<Boolean, Boolean>();
+ UnitTestCacheFactory<Boolean, Boolean> instance = new UnitTestCacheFactory<Boolean, Boolean>();
// setup and start the source cache
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setSyncCommitPhase(true);
c.setLockAcquisitionTimeout(LOCK_ACQUISITION_TIMEOUT);
- srcCache = (CacheSPI<Boolean, Boolean>) instance.createCache(c, false);
+ srcCache = (CacheSPI<Boolean, Boolean>) instance.createCache(c, false, getClass());
srcCache.create();
srcCache.start();
@@ -119,7 +119,7 @@
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setSyncCommitPhase(true);
c.setLockAcquisitionTimeout(LOCK_ACQUISITION_TIMEOUT);
- dstCache = (CacheSPI) instance.createCache(c, false);
+ dstCache = (CacheSPI) instance.createCache(c, false, getClass());
dstCache.create();
dstCache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
protected void setUp() throws Exception
{
if (cache == null) {
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -28,8 +28,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,8 +40,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = cf.createCache(false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = cf.createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setIsolationLevel(isolationLevel);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -61,7 +61,7 @@
conf.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
conf.setClusterConfig(getJGroupsStack());
conf.setFetchInMemoryState(false);
- CacheSPI c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ CacheSPI c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
if (!notifying)
{
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setSerializationExecutorPoolSize(0);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(c);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(c, getClass());
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
tm.setTransactionTimeout(txTimeout);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -9,7 +9,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.transaction.TransactionSetup;
@@ -56,7 +55,7 @@
conf.setIsolationLevel(level);
conf.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
conf.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache.put("/a/b/c", null);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -45,8 +45,8 @@
public void testWithoutTransactions() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -61,8 +61,8 @@
public void testWithTransactions() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -80,8 +80,8 @@
public void testWithTransactionsRepeatableRead() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,8 +59,8 @@
public void setUp() throws Exception
{
- CacheFactory<String, Comparable> instance = new UnitTestCacheFactory<String, Comparable>();
- cache = (CacheSPI<String, Comparable>) instance.createCache(false);
+ UnitTestCacheFactory<String, Comparable> instance = new UnitTestCacheFactory<String, Comparable>();
+ cache = (CacheSPI<String, Comparable>) instance.createCache(false, getClass());
cache.getConfiguration().setClusterName("test");
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setStateRetrievalTimeout(10000);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -31,8 +31,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<String, String>().createCache(false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(HeuristicFailingDummyTransactionManagerLookup.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory().createCache();
+ cache = new UnitTestCacheFactory().createCache(getClass());
}
@AfterMethod(alwaysRun = true)
More information about the jbosscache-commits
mailing list