JBoss Cache SVN: r7117 - core/trunk/src/main/java/org/jboss/cache/config/parsing.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-11-11 18:20:54 -0500 (Tue, 11 Nov 2008)
New Revision: 7117
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
Log:
Reduce logging level
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-11-11 23:17:24 UTC (rev 7116)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-11-11 23:20:54 UTC (rev 7117)
@@ -564,7 +564,7 @@
Map<String, String> stringAttribs = new HashMap<String, String>();
Map<String, Element> xmlAttribs = new HashMap<String, Element>();
NodeList list = source.getElementsByTagName(ATTR);
- if (log.isDebugEnabled()) log.debug("Attribute size: " + list.getLength());
+ if (log.isTraceEnabled()) log.trace("Attribute size: " + list.getLength());
// loop through attributes
for (int loop = 0; loop < list.getLength(); loop++)
17 years, 1 month
JBoss Cache SVN: r7116 - core/trunk/src/main/java/org/jboss/cache/config/parsing.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-11-11 18:17:24 -0500 (Tue, 11 Nov 2008)
New Revision: 7116
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
Log:
Further reduce logging level on advice to update config files
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-11-11 20:44:44 UTC (rev 7115)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-11-11 23:17:24 UTC (rev 7116)
@@ -126,7 +126,7 @@
}
else
{
- log.info("Detected legacy configuration file format when parsing configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
+ log.debug("Detected legacy configuration file format when parsing configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseConfiguration(element);
}
17 years, 1 month
JBoss Cache SVN: r7115 - core/trunk/src/main/java/org/jboss/cache/loader/bdbje.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 15:44:44 -0500 (Tue, 11 Nov 2008)
New Revision: 7115
Modified:
core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
Log:
fixed test
Modified: core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-11-11 20:37:22 UTC (rev 7114)
+++ core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-11-11 20:44:44 UTC (rev 7115)
@@ -43,6 +43,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
+import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.AbstractCacheLoader;
import org.jboss.cache.util.reflect.ReflectionUtil;
@@ -123,7 +124,39 @@
checkNotOpen();
}
+ protected void storeStateHelper(Fqn subtree, List nodeData, boolean moveToBuddy) throws Exception
+ {
+ for (Object aNodeData : nodeData)
+ {
+ NodeData nd = (NodeData) aNodeData;
+ if (nd.isMarker())
+ {
+ if (log.isTraceEnabled()) log.trace("Reached delimiter; exiting loop");
+ break;
+ }
+ Fqn fqn;
+ if (moveToBuddy)
+ {
+ fqn = buddyFqnTransformer.getBackupFqn(subtree, nd.getFqn());
+ }
+ else
+ {
+ fqn = nd.getFqn();
+ }
+ if (log.isTraceEnabled()) log.trace("Storing state in Fqn " + fqn);
+ if (nd.getAttributes() != null)
+ {
+ this.put(fqn, nd.getAttributes(), true);// creates a node with 0 or more attributes
+ }
+ else
+ {
+ this.put(fqn, null);// creates a node with null attributes
+ }
+ }
+ }
+
+
/**
* Opens the JE environment and the database specified by the configuration
* string. The environment and databases are created if necessary.
@@ -874,10 +907,16 @@
{
checkNonNull(tx, "tx");
}
- if (!transactional)
+ if (!transactional & !onePhase)
{
throw new UnsupportedOperationException(
"prepare() not allowed with a non-transactional cache loader");
+ } else if (onePhase)
+ {
+ for (Modification modification: modifications)
+ {
+
+ }
}
Transaction txn = performTransaction(modifications);
if (onePhase)
17 years, 1 month
JBoss Cache SVN: r7114 - core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 15:37:22 -0500 (Tue, 11 Nov 2008)
New Revision: 7114
Modified:
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java
Log:
added replication listeners for async replication to fix intermittent test failures
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -8,6 +8,8 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test (groups = "functional", testName = "cachemodelocal.AsyncInvalidationOptLocksTest")
@@ -20,7 +22,12 @@
isInvalidation = true;
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
+ protected void verifyReplication()
{
TestingUtil.sleepThread(500);
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -8,6 +8,8 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test(groups = "functional", testName = "options.cachemodelocal.AsyncInvalidationPessLocksTest")
@@ -20,8 +22,13 @@
isInvalidation = true;
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
{
+ //do nothing
+ }
+
+ protected void verifyReplication()
+ {
TestingUtil.sleepThread(500);
}
}
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-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -8,13 +8,12 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.commands.ReplicableCommand;
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"}, testName = "options.cachemodelocal.AsyncReplOptLocksTest")
public class AsyncReplOptLocksTest extends CacheModeLocalTestBase
{
@@ -24,7 +23,7 @@
nodeLockingScheme = "OPTIMISTIC";
}
- protected void delay()
+ protected void verifyReplication()
{
TestingUtil.sleepThread(500);
}
@@ -89,4 +88,9 @@
super.testAddChild();
}
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -7,20 +7,59 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.legacy.write.PessPutDataMapCommand;
+import org.jboss.cache.commands.legacy.write.PessPutKeyValueCommand;
+import org.jboss.cache.commands.legacy.write.PessRemoveKeyCommand;
+import org.jboss.cache.commands.legacy.write.PessRemoveNodeCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Cache;
import org.testng.annotations.Test;
+import java.util.Map;
+import java.util.HashMap;
+
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.AsyncReplPessLocksTest")
public class AsyncReplPessLocksTest extends CacheModeLocalTestBase
{
- public AsyncReplPessLocksTest()
- {
- cacheMode = Configuration.CacheMode.REPL_ASYNC;
- nodeLockingScheme = "PESSIMISTIC";
- }
- protected void delay()
- {
- TestingUtil.sleepThread(500);
- }
+ ReplicationListener current;
+
+ Map<Cache, ReplicationListener> cache2Listener = new HashMap<Cache, ReplicationListener>(2);
+
+ public AsyncReplPessLocksTest()
+ {
+ cacheMode = Configuration.CacheMode.REPL_ASYNC;
+ nodeLockingScheme = "PESSIMISTIC";
+ }
+
+ protected void registerReplicationCommand(CacheSPI<String, String> cache, Class<? extends ReplicableCommand> what)
+ {
+ if (what == PutDataMapCommand.class) what = PessPutDataMapCommand.class;
+ if (what == PutKeyValueCommand.class) what = PessPutKeyValueCommand.class;
+ if (what == RemoveKeyCommand.class) what = PessRemoveKeyCommand.class;
+ if (what == RemoveNodeCommand.class) what = PessRemoveNodeCommand.class;
+ getCacheListener(cache).expect(what);
+ }
+
+ protected void verifyReplication()
+ {
+ current.waitForReplicationToOccur(2000);
+ }
+
+ public ReplicationListener getCacheListener(Cache cache)
+ {
+ current = cache2Listener.get(cache);
+ if (current == null)
+ {
+ current = new ReplicationListener(cache);
+ cache2Listener.put(cache, current);
+ }
+ return current;
+ }
}
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-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -12,6 +12,11 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
@@ -52,23 +57,23 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
-
+
CacheSPI<String, String> cache1 = cache1TL.get();
CacheSPI<String, String> cache2 = cache2TL.get();
-
+
// force a tear down if the test runner didn't run one before (happens in IDEA)
if (cache1 != null || cache2 != null)
tearDown();
CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
-
+
Configuration c = new Configuration();
c.setClusterName("test");
c.setStateRetrievalTimeout(1000);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setNodeLockingScheme(nodeLockingScheme);
c.setCacheMode(cacheMode);
-
+
cache1 = (CacheSPI<String, String>) instance.createCache(c, false);
cache1.start();
@@ -78,13 +83,13 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setNodeLockingScheme(nodeLockingScheme);
c.setCacheMode(cacheMode);
-
+
cache2 = (CacheSPI<String, String>) instance.createCache(c, false);
cache2.start();
cache1TL.set(cache1);
cache2TL.set(cache2);
-
+
root1TL.set(cache1.getRoot());
root2TL.set(cache2.getRoot());
}
@@ -107,7 +112,8 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put(fqn, key, "value");
- delay();
+ Thread.sleep(500);
+
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -115,9 +121,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -134,13 +141,14 @@
// now cache2
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
- delay();
+ Thread.sleep(500);
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -158,11 +166,11 @@
CacheSPI<String, String> cache2 = cache2TL.get();
NodeSPI<String, String> root1 = root1TL.get();
NodeSPI<String, String> root2 = root2TL.get();
-
+
Node node1 = root1.addChild(fqn);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value");
- delay();
+ Thread.sleep(500);
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -170,9 +178,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
node1.put(key, "value");
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -191,13 +200,15 @@
Node node2 = root2.addChild(fqn);
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.put(key, "value2");
- delay();
+ Thread.sleep(500);
+
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value2");
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -219,16 +230,17 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put(fqn, map);
- delay();
+ Thread.sleep(500);
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should not
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
+ registerReplicationCommand(cache2, PutDataMapCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
cache1.put(fqn, map);
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
@@ -245,13 +257,15 @@
map.put(key, "value2");
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, map);
- delay();
+ Thread.sleep(500);
+
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -276,16 +290,17 @@
Node node1 = root1.addChild(fqn);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.putAll(map);
- delay();
+ Thread.sleep(500);
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should not
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
+ registerReplicationCommand(cache2, PutDataMapCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
node1.putAll(map);
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
@@ -304,13 +319,15 @@
map.put(key, "value2");
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.putAll(map);
- delay();
+ Thread.sleep(500);
+
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value2");
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -329,9 +346,10 @@
// put some stuff in the cache first
// make sure we cleanup thread local vars.
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -344,7 +362,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.removeNode(fqn);
- delay();
+ Thread.sleep(500);
// should be removed in cache1
assertNull("should be null", cache1.get(fqn, key));
@@ -359,8 +377,9 @@
}
// replace cache entries
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -372,9 +391,10 @@
}
// now try again with passing the default options
+ registerReplicationCommand(cache2, RemoveNodeCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
cache1.removeNode(fqn);
- delay();
+ verifyReplication();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -390,10 +410,11 @@
// put some stuff in the cache first
// make sure we cleanup thread local vars.
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
- delay();
assertEquals("value", cache1.get(fqn, key));
+ verifyReplication();
if (isInvalidation)
{
assertNull("Should be null", cache2.get(fqn, key));
@@ -405,7 +426,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.removeChild(fqn);
- delay();
+ Thread.sleep(500);
// should be removed in cache1
assertNull("should be null", cache1.get(fqn, key));
@@ -420,8 +441,9 @@
}
// replace cache entries
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -432,10 +454,11 @@
assertEquals("value", cache2.get(fqn, key));
}
+ registerReplicationCommand(cache2, RemoveNodeCommand.class);
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
root1.removeChild(fqn);
- delay();
+ verifyReplication();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -447,10 +470,11 @@
CacheSPI<String, String> cache1 = cache1TL.get();
CacheSPI<String, String> cache2 = cache2TL.get();
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
// put some stuff in the cache first
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -463,7 +487,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.remove(fqn, key);
- delay();
+ Thread.sleep(500);
// should be removed in cache1
assertNull("should be null", cache1.get(fqn, key));
@@ -477,9 +501,10 @@
assertEquals("value", cache2.get(fqn, key));
}
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
// replace cache entries
cache1.put(fqn, key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -490,10 +515,11 @@
assertEquals("value", cache2.get(fqn, key));
}
+ registerReplicationCommand(cache2, RemoveKeyCommand.class);
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.remove(fqn, key);
- delay();
+ verifyReplication();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -508,10 +534,11 @@
NodeSPI<String, String> root2 = root2TL.get();
// put some stuff in the cache first
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
Node node1 = root1.addChild(fqn);
cache1.getInvocationContext().setOptionOverrides(null);
node1.put(key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -524,7 +551,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.remove(key);
- delay();
+ Thread.sleep(500);
// should be removed in cache1
assertNull("should be null", cache1.get(fqn, key));
@@ -539,8 +566,9 @@
}
// replace cache entries
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
node1.put(key, "value");
- delay();
+ verifyReplication();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -552,9 +580,10 @@
}
// now try again with passing the default options
+ registerReplicationCommand(cache2, RemoveKeyCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
node1.remove(key);
- delay();
+ verifyReplication();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -567,13 +596,14 @@
CacheSPI<String, String> cache2 = cache2TL.get();
TransactionManager mgr = cache1.getTransactionManager();
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value1");
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put(fqn, key, "value2");
mgr.commit();
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value2", cache1.get(fqn, key));
@@ -586,6 +616,7 @@
assertNull(cache2.get(fqn, key));
}
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
// now try again with passing the default options
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -593,7 +624,7 @@
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value");
mgr.commit();
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -608,6 +639,7 @@
}
// now cache2
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
mgr = cache2.getTransactionManager();
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
@@ -615,7 +647,7 @@
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
mgr.commit();
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
@@ -628,13 +660,14 @@
assertNull(cache1.get(fqn, key));
}
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value4");
mgr.commit();
- delay();
+ verifyReplication();
assertEquals("value4", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -657,14 +690,16 @@
// create these first ...
cache1.put("/a", key, "old");
cache1.put("/b", key, "old");
- delay();
+ Thread.sleep(500);
+
+
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put("/a", key, "value1");
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put("/b", key, "value2");
mgr.rollback();
- delay();
+ Thread.sleep(500);
// cache1 should NOT have this
assert cache1.get("/a", key).equals("old");
assert cache1.get("/b", key).equals("old");
@@ -689,6 +724,7 @@
NodeSPI<String, String> root2 = root2TL.get();
Node node1 = root1.addChild(fqn);
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
TransactionManager mgr = cache1.getTransactionManager();
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().reset();
@@ -696,7 +732,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value2");
mgr.commit();
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value2", cache1.get(fqn, key));
@@ -710,13 +746,14 @@
}
// now try again with passing the default options
+ registerReplicationCommand(cache2, PutKeyValueCommand.class);
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value3");
cache1.getInvocationContext().getOptionOverrides().reset();
node1.put(key, "value");
mgr.commit();
- delay();
+ verifyReplication();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -733,13 +770,14 @@
// now cache2
Node node2 = root2.addChild(fqn);
mgr = cache2.getTransactionManager();
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
node2.put(key, "value3");
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.put(key, "value2");
mgr.commit();
- delay();
+ verifyReplication();
assertEquals("value2", cache2.get(fqn, key));
@@ -752,13 +790,14 @@
assertNull(cache1.get(fqn, key));
}
+ registerReplicationCommand(cache1, PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.put(key, "value2");
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value4");
mgr.commit();
- delay();
+ verifyReplication();
assertEquals("value4", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -780,7 +819,7 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.addChild(fqn);
- delay();
+ Thread.sleep(1000);
// cache1 should still have this
assertTrue(root1.hasChild(fqn));
// cache 2 should not
@@ -790,8 +829,11 @@
// now try again with passing the default options
root1.removeChild(fqn);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
+
+ registerReplicationCommand(cache2, PutDataMapCommand.class);
root1.addChild(fqn);
- delay();
+ verifyReplication();
+
// cache1 should still have this
assertTrue(root1.hasChild(fqn));
// cache 2 should as well
@@ -805,6 +847,18 @@
}
}
- protected abstract void delay();
+ /**
+ * Register a command that should be received by the specified cache as the result of a replication taking place.
+ * @param cache the cache on which the given command should be replicated.
+ * @param what the command that should be replicated
+ * @see org.jboss.cache.options.cachemodelocal.AsyncReplPessLocksTest#registerReplicationCommand(org.jboss.cache.CacheSPI, Class)
+ */
+ protected abstract void registerReplicationCommand(CacheSPI<String, String> cache, Class<? extends ReplicableCommand> what);
+
+ /**
+ * Wait a while until the give command gets replicated.
+ * @see AsyncReplPessLocksTest#verifyReplication()
+ */
+ protected abstract void verifyReplication();
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -7,6 +7,8 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationOptLocksTest")
@@ -19,7 +21,12 @@
isInvalidation = true;
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
+ protected void verifyReplication()
{
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -7,6 +7,8 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationPessLocksTest")
@@ -19,7 +21,12 @@
isInvalidation = true;
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
+ protected void verifyReplication()
{
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -8,6 +8,8 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncReplOptLocksTest")
@@ -19,7 +21,12 @@
nodeLockingScheme = "OPTIMISTIC";
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
+ protected void verifyReplication()
{
TestingUtil.sleepThread(250);
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java 2008-11-11 17:19:39 UTC (rev 7113)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java 2008-11-11 20:37:22 UTC (rev 7114)
@@ -7,6 +7,8 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.CacheSPI;
import org.testng.annotations.Test;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncReplPessLocksTest")
@@ -18,7 +20,12 @@
nodeLockingScheme = "PESSIMISTIC";
}
- protected void delay()
+ protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
+ {
+ //do nothing
+ }
+
+ protected void verifyReplication()
{
}
}
17 years, 1 month
JBoss Cache SVN: r7113 - in core/trunk/src: main/resources/config-samples and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 12:19:39 -0500 (Tue, 11 Nov 2008)
New Revision: 7113
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
core/trunk/src/main/resources/config-samples/all.xml
core/trunk/src/main/resources/config-samples/eviction-enabled.xml
core/trunk/src/main/resources/config-samples/external-jgroups-file.xml
core/trunk/src/main/resources/config-samples/invalidation-async.xml
core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
Log:
fixed sample configuration files
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-11-11 17:19:39 UTC (rev 7113)
@@ -267,7 +267,7 @@
capacityWarnThreshold = (98 * size) / 100 - 100;
if (capacityWarnThreshold <= 0 && log.isWarnEnabled())
{
- log.warn("Capacity warn threshold used in eviction is smaller than 1.");
+ log.warn("Capacity warn threshold used in eviction is smaller than 1. Defined Event queu size is:" + size);
}
synchronized (this)
{
Modified: core/trunk/src/main/resources/config-samples/all.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/all.xml 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/main/resources/config-samples/all.xml 2008-11-11 17:19:39 UTC (rev 7113)
@@ -102,26 +102,33 @@
Configures the JGroups channel. Looks up a JGroups config file on the classpath or filesystem. udp.xml
ships with jgroups.jar and will be picked up by the class loader.
-->
- <jgroupsConfig configFile="udp.xml">
- <!-- uncomment to define a JGroups stack here
+ <jgroupsConfig>
- <PING timeout="2000" num_initial_members="3"/>
+ <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+ loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
+ mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
+ oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
+ thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+ tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
+ use_incoming_packet_handler="true"/>
+ <PING num_initial_members="3" timeout="2000"/>
<MERGE2 max_interval="30000" min_interval="10000"/>
<FD_SOCK/>
- <FD timeout="10000" max_tries="5" shun="true"/>
+ <FD max_tries="5" shun="true" timeout="10000"/>
<VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ use_mcast_xmit="false"/>
<UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
- view_bundling="true" view_ack_collection_timeout="5000"/>
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
+ <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
+ view_bundling="true"/>
<FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
<pbcast.FLUSH timeout="0"/>
- -->
+
</jgroupsConfig>
</clustering>
@@ -131,15 +138,15 @@
-->
<eviction wakeUpInterval="500">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLive" value="1000" />
+ <property name="maxNodes" value="5000"/>
+ <property name="timeToLive" value="1000"/>
</default>
<region name="/org/jboss/data1">
- <property name="timeToLive" value="2000" />
+ <property name="timeToLive" value="2000"/>
</region>
<region name="/org/jboss/data2" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="100000">
- <property name="maxNodes" value="3000" />
- <property name="minTimeToLive" value="4000" />
+ <property name="maxNodes" value="3000"/>
+ <property name="minTimeToLive" value="4000"/>
</region>
</eviction>
@@ -165,12 +172,30 @@
-->
<loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
ignoreModifications="true" purgeOnStartup="true">
+
<properties>
- cache.jdbc.datasource=DefaultDS
cache.jdbc.table.name=jbosscache
cache.jdbc.table.create=true
cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.sql-concat=1 || 2
+ cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+ cache.jdbc.url=jdbc:derby:jbossdb;create=true
+ cache.jdbc.user=user1
+ cache.jdbc.password=user1
</properties>
+ <!-- alternatively use a connection from a datasorce, as per the code sample below-->
+ <!--<properties>-->
+ <!--cache.jdbc.datasource=AllSampleDS-->
+ <!--cache.jdbc.table.name=jbosscache-->
+ <!--cache.jdbc.table.create=true-->
+ <!--cache.jdbc.table.drop=true-->
+ <!--</properties>-->
<singletonStore enabled="true" class="org.jboss.cache.loader.SingletonStoreCacheLoader">
<properties>
pushStateWhenCoordinator=true
Modified: core/trunk/src/main/resources/config-samples/eviction-enabled.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/eviction-enabled.xml 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/main/resources/config-samples/eviction-enabled.xml 2008-11-11 17:19:39 UTC (rev 7113)
@@ -36,6 +36,6 @@
<property name="timeToLive" value="8000" />
<property name="maxAge" value="10000" />
</region>
- <region name="/org/jboss/data1/inherit" eventQueueSize="100" />
+ <region name="/org/jboss/data1/inherit"/>
</eviction>
</jbosscache>
Modified: core/trunk/src/main/resources/config-samples/external-jgroups-file.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/external-jgroups-file.xml 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/main/resources/config-samples/external-jgroups-file.xml 2008-11-11 17:19:39 UTC (rev 7113)
@@ -5,7 +5,7 @@
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering>
- <sync />
+ <async />
<!--
Here we specify a path to an external JGroups configuration file. First the classpath is scanned, and then
the filesystem for the file. In this case, "udp.xml" ships with jgroups.jar and will be picked up by the
Modified: core/trunk/src/main/resources/config-samples/invalidation-async.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/invalidation-async.xml 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/main/resources/config-samples/invalidation-async.xml 2008-11-11 17:19:39 UTC (rev 7113)
@@ -43,9 +43,9 @@
<pbcast.FLUSH timeout="0"/>
</jgroupsConfig>
- <sync />
- <!-- Alternatively, to use async replication, comment out the element above and uncomment the element below. -->
- <!-- <async /> -->
+ <async />
+ <!-- Alternatively, to use sync replication, comment out the element above and uncomment the element below. -->
+ <!-- <sync /> -->
</clustering>
</jbosscache>
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-11-11 16:15:55 UTC (rev 7112)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-11-11 17:19:39 UTC (rev 7113)
@@ -93,8 +93,8 @@
{
System.out.println("Processing file: " + aConfFile);
assert !appender.isFoundUnknownWarning();
- Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, false);
-// cache.stop();
+ Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true);
+ cache.stop();
assert !appender.isFoundUnknownWarning();
}
}
@@ -117,9 +117,16 @@
String[] TOLERABLE_WARNINGS = {"Falling back to DummyTransactionManager"};
boolean foundUnknownWarning = false;
+ /**
+ * As this test runs in parallel with other tests tha also log information, we should disregard
+ * other possible warnings from other threads and only consider warnings issues within this test class's test.
+ * @see #isExpectedThread()
+ */
+ private Thread loggerThread = Thread.currentThread();
+
protected void append(LoggingEvent event)
{
- if (event.getLevel().equals(Level.WARN))
+ if (event.getLevel().equals(Level.WARN) && isExpectedThread())
{
boolean skipPrinting = false;
foundUnknownWarning = true;
@@ -152,5 +159,10 @@
{
return foundUnknownWarning;
}
+
+ public boolean isExpectedThread()
+ {
+ return loggerThread.equals(Thread.currentThread());
+ }
}
}
17 years, 1 month
JBoss Cache SVN: r7112 - core/trunk/src/test/java/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 11:15:55 -0500 (Tue, 11 Nov 2008)
New Revision: 7112
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
Log:
fixed test
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java 2008-11-11 14:32:05 UTC (rev 7111)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java 2008-11-11 16:15:55 UTC (rev 7112)
@@ -87,7 +87,10 @@
Fqn main = Fqn.fromString("/a/b/c");
caches.get(0).put(main, "name", "Joe");
- CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch latch = new CountDownLatch(2);
+
+ //first cache should also wait for buddy groups changes
+ caches.get(0).addCacheListener(new BuddyJoinedListener(latch));
createCacheWithLatch(latch);
assert latch.await(getSleepTimeout(), TimeUnit.MILLISECONDS) : "Buddy groups not formed after " + getSleepTimeout() + " millis!";
17 years, 1 month
JBoss Cache SVN: r7111 - core/trunk/src/test/java/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 09:32:05 -0500 (Tue, 11 Nov 2008)
New Revision: 7111
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
Log:
abstract tests classes should not be annotated
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-11-11 13:17:42 UTC (rev 7110)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-11-11 14:32:05 UTC (rev 7111)
@@ -25,7 +25,7 @@
*
* @author Fredrik Johansson, Cubeia Ltd
*/
-@Test(testName = "buddyreplication.BuddyReplicationTestsBase")
+@Test(groups = "functional", testName = "buddyreplication.BuddyReplicationTestsBase")
public class BuddyReplicationRejoinTest extends BuddyReplicationTestsBase
{
private static Log log = LogFactory.getLog(BuddyReplicationRejoinTest.class);
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-11 13:17:42 UTC (rev 7110)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-11-11 14:32:05 UTC (rev 7111)
@@ -35,7 +35,6 @@
*
* @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
*/
-@Test(groups = {"functional", "jgroups"}, testName = "buddyreplication.BuddyReplicationTestsBase")
public abstract class BuddyReplicationTestsBase
{
protected final ThreadLocal<List<CacheSPI<Object, Object>>> cachesTL = new ThreadLocal<List<CacheSPI<Object, Object>>>();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-11-11 13:17:42 UTC (rev 7110)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-11-11 14:32:05 UTC (rev 7111)
@@ -21,7 +21,7 @@
*
* @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
*/
-@Test(groups = "functional", sequential = true, testName = "buddyreplication.EmptyRegionTest")
+@Test(groups = "functional", testName = "buddyreplication.EmptyRegionTest")
public class EmptyRegionTest extends BuddyReplicationTestsBase
{
CacheSPI c1, c2;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-11-11 13:17:42 UTC (rev 7110)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-11-11 14:32:05 UTC (rev 7111)
@@ -17,7 +17,7 @@
* @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
* @since 2.2.0
*/
-@Test(groups = "functional", sequential = true, testName = "buddyreplication.EvictionOfBuddyBackupsTest")
+@Test(groups = "functional", testName = "buddyreplication.EvictionOfBuddyBackupsTest")
public class EvictionOfBuddyBackupsTest extends BuddyReplicationTestsBase
{
private CacheSPI cache1, cache2;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-11-11 13:17:42 UTC (rev 7110)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-11-11 14:32:05 UTC (rev 7111)
@@ -12,7 +12,7 @@
* @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
* @since 2.1.0
*/
-@Test(groups = "functional", sequential = true, testName = "buddyreplication.GravitationCleanupTest")
+@Test(groups = "functional", testName = "buddyreplication.GravitationCleanupTest")
public class GravitationCleanupTest extends BuddyReplicationTestsBase
{
Fqn fqn = Fqn.fromString("/a/b/c");
17 years, 1 month
JBoss Cache SVN: r7110 - in core/trunk/src: test/java/org/jboss/cache/profiling and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 08:17:42 -0500 (Tue, 11 Nov 2008)
New Revision: 7110
Modified:
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/trunk/src/test/java/org/jboss/cache/profiling/MockAsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
disable profile tests
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-11-11 13:12:39 UTC (rev 7109)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-11-11 13:17:42 UTC (rev 7110)
@@ -388,7 +388,7 @@
* Returns the list of nodes that were in the old view and are not in the new view, and which are also in the
* <b>filter</b> param.
*/
- public Set<Address> getDroppedNodes(Collection filter)
+ public Set<Address> getDroppedNodes(Collection<Address> filter)
{
if (oldMembers == null || oldMembers.isEmpty())
return Collections.emptySet();
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/MockAsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/MockAsyncReplTest.java 2008-11-11 13:12:39 UTC (rev 7109)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/MockAsyncReplTest.java 2008-11-11 13:17:42 UTC (rev 7110)
@@ -17,7 +17,7 @@
import java.util.concurrent.atomic.AtomicInteger;
/**
- *Importnat - make sure you inly enable these tests locally!
+ * Importnat - make sure you inly enable these tests locally!
*
* @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
* @since 3.0
@@ -26,7 +26,7 @@
public class MockAsyncReplTest extends ProfileTest
{
@Override
- @Test(enabled = true)
+ @Test(enabled = false)
public void testReplAsync() throws Exception
{
// same as superclass, except that we use a mock RpcDispatcher that does nothing. Measure throughput to test speed of JBC stack.
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-11-11 13:12:39 UTC (rev 7109)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-11-11 13:17:42 UTC (rev 7110)
@@ -32,7 +32,7 @@
waitForTest();
}
- @Test(enabled = true)
+ @Test(enabled = false)
public void testReplAsync() throws Exception
{
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-11-11 13:12:39 UTC (rev 7109)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-11-11 13:17:42 UTC (rev 7110)
@@ -52,7 +52,7 @@
Log log = LogFactory.getLog(ProfileTest.class);
- @Test(enabled = true)
+ @Test(enabled = false)
public void testLocalModePess() throws Exception
{
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -77,7 +77,7 @@
runCompleteTest();
}
- @Test(enabled = true)
+ @Test(enabled = false)
public void testReplAsync() throws Exception
{
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
17 years, 1 month
JBoss Cache SVN: r7109 - core/trunk/src/test/resources.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 08:12:39 -0500 (Tue, 11 Nov 2008)
New Revision: 7109
Modified:
core/trunk/src/test/resources/log4j.xml
Log:
rollback
Modified: core/trunk/src/test/resources/log4j.xml
===================================================================
--- core/trunk/src/test/resources/log4j.xml 2008-11-11 13:01:25 UTC (rev 7108)
+++ core/trunk/src/test/resources/log4j.xml 2008-11-11 13:12:39 UTC (rev 7109)
@@ -18,7 +18,7 @@
<!-- Rollover at the top of each hour
<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
-->
- <param name="Threshold" value="TRACE"/>
+ <param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
@@ -46,7 +46,7 @@
<!-- ================ -->
<category name="org.jboss.cache">
- <priority value="TRACE"/>
+ <priority value="ERROR"/>
</category>
<category name="org.jboss.cache.factories">
@@ -61,17 +61,13 @@
<priority value="WARN"/>
</category>
- <category name="org.jboss.cache.jmx">
- <priority value="WARN"/>
- </category>
-
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
- <!--<appender-ref ref="CONSOLE"/>-->
- <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="FILE"/>-->
</root>
</log4j:configuration>
17 years, 1 month
JBoss Cache SVN: r7108 - core/trunk/src/main/java/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-11 08:01:25 -0500 (Tue, 11 Nov 2008)
New Revision: 7108
Modified:
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
Log:
fixed buddy issue
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-11-11 12:48:50 UTC (rev 7107)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-11-11 13:01:25 UTC (rev 7108)
@@ -391,7 +391,7 @@
public Set<Address> getDroppedNodes(Collection filter)
{
if (oldMembers == null || oldMembers.isEmpty())
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
Set<Address> result = new HashSet<Address>();
for (Address oldMember : oldMembers)
{
17 years, 1 month