Author: mircea.markus
Date: 2008-11-05 09:55:13 -0500 (Wed, 05 Nov 2008)
New Revision: 7084
Modified:
core/trunk/src/main/java/org/jboss/cache/eviction/LRUQueue.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/PassivationTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/PassivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/loader/DummySharedInMemoryCacheLoader.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
core/trunk/src/test/resources/configs/parser-test.xml
Log:
fixed tests
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUQueue.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUQueue.java 2008-11-04 16:24:20
UTC (rev 7083)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUQueue.java 2008-11-05 14:55:13
UTC (rev 7084)
@@ -22,6 +22,8 @@
package org.jboss.cache.eviction;
import org.jboss.cache.Fqn;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -38,6 +40,8 @@
*/
public class LRUQueue implements EvictionQueue
{
+
+ private static Log log = LogFactory.getLog(LRUQueue.class);
private Map<Fqn, NodeEntry> maxAgeQueue;
private Map<Fqn, NodeEntry> lruQueue;
private long alternatingCount = 0;
@@ -165,6 +169,7 @@
public int getNumberOfNodes()
{
+ if (log.isTraceEnabled()) log.trace("LRUQUeue.size() = " +
maxAgeQueue.size());
return maxAgeQueue.size();
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -291,6 +291,10 @@
n = helper.wrapNodeForWriting(ctx, fqn, true, true, true, false, false);
n.setDataLoaded(false);
}
+ else
+ {
+ this.cacheMisses++;
+ }
if (!bypassLoadingData && n != null)
{
n = loadNode(ctx, fqn, n);
Modified: core/trunk/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java 2008-11-04
16:24:20 UTC (rev 7083)
+++ core/trunk/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -145,8 +145,7 @@
}
catch (Exception e)
{
- throw new CacheException("Unable to invoke method " + method + "
on object " + //instance +
- (parameters != null ? " with parameters " +
Arrays.asList(parameters) : ""), e);
+ throw new CacheException(e);
}
}
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/PassivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/PassivationTest.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/PassivationTest.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -27,7 +27,7 @@
String binName = "bin-" + Thread.currentThread().getName();
- CacheLoaderConfig clc = getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "debug=true,bin=" + binName,
false, true, false);
+ CacheLoaderConfig clc = getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "debug=true\nbin=" + binName,
false, true, false);
clc.setPassivation(true);
cache.getConfiguration().setCacheLoaderConfig(clc);
}
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/PassivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/PassivationTest.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/PassivationTest.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -14,7 +14,7 @@
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
-@Test(groups = {"functional", "mvcc"})
+@Test(groups = {"functional", "mvcc"})
public class PassivationTest extends PassivationTestsBase
{
@Override
@@ -23,7 +23,7 @@
CacheSPI<Object, Object> cache = cacheTL.get();
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- CacheLoaderConfig clc = getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "", false, true, false);
+ CacheLoaderConfig clc = getSingleCacheLoaderConfig("",
DummySharedInMemoryCacheLoader.class.getName(), "bin=" +
Thread.currentThread().getName() + getClass().getName(), false, true, false);
clc.setPassivation(true);
cache.getConfiguration().setCacheLoaderConfig(clc);
}
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -30,12 +30,10 @@
@Test(groups = {"functional"})
public class BuddyReplicationContentTest extends BuddyReplicationTestsBase
{
- private String key = "key";
- private String value = "value";
+ private final String key = "key";
+ private final String value = "value";
private Log log = LogFactory.getLog(BuddyGroupAssignmentTest.class);
- BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
-
private void assertNoStaleLocks(List<CacheSPI<Object, Object>> caches)
{
for (CacheSPI<Object, Object> cache : caches) assertNoStaleLocks(cache);
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -38,8 +38,8 @@
@Test(groups = {"functional", "jgroups"})
public abstract class BuddyReplicationTestsBase
{
- protected ThreadLocal<List<CacheSPI<Object, Object>>> cachesTL = new
ThreadLocal<List<CacheSPI<Object, Object>>>();
- protected BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
+ protected final ThreadLocal<List<CacheSPI<Object, Object>>> cachesTL
= new ThreadLocal<List<CacheSPI<Object, Object>>>();
+ protected final BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/DummySharedInMemoryCacheLoader.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/DummySharedInMemoryCacheLoader.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/loader/DummySharedInMemoryCacheLoader.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -28,7 +28,11 @@
if (config != null && config.getProperties() != null)
{
- bin = config.getProperties().getProperty("bin",
"_default_bin_");
+ bin = config.getProperties().getProperty("bin");
+ if (bin == null)
+ {
+ throw new IllegalStateException("bin MUST be present for shared state
CL. This is because tests might run concurrently!");
+ }
}
if (!BINS.containsKey(bin)) BINS.put(bin, new ConcurrentHashMap<Fqn,
DummyNode>());
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -36,7 +36,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 3.0
*/
-@Test(groups = "functional")
+@Test(groups = "functional", sequential = true)
public class JDBCCacheLoaderStateTransferTest extends AbstractCacheLoaderTestBase
{
Modified:
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -8,19 +8,85 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+import javax.transaction.TransactionManager;
+
@Test(groups = {"functional", "jgroups"})
public class AsyncReplOptLocksTest extends CacheModeLocalTestBase
{
- public AsyncReplOptLocksTest()
- {
- cacheMode = Configuration.CacheMode.REPL_ASYNC;
- nodeLockingScheme = "OPTIMISTIC";
- }
+ public AsyncReplOptLocksTest()
+ {
+ cacheMode = Configuration.CacheMode.REPL_ASYNC;
+ nodeLockingScheme = "OPTIMISTIC";
+ }
- protected void delay()
- {
- TestingUtil.sleepThread(500);
- }
+ protected void delay()
+ {
+ TestingUtil.sleepThread(500);
+ }
+
+ public void testRemoveKey() throws Exception
+ {
+ super.testRemoveKey();
+ }
+
+ public void testPutKeyValue() throws Exception
+ {
+ super.testPutKeyValue();
+ }
+
+ public void testPutKeyValueViaNodeAPI() throws Exception
+ {
+ super.testPutKeyValueViaNodeAPI();
+ }
+
+ public void testPutData() throws Exception
+ {
+ super.testPutData();
+ }
+
+ public void testPutDataViaNodeAPI() throws Exception
+ {
+ super.testPutDataViaNodeAPI();
+ }
+
+ public void testRemoveNode() throws Exception
+ {
+ super.testRemoveNode();
+ }
+
+ public void testRemoveNodeViaNodeAPI() throws Exception
+ {
+ super.testRemoveNodeViaNodeAPI();
+ }
+
+ public void testRemoveKeyViaNodeAPI() throws Exception
+ {
+ super.testRemoveKeyViaNodeAPI();
+ }
+
+ public void testTransactionalBehaviourCommit() throws Exception
+ {
+ super.testTransactionalBehaviourCommit();
+ }
+
+ public void testTransactionalBehaviourRollback() throws Exception
+ {
+ super.testTransactionalBehaviourRollback();
+ }
+
+ public void testTransactionalBehaviourViaNodeAPI() throws Exception
+ {
+ super.testTransactionalBehaviourViaNodeAPI();
+ }
+
+ public void testAddChild() throws Exception
+ {
+ super.testAddChild();
+ }
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-11-04 16:24:20 UTC
(rev 7083)
+++ core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-11-05 14:55:13 UTC
(rev 7084)
@@ -334,10 +334,6 @@
return true;
}
- /**
- * @param c
- * @param memberCount
- */
public static boolean isCacheViewComplete(Cache c, int memberCount)
{
return isCacheViewComplete(c, memberCount, true);
Modified:
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java 2008-11-04
16:24:20 UTC (rev 7083)
+++
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java 2008-11-05
14:55:13 UTC (rev 7084)
@@ -63,6 +63,10 @@
CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher)
TestingUtil.extractField(rpcManager, "rpcDispatcher");
RpcDispatcher.Marshaller2 realMarshaller = (RpcDispatcher.Marshaller2)
realDispatcher.getMarshaller();
RpcDispatcher.Marshaller2 delegate = null;
+ if ( (realMarshaller instanceof RegionMarshallerDelegate) || (realMarshaller
instanceof MarshallerDelegate) )
+ {
+ throw new RuntimeException("Illegal state");
+ }
if (realDispatcher instanceof InactiveRegionAwareRpcDispatcher)
delegate = new RegionMarshallerDelegate((Marshaller) realMarshaller);
else
Modified: core/trunk/src/test/resources/configs/parser-test.xml
===================================================================
--- core/trunk/src/test/resources/configs/parser-test.xml 2008-11-04 16:24:20 UTC (rev
7083)
+++ core/trunk/src/test/resources/configs/parser-test.xml 2008-11-05 14:55:13 UTC (rev
7084)
@@ -5,10 +5,11 @@
<jbosscache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:jbosscache-core:config:3.0">
-
+ <!-- perCache -> differrent EntryFactory-->
<locking isolationLevel="REPEATABLE_READ"
lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
nodeLockingScheme="mvcc" writeSkewCheck="false"
concurrencyLevel="21"/>
+ <!-- perCM -->
<transaction
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="true" syncCommitPhase="true"/>
@@ -17,12 +18,15 @@
<startup regionsInactiveOnStartup="true"/>
<shutdown hookBehavior="REGISTER"/>
<listeners asyncPoolSize="5"/>
+ <!-- perCache -->
<invocationBatching enabled="true"/>
+ <!-- per CM-->
<!-- serialization related configuration, used for replication and cache loading
-->
<serialization objectInputStreamPoolSize="12"
objectOutputStreamPoolSize="14" version="1.2.4"
marshallerClass="some.Clazz"
useLazyDeserialization="true" useRegionBasedMarshalling="true"/>
+ <!-- per Cache -->
<clustering mode="replication"
clusterName="JBossCache-cluster">
<stateRetrieval timeout="15124"
fetchInMemoryState="true"/>
<buddy enabled="true" poolName="myBuddyPoolReplicationGroup"
communicationTimeout="2000">
@@ -34,10 +38,11 @@
</properties>
</locator>
</buddy>
- <sync replTimeout="15421"/>
+ <sync replTimeout="15421"/>
<jgroupsConfig multiplexerStack="file_name" />
</clustering>
+ <!-- per cache, 1) algo/cache 2) what/cache 3) collecting data 4) timer thread /
per CM -->
<eviction wakeUpInterval="5">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
eventQueueSize="200000">
<property name="maxNodes" value="5000" />
@@ -52,6 +57,7 @@
</region>
</eviction>
+ <!-- cacheLoaders/Cache; optimization - reusing CL through caches -->
<!-- this should be deprecated in 3.0 and should be replaced with
CacheLoaderConfig-->
<loaders passivation="true" shared="true">
<preload>
@@ -76,6 +82,7 @@
</loader>
</loaders>
+ <!-- per CacheInstance -->
<!-- this is new behavior added within 3.x only. it support configuring custom
interceptors through configurations -->
<customInterceptors>
<interceptor position="first"
class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">