JBoss Cache SVN: r4883 - core/support-branches/1.4.1.SP8_JBCACHE-1247/tests/functional/org/jboss/cache/aop/loader.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 12:19:50 -0500 (Wed, 19 Dec 2007)
New Revision: 4883
Removed:
core/support-branches/1.4.1.SP8_JBCACHE-1247/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java
Log:
removed PCACHE-58 test
Deleted: core/support-branches/1.4.1.SP8_JBCACHE-1247/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java
===================================================================
--- core/support-branches/1.4.1.SP8_JBCACHE-1247/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java 2007-12-19 17:18:57 UTC (rev 4882)
+++ core/support-branches/1.4.1.SP8_JBCACHE-1247/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java 2007-12-19 17:19:50 UTC (rev 4883)
@@ -1,191 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.aop.loader;
-
-import org.w3c.dom.Element;
-import org.jboss.cache.xml.XmlHelper;
-import org.jboss.cache.aop.test.Address;
-import org.jboss.cache.aop.test.Person;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * Test case for testing Collection manipulation where Pojos are loaded/stored in a CacheLoader.
- *
- * @author ?
- * @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
- */
-public class FileCacheLoaderAopCollectionsTest extends CacheLoaderTestsBase
-{
-
- protected Element getCacheLoaderConfig(String loc) throws Exception
- {
- String xml = " <config>\n" +
- " \n" +
- " <passivation>false</passivation>\n" +
- " <preload></preload>\n" +
- "\n" +
- " <cacheloader>\n" +
- " <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
- " <properties>\n" +
- " location=" + loc + "\n" +
- " </properties>\n" +
- " <async>false</async>\n" +
- " <fetchPersistentState>false</fetchPersistentState>\n" +
- " <ignoreModifications>false</ignoreModifications>\n" +
- " </cacheloader>\n" +
- " \n" +
- " </config>";
- return XmlHelper.stringToElement(xml);
- }
-
- protected void configureCache() throws Exception {
- String tmp_location = System.getProperty("java.io.tmpdir", "c:\\tmp");
- cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "", false, true, false));
-// cache.setCacheLoaderConfiguration(getCacheLoaderConfig(tmp_location));
- }
-
- public static Test suite() {
- return new TestSuite(FileCacheLoaderAopCollectionsTest.class);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(FileCacheLoaderAopCollectionsTest.suite());
- }
-
- // leave in only the collectiosn test - override the rest.
-
- public void testEvictionWithCacheLoader()
- {
- }
-
- public void testPojoEvictionWithCacheLoader()
- {
- }
-
- public void testPojoRemoveWithCacheLoader()
- {
- }
-
- public void testPojoListLoadAndRemoveAfterRestart() throws Exception
- {
- String fqn = "/list";
-
- Person brian = createPerson("Brian");
- Person manik = createPerson("Manik");
-
- List list = new ArrayList();
- list.add(brian);
- list.add(manik);
-
- cache.putObject(fqn, list);
-
- List proxyList = (List) cache.getObject(fqn);
-
- brian = (Person) proxyList.get(0);
- assertEquals("Brian", brian.getName());
- manik = (Person) proxyList.get(1);
- assertEquals("Manik", manik.getName());
-
- stopCache();
-
- startCache();
-
- proxyList = (List) cache.getObject(fqn);
-
- brian = (Person) proxyList.get(0);
- assertEquals("Brian", brian.getName());
- manik = (Person) proxyList.get(1);
- assertEquals("Manik", manik.getName());
-
- brian = (Person) proxyList.remove(0);
- assertEquals("Brian", brian.getName());
-
- manik = (Person) proxyList.get(0);
- assertEquals("Manik", manik.getName());
- }
-
- public void testPojoMapLoadAndRemoveAfterRestart() throws Exception
- {
- String fqn = "/map";
-
- Person brian = createPerson("Brian");
- Person manik = createPerson("Manik");
-
- Map map = new HashMap();
- map.put("key-brian", brian);
- map.put("key-manik", manik);
-
- cache.putObject(fqn, map);
-
- Map proxyMap = (Map) cache.getObject(fqn);
-
- brian = (Person) proxyMap.get("key-brian");
- assertEquals("Brian", brian.getName());
- manik = (Person) proxyMap.get("key-manik");
- assertEquals("Manik", manik.getName());
-
- stopCache();
-
- startCache();
-
- proxyMap = (Map) cache.getObject(fqn);
-
- brian = (Person) proxyMap.get("key-brian");
- assertEquals("Brian", brian.getName());
- manik = (Person) proxyMap.get("key-manik");
- assertEquals("Manik", manik.getName());
-
- brian = (Person) proxyMap.remove("key-brian");
- assertEquals("Brian", brian.getName());
-
- manik = (Person)proxyMap.get("key-manik");
- assertEquals("Manik", manik.getName());
- }
-
-// /**
-// * Test for removal of Collection element, where the Collection has been loaded with Pojos created in the test. I
-// * used this to compare it to the newly added tests where the Collection is loaded from the CacheLoader.
-// */
-// public void testPojoCollectionRemove() throws Exception
-// {
-// String fqn = "/list";
-//
-// Person brian = createPerson("Brian");
-// Person manik = createPerson("Manik");
-//
-// List<Person> list = new ArrayList<Person>();
-// list.add(brian);
-// list.add(manik);
-//
-// cache.putObject(fqn, list);
-//
-// List<Person> proxyList = (List<Person>) cache.getObject(fqn);
-//
-// brian = proxyList.get(0);
-// assertEquals("Brian", brian.getName());
-// manik = proxyList.get(1);
-// assertEquals("Manik", manik.getName());
-//
-// proxyList.remove(0);
-//
-// manik = proxyList.get(0);
-// assertEquals("Manik", manik.getName());
-// }
-
- protected Person createPerson(String name)
- {
- Person p = new Person(); // instantiate a Person object named joe
- p.setName(name);
- return p;
- }
-}
17 years, 3 months
JBoss Cache SVN: r4882 - core/support-branches.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 12:18:57 -0500 (Wed, 19 Dec 2007)
New Revision: 4882
Added:
core/support-branches/1.4.1.SP8_JBCACHE-1247/
Log:
created support tag
Copied: core/support-branches/1.4.1.SP8_JBCACHE-1247 (from rev 4881, core/branches/1.4.X)
17 years, 3 months
JBoss Cache SVN: r4881 - core/branches/1.4.X/tests/functional/org/jboss/cache/aop/loader.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 11:09:47 -0500 (Wed, 19 Dec 2007)
New Revision: 4881
Modified:
core/branches/1.4.X/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java
Log:
Removed generics - needs to be java 1.4 src compatible!!
Modified: core/branches/1.4.X/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java 2007-12-19 15:14:43 UTC (rev 4880)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest.java 2007-12-19 16:09:47 UTC (rev 4881)
@@ -83,17 +83,17 @@
Person brian = createPerson("Brian");
Person manik = createPerson("Manik");
- List<Person> list = new ArrayList<Person>();
+ List list = new ArrayList();
list.add(brian);
list.add(manik);
cache.putObject(fqn, list);
- List<Person> proxyList = (List<Person>) cache.getObject(fqn);
+ List proxyList = (List) cache.getObject(fqn);
- brian = proxyList.get(0);
+ brian = (Person) proxyList.get(0);
assertEquals("Brian", brian.getName());
- manik = proxyList.get(1);
+ manik = (Person) proxyList.get(1);
assertEquals("Manik", manik.getName());
stopCache();
@@ -102,15 +102,15 @@
proxyList = (List) cache.getObject(fqn);
- brian = proxyList.get(0);
+ brian = (Person) proxyList.get(0);
assertEquals("Brian", brian.getName());
- manik = proxyList.get(1);
+ manik = (Person) proxyList.get(1);
assertEquals("Manik", manik.getName());
- brian = proxyList.remove(0);
+ brian = (Person) proxyList.remove(0);
assertEquals("Brian", brian.getName());
- manik = proxyList.get(0);
+ manik = (Person) proxyList.get(0);
assertEquals("Manik", manik.getName());
}
@@ -121,17 +121,17 @@
Person brian = createPerson("Brian");
Person manik = createPerson("Manik");
- Map<String, Person> map = new HashMap<String, Person>();
+ Map map = new HashMap();
map.put("key-brian", brian);
map.put("key-manik", manik);
cache.putObject(fqn, map);
- Map<String, Person> proxyMap = (Map<String, Person>) cache.getObject(fqn);
+ Map proxyMap = (Map) cache.getObject(fqn);
- brian = proxyMap.get("key-brian");
+ brian = (Person) proxyMap.get("key-brian");
assertEquals("Brian", brian.getName());
- manik = proxyMap.get("key-manik");
+ manik = (Person) proxyMap.get("key-manik");
assertEquals("Manik", manik.getName());
stopCache();
@@ -140,12 +140,12 @@
proxyMap = (Map) cache.getObject(fqn);
- brian = proxyMap.get("key-brian");
+ brian = (Person) proxyMap.get("key-brian");
assertEquals("Brian", brian.getName());
- manik = proxyMap.get("key-manik");
+ manik = (Person) proxyMap.get("key-manik");
assertEquals("Manik", manik.getName());
- brian = proxyMap.remove("key-brian");
+ brian = (Person) proxyMap.remove("key-brian");
assertEquals("Brian", brian.getName());
manik = (Person)proxyMap.get("key-manik");
17 years, 3 months
JBoss Cache SVN: r4880 - in core/trunk/src: test/java/org/jboss/cache/api and 24 other directories.
by jbosscache-commits@lists.jboss.org
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());
17 years, 3 months
JBoss Cache SVN: r4879 - in core/trunk/src: main/java/org/jboss/cache/factories and 9 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 10:09:57 -0500 (Wed, 19 Dec 2007)
New Revision: 4879
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
core/trunk/src/test/java/org/jboss/cache/FqnTest.java
core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
Log:
Updated usage of singletons in DefaultCacheFactory and InterceptorChainFactory
Modified: core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -116,7 +116,7 @@
{
config.getRuntimeConfig().setMuxChannelFactory(channelFactory);
}
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
+ cache = new DefaultCacheFactory().createCache(config, false);
registerCache(cache, configName);
}
else if (cache != null)
Modified: core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -1,18 +1,6 @@
package org.jboss.cache;
-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.ViewChanged;
+import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
@@ -33,8 +21,8 @@
@CacheListener
public class ConsoleListener
{
- private CacheImpl _cache;
- private boolean _startCache;
+ private CacheSPI cache;
+ private boolean startCache;
/**
* Constructor.
@@ -44,8 +32,8 @@
*
* @param cache the cache to monitor for replication events.
*/
- public ConsoleListener(CacheImpl cache)
- throws Exception
+ public ConsoleListener(CacheSPI cache)
+ throws Exception
{
this(cache, true, true);
}
@@ -59,12 +47,12 @@
* @param stopCache indicates whether or not the cache should be stopped by
* this class.
*/
- public ConsoleListener(CacheImpl cache,
+ public ConsoleListener(CacheSPI cache,
boolean startCache, boolean stopCache)
- throws Exception
+ throws Exception
{
- _cache = cache;
- _startCache = startCache;
+ this.cache = cache;
+ this.startCache = startCache;
if (stopCache)
{
@@ -80,7 +68,7 @@
* method to return.
*/
public void listen()
- throws Exception
+ throws Exception
{
listen(true);
}
@@ -95,13 +83,13 @@
* notification semantics) will cause this method to return.
*/
public void listen(boolean wait)
- throws Exception
+ throws Exception
{
- _cache.getNotifier().addCacheListener(this);
+ cache.getNotifier().addCacheListener(this);
- if (_startCache)
+ if (startCache)
{
- _cache.start();
+ cache.start();
}
synchronized (this)
@@ -181,7 +169,7 @@
public void run()
{
- _cache.stop();
+ cache.stop();
}
}
@@ -218,7 +206,7 @@
System.out.print("No xml config file argument is supplied. Will use jboss-cache.xml from classpath");
}
- CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(configFileName);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(configFileName);
ConsoleListener listener = new ConsoleListener(cache);
listener.listen();
}
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -16,22 +16,23 @@
import java.io.InputStream;
/**
- * Default (singleton) implementation of the {@link org.jboss.cache.CacheFactory} interface.
- * Use {@link #getInstance()} to obtain an instance.
+ * Default implementation of the {@link org.jboss.cache.CacheFactory} interface.
* <p/>
* This is a special instance of a {@link ComponentFactory} which contains bootstrap information for the
* {@link ComponentRegistry}.
* <p/>
- * E.g., {@link #bootstrap(CacheImpl, CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a {@link ComponentRegistry}, and then wire dependencies as needed.
+ * E.g., {@link #bootstrap(CacheImpl, CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a
+ * {@link ComponentRegistry}, and then wire dependencies as needed.
+ * <p/>
+ * In JBoss Cache 2.0.x, this was a singleton and you had to use {@link #getInstance()} to obtain an instance. From
+ * JBoss Cache 2.1.x onwards, this is no longer a singleton and you can use the default no-arg constructor to obtain
+ * a reference. {@link #getInstance()} has been deprecated and modified to return a new instance of this class.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
* @see org.jboss.cache.factories.ComponentFactory
*/
-//@DefaultFactoryFor(classes = {CacheSPI.class})
public class DefaultCacheFactory<K, V> extends ComponentFactory implements CacheFactory<K, V>
{
- private volatile static CacheFactory<?, ?> singleton = new DefaultCacheFactory();
-
/**
* Note - this method used to return a singleton instance, and since 2.1.0 returns a new instance. The method is
* deprecated and you should use the no-arg constructor to create a new instance of this factory.
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 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -22,6 +22,13 @@
@DefaultFactoryFor(classes = Interceptor.class)
public class InterceptorChainFactory extends ComponentFactory
{
+ /**
+ * Note - this method used to return a singleton instance, and since 2.1.0 returns a new instance. The method is
+ * deprecated and you should use the no-arg constructor to create a new instance of this factory.
+ *
+ * @return a NEW instance of this class.
+ */
+ @Deprecated
public static InterceptorChainFactory getInstance()
{
return new InterceptorChainFactory();
@@ -39,7 +46,7 @@
}
}
- public Interceptor setLastInterceptorPointer(Interceptor first, Interceptor last)
+ public static Interceptor setLastInterceptorPointer(Interceptor first, Interceptor last)
{
Interceptor i = first;
while (i != null)
@@ -533,7 +540,7 @@
return setLastInterceptorPointer(first, invokerInterceptor);
}
- public List<Interceptor> asList(Interceptor interceptor)
+ public static List<Interceptor> asList(Interceptor interceptor)
{
if (interceptor == null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -99,7 +99,7 @@
public List<Interceptor> getInterceptorChain()
{
- return InterceptorChainFactory.getInstance().asList(interceptorChain);
+ return InterceptorChainFactory.asList(interceptorChain);
}
public void addInterceptor(Interceptor i, int position)
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -918,7 +918,7 @@
protected void constructCache() throws ConfigurationException
{
log.debug("Constructing Cache");
- CacheFactory<K, V> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<K, V> cf = new DefaultCacheFactory<K, V>();
setCache(cf.createCache(config, false));
if (multiplexerService != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -120,7 +120,7 @@
}
else if (config != null)
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(this.config);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(this.config);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -46,7 +46,7 @@
public void testFromConfigFileStarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile);
// can't test for this anymore since the RuntimeConfig is attached to the running cache
//assertEquals(expected, cache.getConfiguration());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -55,7 +55,7 @@
public void testFromConfigFileUnstarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile, false);
// can't test for this anymore since the RuntimeConfig is attached to the running cache
// assertEquals(expected, cache.getConfiguration());
@@ -66,7 +66,7 @@
public void testFromConfigObjStarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -75,7 +75,7 @@
public void testFromConfigObjUnstarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
@@ -94,7 +94,7 @@
public void testLifecycle() throws Exception
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
cache.start();
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -105,7 +105,7 @@
public void testCreationFromStreamStarted() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
cache = (CacheSPI) cf.createCache(is);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
doSimpleConfTests(cache.getConfiguration());
@@ -114,7 +114,7 @@
public void testCreationFromStream() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
cache = (CacheSPI) cf.createCache(is, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
doSimpleConfTests(cache.getConfiguration());
@@ -122,7 +122,7 @@
public void testComponentsInjected() throws Exception
{
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -117,7 +117,7 @@
c.setCacheMode(mode);
c.setIsolationLevel(level);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
}
private TransactionManager startTransaction()
Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -350,7 +350,7 @@
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
- cache = DefaultCacheFactory.getInstance().createCache(c);
+ cache = new DefaultCacheFactory().createCache(c);
cache.put(f, "key", "value");
Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -24,7 +24,7 @@
@Test(groups = {"functional"})
public void testGetKeys() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", "name", "Bela Ban");
cache.put("/a/b/c", "age", 40);
cache.put("/a/b/c", "city", "Kreuzlingen");
@@ -42,7 +42,7 @@
@Test(groups = {"functional"})
public void testGetChildren() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", null);
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -61,7 +61,7 @@
@Test(groups = {"functional"})
public void testGetKeysOnNode()
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", "key", "value");
Node node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
Set keySet = node.getKeys();
Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -424,7 +424,7 @@
private CacheSPI<Object, Object> createCache(Configuration.CacheMode cache_mode)
{
- CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
retval.getConfiguration().setCacheMode(cache_mode);
retval.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
return retval;
Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -25,7 +25,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().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified: core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -20,7 +20,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -48,7 +48,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> cf = new DefaultCacheFactory();
cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -30,14 +30,13 @@
@Test(groups = {"functional"})
public class ComponentRegistryFunctionalTest
{
- private ComponentFactory cf;
private ComponentRegistry cr;
private Configuration configuration;
@BeforeMethod
public void setUp() throws Exception
{
- cf = (ComponentFactory) DefaultCacheFactory.getInstance();
+ ComponentFactory cf = (ComponentFactory) new DefaultCacheFactory();
CacheSPI spi = new CacheInvocationDelegate();
Constructor ctor = CacheImpl.class.getDeclaredConstructor();
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -1,18 +1,17 @@
package org.jboss.cache.factories;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.interceptors.Interceptor;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
@@ -25,7 +24,7 @@
public void setUp() throws Exception
{
Configuration c = new Configuration();
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
cache.create();
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -28,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode("LOCAL");
}
@@ -197,7 +197,7 @@
public void testOptimisticChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
@@ -223,7 +223,7 @@
public void testOptimisticReplicatedChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheMode("REPL_SYNC");
@@ -251,7 +251,7 @@
public void testOptimisticCacheLoaderChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
@@ -280,7 +280,7 @@
public void testOptimisticPassivationCacheLoaderChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
@@ -309,7 +309,7 @@
public void testInvalidationInterceptorChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setCacheMode("REPL_ASYNC");
@@ -332,7 +332,7 @@
// ok, my replication chain looks good.
// now for my invalidation chain.
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setCacheMode("INVALIDATION_ASYNC");
chain = getInterceptorChainFactory(cache).buildInterceptorChain();
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -683,7 +683,7 @@
protected CacheSPI<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setClusterName("MyCluster");
cache.getConfiguration().setStateRetrievalTimeout(3000);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -33,7 +33,7 @@
@BeforeMethod
public void setUp() throws Exception
{
- c1 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);
// the FIFO policy cfg
FIFOConfiguration cfg = new FIFOConfiguration();
@@ -59,7 +59,7 @@
c1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c1.getConfiguration().setEvictionConfig(ec);
- c2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new DefaultCacheFactory().createCache(c1.getConfiguration().clone(), false);
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -32,8 +32,8 @@
@BeforeTest
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().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -58,7 +58,7 @@
protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
@@ -135,7 +135,7 @@
protected CacheSPI createPessimisticCache() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -153,7 +153,7 @@
protected CacheSPI createPessimisticCacheLocal() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -199,7 +199,7 @@
protected CacheSPI<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode, boolean start) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
@@ -241,7 +241,7 @@
protected CacheSPI<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared, Configuration.CacheMode cacheMode) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
c.setStateRetrievalTimeout(5000);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -30,7 +30,7 @@
public void setUp()
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -29,13 +29,13 @@
public void setUp()
{
- caches.add(DefaultCacheFactory.getInstance().createCache(false));
+ caches.add(new DefaultCacheFactory().createCache(false));
caches.get(0).getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
caches.get(0).getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
caches.get(0).getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
caches.get(0).start();
- caches.add(DefaultCacheFactory.getInstance().createCache(false));
+ caches.add(new DefaultCacheFactory().createCache(false));
caches.get(1).getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
caches.get(1).getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
caches.get(1).getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -46,7 +46,7 @@
{
if (caches != null)
{
- for (Cache cache: caches)
+ for (Cache cache : caches)
{
try
{
@@ -128,7 +128,7 @@
assert n.getData().size() == 1;
}
- public void testStateTransferIntermediateNodeDefaultVersions() throws Exception
+ public void testStateTransferIntermediateNodeDefaultVersions() throws Exception
{
Fqn f = Fqn.fromString("/one/two/three");
Fqn intermediate = f.getParent();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -60,7 +60,7 @@
prev.setNext(dummy);
- InterceptorChainFactory.getInstance().setLastInterceptorPointer(interceptor, dummy);
+ InterceptorChainFactory.setLastInterceptorPointer(interceptor, dummy);
mgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -31,12 +31,12 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache1.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
c = cache2.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -55,7 +55,7 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI) DefaultCacheFactory.getInstance().createCache(c);
+ return (CacheSPI) new DefaultCacheFactory().createCache(c);
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -41,7 +41,7 @@
{
if (cache != null)
tearDown();
- 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().setNodeLockingScheme("OPTIMISTIC");
Modified: core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -40,7 +40,7 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI) instance.createCache(false);
// very short acquisition timeout
cache.getConfiguration().setLockAcquisitionTimeout(100);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -54,13 +54,13 @@
private void createCaches(NodeLockingScheme scheme, CacheMode mode)
{
- cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache1.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
c = cache2.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -33,7 +33,7 @@
{
Configuration c = new Configuration();
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(c);
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -43,7 +43,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("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -42,7 +42,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(config);
m = cache.getTransactionManager();
}
17 years, 3 months
Build failed in Hudson: jboss-cache-core-jdk1.5 » JBoss Cache - Core Edition #183
by jboss-qa-internal@redhat.com
See https://hudson.jboss.org/hudson/job/jboss-cache-core-jdk1.5/org.jboss.cac...
------------------------------------------
started
Building remotely on dev40-linux
Reusing existing maven process
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ----------------------------------------------------------------------------
[INFO] Building JBoss Cache - Core Edition
[INFO] task-segment: [package]
[INFO] ----------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Compiling 205 source files to /home/hudson/hudson_workspace/workspace/jboss-cache-core-jdk1.5/./target/test-classes
[HUDSON] Archiving /home/hudson/hudson_workspace/workspace/jboss-cache-core-jdk1.5/./pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/home/hudson/hudson_workspace/workspace/jboss-cache-core-jdk1.5/./src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java:[64,27] cannot find symbol
symbol : variable registry
location: class org.jboss.cache.factories.ComponentRegistry
/home/hudson/hudson_workspace/workspace/jboss-cache-core-jdk1.5/./src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java:[64,27] cannot find symbol
symbol : variable registry
location: class org.jboss.cache.factories.ComponentRegistry
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 50 seconds
[INFO] Finished at: Wed Dec 19 09:32:00 EST 2007
[INFO] Final Memory: 13M/45M
[INFO] ------------------------------------------------------------------------
Sending e-mails to: dpospisi(a)redhat.com
Build was marked for publishing on https://hudson.jboss.org/hudson/
finished: FAILURE
17 years, 3 months
JBoss Cache SVN: r4878 - in core/trunk/src: main/java/org/jboss/cache/invocation and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 08:17:43 -0500 (Wed, 19 Dec 2007)
New Revision: 4878
Removed:
core/trunk/src/main/java/org/jboss/cache/factories/annotations/ClasspathScanner.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
Log:
Added fix for JBCACHE-1246
Deleted: core/trunk/src/main/java/org/jboss/cache/factories/annotations/ClasspathScanner.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/annotations/ClasspathScanner.java 2007-12-19 12:57:49 UTC (rev 4877)
+++ core/trunk/src/main/java/org/jboss/cache/factories/annotations/ClasspathScanner.java 2007-12-19 13:17:43 UTC (rev 4878)
@@ -1,171 +0,0 @@
-package org.jboss.cache.factories.annotations;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-/**
- * Class for scanning archives and classpaths in the current JBoss Cache classpath for classes annotated with a given annotation. Inspired by a similar class in
- * JBoss SEAM.
- *
- * @author Manik Surtani
- */
-public class ClasspathScanner
-{
- private Log log = LogFactory.getLog(ClasspathScanner.class);
- private URLClassLoader classLoader;
-
- /**
- * Constructor with the type of annotation to scan for.
- */
- public ClasspathScanner()
- {
- classLoader = (URLClassLoader) ClasspathScanner.class.getClassLoader();
- }
-
- /**
- * Scans the class path element that contains JBoss Cache for all classes that contain the annotation type this class is
- * initialised with. Note that this only scans CLASSES for the annotation; not methods, etc.
- *
- * @param annotationType the type of annotation to scan for.
- * @param classType the type of class to scan for. Subclasses will be scanned, others will not.
- * @return a set of Classes that contain the specified annotation on the class.
- */
- public <T> Set<Class<? extends T>> scan(Class<? extends Annotation> annotationType, Class<T> classType)
- {
- Set<Class<? extends T>> classes = Collections.emptySet();
-
- try
- {
- // only scan the current ClassPath location that contains this file. Could be a directory or a JAR file.
- URL url = getURLPathFromClassLoader();
- String urlPath = url.getFile();
- if (urlPath.endsWith("/"))
- {
- urlPath = urlPath.substring(0, urlPath.length() - 1);
- }
-
- if (log.isDebugEnabled()) log.debug("scanning: " + urlPath);
- File file = new File(urlPath);
- if (file.isDirectory())
- {
- classes = handleDirectory(file, null, classType, annotationType);
- }
- else
- {
- classes = handleArchive(file, classType, annotationType);
- }
- }
- catch (IOException ioe)
- {
- log.warn("could not read entries", ioe);
- }
- catch (ClassNotFoundException e)
- {
- log.warn("Unable to load class", e);
- }
-
- return classes;
- }
-
- private URL getURLPathFromClassLoader() throws MalformedURLException
- {
- URL u2 = classLoader.findResource("org/jboss/cache/Version.class");
-
- for (URL u : classLoader.getURLs())
- {
- String urlString = u.toString().replaceAll("\\/\\.\\/", "/");
- if (u2.toString().startsWith(urlString))
- {
- return new URL(urlString);
- }
- }
-
- return null;
- }
-
-
- private <T> Set<Class<? extends T>> handleArchive(File file, Class<T> classType, Class<? extends Annotation> annotationType) throws IOException, ClassNotFoundException
- {
- Set<Class<? extends T>> classesWithAnnotations = new HashSet<Class<? extends T>>();
- ZipFile zip = new ZipFile(file);
- Enumeration<? extends ZipEntry> entries = zip.entries();
- while (entries.hasMoreElements())
- {
- ZipEntry entry = entries.nextElement();
- String name = entry.getName();
- Class<? extends T> c = handleItem(name, classType, annotationType);
- if (c != null) classesWithAnnotations.add(c);
- }
-
- return classesWithAnnotations;
- }
-
- private <T> Set<Class<? extends T>> handleDirectory(File file, String path, Class<T> classType, Class<? extends Annotation> annotationType) throws IOException, ClassNotFoundException
- {
- Set<Class<? extends T>> classesWithAnnotations = new HashSet<Class<? extends T>>();
- for (File child : file.listFiles())
- {
- String newPath = path == null ? child.getName() : path + '/' + child.getName();
- if (child.isDirectory())
- {
- classesWithAnnotations.addAll(handleDirectory(child, newPath, classType, annotationType));
- }
- else
- {
- Class<? extends T> c = handleItem(newPath, classType, annotationType);
- if (c != null)
- {
- classesWithAnnotations.add(c);
- }
- }
- }
-
- return classesWithAnnotations;
- }
-
- private <T> Class<? extends T> handleItem(String name, Class<T> classType, Class<? extends Annotation> annotationType) throws IOException, ClassNotFoundException
- {
- if (!name.endsWith(".class")) return null;
-
- Class<? extends T> c = getClassFile(filenameToClassname(name), classType);
- if (c != null && hasAnnotation(c, annotationType))
- {
- return c;
- }
- else
- {
- return null;
- }
- }
-
- private <T> Class<? extends T> getClassFile(String name, Class<T> classType) throws IOException, ClassNotFoundException
- {
- Class c = classLoader.loadClass(name);
- if (c != null && classType.isAssignableFrom(c)) return c;
- else return null;
- }
-
- private boolean hasAnnotation(Class clazz, Class<? extends Annotation> annotationType)
- {
- return (clazz.isAnnotationPresent(annotationType));
- }
-
- private static String filenameToClassname(String filename)
- {
- return filename.substring(0, filename.lastIndexOf(".class")).replace('/', '.').replace('\\', '.');
- }
-
-}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 12:57:49 UTC (rev 4877)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 13:17:43 UTC (rev 4878)
@@ -450,11 +450,11 @@
public void putForExternalRead(Fqn<?> fqn, K key, V value)
{
// if the node exists then this should be a no-op.
- if (peek(fqn, false, false) != null)
+ if (peek(fqn, false, false) == null)
{
getInvocationContext().getOptionOverrides().setFailSilently(true);
- GlobalTransaction tx = cache.getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal, tx, fqn, key, value);
+ //GlobalTransaction tx = cache.getCurrentTransaction();
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal, null, fqn, key, value);
invoke(m);
}
else
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 12:57:49 UTC (rev 4877)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 13:17:43 UTC (rev 4878)
@@ -74,41 +74,7 @@
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- if (cache1 != null)
- {
- if (tm1 != null)
- {
- try
- {
- tm1.rollback();
- }
- catch (Exception e)
- {
- // do nothing
- }
- }
- cache1.stop();
- tm1 = null;
- cache1 = null;
- }
-
- if (cache2 != null)
- {
- if (tm2 != null)
- {
- try
- {
- tm2.rollback();
- }
- catch (Exception e)
- {
- // do nothing
- }
- }
- cache2.stop();
- tm2 = null;
- cache2 = null;
- }
+ TestingUtil.killCaches(cache1, cache2);
}
/**
@@ -314,6 +280,8 @@
public void testBasicPropagation() throws Exception
{
+ assert !cache1.exists(fqn);
+ assert !cache2.exists(fqn);
cache1.putForExternalRead(fqn, key, value);
Deleted: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java 2007-12-19 12:57:49 UTC (rev 4877)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java 2007-12-19 13:17:43 UTC (rev 4878)
@@ -1,233 +0,0 @@
-package org.jboss.cache.factories;
-
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.RegionManager;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.buddyreplication.NextMemberBuddyLocator;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheInvocationDelegate;
-import org.jboss.cache.marshall.CacheMarshaller200;
-import org.jboss.cache.marshall.CacheMarshaller210;
-import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.marshall.VersionAwareMarshaller;
-import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.statetransfer.StateTransferManager;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.lang.reflect.Constructor;
-
-/**
- * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
- * @since 2.1.0
- */
-@Test(groups = {"functional"})
-public class ComponentRegistryTest
-{
- private ComponentFactory cf;
- private ComponentRegistry cr;
- private Configuration configuration;
-
- @BeforeMethod
- public void setUp() throws Exception
- {
- cf = (ComponentFactory) DefaultCacheFactory.getInstance();
-
- CacheSPI spi = new CacheInvocationDelegate();
- Constructor ctor = CacheImpl.class.getDeclaredConstructor();
- ctor.setAccessible(true);
- CacheImpl ci = (CacheImpl) ctor.newInstance();
-
- configuration = ci.getConfiguration();
- cr = TestingUtil.extractComponentRegistry(ci);
-
- cr.registerComponent(ci);
- cr.registerComponent(spi);
- cr.registerComponent(cr); // register self
- cr.registerComponent(configuration);
-
- cr.wireDependencies(cf);
- cr.wireDependencies(ci);
- cr.wireDependencies(spi);
- }
-
- public void testWiringDependenciesInFactory()
- {
- assert cf.componentRegistry == cr;
- assert cf.configuration == configuration;
-
- System.out.println(cr.registry);
- }
-
- public void testDefaultFactoryScanning()
- {
- cr.scanDefaultFactories();
-
- assert cr.defaultFactories != null : "Should be populated";
-
- // at very least, expecting a Marshaller factory and a DefaultCacheFactory.
-
- assert cr.defaultFactories.containsKey(CacheSPI.class);
- assert cr.defaultFactories.get(CacheSPI.class).equals(DefaultCacheFactory.class);
- assert cr.defaultFactories.containsKey(Marshaller.class);
- assert cr.defaultFactories.get(Marshaller.class).equals(CacheMarshallerFactory.class);
- }
-
- public void testNamedComponents()
- {
- cr.registerComponent("blah", new Object());
- Object namedComponent1 = cr.getOrCreateComponent("blah", Object.class);
- Object namedComponent2 = cr.getOrCreateComponent("blah", Object.class);
-
- assert namedComponent1 == namedComponent2;
- }
-
- /**
- * Case 1:
- * nothing injected, nothing specified in Configuration. Should use default factory.
- */
- public void testConstructionOrder1()
- {
- Class<Marshaller> componentToTest = Marshaller.class;
- Marshaller m = cr.getOrCreateComponent(null, componentToTest);
- assert m instanceof VersionAwareMarshaller;
- VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
- m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
- assert m instanceof CacheMarshaller210;
- }
-
- /**
- * Case 2:
- * instance injected, class specified in Configuration. Should use injected.
- */
- public void testConstructionOrder2()
- {
- Class<Marshaller> componentToTest = Marshaller.class;
- configuration.setMarshallerClass(CacheMarshaller200.class.getName());
- Marshaller instance = new CacheMarshaller210(null, false, false);
- configuration.setCacheMarshaller(instance);
-
- // the setup() would have wired the default marshaller. Need to update deps.
- cr.unregisterComponent(Marshaller.class);
- cr.updateDependencies();
-
- Marshaller m = cr.getOrCreateComponent(null, componentToTest);
- assert m == instance : "m is " + m + " but expected " + instance;
- }
-
- /**
- * Case 3:
- * instance injected, no class specified in Configuration. Should use injected.
- */
- public void testConstructionOrder3()
- {
- Class<Marshaller> componentToTest = Marshaller.class;
- Marshaller instance = new CacheMarshaller210(null, false, false);
- configuration.setCacheMarshaller(instance);
-
- // the setup() would have wired the default marshaller. Need to update deps.
- cr.unregisterComponent(Marshaller.class);
- cr.updateDependencies();
-
- Marshaller m = cr.getOrCreateComponent(null, componentToTest);
- assert m == instance : "m is " + m + " but expected " + instance;
- }
-
- /**
- * Case 4:
- * nothing injected, class specified in Configuration. Should use class specified.
- */
- public void testConstructionOrder4()
- {
- Class<Marshaller> componentToTest = Marshaller.class;
- configuration.setMarshallerClass(CacheMarshaller200.class.getName());
- Marshaller m = cr.getOrCreateComponent(null, componentToTest);
- assert m instanceof VersionAwareMarshaller;
- VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
- m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
- assert m instanceof CacheMarshaller200;
- }
-
- public void testTransitiveDependencies()
- {
- Class<BuddyManager> componentToTest = BuddyManager.class;
-
- // configure the cfg to use BR
- BuddyReplicationConfig brc = new BuddyReplicationConfig();
- brc.setEnabled(true);
- BuddyReplicationConfig.BuddyLocatorConfig blc = new BuddyReplicationConfig.BuddyLocatorConfig();
- blc.setBuddyLocatorClass(NextMemberBuddyLocator.class.getName());
- brc.setBuddyLocatorConfig(blc);
- configuration.setBuddyReplicationConfig(brc);
-
- BuddyManager bm = cr.getOrCreateComponent(null, componentToTest);
- assert bm != null;
-
- StateTransferManager stm = (StateTransferManager) TestingUtil.extractField(bm, "stateTransferManager");
- assert stm != null;
-
- RPCManager rpcm = (RPCManager) TestingUtil.extractField(bm, "rpcManager");
- assert rpcm != null;
-
- RegionManager rm = (RegionManager) TestingUtil.extractField(bm, "regionManager");
- assert rm != null;
-
- Configuration cfg = (Configuration) TestingUtil.extractField(bm, "configuration");
- assert cfg == configuration;
- }
-
- public void testInjectionOrder()
- {
- // injection should only occur after dependent components have been fully wired.
-
- // E.g. Test1 depends on Test2 and Test2 depends on Test3.
- //cr.reset();
-
- // DefaultFactoryFor annotation won't work since tests are compiled into a separate classpath
- cr.defaultFactories.put(Test1.class, EmptyConstructorFactory.class);
- cr.defaultFactories.put(Test2.class, EmptyConstructorFactory.class);
- cr.defaultFactories.put(Test3.class, EmptyConstructorFactory.class);
-
- Test1 t1 = cr.getOrCreateComponent(null, Test1.class);
-
- assert t1 != null;
- assert t1.test2 != null;
- assert t1.test2.test3 != null;
- assert t1.someValue == t1.test2.test3.someValue;
- }
-
- public static class Test1
- {
- private Test2 test2;
- private boolean someValue = false;
-
- @Inject
- public void setTest2(Test2 test2)
- {
- this.test2 = test2;
- someValue = test2.test3.someValue;
- }
- }
-
- public static class Test2
- {
- private Test3 test3;
-
- @Inject
- public void setTest3(Test3 test3)
- {
- this.test3 = test3;
- }
- }
-
- public static class Test3
- {
- private boolean someValue = true;
- }
-}
-
17 years, 3 months
JBoss Cache SVN: r4877 - core/trunk/src/test/java/org/jboss/cache/api/pfer.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 07:57:49 -0500 (Wed, 19 Dec 2007)
New Revision: 4877
Modified:
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
Log:
Added test for JBCACHE-1246
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 12:52:53 UTC (rev 4876)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 12:57:49 UTC (rev 4877)
@@ -33,7 +33,7 @@
@Test(groups = {"functional", "jgroups", "transaction"})
public abstract class PutForExternalReadTestBase
{
- protected Cache<String, String> cache1, cache2;
+ protected CacheSPI<String, String> cache1, cache2;
protected TransactionManager tm1, tm2;
@@ -50,7 +50,7 @@
{
CacheFactory<String, String> cf = DefaultCacheFactory.getInstance();
- cache1 = cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache1.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache1.getConfiguration().setSyncCommitPhase(optimistic);
@@ -59,7 +59,7 @@
cache1.start();
tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
- cache2 = cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache2.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache2.getConfiguration().setSyncCommitPhase(optimistic);
@@ -148,9 +148,9 @@
asyncWait();
assertEquals("Parent node write should have succeeded", value2, cache1.get(parentFqn, key));
- if (isUsingInvalidation())
+ if (isUsingInvalidation())
assertNull("Parent node write should have invalidated", cache2.get(parentFqn, key));
- else
+ else
assertEquals("Parent node write should have replicated", value2, cache2.get(parentFqn, key));
if (!optimistic)
@@ -167,9 +167,9 @@
asyncWait();
assertEquals("PFER should have succeeded", value, cache1.get(fqn, key));
- if (isUsingInvalidation())
+ if (isUsingInvalidation())
assertNull("PFER should not have effected cache2", cache2.get(fqn, key));
- else
+ else
assertEquals("PFER should have replicated", value, cache2.get(fqn, key));
// reset
@@ -186,9 +186,9 @@
cache1.putForExternalRead(fqn, key, value2);
assertEquals("PFER should have been a no-op", value, cache1.get(fqn, key));
- if (isUsingInvalidation())
+ if (isUsingInvalidation())
assertNull("PFER should have been a no-op", cache2.get(fqn, key));
- else
+ else
assertEquals("PFER should have been a no-op", value, cache2.get(fqn, key));
}
@@ -212,7 +212,7 @@
// specify what we expect called on the mock Rpc Manager. For params we don't care about, just use ANYTHING.
// setting the mock object to expect the "sync" param to be false.
expect(rpcManager.getReplicationQueue()).andReturn(null);
- expect(rpcManager.callRemoteMethods(anyAddresses(), (Method)anyObject(), (Object[]) anyObject(), eq(false), anyBoolean(), anyInt())).andReturn(null);
+ expect(rpcManager.callRemoteMethods(anyAddresses(), (Method) anyObject(), (Object[]) anyObject(), eq(false), anyBoolean(), anyInt())).andReturn(null);
}
replay(rpcManager);
@@ -248,7 +248,7 @@
assertLocked(parentFqn, parentNode, workspace, false);
assertEquals("PFER should have completed", value, cache1.get(fqn, key));
- if (isUsingInvalidation())
+ if (isUsingInvalidation())
assertNull("PFER should not have effected cache2", cache2.get(fqn, key));
else
assertEquals("PFER should have completed", value, cache2.get(fqn, key));
@@ -259,7 +259,7 @@
asyncWait();
assertEquals("parent fqn tx should have completed", value, cache1.get(parentFqn, key));
- if (isUsingInvalidation())
+ if (isUsingInvalidation())
assertNull("parent fqn tx should have invalidated cache2", cache2.get(parentFqn, key));
else
assertEquals("parent fqn tx should have completed", value, cache2.get(parentFqn, key));
@@ -311,73 +311,94 @@
// should not barf
cache1.putForExternalRead(fqn, key, value);
}
-
- public void testBasicPropagation() throws Exception {
-
+
+ public void testBasicPropagation() throws Exception
+ {
+
cache1.putForExternalRead(fqn, key, value);
-
+
asyncWait();
-
+
assertEquals("PFER updated cache1", value, cache1.get(fqn, key));
Object expected = isUsingInvalidation() ? null : value;
assertEquals("PFER propagated to cache2 as expected", expected, cache2.get(fqn, key));
cache2.putForExternalRead(fqn, key, value);
-
+
asyncWait();
-
+
assertEquals("PFER updated cache2", value, cache2.get(fqn, key));
assertEquals("PFER propagated to cache1 as expected", value, cache1.get(fqn, key));
}
-
+
/**
* Tests that setting a cacheModeLocal=true Option prevents propagation
* of the putForExternalRead().
- *
+ *
* @throws Exception
*/
- public void testSimpleCacheModeLocal() throws Exception
+ public void testSimpleCacheModeLocal() throws Exception
{
cacheModeLocalTest(false);
}
-
+
/**
* Tests that setting a cacheModeLocal=true Option prevents propagation
* of the putForExternalRead() when the call occurs inside a transaction.
- *
+ *
* @throws Exception
*/
- public void testCacheModeLocalInTx() throws Exception
+ public void testCacheModeLocalInTx() throws Exception
{
cacheModeLocalTest(true);
}
-
+
/**
+ * Tests that suspended transactions do not leak. See JBCACHE-1246.
+ *
+ * @throws Exception
+ */
+ public void testMemLeakOnSuspendedTransactions() throws Exception
+ {
+ tm1.begin();
+ cache1.putForExternalRead(fqn, key, value);
+ tm1.commit();
+
+ asyncWait();
+
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+ }
+
+ /**
* Tests that setting a cacheModeLocal=true Option prevents propagation
* of the putForExternalRead().
+ *
* @throws Exception
*/
- private void cacheModeLocalTest(boolean transactional) throws Exception
+ private void cacheModeLocalTest(boolean transactional) throws Exception
{
RPCManager rpcManager = EasyMock.createMock(RPCManager.class);
RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
-
+
// inject a mock RPC manager so that we can test whether calls made are sync or async.
cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);
-
+
// specify that we expect nothing will be called on the mock Rpc Manager.
replay(rpcManager);
-
+
// now try a simple replication. Since the RPCManager is a mock object it will not actually replicate anything.
if (transactional)
tm1.begin();
-
+
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.putForExternalRead(fqn, key, value);
-
+
if (transactional)
tm1.commit();
-
+
verify(rpcManager);
// cleanup
cache1.getConfiguration().getRuntimeConfig().setRPCManager(originalRpcManager);
@@ -428,10 +449,10 @@
{
TestingUtil.sleepThread(500);
}
-
- protected boolean isUsingInvalidation()
+
+ protected boolean isUsingInvalidation()
{
- return cacheMode == CacheMode.INVALIDATION_ASYNC
- || cacheMode == CacheMode.INVALIDATION_SYNC;
+ return cacheMode == CacheMode.INVALIDATION_ASYNC
+ || cacheMode == CacheMode.INVALIDATION_SYNC;
}
}
17 years, 3 months
JBoss Cache SVN: r4876 - in core/branches/1.4.X/tests: perf/org/jboss/cache/manualtests and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-19 07:52:53 -0500 (Wed, 19 Dec 2007)
New Revision: 4876
Added:
core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java
Removed:
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java
Log:
JBCACHE-1246 - memory leak when using fail silently option
Copied: core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java (from rev 4875, core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java)
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java (rev 0)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java 2007-12-19 12:52:53 UTC (rev 4876)
@@ -0,0 +1,50 @@
+package org.jboss.cache.options;
+
+import junit.framework.TestCase;
+import org.jboss.cache.DummyTransactionManagerLookup;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.config.Option;
+
+import javax.transaction.TransactionManager;
+
+/**
+ * To test memory leak reported in http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#4112143
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ */
+public class OptimisticMemLeakTest extends TestCase
+{
+ private TreeCache cache;
+ private TransactionManager tm;
+ private Fqn fqn = Fqn.fromString("/a/b/c");
+ private String key = "key", value = "value";
+
+ protected void tearDown()
+ {
+ cache.stop();
+ }
+
+ protected void setUp() throws Exception
+ {
+ cache = new TreeCache();
+ cache.setNodeLockingScheme("OPTIMISTIC");
+ cache.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.startService();
+ tm = cache.getTransactionManager();
+ }
+
+ public void testLeakWithFailSilently() throws Exception
+ {
+ tm.begin();
+ Option option = new Option();
+ option.setFailSilently(true);
+ cache.put(fqn, key, value, option);
+ tm.commit();
+
+ int gtxCnt = cache.getTransactionTable().getNumGlobalTransactions();
+ int txCnt = cache.getTransactionTable().getNumLocalTransactions();
+ assertEquals("Global transaction count is > 0", 0, gtxCnt);
+ assertEquals("Local transaction count is > 0", 0, txCnt);
+ }
+}
Deleted: core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java
===================================================================
--- core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java 2007-12-19 12:50:02 UTC (rev 4875)
+++ core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java 2007-12-19 12:52:53 UTC (rev 4876)
@@ -1,50 +0,0 @@
-package org.jboss.cache.manualtests;
-
-import junit.framework.TestCase;
-import org.jboss.cache.DummyTransactionManagerLookup;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.config.Option;
-
-import javax.transaction.TransactionManager;
-
-/**
- * To test memory leak reported in http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#4112143
- *
- * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
- */
-public class OptimisticMemLeakTest extends TestCase
-{
- private TreeCache cache;
- private TransactionManager tm;
- private Fqn fqn = Fqn.fromString("/a/b/c");
- private String key = "key", value = "value";
-
- protected void tearDown()
- {
- cache.stop();
- }
-
- protected void setUp() throws Exception
- {
- cache = new TreeCache();
- cache.setNodeLockingScheme("OPTIMISTIC");
- cache.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache.startService();
- tm = cache.getTransactionManager();
- }
-
- public void testLeakWithFailSilently() throws Exception
- {
- tm.begin();
- Option option = new Option();
- option.setFailSilently(true);
- cache.put(fqn, key, value, option);
- tm.commit();
-
- int gtxCnt = cache.getTransactionTable().getNumGlobalTransactions();
- int txCnt = cache.getTransactionTable().getNumLocalTransactions();
- assertEquals("Global transaction count is > 0", 0, gtxCnt);
- assertEquals("Local transaction count is > 0", 0, txCnt);
- }
-}
17 years, 3 months