Author: manik.surtani(a)jboss.com
Date: 2007-12-19 10:14:43 -0500 (Wed, 19 Dec 2007)
New Revision: 4880
Modified:
core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.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/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/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/ReplicatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.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/config/ChannelInjectionTest.java
core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.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/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/minttl/MinTTLTestBase.java
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
core/trunk/src/test/java/org/jboss/cache/jmx/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/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/LocalDelegatingCacheLoaderTest.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/UnnecessaryLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java
core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.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/CustomCollectionTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.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/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/notifications/AnnotationsTest.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/RemoteCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.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/ReplicatedPassivationIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.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/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/replicated/SyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.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/AbortionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.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/IsolationLevelNoneTest.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/PrepareTxTest.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/StatusUnknownTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java
Log:
Updated usage of singletons in DefaultCacheFactory and InterceptorChainFactory
Modified: core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -15,7 +15,7 @@
import java.util.List;
/**
- * Factory class that builds an interceptor chain based on CacheImpl config.
+ * Factory class that builds an interceptor chain based on cache configuration.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -39,7 +39,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- CacheFactory<String, String> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> cf = new DefaultCacheFactory();
cache = cf.createCache("META-INF/local-tx-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -1,21 +1,18 @@
package org.jboss.cache.api;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+
@Test(groups = {"functional"})
public class CacheSPITest
{
@@ -34,8 +31,8 @@
conf1.setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC
: Configuration.NodeLockingScheme.PESSIMISTIC);
conf2.setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC
: Configuration.NodeLockingScheme.PESSIMISTIC);
- cache1 = (CacheSPI<Object,
Object>)DefaultCacheFactory.getInstance().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf1, false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf2, false);
}
@AfterMethod(alwaysRun = true)
@@ -47,7 +44,9 @@
{
cache1.stop();
}
- catch (Exception e) {}
+ catch (Exception e)
+ {
+ }
}
if (cache2 != null)
@@ -56,7 +55,9 @@
{
cache2.stop();
}
- catch (Exception e) {}
+ catch (Exception e)
+ {
+ }
}
}
@@ -88,8 +89,8 @@
Configuration conf1 =
UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
Configuration conf2 =
UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf1, false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf2, false);
cache1.start();
assertTrue("Cache1 is coordinator",
cache1.getRPCManager().isCoordinator());
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -46,7 +46,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml",
false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
rootNode = cache.getRoot();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -46,7 +46,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml",
false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
rootNode = cache.getRoot();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -40,7 +40,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache1.getConfiguration().setSyncCommitPhase(true);
cache1.getConfiguration().setSyncRollbackPhase(true);
cache1.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
@@ -49,7 +49,7 @@
tm = cache1.getTransactionManager();
// start second instance
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache2.getConfiguration().setSyncCommitPhase(true);
cache2.getConfiguration().setSyncRollbackPhase(true);
cache2.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -1,21 +1,17 @@
package org.jboss.cache.api;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Map;
-import java.util.Set;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.Map;
+import java.util.Set;
+
/**
* Tests NodeSPI specific APIs.
*/
@@ -28,7 +24,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
root = cache.getRoot();
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -37,7 +37,7 @@
{
Configuration cacheConfig =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(cacheConfig, false);
cache.getConfiguration().getEvictionConfig().setWakeupIntervalSeconds(1);
createNewRegion();
cache.start();
@@ -161,7 +161,7 @@
Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingOptimistic(true);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(config, true);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(config, true);
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 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -7,27 +7,24 @@
package org.jboss.cache.api;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.config.Option;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.Option;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
@@ -40,8 +37,8 @@
public void setUp()
{
System.out.println("*** In setUp()");
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
TestingUtil.blockUntilViewsReceived(new Cache[]{cache1, cache2}, 5000);
System.out.println("*** Finished setUp()");
@@ -107,7 +104,7 @@
cache1.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
assertEquals("Value should be set", "1", cache1.get(fqn,
"1"));
- map= new HashMap<Object, Object>();
+ map = new HashMap<Object, Object>();
map.put("3", "3");
map.put("4", "4");
cache1.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
@@ -139,7 +136,8 @@
{
InvocationContext ctx = c.getInvocationContext();
InvocationContext control = null;
- try {
+ try
+ {
control = ctx.clone();
}
catch (CloneNotSupportedException e)
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -7,50 +7,47 @@
package org.jboss.cache.api;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.config.Option;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.Option;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
@Test(groups = {"functional", "jgroups", "transaction"})
public class SyncReplTxTest
{
- private List<CacheSPI<Object, Object>> caches;
+ private List<CacheSPI<Object, Object>> caches;
@BeforeMethod(alwaysRun = true)
public void setUp()
{
System.out.println("*** In setUp()");
caches = new ArrayList<CacheSPI<Object, Object>>();
- caches.add((CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC)));
- caches.add((CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC)));
+ caches.add((CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC)));
+ caches.add((CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC)));
TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), 5000);
System.out.println("*** Finished setUp()");
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -43,7 +43,7 @@
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> f = new DefaultCacheFactory();
Cache<String, String> cache = f.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
optimisticConfiguration(cache.getConfiguration());
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -8,7 +8,6 @@
import org.testng.annotations.Test;
/**
- *
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
@@ -39,7 +38,7 @@
{
if (cache == null)
{
- CacheFactory<String, String> f = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> f = new DefaultCacheFactory();
cache = f.createCache(false);
optimisticConfiguration(cache.getConfiguration());
cache.start();
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -7,7 +7,6 @@
import org.testng.annotations.Test;
/**
- *
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
@@ -26,7 +25,7 @@
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> f = new DefaultCacheFactory();
Cache<String, String> cache = f.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
optimisticConfiguration(cache.getConfiguration());
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -140,7 +140,7 @@
CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
- CacheSPI<?, ?> cache = (CacheSPI<?, ?>)
DefaultCacheFactory.getInstance().createCache(c, false);
+ CacheSPI<?, ?> cache = (CacheSPI<?, ?>) new
DefaultCacheFactory().createCache(c, false);
cache.getConfiguration().setClusterName("TestCluster");
if (useMarshalling)
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -38,7 +38,7 @@
public void testNullConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setBuddyReplicationConfig(null);
assertNull(cache.getBuddyManager());
}
@@ -48,7 +48,7 @@
String xmlConfig =
"<config><buddyReplicationEnabled>false</buddyReplicationEnabled></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config =
XmlConfigurationParser.parseBuddyReplicationConfig(element);
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setBuddyReplicationConfig(config);
assertNull(cache.getBuddyManager());
}
@@ -58,7 +58,7 @@
String xmlConfig =
"<config><buddyReplicationEnabled>true</buddyReplicationEnabled></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config =
XmlConfigurationParser.parseBuddyReplicationConfig(element);
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache.getConfiguration().setBuddyReplicationConfig(config);
cache.create();
@@ -75,7 +75,7 @@
public void testXmlConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(new
XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"),
false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(new
XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"),
false);
cache.create();
cache.start();
BuddyManager bm = cache.getBuddyManager();
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -127,7 +127,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>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
c.getConfiguration().setClusterName("BuddyReplicationTest");
// basic config
String xmlString =
"<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n"
+
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -241,7 +241,7 @@
Configuration cfg1 = cache1.getConfiguration();
configureEviction(cfg1);
Configuration cfg0 = cfg1.clone();
- CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(cfg0, false);
+ CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(cfg0, false);
// Store them for the teardown method
if (caches == null)
@@ -290,9 +290,9 @@
Configuration cfg0 = cache0.getConfiguration();
configureEviction(cfg0);
Configuration cfg1 = cfg0.clone();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(cfg1, false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(cfg1, false);
Configuration cfg2 = cfg0.clone();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(cfg2, false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(cfg2, false);
// Store them for the teardown method
if (caches == null)
Modified: core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -66,7 +66,7 @@
{
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- CacheFactory<String, String> factory = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> factory = new DefaultCacheFactory();
Cache<String, String> cache = factory.createCache(config, false);
caches.add(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -169,7 +169,7 @@
*/
protected CacheModelDelegate createCacheDelegate() throws Exception
{
- CacheFactory<String, String> factory = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> factory = new DefaultCacheFactory();
Cache<String, String> cache = factory.createCache(configurationFile, false);
// hack to prevent a state transfer for now
cache.getConfiguration().setFetchInMemoryState(false);
@@ -206,8 +206,8 @@
private static void help()
{
System.out.println("JBossCacheView [-help] " +
- "[-console] " +
- "[-config <path to configuration file to use>]
");
+ "[-console] " +
+ "[-config <path to configuration file to use>] ");
System.out.println();
System.out.println("-console enables the embedded BeanShell console");
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -7,20 +7,19 @@
package org.jboss.cache.eviction;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Properties;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.fail;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.Properties;
+
/**
* Tests cache behavior in the presence of concurrent passivation.
*
@@ -50,8 +49,8 @@
void initCaches() throws Exception
{
TestingUtil.recursiveFileRemove(tmpDir + cacheLoaderDir);
- CacheFactory<Integer, String> factory = DefaultCacheFactory.getInstance();
- cache_ =
factory.createCache("META-INF/local-eviction-cacheloader-service.xml", false);//
read in generic local xml
+ CacheFactory<Integer, String> factory = new DefaultCacheFactory();
+ cache_ =
factory.createCache("META-INF/local-eviction-cacheloader-service.xml", false);//
read in generic local xml
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Properties p = new Properties();
p.put("location", tmpDir + cacheLoaderDir);
@@ -88,7 +87,7 @@
Fqn<Object> fqn = new Fqn<Object>(base, i / 100);
Integer key = i;
assertNotNull("found value under Fqn " + fqn + " and key
" + key,
- cache_.get(fqn, key));
+ cache_.get(fqn, key));
}
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -48,7 +48,7 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-elementsize-eviction-service.xml",
false);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-elementsize-eviction-service.xml",
false);// read in generic local xml
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/EvictionConfigurationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -193,14 +193,14 @@
public void testNoEviction() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
regionManager = cache.getRegionManager();
assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
}
private void setupCache(String configurationName)
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(configurationName, false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(configurationName, false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
EvictionConfig econf = new EvictionConfig(ExpirationPolicy.class.getName());
econf.setWakeupIntervalSeconds(1);
conf.setEvictionConfig(econf);
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf, false);
cache.start();
future = System.currentTimeMillis() + 4000;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-fifo-eviction-service.xml",
false);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-fifo-eviction-service.xml",
false);// read in generic local xml
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/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-lfu-eviction-service.xml",
false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lfu-eviction-service.xml",
false);
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/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -45,7 +45,7 @@
public void initCaches() throws Exception
{
- cache_ = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
+ cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
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/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -54,7 +54,7 @@
private void initCaches()
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-mru-eviction-service.xml",
false);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-mru-eviction-service.xml",
false);// read in generic local xml
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/OptimisticEvictionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -41,7 +41,7 @@
public void setUp() throws Exception
{
txManager = new DummyTransactionManagerLookup().getTransactionManager();
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/optimistic-eviction.xml");
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/optimistic-eviction.xml");
}
@AfterMethod(alwaysRun = true)
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -66,7 +66,7 @@
private void initCaches()
{
- cache_ = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
+ cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -28,14 +28,14 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache_ = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC,
true), false);
+ cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC,
true), false);
cache_.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache_.getConfiguration().setUseRegionBasedMarshalling(true);
cache_.start();
cache_.getNotifier().addCacheListener(listener_);
listener_.resetCounter();
- cache2_ = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache2_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache2_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache2_.getConfiguration().setUseRegionBasedMarshalling(true);
cache2_.start();
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,25 +1,18 @@
package org.jboss.cache.eviction.minttl;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.util.CachePrinter;
-import org.jboss.cache.eviction.EvictionPolicyConfigBase;
-import org.jboss.cache.eviction.LRUConfiguration;
-import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.Fqn;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.eviction.EvictionPolicyConfigBase;
+import org.jboss.cache.misc.TestingUtil;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
-import java.util.List;
-import java.util.LinkedList;
import java.util.Collections;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
/**
@@ -63,7 +56,7 @@
ec.setWakeupIntervalSeconds(1);
ec.setEvictionRegionConfigs(evictionRegionConfigs);
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setEvictionConfig(ec);
}
@@ -90,7 +83,7 @@
public void testWithMinimumTTL()
{
((EvictionPolicyConfigBase)
cache.getConfiguration().getEvictionConfig().getEvictionRegionConfigs().get(0).getEvictionPolicyConfig()).setMinTimeToLiveSeconds(3);
-
+
cache.start();
cache.put(fqn, "k", "v");
// in case any waiting threads in subclasses are waiting for the cache to be
initialised
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -52,7 +52,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -25,7 +25,7 @@
{
Configuration c = new Configuration();
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- Cache cache = DefaultCacheFactory.getInstance().createCache(c);
+ Cache cache = new DefaultCacheFactory().createCache(c);
assertInterceptorsHaveSameCache((CacheSPI) cache);
@@ -36,7 +36,7 @@
{
Configuration c = new Configuration();
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- Cache cache = DefaultCacheFactory.getInstance().createCache(c);
+ Cache cache = new DefaultCacheFactory().createCache(c);
assertInterceptorsHaveSameCache((CacheSPI) cache);
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,20 +1,16 @@
package org.jboss.cache.invocationcontext;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.Map;
-
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+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.Map;
+
/**
* A test to ensure the transactional context is properly set up in the IC
*
@@ -29,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml");
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml");
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,7 +1,14 @@
package org.jboss.cache.jmx;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@@ -9,14 +16,6 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.Configuration;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/**
* Tests the JMX wrapper class around the cache.
*
@@ -102,7 +101,7 @@
protected Cache<String, String> createCache(Configuration config)
{
- CacheFactory<String, String> factory = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> factory = new DefaultCacheFactory();
cache = factory.createCache(config, false);
return cache;
}
@@ -157,9 +156,9 @@
{
// should be 3 interceptor MBeans loaded:
ObjectName[] interceptorMBeanNames = {
- new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"TxInterceptor"),
- new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"CacheMgmtInterceptor"),
- new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"InvocationContextInterceptor")
+ new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"TxInterceptor"),
+ new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"CacheMgmtInterceptor"),
+ new ObjectName(baseName + JmxUtil.INTERCEPTOR_KEY +
"InvocationContextInterceptor")
};
for (ObjectName n : interceptorMBeanNames)
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -280,7 +280,7 @@
private CacheSPI<Object, Object> createCache(String clusterName) throws
Exception
{
Configuration config = createConfiguration(clusterName);
- CacheFactory<Object, Object> factory = DefaultCacheFactory.getInstance();
+ CacheFactory<Object, Object> factory = new DefaultCacheFactory();
CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
factory.createCache(config, false);
cache.create();
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -52,8 +52,8 @@
{
newImpl = getNewCacheLoader();
oldImpl = getOldLoader();
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
- CacheSPI cache2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ CacheSPI cache2 = (CacheSPI) new DefaultCacheFactory().createCache(false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -30,7 +30,7 @@
protected void configureCache(String props) throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
// cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("",
"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 2007-12-19 15:09:57 UTC
(rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2007-12-19 15:14:43 UTC
(rev 4880)
@@ -129,7 +129,7 @@
* name and TransactionManagerLookupClass (transactional) propertes only.
* the CacheSPI object is not used otherwise during testing.
*/
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -26,7 +26,7 @@
public void setUp() throws Exception
{
if (cache != null) tearDown();
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
DummyCacheLoader.class.getName(), "", false, false, false));
cache.start();
dummyLoader = (DummyCacheLoader) cache.getCacheLoaderManager().getCacheLoader();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -41,7 +41,7 @@
public void testSingleLoaderNoPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false));
@@ -65,7 +65,7 @@
public void testSingleLoaderPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false,
true));
cache.start();
@@ -91,7 +91,7 @@
public void testTwoLoadersPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
String xml = "<config>\n" +
"<passivation>false</passivation>\n" +
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -59,7 +59,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -37,11 +37,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = new DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
"org.jboss.cache.loader.DummyInMemoryCacheLoader", null, false, true, false));
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = new DefaultCacheFactory().createCache(false);
cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
"org.jboss.cache.loader.DummyInMemoryCacheLoader", null, false, true, false));
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -39,7 +39,7 @@
protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,8 +49,8 @@
public void setUp() throws Exception
{
if (cache1 != null || cache2 != null) tearDown();
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setClusterName("CCL-Test");
cache1.getConfiguration().setStateRetrievalTimeout(2000);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -6,27 +6,25 @@
*/
package org.jboss.cache.loader;
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.transaction.DummyTransactionManager;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.sql.DataSource;
-
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
public class DataSourceIntegrationTest extends AbstractCacheLoaderTestBase
{
private String old_factory = null;
@@ -67,7 +65,7 @@
{
// expected
}
- cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheImpl) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(JNDI_NAME));
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -39,7 +39,7 @@
public void testBlockingProblem() throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
//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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -13,7 +13,7 @@
/**
* To test the closing of JDBC connections
*/
-@Test (groups = {"functional"})
+@Test(groups = {"functional"})
public class JDBCCacheLoaderConnectionTest extends AbstractCacheLoaderTestBase
{
private Cache cache;
@@ -36,7 +36,7 @@
" cache.jdbc.user=user1\n" +
" cache.jdbc.password=user1";
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
JDBCCacheLoader.class.getName(), props, false, false, true, false));
cache.start();
}
@@ -53,7 +53,7 @@
for (int i = 0; i < 100; i++)
{
cache.put(new Fqn("C", Integer.toString(i)), "Blah",
Integer.toString(i));
- System.out.println("added "+i+" dummy node to Jboss
cache.");
+ System.out.println("added " + i + " dummy node to Jboss
cache.");
}
assertConnectionsClosed();
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -20,7 +20,7 @@
@SuppressWarnings("deprecation")
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(false);
+ delegating_cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -33,8 +33,8 @@
if (cache1 != null || cache2 != null) tearDown();
// set up 2 instances of CacheImpl with shared CacheLoaders.
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheMode("REPL_SYNC");
cache2.getConfiguration().setCacheMode("REPL_SYNC");
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -46,9 +46,9 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
- cache3 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ cache3 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
}
public void testPutCacheLoaderWithNoPush() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -55,7 +55,7 @@
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setCacheLoaderConfig(getCacheLoaderConfig());
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(c);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
cache.start();
loader = cache.getCacheLoaderManager().getCacheLoader();
@@ -144,7 +144,7 @@
public void testInjectCache() throws Exception
{
createTcpCacheServer();
- CacheSPI cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(CONFIG_FILE, false);
+ CacheSPI cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(CONFIG_FILE, false);
cache.start();
cache_server.setCache(cache);
startTcpCacheServer();
@@ -156,7 +156,7 @@
public void testInjectCacheJmxWrapper() throws Exception
{
createTcpCacheServer();
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(CONFIG_FILE, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(CONFIG_FILE, false);
CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cache);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -30,7 +30,7 @@
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheMode("repl_sync");
cache1.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -39,7 +39,7 @@
cache1.create();
cache1.start();
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache2.getConfiguration().setCacheMode("repl_sync");
cache2.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -37,7 +37,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new
CacheLoaderConfig.IndividualCacheLoaderConfig();
iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -122,7 +122,7 @@
Configuration c =
UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c,
false);
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -84,7 +84,7 @@
private CacheImpl createCache(Configuration.CacheMode mode, IsolationLevel level)
{
- CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+ CacheImpl c = (CacheImpl) new DefaultCacheFactory().createCache(false);
c.getConfiguration().setCacheMode(mode);
c.getConfiguration().setIsolationLevel(level);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -154,7 +154,7 @@
throw new IllegalStateException(cacheID + " already created");
}
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -71,7 +71,7 @@
CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -34,7 +34,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -86,7 +86,7 @@
private CacheSPI<Object, Object> createCache(IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.JBossTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,24 +1,18 @@
package org.jboss.cache.lock;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Collections;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-@Test(groups = { "functional" })
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Collections;
+
+@Test(groups = {"functional"})
public class WriteLockOnParentTest
{
private CacheSPI<Object, Object> cache;
@@ -28,7 +22,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
// reduce LAT so the test runs faster
cache.getConfiguration().setLockAcquisitionTimeout(500);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -24,33 +24,35 @@
// The problem is in the way READ_COMMITTED is implemented, i.e., writers are not blocked
by readers and this
// allows a reader to hold a lock when a writer comes in and deletes the node in
question.
-@Test(groups = {"functional"}, enabled = false) // Known issue - See
JBCACHE-1164 and JBCACHE-1165
+@Test(groups = {"functional"}, enabled = false)
+// Known issue - See JBCACHE-1164 and JBCACHE-1165
public class ConcurrentPutRemoveTest
{
- private TransactionManager tm;
+ private TransactionManager tm;
- private Cache cache;
+ private Cache cache;
private final Log log = LogFactory.getLog(ConcurrentPutRemoveTest.class);
private List<SeparateThread> threads;
@BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception {
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ public void setUp() throws Exception
+ {
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
- cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
- cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache.getConfiguration().setLockAcquisitionTimeout(10000);
- cache.start();
- tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
+ cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
+
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.getConfiguration().setLockAcquisitionTimeout(10000);
+ cache.start();
+ tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
threads = new ArrayList<SeparateThread>();
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- TestingUtil.killCaches(cache);
+ TestingUtil.killCaches(cache);
for (SeparateThread st : threads)
{
st.interrupt();
@@ -58,54 +60,66 @@
}
}
- @Test (invocationCount = 50, enabled = false)
- public void testLock() throws Exception {
- for (int x = 0; x < 2; x++) {
- SeparateThread t = new SeparateThread(x);
- threads.add(t);
- t.start();
- }
- for (SeparateThread separateThread : threads) {
- separateThread.join();
- if (separateThread.getException() != null) {
- throw separateThread.getException();
- }
- }
+ @Test(invocationCount = 50, enabled = false)
+ public void testLock() throws Exception
+ {
+ for (int x = 0; x < 2; x++)
+ {
+ SeparateThread t = new SeparateThread(x);
+ threads.add(t);
+ t.start();
+ }
+ for (SeparateThread separateThread : threads)
+ {
+ separateThread.join();
+ if (separateThread.getException() != null)
+ {
+ throw separateThread.getException();
+ }
+ }
- }
+ }
- private class SeparateThread extends Thread {
- Exception e = null;
+ private class SeparateThread extends Thread
+ {
+ Exception e = null;
- private int num = 0;
+ private int num = 0;
- public SeparateThread(int num) {
- this.num = num;
- }
+ public SeparateThread(int num)
+ {
+ this.num = num;
+ }
- public Exception getException() {
- return e;
- }
+ public Exception getException()
+ {
+ return e;
+ }
- public void run() {
- Thread.currentThread().setName("Thread:" + num);
- try {
- for (int x = 0; x < 1000; x++) {
+ public void run()
+ {
+ Thread.currentThread().setName("Thread:" + num);
+ try
+ {
+ for (int x = 0; x < 1000; x++)
+ {
tm.begin();
- log.warn("Before Remove ("+x+")");
- //inside transaction
- cache.removeNode(Fqn.fromString("/a"));
- log.warn("After Remove ("+x+")");
- tm.commit();
- //outside transaction
- log.warn("Before Put ("+x+")");
- cache.put(Fqn.fromString("/a/b/c/d"), "text"+x,"b");
- log.warn("After Put ("+x+")");
- }
- } catch (Exception e) {
- this.e = e;
- }
- }
- }
+ log.warn("Before Remove (" + x + ")");
+ //inside transaction
+ cache.removeNode(Fqn.fromString("/a"));
+ log.warn("After Remove (" + x + ")");
+ tm.commit();
+ //outside transaction
+ log.warn("Before Put (" + x + ")");
+ cache.put(Fqn.fromString("/a/b/c/d"), "text" + x,
"b");
+ log.warn("After Put (" + x + ")");
+ }
+ }
+ catch (Exception e)
+ {
+ this.e = e;
+ }
+ }
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -39,7 +39,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- c = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ c = (CacheSPI) new DefaultCacheFactory().createCache(false);
c.getConfiguration().setUseRegionBasedMarshalling(true);
c.getConfiguration().setFetchInMemoryState(false);
c.start();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -70,7 +70,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
cache.getConfiguration().setClusterName(name);
// Use marshaller
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -221,7 +221,7 @@
private Cache<Object, Object> createCache()
{
- Cache<Object, Object> cache =
DefaultCacheFactory.getInstance().createCache(false);
+ Cache<Object, Object> cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -6,15 +6,6 @@
*/
package org.jboss.cache.marshall;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
@@ -23,16 +14,23 @@
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
import org.jgroups.Global;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
/**
* Unit test demonstrating usability of marshalling for application redeployment in
application server.
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder
Zamarreno</a>
*/
-@Test(groups = {"functional"}, enabled = false) // this relies on an old
project structure that no longer exists
+@Test(groups = {"functional"}, enabled = false)
+// this relies on an old project structure that no longer exists
public class RedeploymentEmulationTest
{
private Cache<Object, Object> cache;
@@ -49,7 +47,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -28,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put(fqn, key, value);
}
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -37,7 +37,7 @@
private CacheSPI createCache()
{
- CacheSPI c = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI c = (CacheSPI) new DefaultCacheFactory().createCache(false);
c.getConfiguration().setCacheMode("REPL_SYNC");
c.getConfiguration().setUseRegionBasedMarshalling(true);
c.start();
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -32,13 +32,13 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache1.getConfiguration().setSyncReplTimeout(60000);// to aid with debugging
cache1.start();
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache2.getConfiguration().setUseRegionBasedMarshalling(true);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache2.getConfiguration().setSyncReplTimeout(60000);// to aid with debugging
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -66,7 +66,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache.getConfiguration().setClusterName(name);
// Use marshaller
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -154,6 +154,6 @@
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
- return (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -33,7 +33,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
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 2007-12-19 15:09:57
UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2007-12-19 15:14:43
UTC (rev 4880)
@@ -93,7 +93,7 @@
private CacheSPI<String, Object> createCache() throws Exception
{
- CacheFactory<String, Object> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, Object> instance = new DefaultCacheFactory();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setCacheLoaderConfig(getCacheLoaderConfig());
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2007-12-19 15:09:57 UTC (rev
4879)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2007-12-19 15:14:43 UTC (rev
4880)
@@ -210,7 +210,7 @@
private CacheSPI<Object, Object> createCache(String clusterName)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
cache.getConfiguration().setUseRegionBasedMarshalling(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache.getConfiguration().setExposeManagementStatistics(true);
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,13 +1,10 @@
package org.jboss.cache.multiplexer;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jgroups.JChannel;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -33,7 +30,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(JChannel.DEFAULT_PROTOCOL_STACK);
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
+ cache = new DefaultCacheFactory().createCache(config, false);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,16 +1,12 @@
package org.jboss.cache.multiplexer;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.RuntimeConfig;
import org.jgroups.Channel;
import org.jgroups.JChannel;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -36,7 +32,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(JChannel.DEFAULT_PROTOCOL_STACK);
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
+ cache = new DefaultCacheFactory().createCache(config, false);
cacheStarted = false;
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/AnnotationsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/AnnotationsTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/AnnotationsTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,11 +1,5 @@
package org.jboss.cache.notifications;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.notifications.annotation.CacheListener;
@@ -14,16 +8,19 @@
import org.jboss.cache.notifications.annotation.NodeMoved;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeMovedEvent;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* Tests both correct and incorrect annotations for listeners
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = { "functional" })
+@Test(groups = {"functional"})
public class AnnotationsTest
{
private Notifier n;
@@ -31,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- Cache c = DefaultCacheFactory.getInstance().createCache(false);
+ Cache c = new DefaultCacheFactory().createCache(false);
n = new Notifier(c);
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -8,27 +8,6 @@
*****************************************/
package org.jboss.cache.notifications;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_CREATED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_MODIFIED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_MOVED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_REMOVED;
-import static org.jboss.cache.notifications.event.Event.Type.TRANSACTION_COMPLETED;
-import static org.jboss.cache.notifications.event.Event.Type.TRANSACTION_REGISTERED;
-import static
org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.PUT_DATA;
-import static
org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.PUT_MAP;
-import static
org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.REMOVE_DATA;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
@@ -36,18 +15,30 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.notifications.event.Event;
+import static org.jboss.cache.notifications.event.Event.Type.*;
import org.jboss.cache.notifications.event.EventImpl;
+import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
+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.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Note that this is significantly different from the old
<b>TreeCacheListenerTest</b> of the JBoss Cache 1.x series, and
* exercises the new CacheListener annotation.
*
* @since 2.0.0
*/
-@Test(groups = { "functional" })
+@Test(groups = {"functional"})
public class CacheListenerTest
{
protected boolean optLocking = false;
@@ -66,7 +57,7 @@
if (optLocking)
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = DefaultCacheFactory.getInstance().createCache(c);
+ cache = new DefaultCacheFactory().createCache(c);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,12 +1,5 @@
package org.jboss.cache.notifications;
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
@@ -19,10 +12,16 @@
import org.jboss.cache.notifications.annotation.NodeRemoved;
import org.jboss.cache.notifications.annotation.NodeVisited;
import org.jboss.cache.notifications.event.Event;
+import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
@@ -38,7 +37,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = instance.createCache();
listener = new Listener();
cache.addCacheListener(listener);
@@ -65,7 +64,8 @@
for (int i = 0; i < workers.length; i++)
{
- workers[i] = new Thread() {
+ workers[i] = new Thread()
+ {
public void run()
{
try
Modified:
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,12 +1,6 @@
package org.jboss.cache.notifications;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.transaction.TransactionManager;
-
import junit.framework.Assert;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
@@ -15,26 +9,16 @@
import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.NodeActivated;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodePassivated;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.annotation.TransactionCompleted;
-import org.jboss.cache.notifications.annotation.TransactionRegistered;
-import org.jboss.cache.notifications.annotation.ViewChanged;
+import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import javax.transaction.TransactionManager;
+import java.util.LinkedList;
+import java.util.List;
+
/**
* Tests the threading model used when calling notifications
*
@@ -52,7 +36,7 @@
{
// need 2 caches to test viewChange notifications
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache1 = instance.createCache(false);
cache2 = instance.createCache(false);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
Modified:
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -48,12 +48,13 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
/**
* Remote conterpart of CacheListenerTest. Main difference is event is originating as
local.
*
* @since 2.0.0
*/
-@Test(groups={"functional"})
+@Test(groups = {"functional"})
public class RemoteCacheListenerTest
{
protected boolean optLocking = false;
@@ -81,7 +82,7 @@
// more time to help with debugging
c.setSyncReplTimeout(60000);
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache1 = instance.createCache(c);
cache2 = instance.createCache(c.clone());
@@ -618,7 +619,7 @@
cache1.put(fqnB, data);
// create cache2
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache2 = instance.createCache(cache1.getConfiguration().clone(), false);
cache2.create();
eventLog2.events.clear();
@@ -634,7 +635,7 @@
expected.add(new EventImpl(true, cache2, null, null, Fqn.ROOT, null, false, null,
false, null, NODE_CREATED));
expected.add(new EventImpl(false, cache2, null, null, Fqn.ROOT, null, false, null,
false, null, NODE_CREATED));
-
+
expected.add(new EventImpl(true, cache2, null, null, fqnA, null, false, null,
false, null, NODE_CREATED));
expected.add(new EventImpl(false, cache2, null, null, fqnA, null, false, null,
false, null, NODE_CREATED));
expected.add(new EventImpl(true, cache2,
NodeModifiedEvent.ModificationType.PUT_MAP, Collections.emptyMap(), fqnA, null, false,
null, false, null, NODE_MODIFIED));
@@ -651,18 +652,18 @@
private void setCache(Cache<String, String> c, List<Event> l)
{
for (Event e : l)
- ((EventImpl)e).setCache(c);
+ ((EventImpl) e).setCache(c);
}
private void markOriginRemote(List<Event> l)
{
for (Event e : l)
- ((EventImpl)e).setOriginLocal(false);
+ ((EventImpl) e).setOriginLocal(false);
}
private void scrubTransactions(List<Event> l)
{
for (Event e : l)
- ((EventImpl)e).setTransaction(null);
+ ((EventImpl) e).setTransaction(null);
}
}
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -54,7 +54,7 @@
if (cache1 != null || cache2 != null)
tearDown();
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache1 = (CacheSPI<String, String>) instance.createCache(false);
cache1.getConfiguration().setClusterName("test");
cache1.getConfiguration().setStateRetrievalTimeout(1000);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -58,7 +58,7 @@
private void initCaches()
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Object listener = new TestCacheListener();
Modified:
core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -46,7 +46,7 @@
private void initCaches()
{
- CacheFactory<Integer, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<Integer, String> instance = new DefaultCacheFactory();
cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
Modified:
core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -43,7 +43,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
Modified:
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -54,7 +54,7 @@
public void setUp() throws Exception
{
log.debug("");
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("local");
configureEviction();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -72,7 +72,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode("local");
configureCache();
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified:
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -22,7 +22,7 @@
@SuppressWarnings("deprecation")
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(false);
+ delegating_cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified:
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -64,7 +64,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache_ = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
cache_.getConfiguration().setUseRegionBasedMarshalling(true);
cache_.start();
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -23,7 +23,7 @@
public void setUp()
{
Configuration cfg =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
- cache = DefaultCacheFactory.getInstance().createCache(cfg, false);
+ cache = new DefaultCacheFactory().createCache(cfg, false);
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -45,7 +45,7 @@
private CacheSPI<Object, Object> createCache(String name) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
cache.getConfiguration().setClusterName(name);
// Call the hook that allows mux integration
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -22,7 +22,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test (groups = {"functional"})
+@Test(groups = {"functional"})
public class ExceptionTest
{
private Cache cache1;
@@ -32,8 +32,8 @@
@BeforeMethod
public void setUp()
{
- cache1 = DefaultCacheFactory.getInstance().createCache(false);
- cache2 = DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = new DefaultCacheFactory().createCache(false);
+ cache2 = new DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setSyncCommitPhase(true);
cache1.getConfiguration().setSyncRollbackPhase(true);
@@ -53,7 +53,7 @@
if (cache2 != null) cache2.stop();
}
- @Test (groups = {"functional"}, expectedExceptions =
{ReplicationException.class})
+ @Test(groups = {"functional"}, expectedExceptions =
{ReplicationException.class})
public void testSyncReplTimeout()
{
cache1.getConfiguration().setSyncReplTimeout(1); // 1ms. this is *bound* to fail.
@@ -72,7 +72,7 @@
cache1.put(fqn, "k", "v");
}
- @Test (groups = {"functional"}, expectedExceptions =
{TimeoutException.class})
+ @Test(groups = {"functional"}, expectedExceptions =
{TimeoutException.class})
public void testLockAcquisitionTimeout() throws Exception
{
cache2.getConfiguration().setLockAcquisitionTimeout(1);
Modified:
core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -69,7 +69,7 @@
private void initCaches(Configuration.CacheMode caching_mode)
{
- CacheFactory<String, ContainerData> instance =
DefaultCacheFactory.getInstance();
+ CacheFactory<String, ContainerData> instance = new DefaultCacheFactory();
cache1 = (CacheSPI<String, ContainerData>) instance.createCache(false);
cache2 = (CacheSPI<String, ContainerData>) instance.createCache(false);
cache1.getConfiguration().setCacheMode(caching_mode);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -71,8 +71,8 @@
private void initCaches()
{
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -36,8 +36,8 @@
{
System.out.println("*** In setUp()");
caches = new Cache[2];
- caches[0] =
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
- caches[1] =
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[0] = new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[1] = new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
TestingUtil.blockUntilViewsReceived(caches, 5000);
System.out.println("*** Finished setUp()");
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -86,8 +86,8 @@
private void initCaches(Configuration.CacheMode caching_mode) throws Exception
{
- cache1 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
- cache2 = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheMode(caching_mode);
cache2.getConfiguration().setCacheMode(caching_mode);
cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
@@ -696,8 +696,8 @@
{
Object myMutex = new Object();
- final CacheSPI c1 = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(false);
- final CacheSPI c2 = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(false);
+ final CacheSPI c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ final CacheSPI c2 = (CacheSPI) new DefaultCacheFactory().createCache(false);
c1.getConfiguration().setClusterName("TempCluster");
c2.getConfiguration().setClusterName("TempCluster");
c1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
public void testFailedStateTransfer() throws Exception
{
- CacheSPI cache = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
+ CacheSPI cache = (CacheSPI) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
cache.getConfiguration().setClusterName("VersionedTestBase");
cache.getConfiguration().setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
@@ -68,7 +68,7 @@
cache.start();
- CacheSPI recipient = (CacheSPI)
DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
+ CacheSPI recipient = (CacheSPI) new
DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC),
false);
recipient.getConfiguration().setClusterName("VersionedTestBase");
recipient.getConfiguration().setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -468,14 +468,14 @@
{
Configuration c =
UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
- Cache<Object, Object> cache1 =
DefaultCacheFactory.getInstance().createCache(c, false);
+ Cache<Object, Object> cache1 = new DefaultCacheFactory().createCache(c,
false);
cache1.start();
caches.put("evict1", cache1);
cache1.put(Fqn.fromString("/a/b/c"), "key",
"value");
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC,
true);
- Cache<Object, Object> cache2 =
DefaultCacheFactory.getInstance().createCache(c, false);
+ Cache<Object, Object> cache2 = new DefaultCacheFactory().createCache(c,
false);
cache2.start();
caches.put("evict2", cache2);
@@ -499,7 +499,7 @@
public void testEvictionAfterStateTransfer() throws Exception
{
Configuration c =
UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
- Cache<Object, Object> cache1 =
DefaultCacheFactory.getInstance().createCache(c, false);
+ Cache<Object, Object> cache1 = new DefaultCacheFactory().createCache(c,
false);
cache1.start();
caches.put("evict1", cache1);
@@ -513,7 +513,7 @@
}
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC,
true);
- final Cache<Object, Object> cache2 =
DefaultCacheFactory.getInstance().createCache(c, false);
+ final Cache<Object, Object> cache2 = new DefaultCacheFactory().createCache(c,
false);
cache2.start();
caches.put("evict2", cache2);
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -85,7 +85,7 @@
boolean sync,
boolean useMarshalling,
boolean useCacheLoader)
- throws Exception
+ throws Exception
{
return createCache(cacheID, sync, useMarshalling, useCacheLoader, false, true);
}
@@ -96,7 +96,7 @@
boolean useCacheLoader,
boolean cacheLoaderAsync,
boolean startCache)
- throws Exception
+ throws Exception
{
if (useCacheLoader)
{
@@ -139,7 +139,7 @@
// tree.setConfiguration(c);
//c.setLockAcquisitionTimeout(60000);
//c.setSyncReplTimeout(60000);
- CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(c, false);
+ CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(c, false);
//c.setLockAcquisitionTimeout(60000); // a whole minute?!?? Lots of state to tfr?
//c.setSyncReplTimeout(60000);
configureMultiplexer(tree);
@@ -200,7 +200,7 @@
String cacheID,
boolean useExtended,
boolean async)
- throws Exception
+ throws Exception
{
configureCacheLoader(c, "org.jboss.cache.loader.FileCacheLoader",
cacheID, useExtended, async);
}
@@ -222,14 +222,14 @@
System.out.println("Error loading jdbc properties ");
}
String props = "cache.jdbc.driver =" +
prop.getProperty("cache.jdbc.driver") + "\n" +
"cache.jdbc.url="
- + prop.getProperty("cache.jdbc.url") + "\n" +
"cache.jdbc.user="
- + prop.getProperty("cache.jdbc.user") + "\n" +
"cache.jdbc.password="
- + prop.getProperty("cache.jdbc.password") + "\n"
+ "cache.jdbc.node.type="
- + prop.getProperty("cache.jdbc.node.type") + "\n"
+ "cache.jdbc.sql-concat="
- + prop.getProperty("cache.jdbc.sql-concat");
+ + prop.getProperty("cache.jdbc.url") + "\n" +
"cache.jdbc.user="
+ + prop.getProperty("cache.jdbc.user") + "\n" +
"cache.jdbc.password="
+ + prop.getProperty("cache.jdbc.password") + "\n" +
"cache.jdbc.node.type="
+ + prop.getProperty("cache.jdbc.node.type") + "\n" +
"cache.jdbc.sql-concat="
+ + prop.getProperty("cache.jdbc.sql-concat");
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("",
"org.jboss.cache.loader.JDBCCacheLoader",
- props, false, true, false));
+ props, false, true, false));
}
else
{
@@ -386,7 +386,7 @@
protected ClassLoader getClassLoader() throws Exception
{
String[] includesClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
String[] excludesClasses = {};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(includesClasses, excludesClasses, cl);
@@ -395,7 +395,7 @@
protected ClassLoader getNotFoundClassLoader() throws Exception
{
String[] notFoundClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(null, null, notFoundClasses, cl);
}
@@ -416,7 +416,7 @@
String name,
boolean sync,
boolean activateRoot)
- throws Exception
+ throws Exception
{
this.cache = createCache(name, sync, true, false);
this.semaphore = semaphore;
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -97,8 +97,8 @@
cfg1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cfg2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = DefaultCacheFactory.getInstance().createCache(cfg1, true);
- cache2 = DefaultCacheFactory.getInstance().createCache(cfg2, false);
+ cache1 = new DefaultCacheFactory().createCache(cfg1, true);
+ cache2 = new DefaultCacheFactory().createCache(cfg2, false);
UserTransaction tx1 = (UserTransaction) new
InitialContext(p).lookup("UserTransaction");
writer = new Writer(cache1, tx1);
try
@@ -125,7 +125,7 @@
}
finally
{
- writer.stop();
+ writer.stop();
}
}
@@ -170,7 +170,13 @@
catch (Exception e)
{
e.printStackTrace();
- try {tx.rollback();} catch (SystemException e1) {}
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1)
+ {
+ }
}
finally
{
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -57,7 +57,7 @@
private CacheSPI initCache(boolean notifying)
{
- CacheSPI c = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI c = (CacheSPI) new DefaultCacheFactory().createCache(false);
c.getConfiguration().setCacheMode("REPL_SYNC");
c.getConfiguration().setClusterConfig(getJGroupsStack());
c.getConfiguration().setFetchInMemoryState(false);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -35,7 +35,7 @@
{
Configuration c = new Configuration();
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(c);
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
tm.setTransactionTimeout(txTimeout);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -50,7 +50,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<Object, Integer> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
cache = (CacheSPI<Object, Integer>)
instance.createCache("META-INF/local-lru-eviction-service.xml", false);
// XML file above only sets REPEATABLE-READ
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
private void createCache(IsolationLevel level)
{
- CacheFactory<Integer, String> factory = DefaultCacheFactory.getInstance();
+ CacheFactory<Integer, String> factory = new DefaultCacheFactory();
cache = (CacheSPI<Integer, String>) factory.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-service.xml"), false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -50,7 +50,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setStateRetrievalTimeout(10000);
cache.getConfiguration().setClusterName("test");
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -34,7 +34,7 @@
private CacheSPI<?, ?> createCache(boolean optimistic)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
if (optimistic)
cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -44,7 +44,7 @@
public void testWithoutTransactions() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -59,7 +59,7 @@
public void testWithTransactions() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -77,7 +77,7 @@
public void testWithTransactionsRepeatableRead() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -54,7 +54,7 @@
writerError = null;
readerError = null;
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -55,7 +55,7 @@
config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = instance.createCache(config);
}
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -41,7 +41,7 @@
writerFailed = false;
writerError = null;
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("LOCAL");
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -49,7 +49,7 @@
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = instance.createCache(config);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -28,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -102,7 +102,7 @@
public void setUp() throws Exception
{
exception = null;
- CacheFactory<Boolean, Boolean> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<Boolean, Boolean> instance = new DefaultCacheFactory();
// setup and start the source cache
srcCache = (CacheSPI<Boolean, Boolean>)
instance.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
srcCache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -25,7 +25,8 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
-@Test(groups = {"functional", "transaction"}, enabled = true) //
Known issue - disabled because of JBCACHE-923
+@Test(groups = {"functional", "transaction"}, enabled = true)
+// Known issue - disabled because of JBCACHE-923
public class SimultaneousRollbackAndPutTest
{
private Cache cache;
@@ -36,7 +37,7 @@
@BeforeTest(alwaysRun = true)
protected void setUp() throws Exception
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -100,7 +101,7 @@
try
{
// now try and put stuff in the main thread again
- cache.put(A, "k2", "v2");
+ cache.put(A, "k2", "v2");
tm.commit();
// assert false : "Should never reach here";
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,13 +1,14 @@
package org.jboss.cache.transaction;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -18,22 +19,17 @@
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/**
* This test checks how the cache behaves when a JTA STATUS_UNKNOWN is passed in to the
cache during afterCompletion().
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
@SuppressWarnings("unchecked")
-@Test(groups={"functional"})
+@Test(groups = {"functional"})
public class StatusUnknownTest
{
private Cache cache;
@@ -42,7 +38,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(HeuristicFailingDummyTransactionManagerLookup.class.getName());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -83,18 +79,18 @@
public static DummyTransactionManager getInstance()
{
- if(instance == null)
+ if (instance == null)
{
- instance=new HeuristicFailingDummyTransactionManager();
+ instance = new HeuristicFailingDummyTransactionManager();
try
{
- Properties p=new Properties();
+ Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.cache.transaction.DummyContextFactory");
- Context ctx=new InitialContext(p);
+ Context ctx = new InitialContext(p);
ctx.bind("java:/TransactionManager", instance);
ctx.bind("UserTransaction", new
DummyUserTransaction(instance));
}
- catch(NamingException e)
+ catch (NamingException e)
{
log.error("binding of DummyTransactionManager failed", e);
}
@@ -130,9 +126,9 @@
{
List<Synchronization> tmp;
- synchronized(participants)
+ synchronized (participants)
{
- tmp=new LinkedList<Synchronization>(participants);
+ tmp = new LinkedList<Synchronization>(participants);
}
for (Synchronization s : tmp)
@@ -147,7 +143,7 @@
}
}
- synchronized(participants)
+ synchronized (participants)
{
participants.clear();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -27,7 +27,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java 2007-12-19
15:09:57 UTC (rev 4879)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -53,7 +53,7 @@
public void setUp() throws Exception
{
- CacheFactory<String, Comparable> instance =
DefaultCacheFactory.getInstance();
+ CacheFactory<String, Comparable> instance = new DefaultCacheFactory();
cache = (CacheSPI) instance.createCache(false);
cache.getConfiguration().setClusterName("test");
cache.getConfiguration().setStateRetrievalTimeout(10000);
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 2007-12-19
15:09:57 UTC (rev 4879)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2007-12-19
15:14:43 UTC (rev 4880)
@@ -1,36 +1,29 @@
package org.jboss.cache.transaction.isolationlevels;
-import static org.jboss.cache.lock.IsolationLevel.NONE;
-import static org.jboss.cache.lock.IsolationLevel.READ_COMMITTED;
-import static org.jboss.cache.lock.IsolationLevel.READ_UNCOMMITTED;
-import static org.jboss.cache.lock.IsolationLevel.REPEATABLE_READ;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.lock.IsolationLevel;
+import static org.jboss.cache.lock.IsolationLevel.*;
import org.jboss.cache.transaction.TransactionSetup;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Collection;
+import java.util.HashSet;
+
/**
* Base class for testing isolation levels.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = { "functional", "transaction" })
+@Test(groups = {"functional", "transaction"})
public abstract class IsolationLevelTestBase
{
protected IsolationLevel isolationLevel;
@@ -45,7 +38,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> cf = new DefaultCacheFactory();
cache = cf.createCache(false);
cache.getConfiguration().setIsolationLevel(isolationLevel);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());