[jbosscache-commits] JBoss Cache SVN: r6278 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 46 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Jul 15 12:39:43 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-07-15 12:39:43 -0400 (Tue, 15 Jul 2008)
New Revision: 6278
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/Fqn.java
core/trunk/src/main/java/org/jboss/cache/InternalNode.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java
core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/ThreadLocalMap.java
core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java
core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
core/trunk/src/main/java/org/jboss/cache/util/DeltaMap.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/TreeCacheFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/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/nodevalidity/ReplicatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PFEROptimisticTestBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
core/trunk/src/test/java/org/jboss/cache/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/ExpirationPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java
core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
core/trunk/src/test/java/org/jboss/cache/jmx/LegacyConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/LifecycleNotificationTest.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/CacheLoaderManagerTest.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/DataSourceIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/DummyInMemoryCacheLoader.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/SingletonStoreCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.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/BreakDeadMemberLocksTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.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/RegionManagerTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/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/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/BuddyGroupChangeNotificationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotifierAnnotationsTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.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/FullStackInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.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/LockAcquisitionTimeoutTest.java
core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.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/profiling/ConstructionTest.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/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/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:
More generic based cleanups
Modified: core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -83,7 +83,6 @@
return channelFactory;
}
- @SuppressWarnings("unchecked")
public Set<String> getConfigurationNames()
{
synchronized (caches)
@@ -136,10 +135,9 @@
* @param config the Configuration for the cache
* @return the Cache
*/
- @SuppressWarnings("unchecked")
protected Cache<Object, Object> createCache(Configuration config)
{
- return new DefaultCacheFactory().createCache(config, false);
+ return new DefaultCacheFactory<Object, Object>().createCache(config, false);
}
public void releaseCache(String configName)
Modified: core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -1,6 +1,18 @@
package org.jboss.cache;
-import org.jboss.cache.notifications.annotation.*;
+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.event.Event;
import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
@@ -207,7 +219,7 @@
System.out.print("No xml config file argument is supplied. Will use jboss-cache.xml from classpath");
}
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(configFileName);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -23,9 +23,6 @@
* This is a special instance of a {@link ComponentFactory} which contains bootstrap information for the
* {@link org.jboss.cache.factories.ComponentRegistry}.
* <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 at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @see org.jboss.cache.factories.ComponentFactory
@@ -34,19 +31,6 @@
{
private ClassLoader defaultClassLoader;
- /**
- * 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.
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static <K, V> CacheFactory<K, V> getInstance()
- {
- return new DefaultCacheFactory();
- }
-
public Cache<K, V> createCache() throws ConfigurationException
{
return createCache(true);
@@ -65,11 +49,12 @@
public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
- Configuration c = null;
+ Configuration c;
try
{
c = parser.parseFile(configFileName);
- } catch (OldFileFormatException e)
+ }
+ catch (OldFileFormatException e)
{
log.warn(configFileName + " is an old configuration file; We stronly suggest migrating to the new file format(tools are available for that)");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
@@ -157,7 +142,8 @@
try
{
c = parser.parseStream(is);
- } catch (OldFileFormatException e)
+ }
+ catch (OldFileFormatException e)
{
log.warn("This is an old configuration file; We stronly suggest migrating to the new file format (tools are available for that)");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
Modified: core/trunk/src/main/java/org/jboss/cache/Fqn.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -379,7 +379,6 @@
}
}
- @SuppressWarnings("unchecked")
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
size = in.readShort();
Modified: core/trunk/src/main/java/org/jboss/cache/InternalNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/InternalNode.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/InternalNode.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,11 +32,11 @@
V putDirect(K key, V value);
- NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify);
+ NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx, boolean notify);
V removeDirect(K key);
- void addChildDirect(NodeSPI child);
+ void addChildDirect(NodeSPI<K, V> child);
NodeSPI<K, V> addChildDirect(Fqn f);
@@ -92,7 +92,7 @@
void setLockForChildInsertRemove(boolean lockForChildInsertRemove);
- void setInternalState(Map state);
+ void setInternalState(Map<K, V> state);
Map getInternalState(boolean onlyInternalState);
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.0.0
*/
- at SuppressWarnings("unchecked")
+ at SuppressWarnings("deprecation")
public class UnversionedNode<K, V> extends AbstractNode<K, V> implements InternalNode<K, V>
{
/**
@@ -50,17 +50,17 @@
/**
* A reference of the CacheImpl instance.
*/
- transient CacheSPI cache;
+ transient CacheSPI<K, V> cache;
/**
* Map of general data keys to values.
*/
- final Map data = new HashMap();
+ final Map<K, V> data = new HashMap<K, V>();
- protected NodeSPI delegate;
+ protected NodeSPI<K, V> delegate;
CommandsFactory commandsFactory;
protected LockStrategyFactory lockStrategyFactory;
- private NodeFactory nodeFactory;
+ private NodeFactory<K, V> nodeFactory;
/**
* Constructs a new node with an FQN of Root.
@@ -73,6 +73,8 @@
/**
* Constructs a new node a given Fqn
+ *
+ * @param fqn fqn of the node
*/
public UnversionedNode(Fqn fqn)
{
@@ -82,16 +84,21 @@
/**
* Constructs a new node with a name, etc.
+ *
+ * @param name name of current node
+ * @param fqn Fqn of current node
+ * @param data data to add to node
+ * @param cache cache reference
*/
- public UnversionedNode(Object childName, Fqn fqn, Map data, CacheSPI cache)
+ public UnversionedNode(Object name, Fqn fqn, Map data, CacheSPI<K, V> cache)
{
if (cache == null)
{
throw new IllegalArgumentException("no cache init for " + fqn);
}
- if (!fqn.isRoot() && !childName.equals(fqn.getLastElement()))
+ if (!fqn.isRoot() && !name.equals(fqn.getLastElement()))
{
- throw new IllegalArgumentException("Child " + childName + " must be last part of " + fqn);
+ throw new IllegalArgumentException("Child " + name + " must be last part of " + fqn);
}
initFlags();
@@ -112,17 +119,17 @@
flags.add(VALID);
}
- public NodeSPI getDelegate()
+ public NodeSPI<K, V> getDelegate()
{
return delegate;
}
- public void setDelegate(NodeSPI delegate)
+ public void setDelegate(NodeSPI<K, V> delegate)
{
this.delegate = delegate;
}
- public void injectDependencies(CacheSPI spi, CommandsFactory commandsFactory, LockStrategyFactory lockStrategyFactory, NodeFactory nodeFactory)
+ public void injectDependencies(CacheSPI<K, V> spi, CommandsFactory commandsFactory, LockStrategyFactory lockStrategyFactory, NodeFactory<K, V> nodeFactory)
{
this.cache = spi;
this.commandsFactory = commandsFactory;
@@ -143,7 +150,7 @@
/**
* Returns a parent by checking the TreeMap by name.
*/
- public NodeSPI getParent()
+ public NodeSPI<K, V> getParent()
{
if (fqn.isRoot())
{
@@ -177,7 +184,7 @@
return children;
}
- public CacheSPI getCache()
+ public CacheSPI<K, V> getCache()
{
return cache;
}
@@ -198,13 +205,13 @@
throw new NodeNotValidException("Node " + getFqn() + " is not valid. Perhaps it has been moved or removed.");
}
- public Object get(Object key)
+ public V get(K key)
{
assertValid();
return cache.get(getFqn(), key);
}
- public Object getDirect(Object key)
+ public V getDirect(K key)
{
return data.get(key);
}
@@ -226,45 +233,44 @@
return lock;
}
- public Map getDataDirect()
+ public Map<K, V> getDataDirect()
{
if (data == null) return Collections.emptyMap();
-// return Collections.unmodifiableMap(data);
return data;
}
- public Object put(Object key, Object value)
+ public V put(K key, V value)
{
assertValid();
return cache.put(getFqn(), key, value);
}
- public Object putDirect(Object key, Object value)
+ public V putDirect(K key, V value)
{
return data.put(key, value);
}
- public NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify)
+ public NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify)
{
return getOrCreateChild(child_name, gtx, true, notify);
}
- private NodeSPI getOrCreateChild(Object childName, GlobalTransaction gtx, boolean createIfNotExists, boolean notify)
+ private NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx, boolean createIfNotExists, boolean notify)
{
- NodeSPI child;
+ NodeSPI<K, V> child;
if (childName == null)
{
throw new IllegalArgumentException("null child name");
}
- child = (NodeSPI) children().get(childName);
+ child = (NodeSPI<K, V>) children().get(childName);
InvocationContext ctx = cache.getInvocationContext();
if (createIfNotExists && child == null)
{
// construct the new child outside the synchronized block to avoid
// spending any more time than necessary in the synchronized section
Fqn childFqn = Fqn.fromRelativeElements(fqn, childName);
- NodeSPI newChild = nodeFactory.createNode(childName, childFqn, delegate, null, true);
+ NodeSPI<K, V> newChild = nodeFactory.createNode(childName, childFqn, delegate, null, true);
if (newChild == null)
{
throw new IllegalStateException();
@@ -273,7 +279,7 @@
{
// check again to see if the child exists
// after acquiring exclusive lock
- child = (NodeSPI) children().get(childName);
+ child = (NodeSPI<K, V>) children().get(childName);
if (child == null)
{
if (notify) cache.getNotifier().notifyNodeCreated(childFqn, true, ctx);
@@ -302,13 +308,13 @@
}
- public Object remove(Object key)
+ public V remove(K key)
{
assertValid();
return cache.remove(getFqn(), key);
}
- public Object removeDirect(Object key)
+ public V removeDirect(K key)
{
if (data == null) return null;
return data.remove(key);
@@ -431,7 +437,7 @@
return sb.toString();
}
- public void addChildDirect(NodeSPI child)
+ public void addChildDirect(NodeSPI<K, V> child)
{
if (child.getFqn().getParent().equals(getFqn()))
{
@@ -444,12 +450,12 @@
throw new CacheException("Attempting to add a child [" + child.getFqn() + "] to [" + getFqn() + "]. Can only add direct children.");
}
- public NodeSPI addChildDirect(Fqn f)
+ public NodeSPI<K, V> addChildDirect(Fqn f)
{
return addChildDirect(f, true);
}
- public NodeSPI addChildDirect(Fqn f, boolean notify)
+ public NodeSPI<K, V> addChildDirect(Fqn f, boolean notify)
{
if (f.size() == 1)
{
@@ -463,7 +469,7 @@
}
- public NodeSPI addChildDirect(Object childName, boolean notify)
+ public NodeSPI<K, V> addChildDirect(Object childName, boolean notify)
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
return getOrCreateChild(childName, gtx, true, notify);
@@ -474,7 +480,7 @@
if (data != null) data.clear();
}
- public NodeSPI getChildDirect(Fqn fqn)
+ public NodeSPI<K, V> getChildDirect(Fqn fqn)
{
if (fqn.size() == 1)
{
@@ -482,7 +488,7 @@
}
else
{
- NodeSPI currentNode = delegate;
+ NodeSPI<K, V> currentNode = delegate;
for (int i = 0; i < fqn.size(); i++)
{
Object nextChildName = fqn.get(i);
@@ -520,7 +526,7 @@
}
else
{
- NodeSPI child = getChildDirect(f);
+ NodeSPI<K, V> child = getChildDirect(f);
return child != null && child.getParentDirect().removeChildDirect(f.getLastElement());
}
}
@@ -546,13 +552,13 @@
}
}
- public void putAll(Map data)
+ public void putAll(Map<K, V> data)
{
assertValid();
cache.put(fqn, data);
}
- public void putAllDirect(Map data)
+ public void putAllDirect(Map<K, V> data)
{
if (data == null) return;
this.data.putAll(data);
@@ -591,11 +597,11 @@
}
}
- public void addChild(Object child_name, Node n)
+ public void addChild(Object childName, Node<K, V> n)
{
- if (child_name != null)
+ if (childName != null)
{
- children().put(child_name, n);
+ children().put(childName, n);
}
}
@@ -629,18 +635,18 @@
}
// invoke children
- for (Map.Entry<Object, ? extends Node> me : children.entrySet())
+ for (Map.Entry<Object, ? extends Node<K, V>> me : children.entrySet())
{
- NodeSPI n = (NodeSPI) me.getValue();
+ NodeSPI<K, V> n = (NodeSPI<K, V>) me.getValue();
Fqn cfqn = Fqn.fromRelativeElements(fqn, me.getKey());
n.setFqn(cfqn);
}
}
- public NodeSPI getChildDirect(Object childName)
+ public NodeSPI<K, V> getChildDirect(Object childName)
{
if (childName == null) return null;
- return (NodeSPI) (children == null ? null : children.get(childName));
+ return (NodeSPI<K, V>) (children == null ? null : children.get(childName));
}
public Set<NodeSPI<K, V>> getChildrenDirect()
@@ -649,9 +655,9 @@
if (children == null || children.size() == 0) return Collections.emptySet();
Set<NodeSPI<K, V>> exclDeleted = new HashSet<NodeSPI<K, V>>();
- for (Node n : children.values())
+ for (Node<K, V> n : children.values())
{
- NodeSPI spi = (NodeSPI) n;
+ NodeSPI<K, V> spi = (NodeSPI<K, V>) n;
if (!spi.isDeleted()) exclDeleted.add(spi);
}
exclDeleted = Collections.unmodifiableSet(exclDeleted);
@@ -663,13 +669,14 @@
return children != null && children.size() != 0;
}
+ @SuppressWarnings("unchecked")
public Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
{
if (children != null && !children.isEmpty())
{
- return Collections.unmodifiableSet(new HashSet(children.values()));
+ return Collections.unmodifiableSet(new HashSet<NodeSPI<K, V>>((Set) children.values()));
}
else
{
@@ -698,10 +705,10 @@
sb.append(data);
if (children != null)
{
- for (Node n : children.values())
+ for (Node<K, V> n : children.values())
{
sb.append("\n");
- ((NodeSPI) n).printDetails(sb, indent);
+ ((NodeSPI<K, V>) n).printDetails(sb, indent);
}
}
}
@@ -734,9 +741,9 @@
if (trace) log.trace("Marking node " + getFqn() + " as " + (valid ? "" : "in") + "valid");
if (recursive)
{
- for (Node child : children().values())
+ for (Node<K, V> child : children().values())
{
- ((NodeSPI) child).setValid(valid, recursive);
+ ((NodeSPI<K, V>) child).setValid(valid, recursive);
}
}
}
@@ -751,9 +758,9 @@
setFlag(LOCK_FOR_CHILD_INSERT_REMOVE, lockForChildInsertRemove);
}
- public InternalNode copy()
+ public InternalNode<K, V> copy()
{
- UnversionedNode n = new UnversionedNode(fqn.getLastElement(), fqn, data, cache);
+ UnversionedNode<K, V> n = new UnversionedNode<K, V>(fqn.getLastElement(), fqn, data, cache);
copyInternals(n);
return n;
}
@@ -770,19 +777,19 @@
n.lockStrategyFactory = lockStrategyFactory;
}
- public void setInternalState(Map state)
+ public void setInternalState(Map<K, V> state)
{
// don't bother doing anything here
putAllDirect(state);
}
- public Map getInternalState(boolean onlyInternalState)
+ public Map<K, V> getInternalState(boolean onlyInternalState)
{
if (onlyInternalState)
- return new HashMap(0);
+ return new HashMap<K, V>(0);
// don't bother doing anything here
- if (data == null) return new HashMap(0);
- return new HashMap(data);
+ if (data == null) return new HashMap<K, V>(0);
+ return new HashMap<K, V>(data);
}
public void releaseObjectReferences(boolean recursive)
@@ -797,7 +804,7 @@
if (data != null)
{
- for (Object key : data.keySet())
+ for (K key : data.keySet())
{
// get the key first, before attempting to serialize stuff since data.get() may deserialize the key if doing
// a hashcode() or equals().
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -71,7 +71,6 @@
return Fqn.fromList(elements);
}
- @SuppressWarnings("unchecked")
public boolean isBackupFqn(Fqn name)
{
return name != null && name.hasElement(BuddyManager.BUDDY_BACKUP_SUBTREE);
@@ -91,7 +90,6 @@
* @param name fqn to test
* @return true if the fqn is a part of a dead backup region; false otherwise.
*/
- @SuppressWarnings("unchecked")
public boolean isDeadBackupFqn(Fqn name)
{
if (name == null || name.size() < 2) return false;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -64,10 +64,6 @@
protected TransactionManager txManager;
protected BuddyFqnTransformer buddyFqnTransformer;
- public CommandsFactoryImpl()
- {
- }
-
@Inject
public void initialize(RPCManager rpc, DataContainer dataContainer, Notifier notifier, BuddyManager buddyManager,
InterceptorChain invoker, TransactionTable transactionTable, CacheSPI cacheSpi,
Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -20,7 +20,7 @@
super(fqn);
}
- protected Set<Object> getCorrectedChildNames(Collection<NodeSPI> children, InvocationContext ctx)
+ protected Set<Object> getCorrectedChildNames(Collection<NodeSPI<?, ?>> children, InvocationContext ctx)
{
// prune deleted children - JBCACHE-1136
Set<Object> childNames = new HashSet<Object>();
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,6 +3,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.invocation.InvocationContext;
@@ -47,10 +48,10 @@
@SuppressWarnings("unchecked")
public Object perform(InvocationContext ctx)
{
- NodeSPI n = fqn == null ? null : ctx.lookUpNode(fqn);
+ NodeSPI<?, ?> n = fqn == null ? null : ctx.lookUpNode(fqn);
if (n == null || n.isDeleted()) return null;
- Map childrenMap = n.getChildrenMapDirect();
- Collection<NodeSPI> children = (childrenMap == null || childrenMap.isEmpty()) ? Collections.emptySet() : childrenMap.values();
+ Map<Object, ? extends Node<?, ?>> childrenMap = n.getChildrenMapDirect();
+ Collection<NodeSPI<?, ?>> children = (Collection<NodeSPI<?, ?>>) ((childrenMap == null || childrenMap.isEmpty()) ? Collections.emptySet() : childrenMap.values());
return getCorrectedChildNames(children, ctx);
}
@@ -63,7 +64,7 @@
* @param ctx invocation context
* @return a set of valid children names.
*/
- protected Set<Object> getCorrectedChildNames(Collection<NodeSPI> children, InvocationContext ctx)
+ protected Set<Object> getCorrectedChildNames(Collection<NodeSPI<?, ?>> children, InvocationContext ctx)
{
Set<Object> childNames = new HashSet<Object>();
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -33,7 +33,6 @@
* @param ctx invocation context
* @return a Set<K> of data keys contained in a node for a given Fqn, or null if the Fqn refers to a node that does not exist.
*/
- @SuppressWarnings("unchecked")
public Object perform(InvocationContext ctx)
{
NodeSPI n = ctx.lookUpNode(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -81,7 +81,7 @@
public void setParameters(int commandId, Object[] args)
{
group = (BuddyGroup) args[0];
- state = (Map) args[1];
+ state = (Map<Fqn, byte[]>) args[1];
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -15,7 +15,6 @@
@DefaultFactoryFor(classes = {TransactionManager.class})
public class TransactionManagerFactory extends ComponentFactory
{
- @Override
@SuppressWarnings("unchecked")
protected <T> T construct(Class<T> componentType)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -536,10 +536,10 @@
}
@SuppressWarnings("unchecked")
- private NodeSPI createNodes(Fqn fqn, TransactionContext transactionContext) throws Exception
+ private NodeSPI<?, ?> createNodes(Fqn fqn, TransactionContext transactionContext) throws Exception
{
Object[] results = dataContainer.createNodes(fqn);
- List<NodeSPI> createdNodes = (List<NodeSPI>) results[0];
+ List<NodeSPI<?, ?>> createdNodes = (List<NodeSPI<?, ?>>) results[0];
NodeSPI lastCreated = null;
for (NodeSPI node : createdNodes)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -109,9 +109,9 @@
}
@SuppressWarnings("unchecked")
- protected WorkspaceNode lockAndCreateWorkspaceNode(NodeFactory nodeFactory, NodeSPI node, TransactionWorkspace workspace, GlobalTransaction gtx, long timeout)
+ protected WorkspaceNode lockAndCreateWorkspaceNode(NodeFactory<?, ?> nodeFactory, NodeSPI node, TransactionWorkspace<?, ?> workspace, GlobalTransaction gtx, long timeout)
{
- boolean locked = false;
+ boolean locked;
try
{
locked = lockManager.lock(node, READ, gtx, timeout);
@@ -125,7 +125,7 @@
if (!locked)
throw new TimeoutException("Unable to lock node " + node.getFqn() + " after timeout " + timeout + " for copying into workspace");
- WorkspaceNode wn = nodeFactory.createWrappedNode(node, workspace);
+ WorkspaceNode<?, ?> wn = nodeFactory.createWrappedNode(node, workspace);
lockManager.unlock(node, gtx);
return wn;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -123,7 +123,6 @@
}
@Override
- @SuppressWarnings("unchecked")
public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
{
if (!ctx.getGlobalTransaction().isRemote())
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -55,7 +55,6 @@
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.1.0
*/
- at SuppressWarnings("unchecked")
@NonVolatile
public class CacheInvocationDelegate<K, V> extends AbstractInvocationDelegate implements CacheSPI<K, V>
{
@@ -240,14 +239,15 @@
cacheStatusCheck(ctx);
GravitateDataCommand command = commandsFactory.buildGravitateDataCommand(fqn, searchBuddyBackupSubtrees);
return (GravitateResult) invoker.invoke(ctx, command);
-// return (GravitateResult) command.perform(null);
}
+ @SuppressWarnings("unchecked")
public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
{
return (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes, includeInvalidNodes);
}
+ @SuppressWarnings("unchecked")
public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes)
{
return (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes);
@@ -362,6 +362,7 @@
evict(fqn, false);
}
+ @SuppressWarnings("unchecked")
public V get(Fqn fqn, K key)
{
InvocationContext ctx = invocationContextContainer.get();
@@ -411,12 +412,13 @@
return removeNode(Fqn.fromString(fqn));
}
+ @SuppressWarnings("unchecked")
public NodeSPI<K, V> getNode(Fqn fqn)
{
InvocationContext ctx = invocationContextContainer.get();
cacheStatusCheck(ctx);
GetNodeCommand command = commandsFactory.buildGetNodeCommand(fqn);
- return (NodeSPI) invoker.invoke(ctx, command);
+ return (NodeSPI<K, V>) invoker.invoke(ctx, command);
}
public NodeSPI<K, V> getNode(String fqn)
@@ -424,6 +426,7 @@
return getNode(Fqn.fromString(fqn));
}
+ @SuppressWarnings("unchecked")
public V remove(Fqn fqn, K key) throws CacheException
{
InvocationContext ctx = invocationContextContainer.get();
@@ -470,6 +473,7 @@
}
}
+ @SuppressWarnings("unchecked")
public V put(Fqn fqn, K key, V value)
{
InvocationContext ctx = invocationContextContainer.get();
@@ -484,13 +488,8 @@
return put(Fqn.fromString(fqn), key, value);
}
- /**
- * Retrieves a defensively copied data map of the underlying node.
- *
- * @param fqn
- * @return map of data, or an empty map
- * @throws CacheException
- */
+
+ @SuppressWarnings("unchecked")
public Map<K, V> getData(Fqn fqn)
{
InvocationContext ctx = invocationContextContainer.get();
@@ -499,25 +498,12 @@
return (Map<K, V>) invoker.invoke(ctx, command);
}
- /**
- * Returns a set of attribute keys for the Fqn.
- * Returns null if the node is not found, otherwise a Set.
- * The set is a copy of the actual keys for this node.
- *
- * @param fqn name of the node
- */
- public Set getKeys(String fqn)
+ public Set<K> getKeys(String fqn)
{
return getKeys(Fqn.fromString(fqn));
}
- /**
- * Returns a set of attribute keys for the Fqn.
- * Returns null if the node is not found, otherwise a Set.
- * The set is a copy of the actual keys for this node.
- *
- * @param fqn name of the node
- */
+ @SuppressWarnings("unchecked")
public Set<K> getKeys(Fqn fqn)
{
InvocationContext ctx = invocationContextContainer.get();
@@ -545,13 +531,7 @@
invoker.invoke(ctx, commandsFactory.buildClearDataCommand(tx, fqn));
}
- /**
- * Returns all children of a given node. Returns an empty set if there are no children.
- * The set is unmodifiable.
- *
- * @param fqn The fully qualified name of the node
- * @return Set an unmodifiable set of children names, Object.
- */
+ @SuppressWarnings("unchecked")
public Set<Object> getChildrenNames(Fqn fqn)
{
InvocationContext ctx = invocationContextContainer.get();
@@ -565,6 +545,7 @@
return retval;
}
+ @SuppressWarnings("unchecked")
public Set<String> getChildrenNames(String fqn)
{
return (Set) getChildrenNames(Fqn.fromString(fqn));
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -41,7 +41,6 @@
throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
}
- @SuppressWarnings("unchecked")
public InvocationContext copy()
{
LegacyInvocationContext copy = new LegacyInvocationContext(container);
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -93,7 +93,6 @@
lookedUpNodes.clear();
}
- @SuppressWarnings("unchecked")
public InvocationContext copy()
{
MVCCInvocationContext copy = new MVCCInvocationContext();
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -24,13 +24,12 @@
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.1.0
*/
- at SuppressWarnings("unchecked")
public class NodeInvocationDelegate<K, V> extends AbstractInvocationDelegate implements NodeSPI<K, V>
{
- protected volatile InternalNode node;
+ protected volatile InternalNode<K, V> node;
private CacheSPI<K, V> spi;
- public NodeInvocationDelegate(InternalNode node)
+ public NodeInvocationDelegate(InternalNode<K, V> node)
{
this.node = node;
}
@@ -40,7 +39,7 @@
return node;
}
- public void injectDependencies(CacheSPI spi)
+ public void injectDependencies(CacheSPI<K, V> spi)
{
this.spi = spi;
}
@@ -80,6 +79,7 @@
return node.getOrCreateChild(name, tx, true);
}
+ @SuppressWarnings("deprecation")
public NodeLock getLock()
{
return node.getLock();
@@ -187,12 +187,12 @@
public V removeDirect(K key)
{
- return (V) node.removeDirect(key);
+ return node.removeDirect(key);
}
public V putDirect(K key, V value)
{
- return (V) node.putDirect(key, value);
+ return node.putDirect(key, value);
}
public void putAllDirect(Map<K, V> data)
@@ -207,7 +207,7 @@
public V getDirect(K key)
{
- return (V) node.getDirect(key);
+ return node.getDirect(key);
}
public void clearDataDirect()
@@ -249,7 +249,7 @@
Set<Node<K, V>> children = new HashSet<Node<K, V>>();
for (Object c : spi.getChildrenNames(getFqn()))
{
- Node n = spi.getNode(Fqn.fromRelativeElements(getFqn(), c));
+ Node<K, V> n = spi.getNode(Fqn.fromRelativeElements(getFqn(), c));
if (n != null) children.add(n);
}
return Collections.unmodifiableSet(children);
@@ -271,8 +271,11 @@
public Set<K> getKeys()
{
assertValid();
- Set keys = spi.getKeys(getFqn());
- return keys == null ? Collections.emptySet() : Collections.unmodifiableSet(keys);
+ Set<K> keys = spi.getKeys(getFqn());
+ if (keys == null)
+ return Collections.emptySet();
+ else
+ return Collections.unmodifiableSet(keys);
}
public Fqn getFqn()
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -73,7 +73,6 @@
storeState(Fqn.ROOT, is);
}
- @SuppressWarnings("unchecked")
public void storeState(Fqn subtree, ObjectInputStream in) throws Exception
{
// remove entire existing state
Modified: core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -95,10 +95,6 @@
isOldWindows = System.getProperty("os.name").toLowerCase().startsWith("windows") && osVersion < 4;
}
- public FileCacheLoader()
- {
- }
-
public void setConfig(IndividualCacheLoaderConfig base)
{
if (base instanceof FileCacheLoaderConfig)
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -120,7 +120,7 @@
}
else if (config != null)
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(this.config);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(this.config);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -54,7 +54,7 @@
* @param owner owner to acquire the lock for
* @return true if the lock was acquired, false otherwise.
*/
- boolean lock(NodeSPI node, LockType lockType, Object owner) throws InterruptedException;
+ boolean lock(NodeSPI<?, ?> node, LockType lockType, Object owner) throws InterruptedException;
/**
* As {@link #lock(org.jboss.cache.Fqn, LockType, Object, long)} except that a NodeSPI is passed in instead of an Fqn.
@@ -65,7 +65,7 @@
* @param timeout maximum length of time to wait for (in millis)
* @return true if the lock was acquired, false otherwise.
*/
- boolean lock(NodeSPI node, LockType lockType, Object owner, long timeout) throws InterruptedException;
+ boolean lock(NodeSPI<?, ?> node, LockType lockType, Object owner, long timeout) throws InterruptedException;
/**
* Acquires a lock of type lockType, on a specific Node in the cache, denoted by fqn. This
@@ -101,7 +101,7 @@
* @param ctx invocation context associated with this invocation
* @return true if the lock was acquired, false otherwise.
*/
- boolean lockAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx) throws InterruptedException;
+ boolean lockAndRecord(NodeSPI<?, ?> node, LockType lockType, InvocationContext ctx) throws InterruptedException;
/**
@@ -118,7 +118,7 @@
* @param node Node to unlock
* @param owner lock owner
*/
- void unlock(NodeSPI node, Object owner);
+ void unlock(NodeSPI<?, ?> node, Object owner);
/**
* Releases locks present in an invocation context and transaction entry, if one is available.
@@ -145,7 +145,7 @@
* @param owner owner to acquire the lock for
* @return true if the lock was acquired, false otherwise.
*/
- boolean lockAll(NodeSPI node, LockType lockType, Object owner) throws InterruptedException;
+ boolean lockAll(NodeSPI<?, ?> node, LockType lockType, Object owner) throws InterruptedException;
/**
* Locks the node and all child nodes, acquiring lock of type specified for the owner specified. If only some locks are
@@ -157,7 +157,7 @@
* @param timeout maximum length of time to wait for (in millis)
* @return true if all locks were acquired, false otherwise.
*/
- boolean lockAll(NodeSPI node, LockType lockType, Object owner, long timeout) throws InterruptedException;
+ boolean lockAll(NodeSPI<?, ?> node, LockType lockType, Object owner, long timeout) throws InterruptedException;
/**
* Locks the node and all child nodes, acquiring lock of type specified for the owner specified. If only some locks are
@@ -170,7 +170,7 @@
* @param excludeInternalFqns if true, any Fqns that are internal are excluded.
* @return true if all locks were acquired, false otherwise.
*/
- boolean lockAll(NodeSPI node, LockType lockType, Object owner, long timeout, boolean excludeInternalFqns) throws InterruptedException;
+ boolean lockAll(NodeSPI<?, ?> node, LockType lockType, Object owner, long timeout, boolean excludeInternalFqns) throws InterruptedException;
/**
* Locks the node and all child nodes, acquiring lock of type specified for the owner specified. If only some locks are
@@ -186,7 +186,7 @@
* @param ctx invocation context associated with this invocation
* @return true if all locks were acquired, false otherwise.
*/
- boolean lockAllAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx) throws InterruptedException;
+ boolean lockAllAndRecord(NodeSPI<?, ?> node, LockType lockType, InvocationContext ctx) throws InterruptedException;
/**
* Locks the node and all child nodes, acquiring lock of type specified for the owner specified. If only some locks are
@@ -210,14 +210,14 @@
* @param node node to unlock
* @param owner lock owner
*/
- void unlockAll(NodeSPI node, Object owner);
+ void unlockAll(NodeSPI<?, ?> node, Object owner);
/**
* Releases locks on a given node and all children for all owners. Use with care.
*
* @param node node to unlock
*/
- void unlockAll(NodeSPI node);
+ void unlockAll(NodeSPI<?, ?> node);
/**
* Tests whether a given owner owns a lock of lockType on a particular Fqn.
@@ -245,7 +245,7 @@
* @param owner owner
* @return true if the owner does own the specified lock type on the specified node, false otherwise.
*/
- boolean ownsLock(NodeSPI node, Object owner);
+ boolean ownsLock(NodeSPI<?, ?> node, Object owner);
/**
* Returns true if the node is locked (either for reading or writing) by anyone, and false otherwise.
@@ -253,7 +253,7 @@
* @param n node to inspect
* @return true of locked; false if not.
*/
- boolean isLocked(NodeSPI n);
+ boolean isLocked(NodeSPI<?, ?> n);
/**
* Returns true if the node is locked (either for reading or writing) by anyone, and false otherwise.
@@ -270,7 +270,7 @@
* @param lockType lockType to test for
* @return true of locked; false if not.
*/
- boolean isLocked(NodeSPI n, LockType lockType);
+ boolean isLocked(NodeSPI<?, ?> n, LockType lockType);
/**
* Retrieves the write lock owner, if any, for the current Fqn.
@@ -294,7 +294,7 @@
* @param node the node to inspect
* @return the owner of the lock, or null if not locked.
*/
- Object getWriteOwner(NodeSPI node);
+ Object getWriteOwner(NodeSPI<?, ?> node);
/**
* Retrieves the read lock owners, if any, for the current Fqn.
@@ -302,14 +302,14 @@
* @param node the node to inspect
* @return a collection of read lock owners, or an empty collection if not locked.
*/
- Collection<Object> getReadOwners(NodeSPI node);
+ Collection<Object> getReadOwners(NodeSPI<?, ?> node);
/**
* Prints lock information about a node (and it's children) to a String.
*
* @param node node to inspect
*/
- String printLockInfo(NodeSPI node);
+ String printLockInfo(NodeSPI<?, ?> node);
/**
* Prints lock information for all locks.
Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -48,7 +48,7 @@
LockContainer lockContainer;
DataContainer dataContainer;
private Set<Fqn> internalFqns;
- private CacheSPI cache;
+ private CacheSPI<?, ?> cache;
private TransactionManager transactionManager;
private InvocationContextContainer invocationContextContainer;
private static final Log log = LogFactory.getLog(MVCCLockManager.class);
@@ -70,7 +70,6 @@
}
@Start
- @SuppressWarnings("unchecked")
public void setInternalFqns()
{
internalFqns = cache.getInternalFqns();
@@ -117,6 +116,7 @@
lock.unlock();
}
+ @SuppressWarnings("unchecked")
public void unlock(InvocationContext ctx)
{
List<Fqn> locks = ctx.getLocks();
@@ -133,8 +133,7 @@
}
}
- @SuppressWarnings("unchecked")
- protected boolean lockRecursively(Node node, long timeoutMillis, boolean excludeInternalFqns, InvocationContext ctx) throws InterruptedException
+ protected boolean lockRecursively(Node<?, ?> node, long timeoutMillis, boolean excludeInternalFqns, InvocationContext ctx) throws InterruptedException
{
if (excludeInternalFqns && internalFqns.contains(node.getFqn()))
return true; // this will stop the recursion from proceeding down this subtree.
@@ -148,7 +147,7 @@
// need to recursively walk through the node's children and acquire locks. This needs to happen using API methods
// since any cache loading will need to happen.
- Set<Node> children = node.getChildren();
+ Set<? extends Node<?, ?>> children = node.getChildren();
try
{
if (children != null)
@@ -210,11 +209,10 @@
return lockAllAndRecord(dataContainer.peek(fqn, false), lockType, ctx);
}
- @SuppressWarnings("unchecked")
- public void unlockAll(NodeSPI node, Object owner)
+ public void unlockAll(NodeSPI<?, ?> node, Object owner)
{
// depth first.
- Set<Node> children = node.getChildren();
+ Set<? extends Node<?, ?>> children = node.getChildren();
if (children != null)
{
for (Node child : children) unlockAll((NodeSPI) child, null);
Modified: core/trunk/src/main/java/org/jboss/cache/lock/ThreadLocalMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/ThreadLocalMap.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/lock/ThreadLocalMap.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -15,19 +15,18 @@
public class ThreadLocalMap<K, V> implements Map<K, V>
{
- private final ThreadLocal threadLocal = new ThreadLocal()
+ private final ThreadLocal<Map<K, V>> threadLocal = new ThreadLocal<Map<K, V>>()
{
@Override
- protected Object initialValue()
+ protected Map<K, V> initialValue()
{
- return new HashMap();
+ return new HashMap<K, V>();
}
};
- @SuppressWarnings("unchecked")
private Map<K, V> getThreadLocalMap()
{
- return (Map<K, V>) threadLocal.get();
+ return threadLocal.get();
}
public V put(K key, V value)
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -16,10 +16,10 @@
* @version $Id$
*/
// TODO: 3.0.0: remove Externalizable and rely on the CacheMarshaller.
-public class NodeData implements Externalizable
+public class NodeData<K, V> implements Externalizable
{
private Fqn fqn = null;
- private Map<?, ?> attrs = null;
+ private Map<K, V> attrs = null;
static final long serialVersionUID = -7571995794010294485L;
@@ -32,21 +32,21 @@
this.fqn = fqn;
}
- public NodeData(Fqn fqn, Map<?, ?> attrs, boolean mapSafe)
+ public NodeData(Fqn fqn, Map<K, V> attrs, boolean mapSafe)
{
this.fqn = fqn;
if (mapSafe || attrs == null)
this.attrs = attrs;
else
- this.attrs = new HashMap<Object, Object>(attrs);
+ this.attrs = new HashMap<K, V>(attrs);
}
- public NodeData(String fqn, Map<?, ?> attrs, boolean mapSafe)
+ public NodeData(String fqn, Map<K, V> attrs, boolean mapSafe)
{
this(Fqn.fromString(fqn), attrs, mapSafe);
}
- public Map getAttributes()
+ public Map<K, V> getAttributes()
{
return attrs;
}
@@ -88,7 +88,7 @@
fqn = (Fqn) in.readObject();
if (in.readBoolean())
{
- attrs = (Map) in.readObject();
+ attrs = (Map<K, V>) in.readObject();
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -98,7 +98,6 @@
/**
* Try to figure out which TransactionManager to use
*/
- @SuppressWarnings("unchecked")
private static void doLookups()
{
if (lookupFailed)
Modified: core/trunk/src/main/java/org/jboss/cache/util/DeltaMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/DeltaMap.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/main/java/org/jboss/cache/util/DeltaMap.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -11,24 +11,24 @@
import java.util.Set;
/**
- * Wraps an existing map, which is not modified, reflecting modifications
+ * Wraps an existing map, which is not modified, reflecting modifications
* in an internal modification set.
- *
- * This is to minimize the amount of data copying, for instance in the
+ * <p/>
+ * This is to minimize the amount of data copying, for instance in the
* case few changes are applied.
- *
+ * <p/>
* Example usage:
- <pre>
-HashMap<String, String> hm = new HashMap<String, String>();
-hm.put("a", "apple");
-DeltaMap<String, String> dm = DeltaMap.create(hm);
-dm.remove("a");
-assert hm.containsKey("a");
-assert !dm.containsKey("a");
-dm.commit();
-assert !hm.containsKey("a");
-</pre>
- *
+ * <pre>
+ * HashMap<String, String> hm = new HashMap<String, String>();
+ * hm.put("a", "apple");
+ * DeltaMap<String, String> dm = DeltaMap.create(hm);
+ * dm.remove("a");
+ * assert hm.containsKey("a");
+ * assert !dm.containsKey("a");
+ * dm.commit();
+ * assert !hm.containsKey("a");
+ * </pre>
+ *
* @author Elias Ross
* @param <K> key type
* @param <V> value type
@@ -67,7 +67,7 @@
/**
* Creates and returns a DeltaMap for an original map.
- *
+ *
* @param original will not be modified, except by {@link #commit()}
* @return a new instance
*/
@@ -78,16 +78,17 @@
/**
* Creates and returns a DeltaMap for an empty map.
+ *
* @return a new instance
*/
public static <K, V> DeltaMap<K, V> create()
{
- return create(new HashMap<K,V>(0));
+ return create(new HashMap<K, V>(0));
}
/**
* Creates and returns a DeltaMap for an original map, excluding some key mappings.
- *
+ *
* @param original will not be modified, except by {@link #commit()}
* @param excluded entries not to include
* @return a new instance
@@ -96,7 +97,7 @@
{
return new DeltaMap<K, V>(original, exclude);
}
-
+
/**
* Creates and returns a DeltaMap for an original map, excluding some key mappings.
*/
@@ -142,7 +143,7 @@
}
return size;
}
-
+
@Override
public boolean containsKey(Object key)
{
@@ -180,14 +181,14 @@
return old;
}
+ @Override
@SuppressWarnings("unchecked")
- @Override
public V remove(Object key)
{
if (changed.containsKey(key))
{
- if (original.containsKey(key))
- exclude.add((K) key);
+ if (original.containsKey(key))
+ exclude.add((K) key);
return changed.remove(key);
}
if (exclude.contains(key))
@@ -213,9 +214,9 @@
exclude.clear();
changed.clear();
}
-
+
/**
- * Returns true if the internal map was modified.
+ * Returns true if the internal map was modified.
*/
public boolean isModified()
{
@@ -224,6 +225,7 @@
/**
* Iterator that skips over removed entries.
+ *
* @author Elias Ross
*/
private class WrappedIterator implements Iterator<Entry<K, V>>
@@ -246,24 +248,27 @@
return true;
if (orig)
{
- while (true) {
- if (!i.hasNext()) {
+ while (true)
+ {
+ if (!i.hasNext())
+ {
orig = false;
i = changed.entrySet().iterator();
return hasNext();
}
next = i.next();
- if (!redef(next)) {
+ if (!redef(next))
+ {
nextSet = true;
return true;
}
}
}
- if (!i.hasNext())
- return false;
- next = i.next();
- nextSet = true;
- return true;
+ if (!i.hasNext())
+ return false;
+ next = i.next();
+ nextSet = true;
+ return true;
}
public java.util.Map.Entry<K, V> next()
@@ -286,11 +291,12 @@
}
}
-
+
/**
* Returns a debug string.
*/
- public String toDebugString() {
+ public String toDebugString()
+ {
return "DeltaMap original=" + original + " exclude=" + exclude + " changed=" + changed;
}
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -9,8 +9,8 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -46,13 +46,13 @@
public void testLoadOldConfig()
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache("configs/conf2x/buddy-replication-cache.xml");
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache("configs/conf2x/buddy-replication-cache.xml");
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
}
public void testFromConfigFileStarted()
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().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";
@@ -61,7 +61,7 @@
public void testFromConfigFileUnstarted()
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile, false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(configFile, false);
// can't test for this anymore since the RuntimeConfig is attached to the running cache
// assertEquals(expected, cache.getConfiguration());
@@ -72,7 +72,7 @@
public void testFromConfigObjStarted()
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(expected);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(expected);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -81,7 +81,7 @@
public void testFromConfigObjUnstarted()
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
@@ -100,7 +100,7 @@
public void testLifecycle() throws Exception
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
cache.start();
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -111,7 +111,7 @@
public void testCreationFromStreamStarted() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new DefaultCacheFactory();
+ CacheFactory cf = new DefaultCacheFactory<Object, Object>();
cache = (CacheSPI) cf.createCache(is);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
doSimpleConfTests(cache.getConfiguration());
@@ -120,7 +120,7 @@
public void testCreationFromStream() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new DefaultCacheFactory();
+ CacheFactory cf = new DefaultCacheFactory<Object, Object>();
cache = (CacheSPI) cf.createCache(is, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
doSimpleConfTests(cache.getConfiguration());
@@ -128,7 +128,7 @@
public void testComponentsInjected() throws Exception
{
- CacheFactory cf = new DefaultCacheFactory();
+ CacheFactory cf = new DefaultCacheFactory<Object, Object>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -110,7 +110,7 @@
c.setCacheMode(mode);
c.setIsolationLevel(level);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -317,7 +317,7 @@
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
- cache = new DefaultCacheFactory().createCache(c);
+ cache = new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -24,7 +24,7 @@
@Test(groups = {"functional"})
public void testGetKeys() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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>) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache();
cache.put("/a/b/c", null);
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -61,10 +61,10 @@
@Test(groups = {"functional"})
public void testGetKeysOnNode()
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache();
cache.put("/a/b/c", "key", "value");
- Node node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
- Set keySet = node.getKeys();
+ Node<Object, Object> node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
+ Set<Object> keySet = node.getKeys();
try
{
Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -25,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -20,7 +20,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache();
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -34,8 +34,8 @@
conf1.setNodeLockingScheme(nodeLockingScheme);
conf2.setNodeLockingScheme(nodeLockingScheme);
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf1, false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf2, false);
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -39,7 +39,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- CacheFactory<String, String> cf = new DefaultCacheFactory();
+ CacheFactory<String, String> cf = new DefaultCacheFactory<String, String>();
cache = cf.createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -49,7 +49,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/local-tx.xml", false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(getNodeLockingScheme());
configure(cache.getConfiguration());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -40,7 +40,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
cache1.getConfiguration().setSyncCommitPhase(true);
cache1.getConfiguration().setSyncRollbackPhase(true);
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -50,7 +50,7 @@
tm = cache1.getTransactionManager();
// start second instance
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
cache2.getConfiguration().setSyncCommitPhase(true);
cache2.getConfiguration().setSyncRollbackPhase(true);
cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -23,7 +23,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -37,7 +37,7 @@
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cacheConfig, false);
cache.getConfiguration().getEvictionConfig().setWakeupInterval(1000);
createNewRegion();
cache.start();
@@ -177,7 +177,7 @@
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(config, true);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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/nodevalidity/ReplicatedPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -25,7 +25,7 @@
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = new DefaultCacheFactory();
+ CacheFactory<String, String> f = new DefaultCacheFactory<String, String>();
Cache<String, String> cache = f.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PFEROptimisticTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PFEROptimisticTestBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PFEROptimisticTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -37,6 +37,8 @@
otc = (OptimisticTransactionContext) gtx2ContextMap.get(gtx);
}
+ if (otc == null) throw new NullPointerException("No transaction context available!");
+
TransactionWorkspace workspace = otc.getTransactionWorkSpace();
// scan workspaces for this node
assertNotNull("node " + fqn + " should be in transaction workspace", workspace.getNode(fqn));
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -135,7 +135,7 @@
CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
- CacheSPI<?, ?> cache = (CacheSPI<?, ?>) new DefaultCacheFactory().createCache(c, false);
+ CacheSPI<?, ?> cache = (CacheSPI<?, ?>) new DefaultCacheFactory<Object, Object>().createCache(c, false);
cache.getConfiguration().setClusterName("TestCluster");
if (useMarshalling)
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -8,8 +8,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -124,7 +124,6 @@
* <p/>
* But we get 1's instead of 2's, which means that the recovery failed.
*/
- @SuppressWarnings("unchecked")
public void testGravitationAndFailover() throws CloneNotSupportedException
{
Configuration cfg = cache2.getConfiguration().clone();
@@ -142,7 +141,7 @@
checkRecoveredData(cache1, 1);
printCacheDetails("DATA GRAVITATED BACK TO CACHE1");
- cache2 = new DefaultCacheFactory().createCache(cfg);
+ cache2 = new DefaultCacheFactory<String, Integer>().createCache(cfg);
printCacheDetails("BUDDY BACK");
runBuddyUpdatesAndFail();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -247,7 +247,7 @@
Configuration cfg1 = cache1.getConfiguration();
configureEviction(cfg1);
Configuration cfg0 = cfg1.clone();
- CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg0, false);
+ CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cfg0, false);
// Store them for the teardown method
if (caches == null)
@@ -296,9 +296,9 @@
Configuration cfg0 = cache0.getConfiguration();
configureEviction(cfg0);
Configuration cfg1 = cfg0.clone();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg1, false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cfg1, false);
Configuration cfg2 = cfg0.clone();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg2, false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cfg2, false);
// Store them for the teardown method
if (caches == null)
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -36,7 +36,7 @@
c1 = createCache(1, null, false, false, false);
c1.getConfiguration().setUseRegionBasedMarshalling(true);
c1.getConfiguration().setFetchInMemoryState(true);
- c2 = (CacheSPI) new DefaultCacheFactory().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), false);
c1.start();
region = c1.getRegion(regionFqn, true);
region2 = c1.getRegion(region2Fqn, true);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,11 +3,11 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.LRUConfiguration;
import org.jboss.cache.eviction.NullEvictionPolicy;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -33,7 +33,7 @@
cache1.getConfiguration().setEvictionConfig(getEvictionConfig());
cache1.start();
- cache2 = (CacheSPI) new DefaultCacheFactory().createCache(cache1.getConfiguration().clone());
+ cache2 = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone());
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
}
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -5,11 +5,11 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.RPCManager;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationQueueNotifier;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.ReplicationQueueNotifier;
import org.jgroups.Address;
import static org.testng.AssertJUnit.assertNotNull;
import org.testng.annotations.AfterMethod;
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
cache.getConfiguration().setUseReplQueue(true);
cache.getConfiguration().setReplQueueMaxElements(COUNT);
@@ -41,7 +41,7 @@
registry = TestingUtil.extractComponentRegistry(cache);
replQ = registry.getComponent(ReplicationQueue.class);
originalRpcManager = cache.getConfiguration().getRuntimeConfig().getRPCManager();
- cache2 = new DefaultCacheFactory().createCache(cache.getConfiguration().clone());
+ cache2 = new DefaultCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
TestingUtil.blockUntilViewsReceived(60000, cache, cache2);
}
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -2,10 +2,10 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.ReplicationQueueNotifier;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -21,12 +21,12 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- cache = new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false);
cache.getConfiguration().setUseReplQueue(true);
cache.getConfiguration().setReplQueueInterval(100);
cache.getConfiguration().setReplQueueMaxElements(10);
cache.start();
- cache2 = new DefaultCacheFactory().createCache(cache.getConfiguration().clone());
+ cache2 = new DefaultCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
TestingUtil.blockUntilViewsReceived(60000, cache, cache2);
txManager = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -25,7 +25,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cacheConfig, false);
cache.start();
txMgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -28,7 +28,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cacheConfig, false);
cache.start();
txMgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -66,8 +66,8 @@
{
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- CacheFactory<String, String> factory = new DefaultCacheFactory();
- Cache<String, String> cache = factory.createCache(config, false);
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
+ Cache<String, String> cache = instance.createCache(config, false);
caches.add(cache);
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -174,7 +174,7 @@
*/
protected CacheModelDelegate createCacheDelegate() throws Exception
{
- CacheFactory<String, String> factory = new DefaultCacheFactory();
+ CacheFactory<String, String> factory = new DefaultCacheFactory<String, String>();
Cache<String, String> cache = factory.createCache(configurationFile, false);
CacheModelDelegate delegate = new JBossCacheModelDelegate();
delegate.setCacheShellVariable(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -57,7 +57,7 @@
void initCaches() throws Exception
{
TestingUtil.recursiveFileRemove(tmpDir + cacheLoaderDir);
- CacheFactory<Integer, String> factory = new DefaultCacheFactory();
+ CacheFactory<Integer, String> factory = new DefaultCacheFactory<Integer, String>();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
conf.setEvictionConfig(buildEvictionConfig());
conf.setCacheLoaderConfig(buildCacheLoaderConfig());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -21,8 +21,8 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* @author Daniel Huang
@@ -69,7 +69,7 @@
evConfig.setEvictionRegionConfigs(regionConfigs);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf, 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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -12,10 +12,10 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionPolicyConfig;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -49,7 +49,7 @@
EvictionConfig econf = new EvictionConfig(ExpirationPolicy.class.getName());
econf.setWakeupInterval(1000);
conf.setEvictionConfig(econf);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -9,20 +9,20 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.EvictionController;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.EvictionController;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* Unit tests for FIFOPolicy.
@@ -63,12 +63,12 @@
evConfig.setDefaultEventQueueSize(20000);
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.FIFOPolicy");
List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
- erConfigs.add(createEvictionRegionConfig("/_default_",5000));
- erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data",5));
+ erConfigs.add(createEvictionRegionConfig("/_default_", 5000));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data", 5));
evConfig.setEvictionRegionConfigs(erConfigs);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(config, true);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(config, true);// read in generic local xml
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -9,19 +9,19 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* Unit tests for LFU Policy.
@@ -61,13 +61,13 @@
evConfig.setWakeupInterval(3000);
evConfig.setDefaultEventQueueSize(200000);
List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
- erConfigs.add(createEvictionRegionConfig("/_default_",500,10));
- erConfigs.add(createEvictionRegionConfig("/org/jboss/data",5000,4000));
- erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data",-1,5));
+ erConfigs.add(createEvictionRegionConfig("/_default_", 500, 10));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/data", 5000, 4000));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data", -1, 5));
evConfig.setEvictionRegionConfigs(erConfigs);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(config, true);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(config, true);
}
private EvictionRegionConfig createEvictionRegionConfig(String regionName, int maxNodes, int minNodes)
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -334,7 +334,7 @@
public void testOvereviction() throws Exception
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- Cache<Object, Object> cache1 = new DefaultCacheFactory().createCache(c, true);
+ Cache<Object, Object> cache1 = new DefaultCacheFactory<Object, Object>().createCache(c, true);
cache1.put(Fqn.fromString("/base/" + 0), "key", "base" + 0);
Node node = cache1.getRoot().getChild(Fqn.fromString("/base/"));
node.setResident(true);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -8,19 +8,19 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* Unit tests for MRUPolicy.
@@ -67,13 +67,13 @@
evConfig.setDefaultEventQueueSize(200000);
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.MRUPolicy");
List<EvictionRegionConfig> evictionRegionConfigs = new ArrayList<EvictionRegionConfig>();
- evictionRegionConfigs.add(buildEvictionRegionConfig("_default_",100));
- evictionRegionConfigs.add(buildEvictionRegionConfig("/org/jboss/test/data",6));
+ evictionRegionConfigs.add(buildEvictionRegionConfig("_default_", 100));
+ evictionRegionConfigs.add(buildEvictionRegionConfig("/org/jboss/test/data", 6));
evConfig.setEvictionRegionConfigs(evictionRegionConfigs);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI)new DefaultCacheFactory().createCache(config);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(config);
}
private EvictionRegionConfig buildEvictionRegionConfig(String regionName, int maxNodes)
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -4,19 +4,20 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
-import static org.testng.AssertJUnit.*;
+import org.jboss.cache.util.TestingUtil;
+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 java.util.List;
import java.util.ArrayList;
+import java.util.List;
/**
* Unit tests for LRU Policy.
@@ -43,13 +44,10 @@
{
cache_.stop();
cache_.destroy();
- }
+ }
}
-
-
-
/**
* Builds a cache was null eviction by default and in "/test" region,
* LRU in "/lru" region. Does a mix of puts/reads/removes, wakes for
@@ -57,7 +55,7 @@
* null policy regions but was from lru region.
*/
public void testEviction()
- {
+ {
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
EvictionConfig evConfig = config.getEvictionConfig();
evConfig.setWakeupInterval(1000);
@@ -66,24 +64,24 @@
List<EvictionRegionConfig> regionConfigs = new ArrayList<EvictionRegionConfig>();
regionConfigs.add(buildEvictionRegionConfig("/_default_"));
regionConfigs.add(buildEvictionRegionConfig("/test"));
- regionConfigs.add(UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("/lru", 10000,1000));
+ regionConfigs.add(UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("/lru", 10000, 1000));
evConfig.setEvictionRegionConfigs(regionConfigs);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache_ = (CacheSPI)new DefaultCacheFactory().createCache(config);
+ cache_ = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(config);
String dfltRootStr = "/a/";
String testRootStr = "/test/";
String lruRootStr = "/lru/";
-
+
for (int i = 0; i < 20; i++)
- {
- Fqn dflt = Fqn.fromString(dfltRootStr + i);
- Fqn test = Fqn.fromString(testRootStr + i);
- Fqn lru = Fqn.fromString(lruRootStr + i);
- cache_.put(dflt, "key", "value");
- cache_.put(test, "key", "value");
- cache_.put(lru, "key", "value");
+ {
+ Fqn dflt = Fqn.fromString(dfltRootStr + i);
+ Fqn test = Fqn.fromString(testRootStr + i);
+ Fqn lru = Fqn.fromString(lruRootStr + i);
+ cache_.put(dflt, "key", "value");
+ cache_.put(test, "key", "value");
+ cache_.put(lru, "key", "value");
}
TestingUtil.sleepThread(3500);
for (int i = 0; i < 20; i++)
@@ -92,9 +90,9 @@
Fqn test = Fqn.fromString(testRootStr + i);
Fqn lru = Fqn.fromString(lruRootStr + i);
- assertEquals("value", cache_.get(dflt, "key"));
- assertEquals("value", cache_.get(test, "key"));
- assertNull(cache_.get(lru, "key"));
+ assertEquals("value", cache_.get(dflt, "key"));
+ assertEquals("value", cache_.get(test, "key"));
+ assertNull(cache_.get(lru, "key"));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -49,7 +49,7 @@
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
config.setEvictionConfig(buildEvictionConfig());
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(config);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(config);
}
private EvictionConfig buildEvictionConfig() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -67,8 +67,8 @@
private void initCaches()
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
- cache = (CacheSPI) instance.createCache(conf, false);
+ CacheFactory<Object, Object> instance = new DefaultCacheFactory<Object, Object>();
+ cache = (CacheSPI<Object, Object>) instance.createCache(conf, false);
conf.getEvictionConfig().setWakeupInterval(5000);
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,13 +3,13 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeEvicted;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -28,14 +28,14 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache_ = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+ cache_ = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache2_ = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,10 +3,10 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.EvictionPolicyConfigBase;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -57,7 +57,7 @@
ec.setWakeupInterval(1000);
ec.setEvictionRegionConfigs(evictionRegionConfigs);
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setEvictionConfig(ec);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -15,7 +15,7 @@
// @BeforeMethod
// public void setUp() throws Exception
// {
-// CacheFactory cf = new DefaultCacheFactory();
+// CacheFactory cf = new DefaultCacheFactory<Object, Object>();
//
// Cache cache = cf.createCache(false);
// cr = TestingUtil.extractComponentRegistry(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -14,7 +14,7 @@
{
public void testConstruction()
{
- Cache c = new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
+ Cache c = new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
c.put("/a", "b", "c");
c.stop();
c.destroy();
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -24,7 +24,7 @@
public void setUp() throws Exception
{
Configuration c = new Configuration();
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(c);
cache.create();
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -47,7 +47,7 @@
CacheSPI cache;
int defaultInterceptroCount;
- @AfterMethod
+ @AfterMethod
public void tearDown()
{
if (cache != null)
@@ -118,7 +118,7 @@
assert cache.getInterceptorChain().size() == defaultInterceptroCount + 1;
}
- @Test (enabled = true)
+ @Test(enabled = true)
public void testAddAtIndex()
{
AaaCustomInterceptor interceptor = new AaaCustomInterceptor();
@@ -139,7 +139,8 @@
{
buildCache(config);
assert false : "exception expected here";
- } catch (Exception e)
+ }
+ catch (Exception e)
{
//expected
}
@@ -155,12 +156,12 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
- CacheFactory cacheFactory2 = new DefaultCacheFactory();
+ CacheFactory cacheFactory2 = new DefaultCacheFactory<Object, Object>();
CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config);
defaultInterceptroCount = tmpCacheSPI.getInterceptorChain().size();
tmpCacheSPI.stop();
- CacheFactory cacheFactory = new DefaultCacheFactory();
+ CacheFactory cacheFactory = new DefaultCacheFactory<Object, Object>();
config.setCustomInterceptors(interceptorConfig);
cache = (CacheSPI) cacheFactory.createCache(config, true);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(LOCAL);
cache.getConfiguration().setUseLazyDeserialization(false);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,7 +3,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
@@ -13,6 +12,7 @@
import org.jboss.cache.marshall.VersionAwareMarshaller;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- c = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ c = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -1,6 +1,5 @@
package org.jboss.cache.factories;
-import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
@@ -8,12 +7,12 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.ReplicationException;
import org.jboss.cache.SuspectException;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
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.event.Event;
+import org.jboss.cache.util.TestingUtil;
import org.testng.AssertJUnit;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -36,7 +35,7 @@
@Test(groups = "functional")
public class LifeCycleTest
{
- private CacheSPI[] c;
+ private CacheSPI<Object, Object>[] c;
@AfterMethod
public void tearDown()
@@ -45,10 +44,11 @@
c = null;
}
+ @SuppressWarnings("unchecked")
private void createAndRegisterCache(Configuration.CacheMode mode, boolean start) throws Exception
{
- Cache cache = createCache(mode);
- List<Cache> caches = new LinkedList<Cache>();
+ CacheSPI<Object, Object> cache = createCache(mode);
+ List<CacheSPI<Object, Object>> caches = new LinkedList<CacheSPI<Object, Object>>();
if (c != null) caches.addAll(Arrays.asList(c));
caches.add(cache);
c = caches.toArray(new CacheSPI[]{});
@@ -348,7 +348,6 @@
}
}
- @SuppressWarnings("unchecked")
public void testStopInstanceWhileOtherInstanceSends() throws Exception
{
final Fqn fqn = Fqn.fromString("/a");
@@ -424,7 +423,7 @@
private CacheSPI<Object, Object> createCache(Configuration.CacheMode cache_mode)
{
- CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -59,7 +59,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.getConfiguration().setCacheMode("LOCAL");
@@ -89,8 +89,7 @@
TestingUtil.killCaches(cache);
}
- @SuppressWarnings("unchecked")
- private NodeSPI<Object, Object> cast(Node node)
+ private NodeSPI<Object, Object> cast(Node<Object, Object> node)
{
return (NodeSPI<Object, Object>) node;
}
@@ -324,7 +323,7 @@
for (int i = 0; i < 100; i++)
{
- PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null, (Fqn) fqn, i, "value");
+ PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null, fqn, i, "value");
invoker.invoke(pkvCommand);
assertEquals("value", cache.peek(fqn, false, false).getDirect(i));
@@ -508,7 +507,7 @@
Object key = "key";
Object value = "value";
- PutKeyValueCommand putKeyValueCommand = commandsFactory.buildPutKeyValueCommand(null, (Fqn) fqn, key, value);
+ PutKeyValueCommand putKeyValueCommand = commandsFactory.buildPutKeyValueCommand(null, fqn, key, value);
invoker.invoke(putKeyValueCommand);
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
event = region.takeLastEventNode();
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -33,7 +33,7 @@
@BeforeTest
public void setUp()
{
- cache = new DefaultCacheFactory().createCache();
+ cache = new DefaultCacheFactory<Object, Object>().createCache();
testInterceptor = new TestInterceptor();
((CacheSPI) cache).addInterceptor(testInterceptor, TxInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -4,8 +4,8 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.marshall.MarshalledValueHelper;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -31,13 +31,13 @@
public void testDefaultInterceptorStack()
{
- c = (CacheSPI) new DefaultCacheFactory().createCache();
+ c = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache();
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
TestingUtil.killCaches(c);
- c = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ c = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
c.getConfiguration().setUseLazyDeserialization(true);
c.start();
@@ -48,7 +48,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(true);
- c = (CacheSPI) new DefaultCacheFactory().createCache(cfg);
+ c = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(cfg);
System.out.println(CachePrinter.printCacheInterceptors(c));
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) != null;
@@ -58,7 +58,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(false);
- c = (CacheSPI) new DefaultCacheFactory().createCache(cfg);
+ c = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(cfg);
System.out.println(CachePrinter.printCacheInterceptors(c));
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -362,14 +362,13 @@
nodeRemovalTest(true);
}
- @SuppressWarnings("unchecked")
private void nodeRemovalTest(boolean optimistic) throws Exception
{
cache1 = createCache(optimistic);
cache2 = createCache(optimistic);
- Node root1 = cache1.getRoot();
- Node root2 = cache2.getRoot();
+ Node<Object, Object> root1 = cache1.getRoot();
+ Node<Object, Object> root2 = cache2.getRoot();
// this fqn is relative, but since it is from the root it may as well be absolute
Fqn fqn = Fqn.fromString("/test/fqn");
@@ -382,7 +381,7 @@
assertEquals(true, cache1.removeNode(fqn));
assertFalse(root1.hasChild(fqn));
- Node remoteNode = root2.getChild(fqn);
+ Node<Object, Object> remoteNode = root2.getChild(fqn);
checkRemoteNodeIsRemoved(remoteNode);
assertEquals(false, cache1.removeNode(fqn));
@@ -869,7 +868,7 @@
protected CacheSPI<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -36,7 +36,7 @@
public void setUp() throws Exception
{
log.trace("**** setup called");
- c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ c1 = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
// the FIFO policy cfg
FIFOConfiguration cfg = new FIFOConfiguration();
@@ -63,7 +63,7 @@
c1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c1.getConfiguration().setEvictionConfig(ec);
- c2 = (CacheSPI) new DefaultCacheFactory().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,8 +32,8 @@
@BeforeMethod
public void setUp()
{
- cache1 = new DefaultCacheFactory().createCache(false);
- cache2 = new DefaultCacheFactory().createCache(false);
+ cache1 = new DefaultCacheFactory<Object, Object>().createCache(false);
+ cache2 = new DefaultCacheFactory<Object, Object>().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/invocationcontext/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -29,7 +29,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/local-tx.xml");
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache("configs/local-tx.xml");
tm = cache.getTransactionManager();
}
@@ -153,7 +153,7 @@
cache = null;
}
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/replSync.xml", false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache("configs/replSync.xml", false);
cache.getConfiguration().setCacheMode(CacheMode.REPL_ASYNC);
cache.start();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -101,7 +101,7 @@
protected Cache<String, String> createCache(Configuration config)
{
- CacheFactory<String, String> factory = new DefaultCacheFactory();
+ CacheFactory<String, String> factory = new DefaultCacheFactory<String, String>();
cache = factory.createCache(config, false);
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/LegacyConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/LegacyConfigurationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/LegacyConfigurationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -23,13 +23,23 @@
package org.jboss.cache.jmx;
import org.jboss.cache.Version;
-import org.jboss.cache.config.*;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
+import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
+import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.eviction.*;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.config.RuntimeConfig;
+import org.jboss.cache.config.parsing.XmlConfigHelper;
+import org.jboss.cache.eviction.FIFOConfiguration;
+import org.jboss.cache.eviction.FIFOPolicy;
+import org.jboss.cache.eviction.LRUConfiguration;
+import org.jboss.cache.eviction.LRUPolicy;
+import org.jboss.cache.eviction.MRUConfiguration;
+import org.jboss.cache.eviction.MRUPolicy;
import org.jboss.cache.loader.FileCacheLoader;
import org.jboss.cache.loader.SingletonStoreCacheLoader;
import org.jboss.cache.loader.jdbm.JdbmCacheLoader;
@@ -208,14 +218,14 @@
@SuppressWarnings("unchecked")
public void testRuntimeConfig() throws Exception
{
- CacheJmxWrapperMBean wrapper = new CacheJmxWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper<String, String>();
registerWrapper(wrapper);
- wrapper = (CacheJmxWrapperMBean) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
+ wrapper = (CacheJmxWrapperMBean<String, String>) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
// Fake a TM by making a bogus proxy
TransactionManager tm = (TransactionManager) Proxy.newProxyInstance(getClass().getClassLoader(),
- new Class[]{TransactionManager.class}, new MockInvocationHandler());
+ new Class[]{TransactionManager.class}, new MockInvocationHandler());
wrapper.setTransactionManager(tm);
ChannelFactory cf = new JChannelFactory();
wrapper.setMuxChannelFactory(cf);
@@ -231,10 +241,10 @@
@SuppressWarnings("unchecked")
public void testLegacyMuxChannelCreation() throws Exception
{
- CacheJmxWrapperMBean wrapper = new CacheJmxWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper<String, String>();
registerWrapper(wrapper);
- wrapper = (CacheJmxWrapperMBean) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
+ wrapper = (CacheJmxWrapperMBean<String, String>) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
wrapper.setMultiplexerStack(MultiplexerTestHelper.MUX_STACK);
JChannelFactory factory = new JChannelFactory();
@@ -258,13 +268,13 @@
String xmlStr =
" <buddy enabled=\"true\" poolName=\"testpool\" communicationTimeout=\"600000\">\n" +
- " <dataGravitation auto=\"false\" removeOnFind=\"false\" searchBackupTrees=\"false\"/>\n" +
- " <locator class=\"org.jboss.cache.buddyreplication.TestBuddyLocator\">\n" +
- " <properties>\n" +
- " numBuddies = 2\n" +
- " </properties>\n" +
- " </locator>\n" +
- " </buddy>";
+ " <dataGravitation auto=\"false\" removeOnFind=\"false\" searchBackupTrees=\"false\"/>\n" +
+ " <locator class=\"org.jboss.cache.buddyreplication.TestBuddyLocator\">\n" +
+ " <properties>\n" +
+ " numBuddies = 2\n" +
+ " </properties>\n" +
+ " </locator>\n" +
+ " </buddy>";
return XmlConfigHelper.stringToElement(xmlStr);
}
@@ -272,24 +282,24 @@
{
String xmlStr =
" <loaders passivation=\"false\" shared=\"true\">\n" +
- " <preload>\n" +
- " <node fqn=\"/foo\"/>\n" +
- " </preload>\n" +
- " <loader class=\"org.jboss.cache.loader.FileCacheLoader\" async=\"false\" fetchPersistentState=\"true\"\n" +
- " ignoreModifications=\"true\" purgeOnStartup=\"true\">\n" +
- " <properties>\n" +
- " location=/tmp\n " +
- " </properties>\n" +
- " <singletonStore enabled=\"true\" /> \n" +
- " </loader>\n" +
- " <loader class=\"org.jboss.cache.loader.jdbm.JdbmCacheLoader\" async=\"true\" fetchPersistentState=\"false\"\n" +
- " ignoreModifications=\"false\" purgeOnStartup=\"false\">\n" +
- " <properties>\n" +
- " location=/home/bstansberry\n" +
- " </properties>\n" +
- " <singletonStore enabled=\"false\" /> \n" +
- " </loader>\n" +
- " </loaders>";
+ " <preload>\n" +
+ " <node fqn=\"/foo\"/>\n" +
+ " </preload>\n" +
+ " <loader class=\"org.jboss.cache.loader.FileCacheLoader\" async=\"false\" fetchPersistentState=\"true\"\n" +
+ " ignoreModifications=\"true\" purgeOnStartup=\"true\">\n" +
+ " <properties>\n" +
+ " location=/tmp\n " +
+ " </properties>\n" +
+ " <singletonStore enabled=\"true\" /> \n" +
+ " </loader>\n" +
+ " <loader class=\"org.jboss.cache.loader.jdbm.JdbmCacheLoader\" async=\"true\" fetchPersistentState=\"false\"\n" +
+ " ignoreModifications=\"false\" purgeOnStartup=\"false\">\n" +
+ " <properties>\n" +
+ " location=/home/bstansberry\n" +
+ " </properties>\n" +
+ " <singletonStore enabled=\"false\" /> \n" +
+ " </loader>\n" +
+ " </loaders>";
return XmlConfigHelper.stringToElement(xmlStr);
}
@@ -297,22 +307,22 @@
{
String xmlStr =
- " <eviction wakeUpInterval=\"5000\" defaultPolicyClass=\"org.jboss.cache.eviction.LRUPolicy\" defaultEventQueueSize=\"20000\">\n" +
+ " <eviction wakeUpInterval=\"5000\" defaultPolicyClass=\"org.jboss.cache.eviction.LRUPolicy\" defaultEventQueueSize=\"20000\">\n" +
" <default eventQueueSize=\"1000\">\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
" <attribute name=\"timeToLive\">1000000</attribute>\n" +
" </default>\n" +
- "<region name=\"/org/jboss/data\" policyClass=\"org.jboss.cache.eviction.FIFOPolicy\">\n" +
- " <attribute name=\"maxNodes\">5000</attribute>\n" +
- "</region>\n" +
- "<region name=\"/test/\" policyClass=\"org.jboss.cache.eviction.MRUPolicy\">\n" +
- " <attribute name=\"maxNodes\">10000</attribute>\n" +
- "</region>\n" +
- "<region name=\"/maxAgeTest/\">\n" +
- " <attribute name=\"maxNodes\">10000</attribute>\n" +
- " <attribute name=\"timeToLiveSeconds\">8</attribute>\n" +
- " <attribute name=\"maxAgeSeconds\">10</attribute>\n" +
- "</region>\n" +
+ "<region name=\"/org/jboss/data\" policyClass=\"org.jboss.cache.eviction.FIFOPolicy\">\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ "</region>\n" +
+ "<region name=\"/test/\" policyClass=\"org.jboss.cache.eviction.MRUPolicy\">\n" +
+ " <attribute name=\"maxNodes\">10000</attribute>\n" +
+ "</region>\n" +
+ "<region name=\"/maxAgeTest/\">\n" +
+ " <attribute name=\"maxNodes\">10000</attribute>\n" +
+ " <attribute name=\"timeToLiveSeconds\">8</attribute>\n" +
+ " <attribute name=\"maxAgeSeconds\">10</attribute>\n" +
+ "</region>\n" +
" </eviction>";
return XmlConfigHelper.stringToElement(xmlStr);
}
@@ -377,18 +387,18 @@
protected String getDefaultProperties()
{
return "UDP(mcast_addr=224.0.0.36;mcast_port=55566;ip_ttl=32;" +
- "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
- "PING(timeout=1000;num_initial_members=2):" +
- "MERGE2(min_interval=5000;max_interval=10000):" +
- "FD_SOCK:" +
- "VERIFY_SUSPECT(timeout=1500):" +
- "pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800):" +
- "UNICAST(timeout=600,1200,2400,4800):" +
- "pbcast.STABLE(desired_avg_gossip=20000):" +
- "FRAG(frag_size=8192;down_thread=false;up_thread=false):" +
- "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
- "shun=false;print_local_addr=true):" +
- "pbcast.STATE_TRANSFER";
+ "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
+ "PING(timeout=1000;num_initial_members=2):" +
+ "MERGE2(min_interval=5000;max_interval=10000):" +
+ "FD_SOCK:" +
+ "VERIFY_SUSPECT(timeout=1500):" +
+ "pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800):" +
+ "UNICAST(timeout=600,1200,2400,4800):" +
+ "pbcast.STABLE(desired_avg_gossip=20000):" +
+ "FRAG(frag_size=8192;down_thread=false;up_thread=false):" +
+ "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
+ "shun=false;print_local_addr=true):" +
+ "pbcast.STATE_TRANSFER";
}
class MockInvocationHandler implements InvocationHandler
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/LifecycleNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/LifecycleNotificationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/LifecycleNotificationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -24,12 +24,11 @@
import static org.testng.AssertJUnit.assertEquals;
-import java.util.LinkedList;
-import java.util.List;
-
import javax.management.AttributeChangeNotification;
import javax.management.Notification;
import javax.management.NotificationListener;
+import java.util.LinkedList;
+import java.util.List;
/**
* A LifecycleNotificationTest.
@@ -39,16 +38,14 @@
*/
public class LifecycleNotificationTest extends CacheJmxWrapperTestBase
{
-
- @SuppressWarnings("unchecked")
public void testGetStateAndStateNotification() throws Exception
{
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
StateNotificationListener listener = new StateNotificationListener();
wrapper.addNotificationListener(listener, null, null);
assertEquals("Correct state after instanitation",
- CacheJmxWrapperMBean.UNREGISTERED, wrapper.getState());
+ CacheJmxWrapperMBean.UNREGISTERED, wrapper.getState());
registerWrapper(wrapper);
assertEquals("Correct state after registration",
@@ -97,7 +94,6 @@
if ("State".equals(attrName) && newValue != null && newValue instanceof Integer)
{
notifications.add((Integer) newValue);
- return;
}
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -276,7 +276,7 @@
private CacheSPI<Object, Object> createCache(String clusterName) throws Exception
{
Configuration config = createConfiguration(clusterName);
- CacheFactory<Object, Object> factory = new DefaultCacheFactory();
+ CacheFactory<Object, Object> factory = new DefaultCacheFactory<Object, Object>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -51,8 +51,8 @@
{
newImpl = getNewCacheLoader();
oldImpl = getOldLoader();
- cache = (CacheSPI) new DefaultCacheFactory().createCache();
- cache2 = (CacheSPI) new DefaultCacheFactory().createCache();
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache();
+ cache2 = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache();
newImpl.setCache(cache);//this is needed for marshaller
oldImpl.setCache(cache2);
oldImpl.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -29,7 +29,7 @@
protected void configureCache(String props) throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
// cache.setCacheLoaderConfiguration(buildSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader",
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", props, true, false, true));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -129,7 +129,7 @@
* name and TransactionManagerLookupClass (transactional) propertes only.
* the CacheSPI object is not used otherwise during testing.
*/
- cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setClusterName("myCluster");
if (transactional)
{
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -7,10 +7,10 @@
package org.jboss.cache.loader;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
@@ -27,7 +27,7 @@
@Test(groups = "functional")
public class CacheLoaderManagerTest extends AbstractCacheLoaderTestBase
{
- private LoadersElementParser loadersElementParser = new LoadersElementParser();;
+ private LoadersElementParser loadersElementParser = new LoadersElementParser();
private CacheLoaderConfig createCacheLoaderCfg(boolean passivation)
{
@@ -146,7 +146,7 @@
jdbCl = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(true, "", "org.jboss.cache.loader.JDBCCacheLoader", "location=" + getTempDir(), true, false, false, false, false);
clc.getIndividualCacheLoaderConfigs().add(bdbjeCl.getFirstCacheLoaderConfig());
clc.getIndividualCacheLoaderConfigs().add(jdbCl.getFirstCacheLoaderConfig());
-
+
mgr.setConfig(clc, null, null);
cl = mgr.getCacheLoader();
@@ -187,8 +187,8 @@
public void testChainingCacheLoaderFromXml() throws Exception
{
- CacheLoaderConfig clc = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(false, "",
- "org.jboss.cache.loader.FileCacheLoader", "a=b", false, false, false, false, false);
+ CacheLoaderConfig clc = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(false, "",
+ "org.jboss.cache.loader.FileCacheLoader", "a=b", false, false, false, false, false);
clc.addIndividualCacheLoaderConfig(UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig("",
"org.jboss.cache.loader.JDBCCacheLoader", "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd", false, false, false, false));
CacheLoaderManager mgr = new CacheLoaderManager();
@@ -205,11 +205,11 @@
// async = true
clc = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(false, "",
"org.jboss.cache.loader.FileCacheLoader", "a=b", false, false, false, false, false);
- clc.addIndividualCacheLoaderConfig(UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig("",
- "org.jboss.cache.loader.JDBCCacheLoader", "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd", true, false, false, false));
- mgr = new CacheLoaderManager();
- mgr.setConfig(clc, null, null);
- cl = mgr.getCacheLoader();
+ clc.addIndividualCacheLoaderConfig(UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig("",
+ "org.jboss.cache.loader.JDBCCacheLoader", "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd", true, false, false, false));
+ mgr = new CacheLoaderManager();
+ mgr.setConfig(clc, null, null);
+ cl = mgr.getCacheLoader();
assertEquals(ChainingCacheLoader.class, cl.getClass());
assertEquals(2, ((ChainingCacheLoader) cl).getSize());
@@ -285,17 +285,17 @@
public void testSingletonConfiguration() throws Exception
{
/************************************************************************************************************/
- String conf ;
+ String conf;
CacheLoaderConfig clc;
CacheLoaderManager mgr;
CacheLoaderConfig.IndividualCacheLoaderConfig iclc;
conf =
"<loaders passivation=\"false\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">" +
- " <singletonStore enabled=\"true\"/>\n" +
- " </loader>"+
- "</loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">" +
+ " <singletonStore enabled=\"true\"/>\n" +
+ " </loader>" +
+ "</loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new MockCacheLoaderManager();
@@ -314,11 +314,11 @@
/************************************************************************************************************/
conf =
"<loaders passivation=\"false\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">" +
- " <singletonStore enabled=\"true\" class=\"org.jboss.cache.loader.CacheLoaderManagerTest$MockSingletonStoreCacheLoader\" />\n" +
- " </loader>"+
- "</loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">" +
+ " <singletonStore enabled=\"true\" class=\"org.jboss.cache.loader.CacheLoaderManagerTest$MockSingletonStoreCacheLoader\" />\n" +
+ " </loader>" +
+ "</loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new CacheLoaderManager();
mgr.setConfig(clc, null, null);
@@ -335,19 +335,19 @@
conf =
" <loaders passivation=\"true\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
- " <singletonStore enabled=\"true\">\n" +
- " <properties>\n" +
- " pushStateWhenCoordinator=false\n" +
- " </properties>\n" +
- " </singletonStore>\n" +
- " </loader>\n" +
- " </loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
+ " <singletonStore enabled=\"true\">\n" +
+ " <properties>\n" +
+ " pushStateWhenCoordinator=false\n" +
+ " </properties>\n" +
+ " </singletonStore>\n" +
+ " </loader>\n" +
+ " </loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new CacheLoaderManager();
mgr.setConfig(clc, null, null);
-
+
iclc = mgr.getCacheLoaderConfig().getFirstCacheLoaderConfig();
assertNotNull("Singleton has been configured", iclc.getSingletonStoreConfig());
assertTrue("Singleton should enabled", iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
@@ -360,16 +360,16 @@
conf =
" <loaders passivation=\"true\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
- " <singletonStore enabled=\"true\">\n" +
- " <properties>\n" +
- " pushStateWhenCoordinator = true\n" +
- " pushStateWhenCoordinatorTimeout = 5000\n" +
- " </properties>\n" +
- " </singletonStore>\n" +
- " </loader>\n" +
- " </loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
+ " <singletonStore enabled=\"true\">\n" +
+ " <properties>\n" +
+ " pushStateWhenCoordinator = true\n" +
+ " pushStateWhenCoordinatorTimeout = 5000\n" +
+ " </properties>\n" +
+ " </singletonStore>\n" +
+ " </loader>\n" +
+ " </loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new CacheLoaderManager();
mgr.setConfig(clc, null, null);
@@ -386,16 +386,16 @@
/************************************************************************************************************/
conf =
" <loaders passivation=\"false\" shared=\"true\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
- " <singletonStore enabled=\"true\">\n" +
- " <properties>\n" +
- " pushStateWhenCoordinator = true\n" +
- " pushStateWhenCoordinatorTimeout = 5000\n" +
- " </properties>\n" +
- " </singletonStore>\n" +
- " </loader>\n" +
- " </loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
+ " <singletonStore enabled=\"true\">\n" +
+ " <properties>\n" +
+ " pushStateWhenCoordinator = true\n" +
+ " pushStateWhenCoordinatorTimeout = 5000\n" +
+ " </properties>\n" +
+ " </singletonStore>\n" +
+ " </loader>\n" +
+ " </loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new CacheLoaderManager();
try
@@ -411,12 +411,12 @@
conf =
" <loaders passivation=\"true\">\n" +
- " <preload/>\n" +
- " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
- " <singletonStore enabled=\"true\" class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
- " </singletonStore>\n" +
- " </loader>\n" +
- " </loaders>";
+ " <preload/>\n" +
+ " <loader class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
+ " <singletonStore enabled=\"true\" class=\"org.jboss.cache.loader.DummyInMemoryCacheLoader\">\n" +
+ " </singletonStore>\n" +
+ " </loader>\n" +
+ " </loaders>";
clc = loadersElementParser.parseLoadersElement(strToElement(conf));
mgr = new CacheLoaderManager();
try
@@ -438,7 +438,6 @@
}
}
- @SuppressWarnings("unchecked")
public static class MockSingletonStoreCacheLoader extends AbstractDelegatingCacheLoader
{
public MockSingletonStoreCacheLoader()
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -29,7 +29,7 @@
public void setUp() throws Exception
{
if (cache != null) tearDown();
- cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, false));
cache.start();
dummyLoader = (DummyCountingCacheLoader) 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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -10,8 +10,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
import static org.testng.AssertJUnit.*;
@@ -41,7 +41,7 @@
public void testSingleLoaderNoPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false));
@@ -91,18 +91,18 @@
public void testTwoLoadersPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
- String xml =
- " <loaders passivation=\"false\">\n" +
- " <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"true\"\n" +
- " purgeOnStartup=\"true\">\n" +
- " <properties>bin=bin1</properties>\n" +
- " </loader>" +
- " <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"false\"\n" +
- " purgeOnStartup=\"false\">\n" +
- " <properties>bin=bin2</properties>\n" +
- " </loader>" +
- " </loaders>";
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
+ String xml =
+ " <loaders passivation=\"false\">\n" +
+ " <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"true\"\n" +
+ " purgeOnStartup=\"true\">\n" +
+ " <properties>bin=bin1</properties>\n" +
+ " </loader>" +
+ " <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"false\"\n" +
+ " purgeOnStartup=\"false\">\n" +
+ " <properties>bin=bin2</properties>\n" +
+ " </loader>" +
+ " </loaders>";
LoadersElementParser parser = new LoadersElementParser();
CacheLoaderConfig cacheLoaderConfig = parser.parseLoadersElement(XmlConfigHelper.stringToElement(xml));
Configuration c = cache.getConfiguration();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -62,7 +62,7 @@
{
try
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -309,11 +309,10 @@
assertEquals(20, retval);
}
- @SuppressWarnings("unchecked")
public void testGetNode() throws CacheException
{
final String NODE = "/a/b/c";
- Object retval;
+ Node<Object, Object> retval;
cache.removeNode(NODE);
addDelay();
cache.put(NODE, "1", 10);
@@ -324,8 +323,7 @@
assertNotNull("Should not be null", retval);
- Node node = (Node) retval;
- assertEquals(10, node.get("1"));
+ assertEquals(10, retval.get("1"));
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -12,9 +12,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.ReplicationListener;
-import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.AfterMethod;
@@ -41,11 +41,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = new DefaultCacheFactory().createCache(false);
+ cache1 = new DefaultCacheFactory<Object, Object>().createCache(false);
cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.DummyInMemoryCacheLoader", null, false, true, false));
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = new DefaultCacheFactory().createCache(false);
+ cache2 = new DefaultCacheFactory<Object, Object>().createCache(false);
cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.DummyInMemoryCacheLoader", null, false, true, false));
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
@@ -270,7 +270,7 @@
createCaches(false, true);
ReplicationListener replListener = new ReplicationListener(cache2);
-
+
mgr1.begin();
replListener.expect(CommitCommand.class);
cache1.put(fqn, key, "value");
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -9,16 +9,13 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.Test;
-import org.w3c.dom.Element;
import javax.transaction.TransactionManager;
@@ -40,7 +37,7 @@
protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(ignoreMods1, ignoreMods2));
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -68,7 +65,7 @@
protected CacheLoaderConfig getCacheLoaderConfig(boolean ignoreMods1, boolean ignoreMods2) throws Exception
{
CacheLoaderConfig clc = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(false, null, DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, ignoreMods1);
- CacheLoaderConfig.IndividualCacheLoaderConfig ic = UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig(null,DummyInMemoryCacheLoader.class.getName(), "", false, false, false , ignoreMods2);
+ CacheLoaderConfig.IndividualCacheLoaderConfig ic = UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig(null, DummyInMemoryCacheLoader.class.getName(), "", false, false, false, ignoreMods2);
clc.addIndividualCacheLoaderConfig(ic);
return clc;
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -67,7 +67,7 @@
{
// expected
}
- cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().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/DummyInMemoryCacheLoader.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/DummyInMemoryCacheLoader.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/DummyInMemoryCacheLoader.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -75,10 +75,9 @@
return children.size() == 0 ? null : children;
}
- @SuppressWarnings("unchecked")
- private Set findChildren(Fqn p)
+ private Set<Object> findChildren(Fqn p)
{
- Set c = new HashSet();
+ Set<Object> c = new HashSet<Object>();
for (Fqn f : getNodesMap().keySet())
{
if (!f.isRoot() && f.getParent().equals(p))
Modified: core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -39,7 +39,7 @@
public void testBlockingProblem() throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -36,7 +36,7 @@
" cache.jdbc.user=user1\n" +
" cache.jdbc.password=user1";
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", JDBCCacheLoader.class.getName(), props, false, false, true, false));
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -14,7 +14,7 @@
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ delegating_cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
@@ -51,7 +51,8 @@
break;
}
}
- } while (ldcl == null);
+ }
+ while (ldcl == null);
ldcl.setDelegateCache(delegating_cache);
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -11,17 +11,14 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.internals.ViewChangeListener;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.util.internals.ViewChangeListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.w3c.dom.Element;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
@@ -47,9 +44,9 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- 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);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache3 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
}
public void testPutCacheLoaderWithNoPush() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,7 +3,6 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
@@ -12,6 +11,7 @@
import org.jboss.cache.notifications.annotation.NodeCreated;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -53,7 +53,7 @@
cacheServer.setBindAddress("127.0.0.1");
cacheServer.setPort(12121);
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(config);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(config);
cacheServer.setCache(cache);
cacheServer.create();
cacheServer.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -52,7 +52,7 @@
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setCacheLoaderConfig(getCacheLoaderConfig());
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(c);
cache.start();
loader = cache.getCacheLoaderManager().getCacheLoader();
@@ -120,7 +120,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(conf);
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -132,7 +132,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(conf);
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -144,7 +144,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(conf);
CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
wrapper.start();
cache_server.setCacheJmxWrapper(wrapper);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -30,7 +30,7 @@
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache1.getConfiguration().setCacheMode("repl_sync");
cache1.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -39,7 +39,7 @@
cache1.create();
cache1.start();
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
clc.addIndividualCacheLoaderConfig(iclc);
@@ -172,7 +172,6 @@
verify(mockCacheLoader);
}
- @SuppressWarnings("unchecked")
public void testUnnecessaryMultipleLoading() throws Exception
{
Map<Object, Object> m = new HashMap<Object, Object>();
@@ -181,7 +180,7 @@
// expecting a put on child
mockCacheLoader.put(eq(child), eq(m));
expect(mockCacheLoader.get(eq(child))).andReturn(null);
- expect((Set<String>) mockCacheLoader.getChildrenNames(eq(parent))).andReturn(Collections.singleton(child.getLastElementAsString()));
+ expect((Set) mockCacheLoader.getChildrenNames(eq(parent))).andReturn(Collections.singleton(child.getLastElementAsString()));
replay(mockCacheLoader);
cache.put(child, m);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -123,7 +123,7 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(c, false);
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -25,9 +25,9 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
@@ -153,7 +153,7 @@
throw new IllegalStateException(cacheID + " already created");
}
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -74,7 +74,7 @@
CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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/UpgradeLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -86,7 +86,7 @@
private CacheSPI<Object, Object> createCache(IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -22,7 +22,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -5,10 +5,10 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -40,7 +40,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -41,7 +41,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
c = cache.getConfiguration();
c.setUseRegionBasedMarshalling(true);
c.setFetchInMemoryState(false);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -78,7 +78,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
cache.getConfiguration().setClusterName(name);
// Use marshaller
cache.getConfiguration().setUseLazyDeserialization(useMarshalledValues);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -273,7 +273,7 @@
private Cache<Object, Object> createCache()
{
- Cache<Object, Object> cache = new DefaultCacheFactory().createCache(false);
+ Cache<Object, Object> cache = new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -47,7 +47,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -30,7 +30,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache();
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache();
r = cache.getRegionManager();
c = cache.getConfiguration();
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -10,71 +10,69 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.ArrayList;
+import java.util.List;
+
@Test(groups = {"functional", "jgroups"})
public class ReplicateToInactiveRegionTest
{
- CacheSPI[] caches;
+ List<CacheSPI<Object, Object>> caches;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- caches = new CacheSPI[]{createCache(), createCache()};
- TestingUtil.blockUntilViewsReceived(caches, 10000);
+ caches = new ArrayList<CacheSPI<Object, Object>>(2);
+ caches.add(createCache());
+ caches.add(createCache());
+ TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheSPI[]{}), 10000);
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- destroyCache(caches[0]);
- destroyCache(caches[1]);
+ TestingUtil.killCaches(caches.get(0), caches.get(1));
caches = null;
}
- private void destroyCache(CacheSPI c)
+ private CacheSPI<Object, Object> createCache()
{
- c.stop();
- }
-
- private CacheSPI createCache()
- {
- CacheSPI c = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
c.getConfiguration().setCacheMode("REPL_SYNC");
c.getConfiguration().setUseRegionBasedMarshalling(true);
c.start();
return c;
}
- @SuppressWarnings("unchecked")
public void testTransferToInactiveRegion()
{
Fqn f = Fqn.fromString("/a/b");
- caches[0].put(f, "k", "v");
+ caches.get(0).put(f, "k", "v");
- assertEquals("v", caches[0].get(f, "k"));
- assertEquals("v", caches[1].get(f, "k"));
+ assertEquals("v", caches.get(0).get(f, "k"));
+ assertEquals("v", caches.get(1).get(f, "k"));
// create the region on cache 0, make sure it is marked as a MARSHALLING region by attaching a class loader to it.
- Region region0 = caches[0].getRegionManager().getRegion(f, true);
+ Region region0 = caches.get(0).getRegionManager().getRegion(f, true);
region0.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
assertTrue("Should be active by default", region0.isActive());
// make sure this newly created region is "recognised" as a marshalling region.
- assertTrue(caches[0].getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region0));
+ assertTrue(caches.get(0).getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region0));
// now create a region on cache 1, as above.
- Region region1 = caches[1].getRegionManager().getRegion(f, true);
+ Region region1 = caches.get(1).getRegionManager().getRegion(f, true);
region1.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
assertTrue("Should be active by default", region1.isActive());
// make sure this newly created region is "recognised" as a marshalling region.
- assertTrue(caches[1].getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region1));
+ assertTrue(caches.get(1).getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region1));
// now deactivate the region on cache 1.
region1.deactivate();
assertFalse("Should be have deactivated", region1.isActive());
- caches[0].put(f, "k", "v2");
- assertEquals("v2", caches[0].get(f, "k"));
- assertNull(caches[1].get(f, "k"));
+ caches.get(0).put(f, "k", "v2");
+ assertEquals("v2", caches.get(0).get(f, "k"));
+ assertNull(caches.get(1).get(f, "k"));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -41,14 +41,14 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache1.getConfiguration().setUseLazyDeserialization(useMarshalledValues);
cache1.getConfiguration().setUseRegionBasedMarshalling(!useMarshalledValues);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache1.getConfiguration().setSyncReplTimeout(60000);// to aid with debugging
cache1.start();
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache2.getConfiguration().setUseLazyDeserialization(useMarshalledValues);
cache2.getConfiguration().setUseRegionBasedMarshalling(!useMarshalledValues);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -13,11 +13,11 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.marshall.data.Address;
import org.jboss.cache.marshall.data.Person;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -67,7 +67,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
cache.getConfiguration().setClusterName(name);
// Use marshaller
cache.getConfiguration().setUseLazyDeserialization(useMarshalledValues);
@@ -378,7 +378,6 @@
// Need to test out if app is not registered with beforehand??
}
- @SuppressWarnings("unchecked")
public void testCustomFqn() throws Exception
{
FooClassLoader cl1 = new FooClassLoader(Thread.currentThread().getContextClassLoader());
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,11 +3,11 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.interceptors.InvalidationInterceptor;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -154,6 +154,6 @@
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
- return (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -33,7 +33,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setExposeManagementStatistics(true);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -210,7 +210,7 @@
private CacheSPI<Object, Object> createCache(String clusterName)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -30,7 +30,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(JChannel.DEFAULT_PROTOCOL_STACK);
- cache = new DefaultCacheFactory().createCache(config, false);
+ cache = new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(JChannel.DEFAULT_PROTOCOL_STACK);
- cache = new DefaultCacheFactory().createCache(config, false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(config, false);
cacheStarted = false;
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,7 +3,6 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
import org.jboss.cache.config.BuddyReplicationConfig;
@@ -13,6 +12,7 @@
import org.jboss.cache.notifications.annotation.ViewChanged;
import org.jboss.cache.notifications.event.BuddyGroupChangedEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -36,7 +36,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- CacheFactory cf = new DefaultCacheFactory();
+ CacheFactory cf = new DefaultCacheFactory<Object, Object>();
c1 = cf.createCache(false);
c1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -49,7 +49,7 @@
clc.setPassivation(true);
c.setCacheLoaderConfig(clc);
- cache = new DefaultCacheFactory().createCache(c);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(c);
eventLog.events.clear();
cache.addCacheListener(eventLog);
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -57,7 +57,7 @@
if (optLocking)
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = new DefaultCacheFactory().createCache(c);
+ cache = new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -37,7 +37,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = instance.createCache();
listener = new Listener();
cache.addCacheListener(listener);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -39,7 +39,7 @@
{
// need 2 caches to test viewChange notifications
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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/NotifierAnnotationsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifierAnnotationsTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifierAnnotationsTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -28,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- Cache c = new DefaultCacheFactory().createCache(false);
+ Cache c = new DefaultCacheFactory<Object, Object>().createCache(false);
n = new NotifierImpl(c);
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -84,7 +84,7 @@
// more time to help with debugging
c.setSyncReplTimeout(60000);
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache1 = instance.createCache(c);
cache2 = instance.createCache(c.clone());
@@ -646,7 +646,7 @@
cache1.put(fqnB, data);
// create cache2
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache2 = instance.createCache(cache1.getConfiguration().clone(), false);
cache2.create();
eventLog2.events.clear();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -128,7 +128,7 @@
protected CacheSPI createPessimisticCache() throws Exception
{
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -145,7 +145,7 @@
protected CacheSPI createPessimisticCacheLocal() throws Exception
{
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -161,19 +161,19 @@
return cache;
}
- protected CacheSPI createReplicatedCache(Configuration.CacheMode mode) throws Exception
+ protected CacheSPI<Object, Object> createReplicatedCache(Configuration.CacheMode mode) throws Exception
{
return createReplicatedCache("test", mode);
}
- protected CacheSPI createReplicatedCache(String name, Configuration.CacheMode mode) throws Exception
+ protected CacheSPI<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode) throws Exception
{
return createReplicatedCache(name, mode, true);
}
protected CacheSPI<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode, boolean start) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
@@ -214,7 +214,7 @@
protected CacheSPI<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared, Configuration.CacheMode cacheMode) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
c.setStateRetrievalTimeout(5000);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -381,7 +381,6 @@
}
- @SuppressWarnings("unchecked")
protected CacheSPI<Object, Object> createAsyncReplicatedCache() throws Exception
{
return createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_ASYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -32,7 +32,7 @@
public void setUp() throws IOException
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -29,13 +29,13 @@
public void setUp()
{
- caches.add(new DefaultCacheFactory().createCache(false));
+ caches.add(new DefaultCacheFactory<Object, Object>().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(new DefaultCacheFactory().createCache(false));
+ caches.add(new DefaultCacheFactory<Object, Object>().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);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -640,7 +640,6 @@
destroyCache(cache);
}
- @SuppressWarnings("unchecked")
protected CacheSPI<Object, Object> createSyncReplicatedCache() throws Exception
{
return createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -60,6 +60,7 @@
TestingUtil.killCaches(cache);
}
+ @SuppressWarnings("unchecked")
public void testTransactionGetNamesMethod() throws Exception
{
mgr.begin();
@@ -78,8 +79,7 @@
OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- @SuppressWarnings("unchecked")
- TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
+ TransactionWorkspace workspace = entry.getTransactionWorkSpace();
//assert we can see this with a key value get in the transaction
assertEquals(1, cache.getNode("/one").getChildrenNames().size());
Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -9,9 +9,9 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.AfterMethod;
@@ -32,12 +32,12 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache1.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -22,10 +22,9 @@
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
*/
@Test(groups = {"functional", "optimistic"})
- at SuppressWarnings("unchecked")
public class ExplicitVersionsReplTest
{
- private CacheSPI cache[];
+ private CacheSPI<Object, Object> cache[];
private Fqn fqn = Fqn.fromString("/a");
private String key = "key";
@@ -40,7 +39,7 @@
TestingUtil.blockUntilViewsReceived(cache, 20000);
}
- private CacheSPI createCache()
+ private CacheSPI<Object, Object> createCache()
{
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -53,7 +52,7 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI) new DefaultCacheFactory().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(c);
}
@AfterMethod(alwaysRun = true)
@@ -255,16 +254,16 @@
assertEquals("value", cache[0].get(fqn, key));
assertEquals("value", cache[1].get(fqn, key));
- assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
- assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
+ assertEquals(expected, cache[0].getNode(fqn).getVersion());
+ assertEquals(expected, cache[1].getNode(fqn).getVersion());
cache[1].put(fqn, key, "value2");
expected = (DefaultDataVersion) expected.increment();
assertEquals("value2", cache[0].get(fqn, key));
assertEquals("value2", cache[1].get(fqn, key));
- assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
- assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
+ assertEquals(expected, cache[0].getNode(fqn).getVersion());
+ assertEquals(expected, cache[1].getNode(fqn).getVersion());
}
public void testPropagationOfCustomVersions() throws Exception
@@ -275,8 +274,8 @@
assertEquals("value", cache[0].get(fqn, key));
assertEquals("value", cache[1].get(fqn, key));
- assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
- assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
+ assertEquals(expected, cache[0].getNode(fqn).getVersion());
+ assertEquals(expected, cache[1].getNode(fqn).getVersion());
expected = new TestVersion("200");
cache[1].getInvocationContext().getOptionOverrides().setDataVersion(expected);
@@ -284,8 +283,8 @@
assertEquals("value2", cache[0].get(fqn, key));
assertEquals("value2", cache[1].get(fqn, key));
- assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
- assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
+ assertEquals(expected, cache[0].getNode(fqn).getVersion());
+ assertEquals(expected, cache[1].getNode(fqn).getVersion());
}
public void testExplicitVersionOnRoot() throws Exception
@@ -319,9 +318,9 @@
cache[0].put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[0].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache[0].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache[0].getNode("/org/domain/Entity/EntityInstance#1").getVersion());
assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[1].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache[1].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache[1].getNode("/org/domain/Entity/EntityInstance#1").getVersion());
}
@@ -333,9 +332,9 @@
cache[0].put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache[0].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache[0].getNode("/org/domain/Entity/EntityInstance#1").getVersion());
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache[1].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache[1].getNode("/org/domain/Entity/EntityInstance#1").getVersion());
}
@@ -349,9 +348,9 @@
cache[0].getTransactionManager().commit();
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getRoot()).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache[0].getNode("/parent")).getVersion());
+ assertEquals(vParent, cache[0].getNode("/parent").getVersion());
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getRoot()).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache[1].getNode("/parent")).getVersion());
+ assertEquals(vParent, cache[1].getNode("/parent").getVersion());
TestVersion vChild = new TestVersion("Child-Version");
@@ -361,11 +360,11 @@
cache[0].getTransactionManager().commit();
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getRoot()).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache[0].getNode("/parent")).getVersion());
- assertEquals(vChild, ((NodeSPI) cache[0].getNode("/parent/child")).getVersion());
+ assertEquals(vParent, cache[0].getNode("/parent").getVersion());
+ assertEquals(vChild, cache[0].getNode("/parent/child").getVersion());
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getRoot()).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache[1].getNode("/parent")).getVersion());
- assertEquals(vChild, ((NodeSPI) cache[1].getNode("/parent/child")).getVersion());
+ assertEquals(vParent, cache[1].getNode("/parent").getVersion());
+ assertEquals(vChild, cache[1].getNode("/parent/child").getVersion());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -39,7 +39,7 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
@@ -67,7 +67,7 @@
assertEquals("value", cache.get(fqn, key));
// get a hold of the node
- NodeSPI<String, String> node = (NodeSPI<String, String>) cache.getNode(fqn);
+ NodeSPI<String, String> node = cache.getNode(fqn);
DataVersion versionFromCache = node.getVersion();
assertEquals(TestVersion.class, versionFromCache.getClass());
@@ -129,7 +129,7 @@
cache.put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache.getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache.getNode("/org/domain/Entity/EntityInstance#1").getVersion());
}
public void testExplicitVersionOnLeafImplicitParentCreation() throws Exception
@@ -139,7 +139,7 @@
cache.put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/org/domain/Entity")).getVersion()).getRawVersion());
- assertEquals(v, ((NodeSPI) cache.getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+ assertEquals(v, cache.getNode("/org/domain/Entity/EntityInstance#1").getVersion());
}
public void testExplicitVersionsOnParents()
@@ -187,7 +187,7 @@
cache.getTransactionManager().commit();
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/")).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache.getNode("/parent")).getVersion());
+ assertEquals(vParent, cache.getNode("/parent").getVersion());
TestVersion vChild = new TestVersion("Child-Version");
@@ -197,8 +197,8 @@
cache.getTransactionManager().commit();
assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/")).getVersion()).getRawVersion());
- assertEquals(vParent, ((NodeSPI) cache.getNode("/parent")).getVersion());
- assertEquals(vChild, ((NodeSPI) cache.getNode("/parent/child")).getVersion());
+ assertEquals(vParent, cache.getNode("/parent").getVersion());
+ assertEquals(vChild, cache.getNode("/parent/child").getVersion());
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -40,7 +40,7 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -12,7 +12,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -22,6 +21,7 @@
import org.jboss.cache.notifications.annotation.NodeModified;
import org.jboss.cache.notifications.annotation.NodeRemoved;
import org.jboss.cache.notifications.event.NodeEvent;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -54,13 +54,13 @@
private void createCaches(NodeLockingScheme scheme, CacheMode mode)
{
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
Configuration c = cache1.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
c = cache2.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
Modified: core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -43,7 +43,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -42,7 +42,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI<String, String>) instance.createCache(config);
m = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -55,7 +55,7 @@
if (cache1 != null || cache2 != null)
tearDown();
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -120,7 +120,6 @@
@CacheListener
public class TestCacheListener
{
- @SuppressWarnings("unchecked")
@NodeActivated
@NodePassivated
public void callback(NodeEvent ne)
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -46,7 +46,7 @@
private void initCaches()
{
- CacheFactory<Integer, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -15,7 +15,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeActivated;
import org.jboss.cache.notifications.annotation.NodeLoaded;
@@ -23,6 +22,7 @@
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -43,7 +43,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -54,7 +54,7 @@
public void setUp() throws Exception
{
log.debug("");
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("local");
configureEviction();
@@ -155,7 +155,6 @@
protected Exception passivationException;
protected Exception activationException;
- @SuppressWarnings("unchecked")
@NodeActivated
public void nodeActivated(NodeEvent e)
{
@@ -190,7 +189,6 @@
activated.add(e.getFqn());
}
- @SuppressWarnings("unchecked")
@NodePassivated
public void nodePassivated(NodeEvent e)
{
@@ -217,7 +215,6 @@
{
log.error("nodePassivate(): can't retrieve bean instance from: " + fqn + " with exception: " + ex);
passivationException = ex;
- return;
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -28,7 +28,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -1357,11 +1356,8 @@
private void checkModifications(List<Modification> list)
throws Exception
{
-
- for (int i = 0; i < list.size(); i += 1)
+ for (Modification mod : list)
{
- Modification mod = list.get(i);
- @SuppressWarnings("unchecked")
Fqn fqn = mod.getFqn();
switch (mod.getType())
{
@@ -1369,18 +1365,16 @@
assertEquals(mod.getValue(), loader.get(fqn).get(mod.getKey()));
break;
case PUT_DATA:
- Map map = mod.getData();
- for (Iterator iter = map.keySet().iterator(); iter.hasNext();)
+ for (Object key : mod.getData().keySet())
{
- Object key = iter.next();
- assertEquals(map.get(key), loader.get(fqn).get(key));
+ assertEquals(mod.getData().get(key), loader.get(fqn).get(key));
}
break;
case REMOVE_KEY_VALUE:
assertEquals(null, loader.get(fqn).get(mod.getKey()));
break;
case REMOVE_DATA:
- map = loader.get(fqn);
+ Map map = loader.get(fqn);
assertNotNull(map);
assertTrue(map.isEmpty());
break;
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -23,7 +23,7 @@
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ delegating_cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -72,7 +72,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache1 = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.start();
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -17,7 +17,7 @@
public void setUp()
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
- cache = new DefaultCacheFactory().createCache(cfg, false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(cfg, false);
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -19,7 +19,7 @@
public void testConstruction() throws InterruptedException
{
- for (int i = 0; i < WARMUP; i++) new DefaultCacheFactory().createCache();
+ for (int i = 0; i < WARMUP; i++) new DefaultCacheFactory<Object, Object>().createCache();
System.out.println("Finished warmup.");
System.gc();
Thread.sleep(1000);
@@ -31,7 +31,7 @@
{
for (int i = 0; i < LOOPS; i++)
{
- new DefaultCacheFactory().createCache();
+ new DefaultCacheFactory<Object, Object>().createCache();
if (i % 100 == 0) System.out.println("In loop num " + i);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -12,10 +12,10 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.ReplicationListener;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -50,7 +50,7 @@
private CacheSPI<Object, Object> createCache(String name) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -3,11 +3,11 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -31,8 +31,8 @@
@BeforeMethod
public void setUp()
{
- cache1 = new DefaultCacheFactory().createCache(false);
- cache2 = new DefaultCacheFactory().createCache(false);
+ cache1 = new DefaultCacheFactory<Object, Object>().createCache(false);
+ cache2 = new DefaultCacheFactory<Object, Object>().createCache(false);
cache1.getConfiguration().setSyncCommitPhase(true);
cache1.getConfiguration().setSyncRollbackPhase(true);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -69,7 +69,7 @@
private void initCaches(Configuration.CacheMode caching_mode)
{
- CacheFactory<String, ContainerData> instance = new DefaultCacheFactory();
+ CacheFactory<String, ContainerData> instance = new DefaultCacheFactory<String, ContainerData>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -71,8 +71,8 @@
private void initCaches()
{
- cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -27,15 +27,15 @@
@Test(groups = {"functional", "jgroups"})
public class SyncReplTest
{
- private Cache[] caches;
+ private Cache<Object, Object>[] caches;
@BeforeMethod(alwaysRun = true)
public void setUp()
{
System.out.println("*** In setUp()");
caches = new Cache[2];
- caches[0] = new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
- caches[1] = new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[0] = new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[1] = new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
TestingUtil.blockUntilViewsReceived(caches, 5000);
System.out.println("*** Finished setUp()");
@@ -47,7 +47,6 @@
if (caches != null) TestingUtil.killCaches(caches);
}
- @SuppressWarnings("unchecked")
public void testBasicOperation()
{
assertClusterSize("Should only be 2 caches in the cluster!!!", 2);
@@ -59,7 +58,7 @@
assertNull("Should be null", caches[0].getRoot().getChild(f));
assertNull("Should be null", caches[1].getRoot().getChild(f));
- Node node = caches[0].getRoot().addChild(f);
+ Node<Object, Object> node = caches[0].getRoot().addChild(f);
assert ((NodeSPI) node).getCache() instanceof CacheInvocationDelegate;
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -26,13 +26,13 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Version;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.fail;
import org.testng.annotations.Test;
@@ -50,7 +50,7 @@
public void testFailedStateTransfer() throws Exception
{
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
cache.getConfiguration().setClusterName("VersionedTestBase");
cache.getConfiguration().setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
@@ -69,7 +69,7 @@
cache.start();
- CacheSPI recipient = (CacheSPI) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
+ CacheSPI recipient = (CacheSPI) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -7,7 +7,13 @@
package org.jboss.cache.statetransfer;
-import org.jboss.cache.*;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -469,14 +475,14 @@
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
- Cache<Object, Object> cache1 = new DefaultCacheFactory().createCache(c, false);
+ Cache<Object, Object> cache1 = new DefaultCacheFactory<Object, Object>().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 = new DefaultCacheFactory().createCache(c, false);
+ Cache<Object, Object> cache2 = new DefaultCacheFactory<Object, Object>().createCache(c, false);
cache2.start();
caches.put("evict2", cache2);
@@ -498,7 +504,7 @@
public void testEvictionAfterStateTransfer() throws Exception
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
- Cache<Object, Object> cache1 = new DefaultCacheFactory().createCache(c, false);
+ Cache<Object, Object> cache1 = new DefaultCacheFactory<Object, Object>().createCache(c, false);
cache1.start();
caches.put("evict1", cache1);
@@ -518,10 +524,10 @@
EvictionController ec1 = new EvictionController(cache1);
ec1.startEviction();
- assert cache1.getRoot().getChild(Fqn.fromString("/org/jboss/data")).getChildren().size() == 5000;
+ assert cache1.getRoot().getChild(Fqn.fromString("/org/jboss/data")).getChildren().size() == 5000;
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
- final Cache<Object, Object> cache2 = new DefaultCacheFactory().createCache(c, false);
+ final Cache<Object, Object> cache2 = new DefaultCacheFactory<Object, Object>().createCache(c, false);
cache2.start();
caches.put("evict2", cache2);
@@ -585,7 +591,8 @@
{
System.out.println("data " + dataCount + " < " + maxCountData + " elapsed = " + (System.currentTimeMillis() - start));
sawDataDecrease = true;
- } else
+ }
+ else
{
maxCountData = dataCount;
}
@@ -600,7 +607,8 @@
{
System.out.println("base " + baseCount + " < " + maxCountBase + " elapsed = " + (System.currentTimeMillis() - start));
sawBaseDecrease = true;
- } else
+ }
+ else
{
maxCountBase = baseCount;
}
@@ -656,6 +664,7 @@
}
}
}
+
private class CacheActivator extends CacheUser
{
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -148,7 +148,7 @@
}
additionalConfiguration(c);
- CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c, false);
+ CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(c, false);
configureMultiplexer(tree);
// Put the cache in the map before starting, so if it fails in
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -4,9 +4,9 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.transaction.DummyTransactionManager;
+import org.jboss.cache.util.TestingUtil;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -97,8 +97,8 @@
cfg1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cfg2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = new DefaultCacheFactory().createCache(cfg1, true);
- cache2 = new DefaultCacheFactory().createCache(cfg2, false);
+ cache1 = new DefaultCacheFactory<Object, Object>().createCache(cfg1, true);
+ cache2 = new DefaultCacheFactory<Object, Object>().createCache(cfg2, false);
UserTransaction tx1 = (UserTransaction) new InitialContext(p).lookup("UserTransaction");
writer = new Writer(cache1, tx1);
try
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -48,7 +48,7 @@
private CacheSPI initCache(boolean notifying)
{
- CacheSPI c = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ CacheSPI c = (CacheSPI) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -35,7 +35,7 @@
{
Configuration c = new Configuration();
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -11,8 +11,8 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.TimeoutException;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.fail;
import org.testng.annotations.AfterMethod;
@@ -53,7 +53,7 @@
public void setUp() throws Exception
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
+ CacheFactory<Object, Integer> instance = new DefaultCacheFactory<Object, Integer>();
cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false);
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -49,12 +49,12 @@
private void createCache(IsolationLevel level)
{
- CacheFactory<Integer, String> factory = new DefaultCacheFactory();
+ CacheFactory<Integer, String> factory = new DefaultCacheFactory<Integer, String>();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
conf.setCacheMode(Configuration.CacheMode.LOCAL);
conf.setIsolationLevel(level);
conf.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- cache = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(conf);
cache.put("/a/b/c", null);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -19,8 +19,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.lock.UpgradeException;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -49,7 +49,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -10,8 +10,8 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
@@ -34,7 +34,7 @@
private CacheSPI<?, ?> createCache(boolean optimistic)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -44,7 +44,7 @@
public void testWithoutTransactions() throws Exception
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -53,7 +53,7 @@
writerError = null;
readerError = null;
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -54,7 +54,7 @@
config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -40,7 +40,7 @@
writerFailed = false;
writerError = null;
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -48,7 +48,7 @@
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = instance.createCache(config);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -101,7 +101,7 @@
public void setUp() throws Exception
{
exception = null;
- CacheFactory<Boolean, Boolean> instance = new DefaultCacheFactory();
+ CacheFactory<Boolean, Boolean> instance = new DefaultCacheFactory<Boolean, Boolean>();
// 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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -7,8 +7,8 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.invocation.CacheInvocationDelegate;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
@@ -37,7 +37,7 @@
@BeforeTest(alwaysRun = true)
protected void setUp() throws Exception
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -28,17 +28,16 @@
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
*/
- at SuppressWarnings("unchecked")
@Test(groups = "functional")
public class StatusUnknownTest
{
- private Cache cache;
+ private Cache<String, String> cache;
private TransactionManager tm;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new DefaultCacheFactory().createCache(false);
+ cache = new DefaultCacheFactory<String, String>().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(HeuristicFailingDummyTransactionManagerLookup.class.getName());
cache.start();
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -27,7 +27,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new DefaultCacheFactory();
+ CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
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 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -1040,7 +1040,6 @@
public void testRootNodeRemovalRollback() throws Exception
{
- @SuppressWarnings("unchecked")
Fqn root = Fqn.ROOT;
Fqn fqn = Fqn.fromRelativeElements(root, 1);
//put first time
@@ -1061,49 +1060,6 @@
assertEquals("v", this.cache.get(fqn, "k"));
}
- /* public void testConcurrentReadAccess() throws Exception {
- cache.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- cache.setUseMbean(false);
-
- cache.put("/1/2/3/4", "foo", "bar"); // no TX, no locks held after put() returns
-
-
- class Reader extends Thread {
- Transaction thread_tx;
-
- public Reader(String name) {
- super(name);
- }
-
- public void run() {
- try {
- thread_tx=startTransaction();
- log("acquiring RL");
- cache.get("/1/2/3", "foo"); // acquires RLs on all 3 nodes
- log("RL acquired successfully");
- sleep(200000);
- log("committing TX");
- thread_tx.commit(); // releases RLs
- log("committed TX");
- }
- catch(Exception e) {
- thread_ex=e;
- }
- }
- }
-
-
- Reader reader=new Reader("R1");
- Reader reader2=new Reader("R2");
- reader.start();
- reader2.start();
- reader.join();
- reader2.join();
- if(thread_ex != null)
- throw thread_ex;
- }
-
- */
private static void log(String msg)
{
System.out.println(Thread.currentThread().getName() + ": " + msg);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2008-07-15 16:20:06 UTC (rev 6277)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2008-07-15 16:39:43 UTC (rev 6278)
@@ -38,7 +38,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = new DefaultCacheFactory();
+ CacheFactory<String, String> cf = new DefaultCacheFactory<String, String>();
cache = cf.createCache(false);
cache.getConfiguration().setIsolationLevel(isolationLevel);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
More information about the jbosscache-commits
mailing list