JBoss Cache SVN: r7289 - in core/trunk/src/test/java/org/jboss/cache/eviction: minttl and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 03:38:03 -0500 (Fri, 12 Dec 2008)
New Revision: 7289
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeAlgorithmTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeQueueTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionQueueListTest.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/FIFOQueueTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/RegionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/minttl/FIFOMinTTLTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeAlgorithmTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeAlgorithmTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeAlgorithmTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -56,8 +56,6 @@
int count = 6;
for (NodeEntry ne : queue)
{
- System.out.println(ne);
-
if (count > 0)
{
assertEquals(count, ne.getNumberOfElements());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -92,18 +92,15 @@
}
}
- System.out.println(cache);
EvictionController evController = new EvictionController(cache);
evController.startEviction();
TestingUtil.sleepThread(200); // small grace period
- System.out.println(cache);
for (int i = 0; i < 10; i++)
{
String f = "/org/jboss/test/data/" + i;
Node node = cache.getNode(f);
- System.out.println("Node for " + f + " is " + node);
if (i % 2 == 0)
{
if (i < 6)
@@ -148,7 +145,6 @@
String str = rootStr + Integer.toString(i);
Fqn fqn = Fqn.fromString(str);
Node node = cache.getNode(fqn);
- System.out.println(i + " " + node);
if (i > 9)
{
assertNull("Testing at " + i, node);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeQueueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeQueueTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeQueueTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -68,7 +68,6 @@
k = 0;
for (NodeEntry ne : queue)
{
- System.out.println(ne.toString());
// the first 250 elements should have (250 - 1 - n) * 2 elements. The rest should have 0 elements.
int expectedElements = 0;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionQueueListTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionQueueListTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionQueueListTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -250,27 +250,4 @@
assertEquals(0, list.size());
}
-/*
- public void testSort() throws Exception
- {
- Comparator lfuComp = new LFUComparator();
- // this will create a reverse sorted list. LFUComparator will sort items from lowest node visits to highest
- // node visits.
- for(int i = 0, j = 9; i < 10; i++, j--)
- {
- NodeEntry ne = new NodeEntry("/" + Integer.toString(i));
- ne.setNumberOfNodeVisits(j);
- list.addToBottom(new EvictionListEntry(ne));
- }
-
- list.sort(lfuComp);
-
- EvictionListEntry entries[] = list.toArray();
-
- for(int i = 0; i < 10; i++)
- {
- System.out.println(entries[i].node);
- assertEquals(i, entries[i].node.getNumberOfNodeVisits());
- }
- } */
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -59,8 +59,6 @@
future = System.currentTimeMillis() + 500;
past = System.currentTimeMillis() - 200;
-
- System.out.println(eAC);
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -47,7 +47,6 @@
{
initCaches();
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
- log("wakeupInterval is " + wakeupIntervalMillis);
if (wakeupIntervalMillis < 0)
{
fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis);
@@ -320,7 +319,6 @@
{
fail("Exception generated in put() " + t1_ex);
}
- log("nodes/locks: " + cache.getNumberOfNodes() + "/" + cache.getNumberOfLocksHeld());
TestingUtil.sleepThread(1000);
if (counter > 5)
{// run for 5 seconds
@@ -331,10 +329,4 @@
for (MyPutter p : putters) p.join();
}
-
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOQueueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOQueueTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOQueueTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -115,8 +115,6 @@
{
queue.addNodeEntry(new NodeEntry("/test/" + Integer.toString(i)));
}
- System.out.println("Took " + (System.currentTimeMillis() - begin) + "ms to add " + CAPACITY + " entries to queue");
-
assertEquals(CAPACITY, queue.getNumberOfNodes());
begin = System.currentTimeMillis();
@@ -126,8 +124,6 @@
queue.removeNodeEntry(new NodeEntry("/test/" + Integer.toString(i)));
}
- System.out.println("Took " + (System.currentTimeMillis() - begin) + "ms to remove " + CAPACITY + " entries to queue");
-
assertEquals(0, queue.getNumberOfNodes());
begin = System.currentTimeMillis();
@@ -135,8 +131,6 @@
{
queue.addNodeEntry(new NodeEntry("/test/" + Integer.toString(i)));
}
- System.out.println("Took " + (System.currentTimeMillis() - begin) + "ms to readd " + CAPACITY + " entries to queue");
-
assertEquals(CAPACITY, queue.getNumberOfNodes());
NodeEntry ne;
begin = System.currentTimeMillis();
@@ -146,9 +140,6 @@
queue.removeNodeEntry(ne);
}
- System.out.println("Took " + (System.currentTimeMillis() - begin) + "ms to iterate via getFirstNodeEntry() and remove (pop from top of queue) " +
- CAPACITY + " entries from queue");
-
assertEquals(0, queue.getNumberOfNodes());
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -184,7 +184,6 @@
for (NodeEntry ne : queue)
{
- System.out.println("Fqn: " + ne.getFqn() + " NodeVisits: " + ne.getNumberOfNodeVisits());
assertEquals(1, ne.getNumberOfNodeVisits());
}
@@ -214,14 +213,10 @@
region.registerEvictionEvent(fqn10, VISIT_NODE_EVENT);
algo.process(region.getEvictionEventQueue());
- System.out.println();
- System.out.println();
-
int count = 0;
for (NodeEntry ne : queue)
{
count++;
- System.out.println("Fqn: " + ne.getFqn() + " NodeVisits: " + ne.getNumberOfNodeVisits());
if (count == 5 || count == 6)
{
assertEquals(2, ne.getNumberOfNodeVisits());
@@ -254,14 +249,11 @@
region.registerEvictionEvent(fqn12, ADD_NODE_EVENT);
algo.process(region.getEvictionEventQueue());
- System.out.println();
- System.out.println();
count = 0;
for (NodeEntry ne : queue)
{
count++;
- System.out.println("Fqn: " + ne.getFqn() + " NodeVisits: " + ne.getNumberOfNodeVisits());
if (count == 7 || count == 8)
{
assertEquals(2, ne.getNumberOfNodeVisits());
@@ -293,13 +285,10 @@
algo.process(region.getEvictionEventQueue());
- System.out.println();
- System.out.println();
count = 0;
for (NodeEntry ne : queue)
{
count++;
- System.out.println("Fqn: " + ne.getFqn() + " NodeVisits: " + ne.getNumberOfNodeVisits());
if (count == 5 || count == 6)
{
assertEquals(2, ne.getNumberOfNodeVisits());
@@ -338,13 +327,10 @@
algo.process(region.getEvictionEventQueue());
- System.out.println();
- System.out.println();
count = 0;
for (NodeEntry ne : queue)
{
count++;
- System.out.println("Fqn: " + ne.getFqn() + " NodeVisits: " + ne.getNumberOfNodeVisits());
if (count == 5 || count == 6)
{
assertEquals(2, ne.getNumberOfNodeVisits());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -329,7 +329,6 @@
{
fail("Exception generated in put() " + t1_ex);
}
- log("nodes/locks: " + cache.getNumberOfNodes() + "/" + cache.getNumberOfLocksHeld());
TestingUtil.sleepThread(1000);
if (counter > 5)
{// run for 5 seconds
@@ -338,10 +337,4 @@
}
}
}
-
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -383,9 +383,4 @@
queue.removeNodeEntry(ne);
}
}
-
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -61,7 +61,6 @@
cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
- System.out.println("-- wakeupInterval is " + wakeupIntervalMillis);
if (wakeupIntervalMillis < 0)
{
fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis);
@@ -90,7 +89,6 @@
cache.put(fqn, str, str);
}
- System.out.println("-- Marking as in-use");
cache.getRegionManager().getRegion(Fqn.fromString(rootStr + 5), false).markNodeCurrentlyInUse(Fqn.fromString(rootStr + 5), 0);
for (int i = 10; i < 15; i++)
@@ -139,9 +137,7 @@
e.printStackTrace();
}
}
- System.out.println(cache.toString());
TestingUtil.sleepThread(wakeupIntervalMillis + 500);
- System.out.println(cache.toString());
String val = (String) cache.get(rootStr + "3", rootStr + "3");
assertNull("Node should be empty ", val);
}
@@ -150,8 +146,6 @@
{
String rootStr = "/org/jboss/test/data/";
- System.out.println("REGIONS: " + cache.getRegionManager().dumpRegions());
-
final Fqn fqn7 = Fqn.fromString(rootStr + "7");
for (int i = 0; i < 10; i++)
@@ -164,8 +158,6 @@
cache.getNode(fqn7);// just to keep it fresh
}
- System.out.println("Cache: " + CachePrinter.printCacheDetails(cache));
-
Thread retrieverThread = new Thread()
{
@Override
@@ -199,7 +191,6 @@
new EvictionController(cache).startEviction(true);
assert waitForEviction(cache, 30, TimeUnit.SECONDS, Fqn.fromString(rootStr + 7));
val = (String) cache.get(rootStr + "7", rootStr + "7");
- System.out.println("-- val=" + val);
assertNull("Node should be empty ", val);
}
@@ -245,7 +236,6 @@
// Give eviction time to run a few times, then confirm parent
// is completely gone
long period = (wakeupIntervalMillis + testRegionTTLMillis) * 2;
- System.out.println("-- Sleeping for " + period);
TestingUtil.sleepThread(period);
assertFalse("Parent not completely removed", cache.getRoot().hasChild(parent));
}
@@ -310,7 +300,6 @@
{
fail("Exception generated in put() " + t1_ex);
}
- System.out.println("-- nodes/locks: " + cache.getNumberOfNodes() + "/" + cache.getNumberOfLocksHeld());
TestingUtil.sleepThread(1000);
if (counter > 5)
{// run for 5 seconds
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -41,7 +41,6 @@
{
initCaches();
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
- log("wakeupInterval is " + wakeupIntervalMillis);
if (wakeupIntervalMillis < 0)
{
fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis);
@@ -173,7 +172,6 @@
{
fail("Exception generated in put() " + t1_ex);
}
- log("nodes/locks: " + cache.getNumberOfNodes() + "/" + cache.getNumberOfLocksHeld());
TestingUtil.sleepThread(1000);
if (counter > 5)
{// run for 5 seconds
@@ -182,9 +180,4 @@
}
}
}
-
- private void log(String s)
- {
- System.out.println(s);
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -69,7 +69,6 @@
public void testInterceptorChain() throws Exception
{
List interceptors = cache.getInterceptorChain();
- System.out.println(interceptors);
Iterator i = interceptors.iterator();
boolean found = false;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -59,7 +59,6 @@
{
initCaches();
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
- log("wakeupInterval is " + wakeupIntervalMillis);
if (wakeupIntervalMillis < 0)
{
fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis);
@@ -116,9 +115,7 @@
String val = (String) cache.get(rootStr + "3", rootStr + "3");
assertNotNull("DataNode should be empty ", val);
- System.out.println(cache.toString());
assert waitForEviction(cache, 30, TimeUnit.SECONDS, Fqn.fromString(rootStr + 3));
- System.out.println(cache.toString());
val = (String) cache.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be empty ", val);
}
@@ -169,9 +166,7 @@
fail("Failed to get" + e);
}
- System.out.println(cache.toString());
assert waitForEviction(cache, 30, TimeUnit.SECONDS, fqn);
- System.out.println(cache.toString());
try
{
@@ -220,10 +215,8 @@
Integer in = 3;
Fqn fqn = Fqn.fromRelativeElements(rootfqn, in);
- System.out.println(cache.toString());
assert waitForEviction(cache, 30, TimeUnit.SECONDS, fqn);
- System.out.println(cache.toString());
try
{
Object val = cache.get(fqn, in);
@@ -235,10 +228,4 @@
fail("Failed to get" + e);
}
}
-
- private void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/RegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/RegionTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/RegionTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -98,11 +98,6 @@
}
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
EvictionEvent takeLastEvent(RegionImpl r) throws InterruptedException
{
return r.getEvictionEventQueue().poll(0, TimeUnit.MILLISECONDS);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -135,11 +135,6 @@
assertNotNull("DataNode should not be null", val);
}
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
@CacheListener
public class EvictionListener
{
@@ -158,7 +153,6 @@
@NodeEvicted
public void nodeEvicted(Event e)
{
- System.out.println(e);
if (e.isPre()) counter++;
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/minttl/FIFOMinTTLTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/minttl/FIFOMinTTLTest.java 2008-12-12 08:37:13 UTC (rev 7288)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/minttl/FIFOMinTTLTest.java 2008-12-12 08:38:03 UTC (rev 7289)
@@ -61,7 +61,6 @@
while (busyThreadRunning)
{
- System.out.println("Busy thread working... ");
cache.put(fqn2, "k", "v");
TestingUtil.sleepRandom(150);
}
16 years, 3 months
JBoss Cache SVN: r7288 - in core/trunk/src/test/java/org/jboss/cache/config: parsing and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 03:37:13 -0500 (Fri, 12 Dec 2008)
New Revision: 7288
Modified:
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/Eviction2xto3xCompatibilityTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-12-12 08:35:58 UTC (rev 7287)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-12-12 08:37:13 UTC (rev 7288)
@@ -38,7 +38,6 @@
String fileName = getFileName("/policyPerRegion-eviction.xml");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);
- System.out.println("result = \n" + baos);
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
@@ -59,11 +58,9 @@
};
for (String file : fileNames)
{
- System.out.println("Processing file = " + file);
String fileName = getFileName(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);
- System.out.println("result = \n" + baos);
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
@@ -91,11 +88,9 @@
};
for (String file : fileNames)
{
- System.out.println("Processing file = " + file);
String fileName = getFileName(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);
- System.out.println("result = \n" + baos);
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
@@ -113,7 +108,6 @@
String fileName = getFileName("/zeroTTL.xml");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);
- System.out.println("result = \n" + baos);
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/Eviction2xto3xCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/Eviction2xto3xCompatibilityTest.java 2008-12-12 08:35:58 UTC (rev 7287)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/Eviction2xto3xCompatibilityTest.java 2008-12-12 08:37:13 UTC (rev 7288)
@@ -153,7 +153,6 @@
assert false : "custom eviction config not supported for the old parser";
} catch (Exception e)
{
- System.out.println(e.getMessage());
}
}
@@ -182,7 +181,6 @@
assert false : "default custom eviction config not supported for the old parser";
} catch (Exception e)
{
- System.out.println(e.getMessage());
}
}
}
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-12-12 08:35:58 UTC (rev 7287)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-12-12 08:37:13 UTC (rev 7288)
@@ -60,7 +60,6 @@
appender = new InMemoryAppender();
log4jLogger.addAppender(appender);
File f = new File(".");
- System.out.println("f = " + f.getAbsolutePath());
}
@AfterMethod
@@ -80,7 +79,6 @@
String[] configFiles = getConfigFileNames();
for (String aConfFile : configFiles)
{
- System.out.println("Processing file: " + aConfFile);
parser.parseFile(CONFIG_ROOT + "/" + aConfFile);
}
assert errorHandler.noErrors();
@@ -91,7 +89,6 @@
UnitTestCacheFactory ucf = new UnitTestCacheFactory();
for (String aConfFile : getConfigFileNames())
{
- System.out.println("Processing file: " + aConfFile);
assert !appender.isFoundUnknownWarning();
Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true, getClass());
cache.stop();
@@ -138,10 +135,6 @@
foundUnknownWarning = false;
}
}
- if (!skipPrinting)
- {
- System.out.println("Unaccepted warn message :" + event.getMessage());
- }
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java 2008-12-12 08:35:58 UTC (rev 7287)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java 2008-12-12 08:37:13 UTC (rev 7288)
@@ -47,9 +47,7 @@
XmlConfigurationParser parser = new XmlConfigurationParser(handler);
for (String file : testFiles)
{
- System.out.println("file = " + file);
parser.parseFile(BASE_DIR_FOR_CONFIG + File.separator + file);
- System.out.println("Processed file = " + file);
for (Exception e : handler.exceptionList) e.printStackTrace();
assert handler.noErrors() : "error during parsing (file " + file + ")";
}
@@ -93,7 +91,6 @@
private void handleDefault(SAXParseException exception)
{
- System.out.println("Error :" + exception.getMessage());
exceptionList.add(exception);
}
16 years, 3 months
JBoss Cache SVN: r7287 - core/trunk/src/test/java/org/jboss/cache/cluster.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 03:35:58 -0500 (Fri, 12 Dec 2008)
New Revision: 7287
Modified:
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-12-12 08:35:04 UTC (rev 7286)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-12-12 08:35:58 UTC (rev 7287)
@@ -159,7 +159,6 @@
{
for (int i = 0; i < COUNT; i++)
{
- System.out.println("on put i = " + i);
cache.put("/a/b/c" + i, "key", "value");
assertNotNull(cache.get("/a/b/c" + i, "key"));
}
16 years, 3 months
JBoss Cache SVN: r7286 - core/trunk/src/test/java/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 03:35:04 -0500 (Fri, 12 Dec 2008)
New Revision: 7286
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -66,16 +66,8 @@
// TestingUtil.sleepThread(getSleepTimeout());
- System.out.println("Cache dump BEFORE activation");
- System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
- System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
-
c2.activate();
- System.out.println("Cache dump AFTER activation");
- System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
- System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
-
Fqn fqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
assertEquals("State transferred with activation", JOE, cache2.get(fqn, "name"));
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -32,7 +32,6 @@
caches.get(1).put("/cache1", "k", "v");
waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1:");
waitForBuddy(caches.get(1), caches.get(0), true);
assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -28,27 +28,17 @@
public void testSingleBuddy() throws Exception
{
- System.out.println("*** Testing cache 0:");
waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1:");
waitForBuddy(caches.get(1), caches.get(2), true);
- System.out.println("*** Testing cache 2:");
waitForBuddy(caches.get(2), caches.get(0), true);
-
- System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
- System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
- System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
}
public void testRemovalFromClusterSingleBuddy() throws Exception
{
try
{
- System.out.println("*** Testing cache 0");
waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1");
waitForBuddy(caches.get(1), caches.get(2), true);
- System.out.println("*** Testing cache 2");
waitForBuddy(caches.get(2), caches.get(0), true);
// now remove a cache from the cluster
@@ -90,10 +80,6 @@
assertNull("Should be null", caches.get(2).get(backupFqn, key));
assertNoStaleLocks(caches);
-
- System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
- System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
- System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
}
@@ -156,9 +142,6 @@
assertNoLocks(caches);
backupFqn = fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), fqn);
-
- System.out.println("*** Calling get() on cache[1] with force option");
-
ReplicationListener replicationListener0 = ReplicationListener.getReplicationListener(caches.get(0));
replicationListener0.expect(DataGravitationCleanupCommand.class);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -60,8 +60,6 @@
assertTrue("Value be true", caches.get(1).exists(backupFqn));
assertFalse("Should be false", caches.get(2).exists(backupFqn));
- System.out.println("***** Killed original data owner, about to call a get on a different cache instance. *****");
-
ReplicationListener replListener = ReplicationListener.getReplicationListener(caches.get(1));
replListener.expect(DataGravitationCleanupCommand.class);
@@ -132,8 +130,6 @@
// now try the assertion again since the local gravitation would have worked.
- System.out.println("Cache contents " + CachePrinter.printCacheDetails(caches.get(0)));
-
assertEquals("value", caches.get(0).get("/1", "key"));
assertEquals("value", caches.get(0).get("/2", "key"));
caches.get(1).start();
@@ -213,11 +209,9 @@
public void testTransactionsRollback() throws Exception
{
- System.out.println("Buddy3NodesNoPoolWithDataGravitationTest.testTransactionsRollback****************************");
TestingUtil.dumpCacheContents(caches.get(0));
TestingUtil.dumpCacheContents(caches.get(1));
TestingUtil.dumpCacheContents(caches.get(2));
- System.out.println("Buddy3NodesNoPoolWithDataGravitationTest.testTransactionsRollback****************************");
caches.get(0).put(fqn, key, value);
Fqn oldBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + "/test");
@@ -345,9 +339,6 @@
dataOwner.put(fqn, key, value);
- System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
-
assert dataOwner.peek(fqn, false) != null : "Should have data";
assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -362,9 +353,6 @@
// gravitation cleanup calls are async.
cleanupDelay();
- System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
-
assert buddy.peek(fqn, false) != null : "Should have data";
assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -384,9 +372,6 @@
first.put(fqn, key, value);
- System.out.println("first: " + CachePrinter.printCacheDetails(first));
- System.out.println("second: " + CachePrinter.printCacheDetails(second));
-
assert first.peek(fqn, false) != null : "Should have data";
assert first.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(third.getLocalAddress())), false) != null : "Should have backup node for second";
assert first.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(first.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -401,9 +386,6 @@
// gravitation cleanup calls are async.
cleanupDelay();
- System.out.println("first: " + CachePrinter.printCacheDetails(first));
- System.out.println("second: " + CachePrinter.printCacheDetails(second));
-
assert second.peek(fqn, false) != null : "Should have data";
assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(first.getLocalAddress())), false) != null : "Should have backup node for second";
assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(second.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -430,10 +412,6 @@
dataOwner.put(fqn, key, value);
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
- System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
-
assert dataOwner.peek(fqn, false) != null : "Should have data";
assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) != null : "Should have backup node for buddy";
assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -450,10 +428,6 @@
// gravitation cleanup calls are async.
TestingUtil.sleepThread(250);
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
- System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
-
assert thirdInstance.peek(fqn, false) != null : "Should have data";
assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
@@ -493,7 +467,6 @@
{
if (e.isPre())
{
- System.out.println(">>>>>>>> Got BLOCK on cache " + e.getCache().getLocalAddress());
synchronized (this)
{
blocks++;
@@ -507,7 +480,6 @@
{
if (e.isPre())
{
- System.out.println(">>>>>>>> Got UNBLOCK on cache " + e.getCache().getLocalAddress());
synchronized (this)
{
blocks--;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -34,9 +34,6 @@
waitForBuddy(caches.get(2), caches.get(0), true);
Thread.sleep(2000);//wait for state transfer
- for (CacheSPI c : caches)
- System.out.println("Cache (local address " + c.getLocalAddress() + ") contents: " + CachePrinter.printCacheLockingInfo(c));
-
for (int i = 0; i < 3; i++)
{
int backupIndex = i == 2 ? 0 : i + 1;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -122,12 +122,10 @@
assertTrue("Value be true", cachePool.get(1).exists(backupFqn));
assertFalse("Should be false", cachePool.get(2).exists(backupFqn));
- System.out.println("***** About to kill original data owner (" + cachePool.get(0).getLocalAddress() + "). *****");
// forcefully kill data owner.
amendDiscard(cachePool.get(0), cachePool.get(1), 2, true);
waitForSingleBuddy(cachePool.get(1), cachePool.get(2));
- System.out.println("Killed. Testing backup roots.");
TestingUtil.dumpCacheContents(cachePool);
// assert that the remaining cachePool have picked new buddies. Cache 1 should have cache 2's backup data.
assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
@@ -140,8 +138,6 @@
assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
assert cachePool.get(2).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
- System.out.println("***** Killed original data owner, about to call a get on a different cache instance. *****");
-
ReplicationListener replListener = ReplicationListener.getReplicationListener(cachePool.get(1));
replListener.expect(DataGravitationCleanupCommand.class);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -62,7 +62,6 @@
public void test3CachesWithPoolNames() throws Exception
{
long st = System.currentTimeMillis();
- System.out.println("Setup: " + (System.currentTimeMillis() - st));
st = System.currentTimeMillis();
BuddyManager m = caches.get(0).getBuddyManager();
@@ -71,7 +70,6 @@
assertEquals("A", groupMap.get(caches.get(0).getLocalAddress()));
assertEquals("B", groupMap.get(caches.get(1).getLocalAddress()));
assertEquals("C", groupMap.get(caches.get(2).getLocalAddress()));
- System.out.println("Test: " + (System.currentTimeMillis() - st));
}
public void testBuddyPoolSync() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -35,7 +35,6 @@
{
long st = System.currentTimeMillis();
super.tearDown();
- System.out.println("Teardown: " + (System.currentTimeMillis() - st));
}
public void test2CachesWithPoolNames() throws Exception
@@ -84,7 +83,6 @@
}
if (allPoolNameBroadcasted)
{
- System.out.println("Received from all!!!");
break;
}
if (System.currentTimeMillis() >= timeout)
@@ -98,13 +96,10 @@
//and now look at the state of things.
Map map = caches.get(0).getBuddyManager().buddyPool;
- System.out.println(map);
for (int i = 0; i < numCaches; i++)
{
if (caches.get(i) != null)
assertEquals("Failed on cache " + i + "(" + caches.get(i).getLocalAddress() + ")", new String(new char[]{(char) ('A' + i)}), map.get(caches.get(i).getLocalAddress()));
- else
- System.out.println("Cache " + i + " is null!??");
}
checkConsistentPoolState(caches);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -107,8 +107,6 @@
hasDG = hasDG || (interceptor instanceof LegacyDataGravitatorInterceptor);
}
- System.out.println(cache.getInterceptorChain());
-
assertTrue("Should have a data gravitator!!", hasDG);
}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -41,7 +41,6 @@
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- System.out.println("***** TEARING DOWN *****");
System.setProperty("org.jboss.cache.shutdown.force", "true");
List<CacheSPI<Object, Object>> caches = cachesTL.get();
if (caches != null)
@@ -281,14 +280,6 @@
return caches;
}
- protected void printBuddyGroup(Cache cache)
- {
-// BuddyManager bm = ((CacheSPI) cache).getBuddyManager();
-// BuddyGroup bg = bm.buddyGroup;
-// System.out.println("*** " + bg);
-// System.out.println(" Groups I participate in: " + bm.buddyGroupsIParticipateIn.keySet());
- }
-
/**
* This is to allow for any state transfers involved (when assigning a buddy) to complete
*/
@@ -302,7 +293,6 @@
Address dataOwnerLocalAddress = dataOwner.getLocalAddress();
Address buddyLocalAddress = buddy.getLocalAddress();
- printBuddyGroup(dataOwner);
BuddyManager dataOwnerBuddyManager = ((CacheSPI) dataOwner).getBuddyManager();
BuddyManager buddyBuddyManager = ((CacheSPI) buddy).getBuddyManager();
@@ -364,7 +354,6 @@
{
Address dataOwnerLocalAddress = dataOwner.getLocalAddress();
Address buddyLocalAddress = buddy.getLocalAddress();
- printBuddyGroup(dataOwner);
BuddyManager dataOwnerBuddyManager = ((CacheSPI) dataOwner).getBuddyManager();
BuddyManager buddyBuddyManager = ((CacheSPI) buddy).getBuddyManager();
boolean result = true;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -75,15 +75,11 @@
// cleanup
for (int i = 0; i < 3; i++) loaders[i].remove(Fqn.ROOT);
- for (int i = 0; i < 3; i++) System.out.println("Loader " + i + ": " + loaders[i].get(fqn));
-
// put stuff in cache0
caches.get(0).put(fqn, key, value);
// make sure there are no locks.
assertNoLocks(caches);
- for (int i = 0; i < 3; i++) System.out.println("Loader " + i + ": " + loaders[i].get(fqn));
-
dumpCacheContents(caches);
// request data from cache2
@@ -95,8 +91,6 @@
cleanupDelay(); // gravitation cleanup is async!!
assertNoLocks(caches);
- for (int i = 0; i < 3; i++) System.out.println("Loader " + i + ": " + loaders[i].get(fqn));
-
dumpCacheContents(caches);
// test that data does not exist in cache0
@@ -181,9 +175,6 @@
caches.get(0).put(fqn, key, value);
Map m = loaders[1].get(b1);
- System.out.println("From loader: " + m);
-
- System.out.println("*** About do cause a gravitation event ... ");
// request data from cache2
if (!autoGravitate)
caches.get(2).getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -72,9 +72,6 @@
// should not throw any exceptions!!
- System.out.println("Cache1 " + CachePrinter.printCacheDetails(c1));
- System.out.println("Cache2 " + CachePrinter.printCacheDetails(c2));
-
// make sure region2 stuff did get transmitted!
assert c2.peek(fqnTransformer.getBackupFqn(c1.getLocalAddress(), region2Fqn), false) != null : "Region2 state should have transferred!";
}
@@ -85,7 +82,6 @@
@BuddyGroupChanged
public void buddyJoined(Event e)
{
- System.out.println("e = " + e);
buddyJoinLatch.countDown();
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-12-12 08:33:22 UTC (rev 7285)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-12-12 08:35:04 UTC (rev 7286)
@@ -54,7 +54,6 @@
assert !cache0.exists(fqn);
- System.out.println(CachePrinter.printCacheDetails(cache0));
} finally
{
TestingUtil.killCaches(cache0, cache1);
16 years, 3 months
JBoss Cache SVN: r7285 - in core/trunk/src/test/java/org/jboss/cache/api: nodevalidity and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 03:33:22 -0500 (Fri, 12 Dec 2008)
New Revision: 7285
Modified:
core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
Log:
fixed tests
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-12 08:33:22 UTC (rev 7285)
@@ -37,7 +37,7 @@
private TransactionManager tm;
- public CacheSPI createCache()
+ protected CacheSPI createCache()
{
// start a single cache instance
CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false, getClass());
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-12 08:33:22 UTC (rev 7285)
@@ -21,17 +21,28 @@
nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
}
+
+ Cache<String, String> onlyInstance;
+
protected Cache<String, String> createObserver()
{
- return createModifier();
+ return returnOnlyInstance();
}
protected Cache<String, String> createModifier()
{
+ return returnOnlyInstance();
+ }
+
+ private Cache<String, String> returnOnlyInstance()
+ {
+ if (onlyInstance == null)
+ {
UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
- Cache<String, String> cache = f.createCache(false, getClass());
- nodeLockingSchemeSpecificSetup(cache.getConfiguration());
- cache.start();
- return cache;
+ onlyInstance = f.createCache(false, getClass());
+ nodeLockingSchemeSpecificSetup(onlyInstance.getConfiguration());
+ onlyInstance.start();
+ }
+ return onlyInstance;
}
}
16 years, 3 months
JBoss Cache SVN: r7284 - in core/trunk/src/test/java/org/jboss/cache: api and 43 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-12 00:00:02 -0500 (Fri, 12 Dec 2008)
New Revision: 7284
Added:
core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java
core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
Removed:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
Modified:
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/UnitTestCacheFactory.java
core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.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/NodeMoveAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java
core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java
core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java
core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
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/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/config/parsing/SampleConfigFilesCorrectnessTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/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/legacy/BackwardCompatibilityTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.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/integration/UnitTestCacheFactoryCacheManager.java
core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.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/JmxRegistrationManagerTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java
core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java
core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.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/LockParentRootFlagTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java
core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.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/SimpleArrayReplTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java
core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java
core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.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/NotifyNodeInvalidatedTest.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/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/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/ForceCacheModeTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java
core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.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/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/ReplAndStateTransferWithPassivationTest.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/profiling/MemoryFootprintTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.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/PessimisticSyncReplTxTest.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/PersistingTransientStateTest.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/ConcurrentBankTest.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/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/PrepareCommitContentionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.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/SuspendTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java
core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java
Log:
test improvements
Added: core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractCacheTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,35 @@
+package org.jboss.cache;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class AbstractCacheTest<K, V>
+{
+ public void clearContent(CacheSPI<K, V> cache)
+ {
+ clearRunningTx(cache);
+ if (!cache.getCacheStatus().allowInvocations()) return;
+ cache.getRoot().clearDataDirect();
+ cache.getRoot().removeChildrenDirect();
+ RegionManager regionManager = cache.getRegionManager();
+ if (regionManager != null) regionManager.reset();
+ //impoortant!!! keep invocation ctxt cleanup as the last line in the cleanup process, prev calls modify
+ // OptionOverrides
+ cache.getInvocationContext().reset();
+ }
+
+ private void clearRunningTx(CacheSPI<K, V> cache)
+ {
+ if (cache != null && cache.getTransactionManager() != null)
+ {
+ try
+ {
+ cache.getTransactionManager().rollback();
+ }
+ catch (Exception e)
+ {
+ // don't care
+ }
+ }
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,48 @@
+package org.jboss.cache;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeTest;
+import org.jboss.cache.util.TestingUtil;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+public abstract class AbstractMultipleCachesTest<K, V> extends AbstractCacheTest<K,V>
+{
+ protected Set<CacheSPI<K, V>> caches = new HashSet<CacheSPI<K,V>>();
+
+ @BeforeTest
+ public void create() throws Throwable
+ {
+ createCaches();
+ }
+
+ @AfterClass
+ public void destroy()
+ {
+ TestingUtil.killCaches(caches.toArray(new Cache[caches.size()]));
+ }
+
+ @AfterMethod
+ public void clearContent() throws Throwable
+ {
+ for (CacheSPI<K, V> cache : caches)
+ {
+ super.clearContent(cache);
+ }
+ }
+
+ protected abstract void createCaches() throws Throwable;
+
+ public void registerCaches(Cache... caches)
+ {
+ for (Cache c: caches) this.caches.add((CacheSPI<K, V>) c);
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -0,0 +1,34 @@
+package org.jboss.cache;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterClass;
+import org.jboss.cache.util.TestingUtil;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+public abstract class AbstractSingleCacheTest<K, V> extends AbstractCacheTest<K, V>
+{
+ protected CacheSPI<K, V> cache;
+
+ @BeforeClass
+ public void create()
+ {
+ cache = createCache();
+ }
+
+ @AfterClass
+ public void destroy()
+ {
+ TestingUtil.killCaches(cache);
+ }
+
+ @AfterMethod
+ public void clearContent()
+ {
+ super.clearContent(cache);
+ }
+
+ public abstract CacheSPI<K, V> createCache();
+}
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -48,13 +48,13 @@
public void testLoadOldConfig()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/conf2x/buddy-replication-cache.xml");
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/conf2x/buddy-replication-cache.xml", getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
}
public void testFromConfigFileStarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, getClass());
// 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";
@@ -63,7 +63,7 @@
public void testFromConfigFileUnstarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configFile, false, getClass());
// can't test for this anymore since the RuntimeConfig is attached to the running cache
// assertEquals(expected, cache.getConfiguration());
@@ -74,7 +74,7 @@
public void testFromConfigObjStarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -83,7 +83,7 @@
public void testFromConfigObjUnstarted()
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
@@ -102,7 +102,7 @@
public void testLifecycle() throws Exception
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(expected, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
cache.start();
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -113,8 +113,8 @@
public void testCreationFromStreamStarted() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI) cf.createCache(is);
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI) cf.createCache(is, getClass());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
doSimpleConfTests(cache.getConfiguration());
}
@@ -122,19 +122,19 @@
public void testCreationFromStream() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI) cf.createCache(is, false);
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI) cf.createCache(is, false, getClass());
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
doSimpleConfTests(cache.getConfiguration());
}
public void testComponentsInjected() throws Exception
{
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache = (CacheSPI) cf.createCache(c);
+ cache = (CacheSPI) cf.createCache(c, getClass());
assert TestingUtil.extractField(cache, "regionManager") != null;
assert TestingUtil.extractField(cache, "notifier") != null;
Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -107,7 +107,7 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setIsolationLevel(level);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -308,7 +308,7 @@
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
@Test(groups = {"functional"})
public void testGetKeys() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", "name", "Bela Ban");
cache.put("/a/b/c", "age", 40);
cache.put("/a/b/c", "city", "Kreuzlingen");
@@ -55,7 +55,7 @@
@Test(groups = {"functional"})
public void testGetChildren() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", null);
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -74,7 +74,7 @@
@Test(groups = {"functional"})
public void testGetKeysOnNode()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
cache.put("/a/b/c", "key", "value");
Node<Object, Object> node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
Set<Object> keySet = node.getKeys();
Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -20,7 +20,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,23 +15,27 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
/**
* @author <a href="mailto:dpospisi@redhat.com">Dominik Pospisil (dpospisi(a)redhat.com)</a>
*/
-public class UnitTestCacheFactory<K, V> implements CacheFactory<K, V>
+public class UnitTestCacheFactory<K, V>
{
+ public UnitTestCacheFactory()
+ {
+ }
+
private final Log log = LogFactory.getLog(UnitTestCacheFactory.class);
@@ -81,26 +85,26 @@
/**
* For each thread holds the name of the test class which executed createCache factory method.
*/
- private static final ThreadLocal<String> threadTestName = new ThreadLocal<String>();
+ private static final ThreadLocal<Class> threadTestName = new ThreadLocal<Class>();
// factory methods
- public Cache<K, V> createCache() throws ConfigurationException
+ public Cache<K, V> createCache(Class ownerClass) throws ConfigurationException
{
- return createCache(true);
+ return createCache(true, getClass());
}
- public Cache<K, V> createCache(boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(boolean start, Class ownerClass) throws ConfigurationException
{
- return createCache(new Configuration(), start);
+ return createCache(new Configuration(), start, getClass());
}
- public Cache<K, V> createCache(String configFileName) throws ConfigurationException
+ public Cache<K, V> createCache(String configFileName, Class ownerClass) throws ConfigurationException
{
- return createCache(configFileName, true);
+ return createCache(configFileName, true, getClass());
}
- public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(String configFileName, boolean start, Class ownerClass) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c;
@@ -114,27 +118,27 @@
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseFile(configFileName);
}
- return createCache(c, start);
+ return createCache(c, start, getClass());
}
- public Cache<K, V> createCache(Configuration configuration) throws ConfigurationException
+ public Cache<K, V> createCache(Configuration configuration, Class ownerClass) throws ConfigurationException
{
- return createCache(configuration, true);
+ return createCache(configuration, true, ownerClass);
}
- public Cache<K, V> createCache(InputStream is) throws ConfigurationException
+ public Cache<K, V> createCache(InputStream is, Class ownerClass) throws ConfigurationException
{
- return createCache(is, true);
+ return createCache(is, true, ownerClass);
}
- public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(InputStream is, boolean start, Class ownerClass) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseStream(is);
- return createCache(c, start);
+ return createCache(c, start, ownerClass);
}
- public Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException
+ public Cache<K, V> createCache(Configuration configuration, boolean start, Class ownerClass) throws ConfigurationException
{
// - Do not print out this exception - since tests are ALSO run from IDEs on the main thread. - MANIK
// if (!Thread.currentThread().getName().contains("pool"))
@@ -142,7 +146,7 @@
// System.out.println("CreateCache called from wrong thread: " + Thread.currentThread().getName());
// }
- checkCaches();
+ checkCaches(ownerClass);
tryMCastAddress();
switch (configuration.getCacheMode())
@@ -324,12 +328,11 @@
// return "[" + Thread.currentThread().getName() + "]";
// }
- private void checkCaches()
+ private void checkCaches(Class ownerClass)
{
- String lastTestName = threadTestName.get();
- String currentTestName = extractTestName();
+ Class lastTestClass = threadTestName.get();
- if ((lastTestName != null) && (!lastTestName.equals(currentTestName)))
+ if ((lastTestClass != null) && (!lastTestClass.equals(ownerClass)))
{
String threadId = "[" + Thread.currentThread().getName() + "] ";
@@ -340,12 +343,12 @@
if (cleanUp())
{
System.out.print(threadId + "WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ");
- System.out.print(threadId + " A test method in " + lastTestName + " did not clean all cache instances properly. ");
+ System.out.print(threadId + " A test method in " + lastTestClass + " did not clean all cache instances properly. ");
System.out.println(threadId + " Use UnitTestCacheFactory.cleanUp() or TestngUtil.killCaches(...) ");
}
}
- threadTestName.set(currentTestName);
+ threadTestName.set(ownerClass);
}
private String extractTestName()
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,12 +1,6 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.Region;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.config.ConfigurationException;
@@ -34,21 +28,21 @@
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.CacheAPITest")
-public class CacheAPITest
+public class CacheAPITest extends AbstractSingleCacheTest
{
private CacheSPI<String, String> cache;
private List<String> events;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
// start a single cache instance
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setEvictionConfig(null);
configure(cache.getConfiguration());
cache.start();
events = new ArrayList<String>();
+ return cache;
}
protected void configure(Configuration c)
@@ -56,13 +50,10 @@
c.setNodeLockingScheme(getNodeLockingScheme());
}
-
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- TestingUtil.killCaches(cache);
- cache = null;
- events = null;
+ events.clear();
}
protected NodeLockingScheme getNodeLockingScheme()
@@ -178,8 +169,6 @@
n = cache.peek(fqn, true, true);
assert n == null;
- System.out.println("Cache: " + CachePrinter.printCacheDetails(cache));
-
// Check that it's removed if it has a child
Fqn child = Fqn.fromString("/test/fqn/child");
cache.getRoot().addChild(child);
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheSPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,38 +34,14 @@
conf1.setNodeLockingScheme(nodeLockingScheme);
conf2.setNodeLockingScheme(nodeLockingScheme);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- if (cache1 != null)
- {
- try
- {
- cache1.stop();
- cache1.destroy();
- cache1 = null;
- }
- catch (Exception e)
- {
- }
- }
-
- if (cache2 != null)
- {
- try
- {
- cache2.stop();
- cache2.destroy();
- cache2 = null;
- }
- catch (Exception e)
- {
- }
- }
+ TestingUtil.killCaches(cache1, cache2);
}
public void testGetMembers() throws Exception
@@ -93,12 +69,6 @@
public void testIsCoordinator() throws Exception
{
- Configuration conf1 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
- Configuration conf2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
-
- //cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf1, false);
- //cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(conf2, false);
-
cache1.start();
assertTrue("Cache1 is coordinator", cache1.getRPCManager().isCoordinator());
Modified: core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,8 +1,5 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -12,8 +9,9 @@
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
+
/**
* Tests whether, in a single tx, deleting a parent node with an pre-existing
* child and then re-adding a node with the parent Fqn results
@@ -23,7 +21,7 @@
* @since 2.1.0
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.DeletedChildResurrectionTest")
-public class DeletedChildResurrectionTest
+public class DeletedChildResurrectionTest extends AbstractSingleCacheTest
{
private CacheSPI<Object, Object> cache;
private static final Fqn A_B = Fqn.fromString("/a/b");
@@ -37,10 +35,9 @@
protected NodeSPI root;
protected TransactionManager txManager;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+ public CacheSPI createCache()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true), false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true), false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setCacheLoaderConfig(null);
cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -48,17 +45,9 @@
cache.start();
root = cache.getRoot();
txManager = cache.getTransactionManager();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- TestingUtil.killCaches(cache);
- cache = null;
- txManager = null;
- root = null;
- }
-
protected void configure(Configuration c)
{
// to be overridden
Modified: core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,10 +1,5 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheStatus;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeCreated;
@@ -16,7 +11,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.cache.UnitTestCacheFactory;
+
+import org.jboss.cache.*;
import org.testng.annotations.AfterMethod;
/**
@@ -27,7 +23,7 @@
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.DestroyedCacheAPITest")
-public class DestroyedCacheAPITest
+public class DestroyedCacheAPITest extends AbstractSingleCacheTest
{
private Cache<String, String> cache;
protected boolean optimistic;
@@ -36,12 +32,11 @@
private String version;
private Node<String, String> root;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
// start a single cache instance
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
version = cache.getVersion();
@@ -50,18 +45,9 @@
root = cache.getRoot();
cache.stop();
cache.destroy();
+ return (CacheSPI) cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- if (cache != null) {
- cache.destroy();
- cache = null;
- }
- root = null;
- }
-
/**
* Tests that the configuration contains the values expected, as well as immutability of certain elements
*/
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,9 +1,6 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import static org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
@@ -14,17 +11,11 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.transaction.OptimisticTransactionContext;
-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 javax.transaction.TransactionManager;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* Tests {@link org.jboss.cache.Node}-centric operations
@@ -33,24 +24,20 @@
* @since 2.0.0
*/
@Test(groups = {"functional", "pessimistic"}, testName = "api.NodeAPITest")
-public class NodeAPITest
+public class NodeAPITest extends AbstractSingleCacheTest
{
- protected ThreadLocal<CacheSPI<Object, Object>> cacheTL = new ThreadLocal<CacheSPI<Object, Object>>();
-
protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn
.fromString("/d");
protected Fqn A_B = Fqn.fromRelativeFqn(A, B);
protected Fqn A_C = Fqn.fromRelativeFqn(A, C);
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ public CacheSPI createCache()
{
- // start a single cache instance
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
- cacheTL.set(cache);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(getNodeLockingScheme());
configure(cache.getConfiguration());
cache.start();
+ return cache;
}
protected void configure(Configuration c)
@@ -58,29 +45,6 @@
// to be overridden
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- CacheSPI<Object, Object> cache = cacheTL.get();
-
- if (cache != null)
- {
- if (cache.getTransactionManager() != null)
- {
- try
- {
- cache.getTransactionManager().rollback();
- }
- catch (Exception e)
- {
- // don't care
- }
- }
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
- }
-
protected NodeLockingScheme getNodeLockingScheme()
{
return PESSIMISTIC;
@@ -88,11 +52,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assert cache.getConfiguration().getNodeLockingScheme() == PESSIMISTIC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) interceptorChainOK = true;
if (i instanceof OptimisticNodeInterceptor) assert false : "Not a pessimistic locking chain!!";
@@ -104,7 +68,6 @@
public void testAddingData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertNodeLockingScheme();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -115,7 +78,7 @@
public void testAddingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
tm.begin();
@@ -128,7 +91,7 @@
public void testOverwritingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -149,7 +112,7 @@
*/
public void testParentsAndChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -194,7 +157,7 @@
public void testLocking() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -219,7 +182,7 @@
public void testImmutabilityOfData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("key", "value");
@@ -247,7 +210,7 @@
public void testDefensiveCopyOfData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("key", "value");
@@ -274,7 +237,7 @@
public void testDefensiveCopyOfChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
Fqn childFqn = Fqn.fromString("/child");
@@ -303,7 +266,7 @@
public void testImmutabilityOfChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.addChild(A);
@@ -321,15 +284,15 @@
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
assertEquals(3, cache.getNumberOfNodes());
assertEquals(4, cache.getNumberOfLocksHeld());
}
public void testGetChildrenUnderTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
tm.begin();
@@ -344,14 +307,14 @@
@SuppressWarnings("unchecked")
protected TransactionWorkspace<Object, Object> getTransactionWorkspace() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
return ((OptimisticTransactionContext) cache.getTransactionTable().get(cache.getTransactionTable().get(tm.getTransaction()))).getTransactionWorkSpace();
}
public void testGetChildAPI()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
// creates a Node<Object, Object> with fqn /a/b/c
@@ -371,7 +334,7 @@
public void testClearingData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
rootNode.put("k", "v");
@@ -384,7 +347,7 @@
public void testClearingDataTx() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -401,7 +364,7 @@
public void testPutData()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
Node<Object, Object> rootNode = cache.getRoot();
assertTrue(rootNode.getData().isEmpty());
@@ -437,7 +400,7 @@
public void testGetChildrenNames() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
Node<Object, Object> rootNode = cache.getRoot();
@@ -462,7 +425,7 @@
public void testDoubleRemovalOfData() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
cache.put("/foo/1/2/3", "item", 1);
@@ -483,7 +446,7 @@
public void testDoubleRemovalOfData2() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
+
TransactionManager tm = cache.getTransactionManager();
cache.put("/foo/1/2", "item", 1);
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,11 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -15,8 +11,6 @@
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
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 org.w3c.dom.Element;
@@ -32,7 +26,7 @@
* @since 2.0.0
*/
@Test(groups = {"functional", "pessimistic"}, testName = "api.NodeMoveAPITest")
-public class NodeMoveAPITest
+public class NodeMoveAPITest extends AbstractSingleCacheTest
{
protected final Log log = LogFactory.getLog(getClass());
@@ -41,33 +35,21 @@
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
- protected ThreadLocal<CacheSPI<Object, Object>> cacheTL = new ThreadLocal<CacheSPI<Object, Object>>();
- protected ThreadLocal<TransactionManager> tmTL = new ThreadLocal<TransactionManager>();
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ private TransactionManager tm;
+
+ public CacheSPI createCache()
{
-
// start a single cache instance
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache.getConfiguration().setFetchInMemoryState(false);
cache.getConfiguration().setEvictionConfig(null);
configure(cache.getConfiguration());
cache.start();
-
- cacheTL.set(cache);
- tmTL.set(cache.getTransactionManager());
+ tm = cache.getTransactionManager();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- CacheSPI<Object, Object> cache = cacheTL.get();
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
-
protected void configure(Configuration c)
{
// to be overridden
@@ -75,8 +57,6 @@
public void testBasicMove()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -143,8 +123,6 @@
public void testMoveWithChildren()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -182,8 +160,6 @@
// move
log.info("move " + nodeC + " to " + nodeB);
cache.move(nodeC.getFqn(), nodeB.getFqn());
- //System.out.println("nodeB " + nodeB);
- //System.out.println("nodeC " + nodeC);
// child nodes will need refreshing, since existing pointers will be stale.
nodeC = nodeB.getChild(C);
@@ -215,8 +191,6 @@
public void testTxCommit() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -246,8 +220,6 @@
public void testTxRollback() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -308,8 +280,6 @@
protected void doCacheLoaderTest(boolean pasv, boolean useTx) throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
cache.destroy();
@@ -389,8 +359,6 @@
public void testLocksDeepMove() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -413,8 +381,6 @@
public void testLocks() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = tmTL.get();
Node<Object, Object> rootNode = cache.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
@@ -433,29 +399,25 @@
protected void checkLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL", 4, cache.getNumberOfLocksHeld());
}
protected void checkLocksDeep()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL", 6, cache.getNumberOfLocksHeld());
}
protected void assertNoLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
assertEquals(0, cache.getNumberOfLocksHeld());
}
public void testConcurrency() throws InterruptedException
{
- final CacheSPI<Object, Object> cache = cacheTL.get();
Node<Object, Object> rootNode = cache.getRoot();
final int N = 3;// number of threads
- final int loops = 1 << 6;// number of loops
+ final int loops = 1 << 4;// number of loops
// tests a tree structure as such:
// /a
// /b
@@ -499,7 +461,6 @@
for (int counter = 0; counter < loops; counter++)
{
- System.out.println(getName() + ": Attempt " + counter);
try
{
cache.move(NODE_X.getFqn(), NODES[r.nextInt(NODES.length)].getFqn());
@@ -508,7 +469,7 @@
{
// this may happen ...
}
- TestingUtil.sleepRandom(250);
+ TestingUtil.sleepRandom(50);
try
{
cache.move(NODE_Y.getFqn(), NODES[r.nextInt(NODES.length)].getFqn());
@@ -517,7 +478,7 @@
{
// this may happen ...
}
- TestingUtil.sleepRandom(250);
+ TestingUtil.sleepRandom(50);
}
}
};
@@ -567,7 +528,6 @@
public void testMoveInSamePlace()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
Node<Object, Object> rootNode = cache.getRoot();
final Fqn FQN_X = Fqn.fromString("/x");
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -6,70 +6,52 @@
*/
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
+import java.util.HashSet;
+import java.util.Set;
@Test(groups = {"functional", "jgroups", "pessimistic"}, testName = "api.NodeReplicatedMoveTest")
-public class NodeReplicatedMoveTest
+public class NodeReplicatedMoveTest extends AbstractMultipleCachesTest
{
- private class NodeReplicatedMoveTestTL {
- protected CacheSPI<Object, Object> cache1;
- protected CacheSPI<Object, Object> cache2;
- protected TransactionManager tm;
- }
- protected ThreadLocal<NodeReplicatedMoveTestTL> threadLocal = new ThreadLocal<NodeReplicatedMoveTestTL>();
-
+
protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d"), E = Fqn.fromString("/e");
protected static final Object k = "key", vA = "valueA", vB = "valueB", vC = "valueC", vD = "valueD", vE = "valueE";
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
+ private CacheSPI<Object, Object> cache1;
+ private TransactionManager tm;
+ private CacheSPI<Object, Object> cache2;
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
+ protected void createCaches()
{
- NodeReplicatedMoveTestTL tl = new NodeReplicatedMoveTestTL();
- threadLocal.set(tl);
// start a single cache instance
- tl.cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- tl.cache1.getConfiguration().setSyncCommitPhase(true);
- tl.cache1.getConfiguration().setSyncRollbackPhase(true);
- tl.cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- configure(tl.cache1.getConfiguration());
- tl.cache1.start();
- tl.tm = tl.cache1.getTransactionManager();
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache1.getConfiguration().setSyncCommitPhase(true);
+ cache1.getConfiguration().setSyncRollbackPhase(true);
+ cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ configure(cache1.getConfiguration());
+ cache1.start();
+ tm = cache1.getTransactionManager();
// start second instance
- tl.cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- tl.cache2.getConfiguration().setSyncCommitPhase(true);
- tl.cache2.getConfiguration().setSyncRollbackPhase(true);
- tl.cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- configure(tl.cache2.getConfiguration());
- tl.cache2.start();
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2.getConfiguration().setSyncCommitPhase(true);
+ cache2.getConfiguration().setSyncRollbackPhase(true);
+ cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ cache2.start();
+ configure(cache2.getConfiguration());
+ registerCaches(cache1, cache2);
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- TestingUtil.killCaches(tl.cache1, tl.cache2);
- threadLocal.set(null);
- }
protected void configure(Configuration c)
{
@@ -78,10 +60,7 @@
public void testReplicatability()
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+ Node<Object, Object> rootNode = cache1.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -105,76 +84,9 @@
assertEquals(vB, cache2.getRoot().getChild(B).get(k));
}
- public void testInvalidations() throws Exception
- {
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
- cache1.stop();
- cache2.stop();
- cache1.destroy();
- cache2.destroy();
- if (isOptimistic())
- {
- cache1.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- cache2.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- }
- cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- cache1.start();
- cache2.start();
-
- Node<Object, Object> nodeA = rootNode.addChild(A);
- Node<Object, Object> nodeB = nodeA.addChild(B);
-
- nodeA.put(k, vA);
- nodeB.put(k, vB);
-
- assertEquals(vA, cache1.getRoot().getChild(A).get(k));
- assertEquals(vB, cache1.getRoot().getChild(A).getChild(B).get(k));
-
- assertInvalidated(cache2, A, "Should be invalidated");
- assertInvalidated(cache2, Fqn.fromRelativeElements(A, B.getLastElement()), "Should be invalidated");
-
- // now move...
- cache1.move(nodeB.getFqn(), Fqn.ROOT);
-
- assertEquals(vA, cache1.getRoot().getChild(A).get(k));
- assertEquals(vB, cache1.getRoot().getChild(B).get(k));
-
- assertInvalidated(cache2, A, "Should be invalidated");
- assertInvalidated(cache2, B, "Should be invalidated");
-
- // now make sure a node exists on cache 2
- cache2.getRoot().addChild(A).put("k2", "v2");
-
- // te invalidation will happen in afterCompletion, hence no exception!
- try
- {
- cache1.move(B, A);// should throw an NPE
- if (!isOptimistic()) assert false : "Should throw an exception!";
- }
- catch (Exception expected)
- {
- if (isOptimistic()) assert false : "Should not have thrown an exception!";
- }
- }
-
- private void assertInvalidated(Cache cache, Fqn fqn, String msg)
- {
- assert cache.getRoot().getChild(fqn) == null : msg;
- NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
- assert n == null || isOptimistic() : msg;
- assert !isOptimistic() || !n.isValid() : msg;
- }
-
public void testReplTxCommit() throws Exception
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+ Node<Object, Object> rootNode = cache1.getRoot();
Fqn A_B = Fqn.fromRelativeFqn(A, B);
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -189,13 +101,13 @@
assertEquals(vB, cache2.getRoot().getChild(A).getChild(B).get(k));
// now move...
- tl.tm.begin();
+ tm.begin();
cache1.move(nodeB.getFqn(), Fqn.ROOT);
assertEquals(vA, cache1.get(A, k));
assertNull(cache1.get(A_B, k));
assertEquals(vB, cache1.get(B, k));
- tl.tm.commit();
+ tm.commit();
assertEquals(vA, cache1.getRoot().getChild(A).get(k));
assertEquals(vB, cache1.getRoot().getChild(B).get(k));
@@ -206,10 +118,8 @@
public void testReplTxRollback() throws Exception
{
- NodeReplicatedMoveTestTL tl = threadLocal.get();
- CacheSPI<Object, Object> cache1 = tl.cache1;
- CacheSPI<Object, Object> cache2 = tl.cache2;
- Node<Object, Object> rootNode = tl.cache1.getRoot();
+
+ Node<Object, Object> rootNode = cache1.getRoot();
Node<Object, Object> nodeA = rootNode.addChild(A);
Node<Object, Object> nodeB = nodeA.addChild(B);
@@ -222,13 +132,13 @@
assertEquals(vB, cache2.getRoot().getChild(A).getChild(B).get(k));
// now move...
- tl.tm.begin();
+ tm.begin();
cache1.move(nodeB.getFqn(), Fqn.ROOT);
assertEquals(vA, cache1.get(A, k));
assertEquals(vB, cache1.get(B, k));
- tl.tm.rollback();
+ tm.rollback();
assertEquals(vA, cache1.getRoot().getChild(A).get(k));
assertEquals(vB, cache1.getRoot().getChild(A).getChild(B).get(k));
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,44 +1,30 @@
package org.jboss.cache.api;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Set;
-import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
/**
* Tests NodeSPI specific APIs.
*/
@Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.NodeSPITest")
-public class NodeSPITest
+public class NodeSPITest extends AbstractSingleCacheTest
{
- private CacheSPI<Object, Object> cache;
private NodeSPI<Object, Object> root;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+
+ public CacheSPI createCache()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
root = cache.getRoot();
+ return cache;
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- if (cache != null) TestingUtil.killCaches(cache);
- root = null;
- cache = null;
- }
-
public void testDeepOperations() throws Exception
{
Fqn A = Fqn.fromString("/a");
Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false, getClass());
cache.getConfiguration().getEvictionConfig().setWakeupInterval(1000);
createNewRegion();
cache.start();
@@ -175,7 +175,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 UnitTestCacheFactory<Object, Object>().createCache(config, true);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
cache.put(Fqn.fromString("/a/b"), "key", "value");
TransactionManager txManager = cache.getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,12 +7,7 @@
package org.jboss.cache.api;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -25,22 +20,23 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
/**
* @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
*/
@Test(groups = {"functional", "jgroups", "pessimistic"}, sequential = true, testName = "api.SyncReplTest")
-public class SyncReplTest
+public class SyncReplTest extends AbstractMultipleCachesTest
{
private CacheSPI<Object, Object> cache1, cache2;
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+
+ protected void createCaches()
{
- System.out.println("*** In setUp()");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -50,17 +46,9 @@
cache1.start();
cache2.start();
-
TestingUtil.blockUntilViewsReceived(new Cache[]{cache1, cache2}, 5000);
- System.out.println("*** Finished setUp()");
- }
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- TestingUtil.killCaches(cache1, cache2);
- cache1 = null;
- cache2 = null;
+ registerCaches(cache1, cache2);
}
protected void configure(Configuration c)
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,9 +46,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws CloneNotSupportedException
{
- System.out.println("*** In setUp()");
caches = new ArrayList<CacheSPI<Object, Object>>();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
cache1.getConfiguration().setSyncCommitPhase(true);
@@ -59,7 +58,7 @@
cache1.start();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache2.start();
@@ -67,46 +66,12 @@
caches.add(cache2);
TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), 10000);
- System.out.println("*** Finished setUp()");
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- System.out.println("*** In tearDown()");
- if (caches != null)
- {
- for (CacheSPI c : caches)
- {
- if (c != null)
- {
- Transaction t;
-
- try
- {
- if ((t = c.getTransactionManager().getTransaction()) != null)
- {
- try
- {
- if (t.getStatus() == Status.STATUS_ACTIVE)
- c.getTransactionManager().rollback();
- }
- catch (SystemException e)
- {
- // do nothing
- }
- }
- }
- catch (SystemException e)
- {
- // do nothing
- }
- c.stop();
- }
- }
- caches = null;
- }
- System.out.println("*** Finished tearDown()");
+ TestingUtil.killCaches(caches.toArray(new Cache[caches.size()]));
}
protected void configure(Configuration c)
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/AbstractBatchTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,10 +1,11 @@
package org.jboss.cache.api.batch;
import org.jboss.cache.Cache;
+import org.jboss.cache.AbstractSingleCacheTest;
import java.util.concurrent.atomic.AtomicReference;
-public abstract class AbstractBatchTest
+public abstract class AbstractBatchTest extends AbstractSingleCacheTest<String, String>
{
protected String getOnDifferentThread(final Cache<String, String> cache, final String fqn, final String key) throws InterruptedException
{
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithTM.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -10,104 +10,76 @@
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
+
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.CacheSPI;
@Test(groups = {"functional", "transaction"}, testName = "api.batch.BatchWithTM")
public class BatchWithTM extends AbstractBatchTest
{
public void testBatchWithOngoingTM() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- tm.begin();
- cache.put("/a/b/c", "k", "v");
- cache.startBatch();
- cache.put("/a/b/c", "k2", "v2");
- tm.commit();
+ TransactionManager tm = getTransactionManager(cache);
+ tm.begin();
+ cache.put("/a/b/c", "k", "v");
+ cache.startBatch();
+ cache.put("/a/b/c", "k2", "v2");
+ tm.commit();
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
- cache.endBatch(false); // should be a no op
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ cache.endBatch(false); // should be a no op
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
}
public void testBatchWithoutOngoingTMSuspension() throws Exception
{
- Cache<String, String> cache = null;
+ TransactionManager tm = getTransactionManager(cache);
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.put("/a/b/c", "k2", "v2");
+
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+
try
{
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- assert tm.getTransaction() == null : "Should have no ongoing txs";
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- assert tm.getTransaction() == null : "Should have no ongoing txs";
- cache.put("/a/b/c", "k2", "v2");
+ tm.commit(); // should have no effect
+ }
+ catch (Exception e)
+ {
+ // the TM may barf here ... this is OK.
+ }
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert tm.getTransaction() == null : "Should have no ongoing txs";
- try
- {
- tm.commit(); // should have no effect
- }
- catch (Exception e)
- {
- // the TM may barf here ... this is OK.
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- assert tm.getTransaction() == null : "Should have no ongoing txs";
+ cache.endBatch(true); // should be a no op
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
-
- cache.endBatch(true); // should be a no op
-
- assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
- assert "v2".equals(getOnDifferentThread(cache, "/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
+ assert "v2".equals(getOnDifferentThread(cache, "/a/b/c", "k2"));
}
public void testBatchRollback() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache();
- TransactionManager tm = getTransactionManager(cache);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.put("/a/b/c", "k2", "v2");
+ TransactionManager tm = getTransactionManager(cache);
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.put("/a/b/c", "k2", "v2");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- cache.endBatch(false);
+ cache.endBatch(false);
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
}
private TransactionManager getTransactionManager(Cache<String, String> c)
@@ -115,13 +87,15 @@
return c.getConfiguration().getRuntimeConfig().getTransactionManager();
}
- private Cache<String, String> createCache()
+ @Override
+ public CacheSPI<String, String> createCache()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL); // this should pick up any configured TM for the test
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setInvocationBatchingEnabled(true);
assert c.getTransactionManagerLookupClass() != null : "Should have a transaction manager lookup class attached!!";
- return cf.createCache(c);
+ return (CacheSPI<String, String>) cf.createCache(c, getClass());
}
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/batch/BatchWithoutTM.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -3,6 +3,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.config.ConfigurationException;
@@ -12,15 +13,16 @@
@Test(groups = "functional", testName = "api.batch.BatchWithoutTM")
public class BatchWithoutTM extends AbstractBatchTest
{
+
+ @Test (enabled = true)
public void testBatchWithoutCfg()
{
- Cache<String, String> cache = null;
+ Cache<String, String> localCache = createCache(false);
try
{
- cache = createCache(false);
try
{
- cache.startBatch();
+ localCache.startBatch();
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -30,7 +32,7 @@
try
{
- cache.endBatch(true);
+ localCache.endBatch(true);
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -40,7 +42,7 @@
try
{
- cache.endBatch(false);
+ localCache.endBatch(false);
assert false : "Should have failed";
}
catch (ConfigurationException good)
@@ -50,101 +52,59 @@
}
finally
{
- TestingUtil.killCaches(cache);
- cache = null;
+ TestingUtil.killCaches(localCache);
}
}
- public void testEndBatchWithoutStartBatch()
- {
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.endBatch(true);
- cache.endBatch(false);
- // should not fail.
- }
- finally
- {
- TestingUtil.killCaches(cache);
- }
- }
-
public void testStartBatchIdempotency()
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.startBatch(); // again
- cache.put("/a/b/c", "k2", "v2");
- cache.endBatch(true);
+ assert cache.getCacheStatus().allowInvocations();
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.startBatch(); // again
+ cache.put("/a/b/c", "k2", "v2");
+ cache.endBatch(true);
- assert "v".equals(cache.get("/a/b/c", "k"));
- assert "v2".equals(cache.get("/a/b/c", "k2"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert "v".equals(cache.get("/a/b/c", "k"));
+ assert "v2".equals(cache.get("/a/b/c", "k2"));
}
public void testBatchVisibility() throws InterruptedException
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null : "Other thread should not see batch update till batch completes!";
-
- cache.endBatch(true);
-
- assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ cache = createCache(true);
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null : "Other thread should not see batch update till batch completes!";
+ cache.endBatch(true);
+ assert "v".equals(getOnDifferentThread(cache, "/a/b/c", "k"));
}
public void testBatchRollback() throws Exception
{
- Cache<String, String> cache = null;
- try
- {
- cache = createCache(true);
- cache.startBatch();
- cache.put("/a/b/c", "k", "v");
- cache.put("/a/b/c", "k2", "v2");
+ cache.startBatch();
+ cache.put("/a/b/c", "k", "v");
+ cache.put("/a/b/c", "k2", "v2");
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- cache.endBatch(false);
+ cache.endBatch(false);
- assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
- assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
- }
- finally
- {
- TestingUtil.killCaches(cache);
- cache = null;
- }
+ assert getOnDifferentThread(cache, "/a/b/c", "k") == null;
+ assert getOnDifferentThread(cache, "/a/b/c", "k2") == null;
}
- private Cache<String, String> createCache(boolean enableBatch)
+ public CacheSPI<String, String> createCache()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ return createCache(true);
+ }
+
+ private CacheSPI<String, String> createCache(boolean enableBatch)
+ {
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setInvocationBatchingEnabled(enableBatch);
- return cf.createCache(c);
+ return (CacheSPI<String, String>) cf.createCache(c, getClass());
}
}
Deleted: core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,41 +0,0 @@
-package org.jboss.cache.api.mvcc;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
-import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.Test;
-
-@Test(groups = {"functional", "mvcc"}, testName = "api.mvcc.BuddyReplicationConcurrencyTest")
-public class BuddyReplicationConcurrencyTest extends BuddyReplicationTestsBase
-{
- public static final Fqn f = Fqn.fromString("/a/b/c");
- public static final String k = "k";
- public static final String v = "v";
-
- public void testConcurrency() throws Exception
- {
- Cache<Object, Object> cache1 = null, cache2 = null;
-
- try
- {
- cache1 = createCache(1, null, true, true);
- cache2 = createCache(1, null, true, true);
-
- TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
-
- // put stuff in cache 1. And ensure they exist in cache 2.
-
- for (int i = 0; i < 10; i++)
- {
- cache1.put(Fqn.fromRelativeElements(f, i), k, v);
- assert v.equals(cache1.get(Fqn.fromRelativeElements(f, i), k));
- assert v.equals(cache2.get(Fqn.fromRelativeElements(f, i), k));
- }
- }
- finally
- {
- TestingUtil.killCaches(cache1, cache2);
- }
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,8 +1,6 @@
package org.jboss.cache.api.mvcc;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -12,8 +10,6 @@
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;
import javax.transaction.Transaction;
@@ -25,7 +21,7 @@
* @since 3.0
*/
@Test(groups = {"functional", "mvcc"})
-public abstract class LockTestBase
+public abstract class LockTestBase extends AbstractSingleCacheTest
{
protected Fqn A = Fqn.fromString("/a");
protected Fqn AB = Fqn.fromString("/a/b");
@@ -34,65 +30,47 @@
protected boolean repeatableRead = true;
protected boolean lockParentForChildInsertRemove = false;
- protected class LockTestBaseTL {
- public Cache<String, String> cache;
- public TransactionManager tm;
- public LockManager lockManager;
- public InvocationContextContainer icc;
- }
-
- protected ThreadLocal<LockTestBaseTL> threadLocal = new ThreadLocal<LockTestBaseTL>();
+ public Cache<String, String> cache;
+ public TransactionManager tm;
+ public LockManager lockManager;
+ public InvocationContextContainer icc;
- @BeforeMethod
- public void setUp()
+
+ public CacheSPI createCache()
{
- LockTestBaseTL tl = new LockTestBaseTL();
-
- tl.cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false);
- tl.cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
- tl.cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- tl.cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
- tl.cache.getConfiguration().setLockParentForChildInsertRemove(lockParentForChildInsertRemove);
+ cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false, getClass());
+ cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
+ cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
+ cache.getConfiguration().setLockParentForChildInsertRemove(lockParentForChildInsertRemove);
// reduce lock acquisition timeout so this doesn't take forever to run
- tl.cache.getConfiguration().setLockAcquisitionTimeout(200); // 200 ms
- tl.cache.start();
- tl.lockManager = TestingUtil.extractComponentRegistry(tl.cache).getComponent(LockManager.class);
- tl.icc = TestingUtil.extractComponentRegistry(tl.cache).getComponent(InvocationContextContainer.class);
- tl.tm = TestingUtil.extractComponentRegistry(tl.cache).getComponent(TransactionManager.class);
- threadLocal.set(tl);
+ cache.getConfiguration().setLockAcquisitionTimeout(200); // 200 ms
+ cache.start();
+ lockManager = TestingUtil.extractComponentRegistry(cache).getComponent(LockManager.class);
+ icc = TestingUtil.extractComponentRegistry(cache).getComponent(InvocationContextContainer.class);
+ tm = TestingUtil.extractComponentRegistry(cache).getComponent(TransactionManager.class);
+ return (CacheSPI) cache;
}
- @AfterMethod
- public void tearDown()
- {
- LockTestBaseTL tl = threadLocal.get();
- TestingUtil.killCaches(tl.cache);
- threadLocal.set(null);
- }
-
protected void assertLocked(Fqn fqn)
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertLocked(fqn, tl.lockManager, tl.icc);
+ LockAssert.assertLocked(fqn, lockManager, icc);
}
protected void assertNotLocked(Fqn fqn)
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertNotLocked(fqn, tl.lockManager, tl.icc);
+ LockAssert.assertNotLocked(fqn, lockManager, icc);
}
protected void assertNoLocks()
{
- LockTestBaseTL tl = threadLocal.get();
- LockAssert.assertNoLocks(tl.lockManager, tl.icc);
+ LockAssert.assertNoLocks(lockManager, icc);
}
public void testLocksOnPutKeyVal() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
+ tm.begin();
+ cache.put(AB, "k", "v");
if (lockParentForChildInsertRemove)
assertLocked(Fqn.ROOT);
else
@@ -100,22 +78,22 @@
assertLocked(A);
assertLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.get(AB, "k").equals("v");
+ tm.begin();
+ assert cache.get(AB, "k").equals("v");
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
assertNotLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
+ tm.begin();
+ cache.put(ABC, "k", "v");
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
if (lockParentForChildInsertRemove)
@@ -123,16 +101,16 @@
else
assertNotLocked(AB);
assertLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnPutData() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+
+ tm.begin();
+ cache.put(AB, Collections.singletonMap("k", "v"));
if (lockParentForChildInsertRemove)
assertLocked(Fqn.ROOT);
else
@@ -140,23 +118,23 @@
assertLocked(A);
assertLocked(AB);
assertNotLocked(ABC);
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.commit();
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ tm.commit();
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
assertNotLocked(AB);
assertNotLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- tl.cache.put(ABC, Collections.singletonMap("k", "v"));
+ tm.begin();
+ cache.put(ABC, Collections.singletonMap("k", "v"));
assertNotLocked(Fqn.ROOT);
assertNotLocked(A);
if (lockParentForChildInsertRemove)
@@ -164,67 +142,67 @@
else
assertNotLocked(AB);
assertLocked(ABC);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnRemoveNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
- tl.tm.begin();
- tl.cache.removeNode(AB);
+ tm.begin();
+ cache.removeNode(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
- tl.tm.begin();
- tl.cache.evict(AB);
+ tm.begin();
+ cache.evict(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictRecursiveNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, Collections.singletonMap("k", "v"));
- tl.cache.put(ABC, Collections.singletonMap("k", "v"));
- tl.cache.put(ABCD, Collections.singletonMap("k", "v"));
+ cache.put(AB, Collections.singletonMap("k", "v"));
+ cache.put(ABC, Collections.singletonMap("k", "v"));
+ cache.put(ABCD, Collections.singletonMap("k", "v"));
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(ABCD, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(ABCD, "k"));
- tl.tm.begin();
- tl.cache.evict(AB, true);
+ tm.begin();
+ cache.evict(AB, true);
assertLocked(AB);
assertLocked(ABC);
assertLocked(ABCD);
@@ -233,481 +211,481 @@
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnRemoveNonexistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.removeNode(AB);
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.removeNode(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnEvictNonexistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.evict(AB);
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.evict(AB);
assertLocked(AB);
if (lockParentForChildInsertRemove)
assertLocked(A);
else
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
assertNoLocks();
}
public void testLocksOnRemoveData() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// init some data on a node
- tl.cache.put(AB, "k", "v");
- tl.cache.put(AB, "k2", "v2");
+ cache.put(AB, "k", "v");
+ cache.put(AB, "k2", "v2");
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v2".equals(tl.cache.get(AB, "k2"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v2".equals(cache.get(AB, "k2"));
// remove
- tl.tm.begin();
- Object x = tl.cache.remove(AB, "k");
+ tm.begin();
+ Object x = cache.remove(AB, "k");
assert x.equals("v");
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.get(AB, "k") == null : "Should not exist";
- assert "v2".equals(tl.cache.get(AB, "k2"));
+ tm.commit();
+ assert cache.get(AB, "k") == null : "Should not exist";
+ assert "v2".equals(cache.get(AB, "k2"));
assertNoLocks();
// clearData
- tl.tm.begin();
- tl.cache.clearData(AB);
+ tm.begin();
+ cache.clearData(AB);
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
+ tm.commit();
- assert tl.cache.get(AB, "k") == null : "Should not exist";
- assert tl.cache.get(AB, "k2") == null : "Should not exist";
+ assert cache.get(AB, "k") == null : "Should not exist";
+ assert cache.get(AB, "k2") == null : "Should not exist";
assertNoLocks();
// nonexistent key
- assert tl.cache.get(AB, "k3") == null : "Should not exist";
- tl.tm.begin();
- tl.cache.remove(AB, "k3");
+ assert cache.get(AB, "k3") == null : "Should not exist";
+ tm.begin();
+ cache.remove(AB, "k3");
assertLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testLocksOnRemoveDataNonExistentNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- assert tl.cache.getNode(AB) == null : "Should not exist";
- tl.tm.begin();
- tl.cache.remove(AB, "k");
+ assert cache.getNode(AB) == null : "Should not exist";
+
+ tm.begin();
+ cache.remove(AB, "k");
assertNotLocked(AB);
assertNotLocked(A);
assertNotLocked(Fqn.ROOT);
- tl.tm.commit();
- assert tl.cache.getNode(AB) == null : "Should not exist";
+ tm.commit();
+ assert cache.getNode(AB) == null : "Should not exist";
}
public void testReadMethods() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
+ cache.put(AB, "k", "v");
+
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getData(AB).containsKey("k");
+ tm.begin();
+ assert cache.getData(AB).containsKey("k");
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getKeys(AB).contains("k");
+ tm.begin();
+ assert cache.getKeys(AB).contains("k");
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getNode(AB) != null;
+ tm.begin();
+ assert cache.getNode(AB) != null;
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
- tl.tm.begin();
- assert tl.cache.getNode(A) != null;
- assert !(tl.cache.getNode(A).getChildrenNames().isEmpty());
- assert tl.cache.getNode(A).getChildrenNames().contains(AB.getLastElement());
+ tm.begin();
+ assert cache.getNode(A) != null;
+ assert !(cache.getNode(A).getChildrenNames().isEmpty());
+ assert cache.getNode(A).getChildrenNames().contains(AB.getLastElement());
assertNoLocks();
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testWriteDoesntBlockRead() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
+ cache.put(AB, "k", "v");
+
// start a write.
- tl.tm.begin();
- tl.cache.put(AB, "k2", "v2");
+ tm.begin();
+ cache.put(AB, "k2", "v2");
assertLocked(AB);
- Transaction write = tl.tm.suspend();
+ Transaction write = tm.suspend();
// now start a read and confirm that the write doesn't block it.
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(AB, "k2") : "Should not see uncommitted changes";
- Transaction read = tl.tm.suspend();
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ assert null == cache.get(AB, "k2") : "Should not see uncommitted changes";
+ Transaction read = tm.suspend();
// commit the write
- tl.tm.resume(write);
- tl.tm.commit();
+ tm.resume(write);
+ tm.commit();
assertNoLocks();
- tl.tm.resume(read);
+ tm.resume(read);
if (repeatableRead)
- assert null == tl.cache.get(AB, "k2") : "Should have repeatable read";
+ assert null == cache.get(AB, "k2") : "Should have repeatable read";
else
- assert "v2".equals(tl.cache.get(AB, "k2")) : "Read committed should see committed changes";
- tl.tm.commit();
+ assert "v2".equals(cache.get(AB, "k2")) : "Read committed should see committed changes";
+ tm.commit();
assertNoLocks();
}
public void testWriteDoesntBlockReadNonexistent() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
+
// start a write.
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
+ tm.begin();
+ cache.put(AB, "k", "v");
assertLocked(AB);
- Transaction write = tl.tm.suspend();
+ Transaction write = tm.suspend();
// now start a read and confirm that the write doesn't block it.
- tl.tm.begin();
- assert null == tl.cache.get(AB, "k") : "Should not see uncommitted changes";
- assert null == tl.cache.getNode(AB);
- Transaction read = tl.tm.suspend();
+ tm.begin();
+ assert null == cache.get(AB, "k") : "Should not see uncommitted changes";
+ assert null == cache.getNode(AB);
+ Transaction read = tm.suspend();
// commit the write
- tl.tm.resume(write);
- tl.tm.commit();
+ tm.resume(write);
+ tm.commit();
assertNoLocks();
- tl.tm.resume(read);
+ tm.resume(read);
if (repeatableRead)
{
- assert null == tl.cache.get(AB, "k") : "Should have repeatable read";
- assert null == tl.cache.getNode(AB);
+ assert null == cache.get(AB, "k") : "Should have repeatable read";
+ assert null == cache.getNode(AB);
}
else
{
- assert "v".equals(tl.cache.get(AB, "k")) : "Read committed should see committed changes";
- assert null != tl.cache.getNode(AB);
+ assert "v".equals(cache.get(AB, "k")) : "Read committed should see committed changes";
+ assert null != cache.getNode(AB);
}
- tl.tm.commit();
+ tm.commit();
assertNoLocks();
}
public void testConcurrentWriters() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
- Transaction t1 = tl.tm.suspend();
- tl.tm.begin();
+ tm.begin();
+ cache.put(AB, "k", "v");
+ Transaction t1 = tm.suspend();
+
+ tm.begin();
try
{
- tl.cache.put(AB, "k", "v");
+ cache.put(AB, "k", "v");
assert false : "Should fail lock acquisition";
}
catch (TimeoutException expected)
{
// expected.printStackTrace(); // for debugging
}
- tl.tm.commit();
- tl.tm.resume(t1);
- tl.tm.commit();
+ tm.commit();
+ tm.resume(t1);
+ tm.commit();
assertNoLocks();
}
public void testRollbacks() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction reader = tl.tm.suspend();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- tl.tm.rollback();
+ cache.put(AB, "k", "v");
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction reader = tm.suspend();
- tl.tm.resume(reader);
- assert "v".equals(tl.cache.get(AB, "k")) : "Expecting 'v' but was " + tl.cache.get(AB, "k");
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ tm.rollback();
+ tm.resume(reader);
+ assert "v".equals(cache.get(AB, "k")) : "Expecting 'v' but was " + cache.get(AB, "k");
+ tm.commit();
+
// even after commit
- assert "v".equals(tl.cache.get(AB, "k"));
+ assert "v".equals(cache.get(AB, "k"));
assertNoLocks();
}
public void testRollbacksOnNullNode() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.tm.begin();
- assert null == tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
- Transaction reader = tl.tm.suspend();
- tl.tm.begin();
- tl.cache.put(AB, "k", "v");
- assert null != tl.cache.getNode(AB);
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.rollback();
+ tm.begin();
+ assert null == cache.get(AB, "k");
+ assert null == cache.getNode(AB);
+ Transaction reader = tm.suspend();
- tl.tm.resume(reader);
- assert null == tl.cache.get(AB, "k") : "Expecting null but was " + tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v");
+ assert null != cache.getNode(AB);
+ assert "v".equals(cache.get(AB, "k"));
+ tm.rollback();
+ tm.resume(reader);
+ assert null == cache.get(AB, "k") : "Expecting null but was " + cache.get(AB, "k");
+ assert null == cache.getNode(AB);
+ tm.commit();
+
// even after commit
- assert null == tl.cache.get(AB, "k");
- assert null == tl.cache.getNode(AB);
+ assert null == cache.get(AB, "k");
+ assert null == cache.getNode(AB);
assertNoLocks();
}
public void testPhantomChildren() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert tl.cache.getRoot().hasChild(ABC);
- assert tl.cache.getNode(ABC) != null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) != null;
- assert tl.cache.getNode(AB).getChildren().size() == 1;
- Transaction t = tl.tm.suspend();
+ cache.put(AB, "k", "v");
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert cache.getRoot().hasChild(ABC);
+ assert cache.getNode(ABC) != null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) != null;
+ assert cache.getNode(AB).getChildren().size() == 1;
+ Transaction t = tm.suspend();
- assert tl.cache.getNode(ABC) == null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) == null;
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- tl.tm.resume(t);
- assert tl.cache.getRoot().hasChild(ABC);
- assert tl.cache.getNode(ABC) != null;
- tl.tm.commit();
+ assert cache.getNode(ABC) == null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) == null;
+ assert cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(ABC) != null;
- assert tl.cache.getNode(AB).getChild(ABC.getLastElement()) != null;
- assert tl.cache.getNode(AB).getChildren().size() == 1;
+ tm.resume(t);
+ assert cache.getRoot().hasChild(ABC);
+ assert cache.getNode(ABC) != null;
+ tm.commit();
+
+ assert cache.getNode(ABC) != null;
+ assert cache.getNode(AB).getChild(ABC.getLastElement()) != null;
+ assert cache.getNode(AB).getChildren().size() == 1;
}
public void testChildCount() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.begin();
- assert tl.cache.getNode(AB).getChildren().size() == 0;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.cache.removeNode(AB);
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
- Transaction t = tl.tm.suspend();
+ cache.put(AB, "k", "v");
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ tm.begin();
+ assert cache.getNode(AB).getChildren().size() == 0;
+ assert cache.getNode(A).getChildren().size() == 1;
+ cache.removeNode(AB);
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
+ Transaction t = tm.suspend();
- assert tl.cache.getNode(AB) != null;
- assert tl.cache.getNode(A).getChild(AB.getLastElement()) != null;
- assert tl.cache.getNode(A).getChildren().size() == 1;
- tl.tm.resume(t);
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
- tl.tm.commit();
+ assert cache.getNode(AB) != null;
+ assert cache.getNode(A).getChild(AB.getLastElement()) != null;
+ assert cache.getNode(A).getChildren().size() == 1;
- assert tl.cache.getNode(A).getChildren().size() == 0;
- assert tl.cache.getNode(A).hasChild(AB.getLastElement()) == false;
- assert tl.cache.getNode(AB) == null;
+ tm.resume(t);
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
+ tm.commit();
+
+ assert cache.getNode(A).getChildren().size() == 0;
+ assert cache.getNode(A).hasChild(AB.getLastElement()) == false;
+ assert cache.getNode(AB) == null;
}
public void testOverwritingOnInsert() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t2 = tl.tm.suspend();
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction t1 = tm.suspend();
- tl.tm.resume(t1);
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t2 = tm.suspend();
+
+ tm.resume(t1);
t1.commit();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
- tl.tm.resume(t2);
+ tm.resume(t2);
t2.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testOverwritingOnInsert2() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- Transaction t2 = tl.tm.suspend();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t1 = tm.suspend();
- tl.tm.resume(t1);
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ Transaction t2 = tm.suspend();
+
+ tm.resume(t1);
t1.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
- tl.tm.resume(t2);
+ tm.resume(t2);
t2.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testOverwritingOnInsert3() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(AB, "k", "v2");
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert null == tl.cache.get(ABC, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.tm.commit();
+ tm.begin();
+ cache.put(AB, "k", "v2");
+ assert "v2".equals(cache.get(AB, "k"));
+ assert null == cache.get(ABC, "k");
+ Transaction t1 = tm.suspend();
- assert "v".equals(tl.cache.get(ABC, "k"));
- assert "v".equals(tl.cache.get(AB, "k"));
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+ tm.commit();
- tl.tm.resume(t1);
+ assert "v".equals(cache.get(ABC, "k"));
+ assert "v".equals(cache.get(AB, "k"));
+
+ tm.resume(t1);
t1.commit();
- assert "v2".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ assert "v2".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
}
public void testConcurrentInsertRemove1() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.removeNode(AB);
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
- tl.tm.commit();
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+ Transaction t1 = tm.suspend();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ tm.commit();
- tl.tm.resume(t1);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+
+ tm.resume(t1);
t1.commit();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
}
public void testConcurrentInsertRemove2() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- tl.cache.put(AB, "k", "v");
- tl.tm.begin();
- tl.cache.removeNode(AB);
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
- Transaction t1 = tl.tm.suspend();
+ cache.put(AB, "k", "v");
- tl.tm.begin();
- assert "v".equals(tl.cache.get(AB, "k"));
- tl.cache.put(ABC, "k", "v");
- assert "v".equals(tl.cache.get(ABC, "k"));
- tl.tm.commit();
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ Transaction t1 = tm.suspend();
- assert "v".equals(tl.cache.get(AB, "k"));
- assert "v".equals(tl.cache.get(ABC, "k"));
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ tm.commit();
- tl.tm.resume(t1);
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+
+ tm.resume(t1);
t1.commit();
- assert null == tl.cache.get(ABC, "k");
- assert null == tl.cache.get(AB, "k");
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/NodeMoveMvccTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,6 @@
@Override
protected void checkLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -45,7 +44,6 @@
@Override
protected void checkLocksDeep()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -65,7 +63,6 @@
@Override
protected void assertNoLocks()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
LockManager lm = cr.getComponent(LockManager.class);
InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
@@ -74,7 +71,6 @@
public void testNonexistentSource()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
cache.put(A_B_C, "k", "v");
assert "v".equals(cache.get(A_B_C, "k"));
assert 1 == cache.getNode(A_B).getChildren().size();
@@ -91,7 +87,6 @@
public void testNonexistentTarget()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
cache.put(A_B_C, "k", "v");
assert "v".equals(cache.get(A_B_C, "k"));
assert 1 == cache.getNode(A_B).getChildren().size();
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeAPIMVCCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -13,6 +13,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* An MVCC version of {@link org.jboss.cache.api.NodeAPITest}
*/
@@ -32,13 +34,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
- TransactionManager tm = cache.getTransactionManager();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an MVCC locking chain!!";
if (i instanceof OptimisticNodeInterceptor) assert false : "Not an MVCC locking chain!!";
@@ -58,8 +58,6 @@
@Override
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getNode(A_B) != null;
assert cache.getNode(A_C) != null;
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/NodeReplicatedMoveMvccTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,10 +25,4 @@
{
c.setIsolationLevel(IsolationLevel.READ_COMMITTED);
}
-
- @Override
- public void testInvalidations() throws Exception
- {
- // TODO: Think about how this test should be written for MVCC
- }
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeAPIMVCCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -11,6 +11,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* An MVCC version of {@link org.jboss.cache.api.NodeAPITest}
*/
@@ -31,12 +33,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an MVCC locking chain!!";
if (i instanceof OptimisticNodeInterceptor) assert false : "Not an MVCC locking chain!!";
@@ -56,8 +57,6 @@
@Override
protected void childrenUnderTxCheck() throws Exception
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getNode(A_B) != null;
assert cache.getNode(A_C) != null;
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/NodeReplicatedMoveMvccTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,9 +26,4 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
}
- @Override
- public void testInvalidations() throws Exception
- {
- // TODO: Think about how this test should be written for MVCC
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -17,10 +17,6 @@
public void testRepeatableReadWithRemove() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
cache.put(AB, "k", "v");
tm.begin();
@@ -45,10 +41,6 @@
public void testRepeatableReadWithEvict() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
cache.put(AB, "k", "v");
tm.begin();
@@ -73,10 +65,6 @@
public void testRepeatableReadWithNull() throws Exception
{
- LockTestBaseTL tl = threadLocal.get();
- Cache<String, String> cache = tl.cache;
- TransactionManager tm = tl.tm;
-
assert cache.getNode(AB) == null;
tm.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
@BeforeMethod
public void setUp()
{
- cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL), false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setIsolationLevel(repeatableRead ? IsolationLevel.REPEATABLE_READ : IsolationLevel.READ_COMMITTED);
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedOptNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -22,9 +22,6 @@
public void testTombstoneRevival()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
modifier.put(parent, K, V);
modifier.removeNode(parent);
@@ -48,16 +45,12 @@
public void testTombstoneVersioningFailure() throws Exception
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
modifier.put(parent, K, V);
- DummyInMemoryCacheLoader loader = loaderTL.get();
-
+
// test that this exists in the (shared) loader
assert loader.get(parent) != null;
assert loader.get(parent).size() > 0;
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/InvalidatedPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -11,6 +11,8 @@
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.AfterClass;
import java.util.Properties;
@@ -21,7 +23,7 @@
@Test(groups = {"functional", "pessimistic"}, testName = "api.nodevalidity.InvalidatedPessNodeValidityTest")
public class InvalidatedPessNodeValidityTest extends NodeValidityTestBase
{
- protected ThreadLocal<DummyInMemoryCacheLoader> loaderTL = new ThreadLocal<DummyInMemoryCacheLoader>();
+ protected DummySharedInMemoryCacheLoader loader;
public InvalidatedPessNodeValidityTest()
{
@@ -39,20 +41,18 @@
return newCache();
}
- @AfterMethod
+ @AfterClass
public void emptyCacheLoader()
{
- DummySharedInMemoryCacheLoader loader = (DummySharedInMemoryCacheLoader) loaderTL.get();
- if (loader != null) loader.wipeBin();
- loaderTL.set(null);
+ loader.wipeBin();
}
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- Cache<String, String> cache = f.createCache(c, false);
+ Cache<String, String> cache = f.createCache(c, false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
// need a cache loader as a shared data source between the 2 instances
@@ -71,8 +71,7 @@
CacheSPI spi = (CacheSPI) cache;
- DummyInMemoryCacheLoader loader = (DummyInMemoryCacheLoader) spi.getCacheLoaderManager().getCacheLoader();
- loaderTL.set(loader);
+ loader = (DummySharedInMemoryCacheLoader) spi.getCacheLoaderManager().getCacheLoader();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/LocalPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,23 +15,12 @@
@Test(groups = {"functional", "pessimistic"}, testName = "api.nodevalidity.LocalPessNodeValidityTest")
public class LocalPessNodeValidityTest extends NodeValidityTestBase
{
- private ThreadLocal<Cache<String, String>> cacheTL = new ThreadLocal<Cache<String, String>>();
-
public LocalPessNodeValidityTest()
{
clustered = false;
nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
}
- @AfterMethod
- public void tearDown()
- {
- Cache<String, String> cache = cacheTL.get();
- super.tearDown();
- TestingUtil.killCaches(cache);
- cacheTL.set(null);
- }
-
protected Cache<String, String> createObserver()
{
return createModifier();
@@ -39,17 +28,10 @@
protected Cache<String, String> createModifier()
{
- Cache<String, String> cache = cacheTL.get();
-
- if (cache == null)
- {
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
- cache = f.createCache(false);
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ Cache<String, String> cache = f.createCache(false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
cache.start();
- cacheTL.set(cache);
return cache;
- }
- return cache;
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/NodeValidityTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -1,11 +1,6 @@
package org.jboss.cache.api.nodevalidity;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeNotValidException;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -24,7 +19,7 @@
* @since 2.1.0
*/
@Test(groups = {"functional"})
-public abstract class NodeValidityTestBase
+public abstract class NodeValidityTestBase extends AbstractMultipleCachesTest
{
protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
@@ -34,12 +29,12 @@
// needed to test tombstones
protected boolean invalidation = false;
- protected ThreadLocal<Cache<String, String>> observerTL = new ThreadLocal<Cache<String, String>>();
- protected ThreadLocal<Cache<String, String>> modifierTL = new ThreadLocal<Cache<String, String>>();
-
+
protected static final Fqn parent = Fqn.fromString("/parent");
protected static final Fqn child = Fqn.fromString("/parent/child");
protected static final String K = "k", V = "v";
+ protected Cache<String, String> observer;
+ protected Cache<String, String> modifier;
protected abstract Cache<String, String> createObserver();
@@ -61,31 +56,16 @@
return nodeLockingScheme == NodeLockingScheme.OPTIMISTIC;
}
- @BeforeMethod
- public void setUp()
+ protected void createCaches()
{
- Cache<String, String> observer = createObserver();
- Cache<String, String> modifier = createModifier();
- observerTL.set(observer);
- modifierTL.set(modifier);
+ observer = createObserver();
+ modifier = createModifier();
+ registerCaches(observer, modifier);
if (clustered) TestingUtil.blockUntilViewsReceived(60000, observer, modifier);
}
- @AfterMethod
- public void tearDown()
- {
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
- TestingUtil.killCaches(observer, modifier);
- observerTL.set(null);
- modifierTL.set(null);
- }
-
public void testRemoval()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-// observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -100,9 +80,6 @@
public void testRemovalWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-// observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
observer.put(child, K, V);
Node<String, String> obsParentNode = observer.getRoot().getChild(parent);
@@ -120,9 +97,6 @@
public void testMove()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
Fqn newParent = Fqn.fromString("/newParent/parent");
//observer.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -147,9 +121,6 @@
public void testMoveWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
Fqn newParent = Fqn.fromString("/newParent/parent");
Fqn newChild = Fqn.fromString("/newParent/parent/child");
@@ -181,9 +152,6 @@
public void testEvict()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
// eviction should affect validity
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -199,9 +167,6 @@
public void testOperationsOnInvalidNode()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
observer.put(parent, K, V);
Node<String, String> obsNode = observer.getRoot().getChild(parent);
@@ -317,9 +282,6 @@
public void testExistenceOfTombstones()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
@@ -352,9 +314,6 @@
public void testExistenceOfTombstonesWithChildren()
{
- Cache<String, String> observer = observerTL.get();
- Cache<String, String> modifier = modifierTL.get();
-
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/nodevalidity/ReplicatedPessNodeValidityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,11 +25,11 @@
protected Cache<String, String> newCache()
{
- CacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> f = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- Cache<String, String> cache = f.createCache(c, false);
+ Cache<String, String> cache = f.createCache(c, false, getClass());
nodeLockingSchemeSpecificSetup(cache.getConfiguration());
cache.start();
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/optimistic/NodeAPIOptimisticTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,12 +26,11 @@
protected void assertNodeLockingScheme()
{
- CacheSPI<Object, Object> cache = cacheTL.get();
-
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
boolean interceptorChainOK = false;
- for (CommandInterceptor i : cache.getInterceptorChain())
+ List<CommandInterceptor> chain = cache.getInterceptorChain();
+ for (CommandInterceptor i : chain)
{
if (i instanceof PessimisticLockInterceptor) assert false : "Not an optimistic locking chain!!";
if (i instanceof OptimisticNodeInterceptor) interceptorChainOK = true;
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -6,6 +6,9 @@
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.lock.NodeLock;
import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.transaction.Transaction;
@@ -31,16 +34,25 @@
}
}
+ private static Log log = LogFactory.getLog(PFERPessimisticTestBase.class);
+
/**
* Locks could only occur on the parent node is write locked since if the child node exists it is a no-op anyway.
* If the parent node is read locked as well, there is no issue.
*/
public void testNoOpWhenLockedAnd0msTimeout() throws Exception
{
+ log.warn("******** Here is where it is not going to happen");
// create the parent node first ...
replListener2.expect(PutKeyValueCommand.class);
cache1.put(parentFqn, key, value);
- replListener2.waitForReplicationToOccur(10000);
+ try
+ {
+ replListener2.waitForReplicationToOccur(10000);
+ } finally
+ {
+ log.warn("******** Here is where it did not happen!!!");
+ }
replListener2.expectWithTx(PutKeyValueCommand.class);
tm1.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -18,8 +18,6 @@
import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.jgroups.Address;
import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.SystemException;
@@ -29,7 +27,7 @@
import java.util.Vector;
@Test(groups = {"functional", "jgroups", "transaction"})
-public abstract class PutForExternalReadTestBase
+public abstract class PutForExternalReadTestBase extends AbstractMultipleCachesTest
{
protected Configuration.CacheMode cacheMode;
protected NodeLockingScheme nodeLockingScheme;
@@ -46,14 +44,11 @@
protected boolean useTx;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+ protected void createCaches()
{
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
-
- cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false, getClass());
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache1.getConfiguration().setSerializationExecutorPoolSize(0);//this is very important for async tests!
cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -61,7 +56,7 @@
cache1.start();
tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
- cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false, getClass());
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache2.getConfiguration().setSerializationExecutorPoolSize(0); //this is very important for async tests!
cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
@@ -72,14 +67,9 @@
replListener2 = ReplicationListener.getReplicationListener(cache2);
TestingUtil.blockUntilViewsReceived(10000, cache1, cache2);
+ registerCaches(cache1, cache2);
}
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- TestingUtil.killCaches(cache1, cache2);
- }
-
public void testNoOpWhenNodePresent()
{
replListener2.expect(PutForExternalReadCommand.class);
@@ -148,6 +138,7 @@
// cleanup
TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
+ TestingUtil.extractComponentRegistry(cache1).rewire();
cache1.removeNode(fqn);
}
@@ -236,6 +227,7 @@
finally
{
TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
+ TestingUtil.extractComponentRegistry(cache1).rewire();
}
}
@@ -300,7 +292,6 @@
assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
- System.out.println("PutForExternalReadTestBase.testMemLeakOnSuspendedTransactions");
//do not expectWithTx a PFER replication, as the node already exists so this is a no-op
replListener2.expectWithTx(PutKeyValueCommand.class);
tm1.begin();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -130,7 +130,7 @@
{
CacheMode mode = CacheMode.REPL_SYNC;
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setUseRegionBasedMarshalling(true);
cache.getConfiguration().setInactiveOnStartup(true);
cache.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,6 +2,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Cache;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.CacheBlocked;
import org.jboss.cache.notifications.annotation.CacheUnblocked;
@@ -466,6 +467,22 @@
assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) == null : "Should NOT have backup data";
}
+
+ public void testConcurrency() throws Exception
+ {
+ Fqn f = Fqn.fromString("/a/b/c");
+ String k = "k";
+ String v = "v";
+
+ for (int i = 0; i < 10; i++)
+ {
+ caches.get(0).put(Fqn.fromRelativeElements(f, i), k, v);
+ assert v.equals(caches.get(1).get(Fqn.fromRelativeElements(f, i), k));
+ assert v.equals(caches.get(1).get(Fqn.fromRelativeElements(f, i), k));
+ }
+ }
+
+
@CacheListener
public static class CacheBlockListener
{
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,7 +41,7 @@
public void testNullConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(null);
assertNull(cache.getBuddyManager());
}
@@ -50,7 +50,7 @@
{
String xmlConfig = "<buddy enabled=\"false\"/>";
BuddyReplicationConfig config = getBuddyReplicationConfig(xmlConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(config);
assertNull(cache.getBuddyManager());
}
@@ -62,7 +62,7 @@
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setBuddyReplicationConfig(config);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
assertNotNull(cache.getBuddyManager());
@@ -86,7 +86,7 @@
public void testXmlConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(new XmlConfigurationParser().parseFile("configs/buddy-replication-cache.xml"), false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(new XmlConfigurationParser().parseFile("configs/buddy-replication-cache.xml"), false, getClass());
cache.create();
cache.start();
BuddyManager bm = cache.getBuddyManager();
@@ -116,7 +116,7 @@
{
String xmlConfig = "<buddy enabled=\"true\"/>";
BuddyReplicationConfig config = getBuddyReplicationConfig(xmlConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setBuddyReplicationConfig(config);
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationRejoinTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,8 +54,8 @@
// Cache1 will be used only for recovery.
// Cache2 will perform some updates on the objects and then fail.
- cache1 = new UnitTestCacheFactory<String, Integer>().createCache(c, false);
- cache2 = new UnitTestCacheFactory<String, Integer>().createCache(c.clone(), false);
+ cache1 = new UnitTestCacheFactory<String, Integer>().createCache(c, false, getClass());
+ cache2 = new UnitTestCacheFactory<String, Integer>().createCache(c.clone(), false, getClass());
}
@AfterMethod
@@ -144,7 +144,7 @@
checkRecoveredData(cache1, 1);
printCacheDetails("DATA GRAVITATED BACK TO CACHE1");
- cache2 = new UnitTestCacheFactory<String, Integer>().createCache(cfg);
+ cache2 = new UnitTestCacheFactory<String, Integer>().createCache(cfg, getClass());
printCacheDetails("BUDDY BACK");
runBuddyUpdatesAndFail();
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -134,7 +134,7 @@
protected CacheSPI<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, false, false, true), false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, false, false, true), false, getClass());
String threadId = Thread.currentThread().getName();
//c.getConfiguration().setClusterName("BuddyReplicationTest-" + threadId);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -247,7 +247,7 @@
Configuration cfg1 = cache1.getConfiguration();
configureEviction(cfg1);
Configuration cfg0 = cfg1.clone();
- CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg0, false);
+ CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg0, false, getClass());
// Store them for the teardown method
List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
@@ -297,9 +297,9 @@
Configuration cfg0 = cache0.getConfiguration();
configureEviction(cfg0);
Configuration cfg1 = cfg0.clone();
- CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg1, false);
+ CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg1, false, getClass());
Configuration cfg2 = cfg0.clone();
- CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false);
+ CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false, getClass());
// Store them for the teardown method
List<CacheSPI<Object, Object>> caches = new ArrayList<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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EmptyRegionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -36,7 +36,7 @@
c1 = createCache(1, null, false, false, false);
c1.getConfiguration().setUseRegionBasedMarshalling(true);
c1.getConfiguration().setFetchInMemoryState(true);
- c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
cache1.getConfiguration().setEvictionConfig(getEvictionConfig());
cache1.start();
- cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone());
+ cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -2,26 +2,27 @@
import org.easymock.EasyMock;
import static org.easymock.EasyMock.*;
+import org.jboss.cache.AbstractMultipleCachesTest;
import org.jboss.cache.Cache;
import org.jboss.cache.RPCManager;
+import org.jboss.cache.UnitTestCacheFactory;
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.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Collections;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
-import org.jboss.cache.UnitTestCacheFactory;
@Test(groups = "functional", sequential = true, testName = "cluster.ReplicationQueueTest")
-public class ReplicationQueueTest
+public class ReplicationQueueTest extends AbstractMultipleCachesTest
{
private static final int COUNT = 10;
Cache cache, cache2;
@@ -29,21 +30,20 @@
ComponentRegistry registry;
RPCManager originalRpcManager;
- @BeforeMethod
- public void setUp() throws CloneNotSupportedException
+ protected void createCaches() throws Throwable
{
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_ASYNC);
c.setUseReplQueue(true);
c.setReplQueueMaxElements(COUNT);
c.setReplQueueInterval(-1);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
registry = TestingUtil.extractComponentRegistry(cache);
replQ = registry.getComponent(ReplicationQueue.class);
originalRpcManager = cache.getConfiguration().getRuntimeConfig().getRPCManager();
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
-
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone(), getClass());
+ registerCaches(cache, cache2);
TestingUtil.blockUntilViewsReceived(60000, cache, cache2);
}
@@ -52,9 +52,7 @@
{
// reset the original RPCManager
injectRpcManager(originalRpcManager);
- TestingUtil.killCaches(cache, cache2);
- cache = null;
- cache2 = null;
+ registry.rewire();
}
private void injectRpcManager(RPCManager manager)
@@ -76,7 +74,7 @@
// check that nothing on the RPCManager will be called until we hit the replication queue threshold.
for (int i = 0; i < COUNT - 1; i++) cache.put("/a/b/c/" + i, "k", "v");
- assert replQ.elements.size() == COUNT - 1;
+ assertEquals(replQ.elements.size(), COUNT - 1);
// verify that no calls have been made on the mockRpcManager
verify(mockRpcManager);
@@ -99,8 +97,8 @@
public void testFlushConcurrency() throws Exception
{
// will create multiple threads to constantly perform a cache update, and measure the number of expected invocations on the RPC manager.
- final int numThreads = 25;
- final int numLoopsPerThread = 1000;
+ final int numThreads = 5;
+ final int numLoopsPerThread = 200;
int totalInvocations = numThreads * numLoopsPerThread;
@@ -153,7 +151,6 @@
ReplicationQueueNotifier notifier = new ReplicationQueueNotifier(cache);
notifier.waitUntillAllReplicated(250);
-// TestingUtil.sleepThread(250); // make sure the queue flushes
assert replQ.elements.size() == 0;
}
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -24,12 +24,12 @@
public void setUp() throws CloneNotSupportedException
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setUseReplQueue(true);
cache.getConfiguration().setReplQueueInterval(100);
cache.getConfiguration().setReplQueueMaxElements(10);
cache.start();
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cache.getConfiguration().clone(), getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
public void setUp()
{
Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cacheConfig, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -67,8 +67,8 @@
{
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- Cache<String, String> cache = instance.createCache(config, false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ Cache<String, String> cache = instance.createCache(config, false, getClass());
caches.add(cache);
return cache;
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -93,7 +93,7 @@
{
System.out.println("Processing file: " + aConfFile);
assert !appender.isFoundUnknownWarning();
- Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true);
+ Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true, getClass());
cache.stop();
assert !appender.isFoundUnknownWarning();
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -56,12 +56,12 @@
void initCaches() throws Exception
{
TestingUtil.recursiveFileRemove(tmpDir + cacheLoaderDir);
- CacheFactory<Integer, String> factory = new UnitTestCacheFactory<Integer, String>();
+ UnitTestCacheFactory<Integer, String> factory = new UnitTestCacheFactory<Integer, String>();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
conf.setEvictionConfig(buildEvictionConfig());
conf.setCacheLoaderConfig(buildCacheLoaderConfig());
conf.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache = factory.createCache(conf, true);// read in generic local xml
+ cache = factory.createCache(conf, true, getClass());// read in generic local xml
}
private CacheLoaderConfig buildCacheLoaderConfig()
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/DisabledEvictionThreadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -20,7 +20,7 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
cfg.getEvictionConfig().setWakeupInterval(0);
- c = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
RegionManager rm = cr.getComponent(RegionManager.class);
EvictionTimerTask ett = rm.getEvictionTimerTask();
@@ -39,7 +39,7 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
cfg.getEvictionConfig().setWakeupInterval(10);
- c = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
RegionManager rm = cr.getComponent(RegionManager.class);
EvictionTimerTask ett = rm.getEvictionTimerTask();
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new ElementSizeAlgorithmConfig(-1, 5)));
evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/test/"), new ElementSizeAlgorithmConfig(5000, 1)));
conf.setEvictionConfig(evConfig);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -196,7 +196,7 @@
try
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
regionManager = cache.getRegionManager();
assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
}
@@ -208,7 +208,7 @@
private CacheSPI<Object, Object> setupCache(String configurationName)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(configurationName, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(configurationName, false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
EvictionConfig econf = new EvictionConfig(eRC);
econf.setWakeupInterval(100);
conf.setEvictionConfig(econf);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
cache.start();
future = System.currentTimeMillis() + 500;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.util.internals.EvictionController;
-import org.jboss.cache.util.internals.EvictionWatcher;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -24,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
+
import org.jboss.cache.UnitTestCacheFactory;
/**
@@ -66,7 +65,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);// read in generic local xml
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());// read in generic local xml
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,7 +54,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
evController = new EvictionController(cache);
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -58,7 +58,7 @@
evConfig.setEvictionRegionConfigs(regionConfigs);
conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
conf.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
System.out.println("-- wakeupInterval is " + wakeupIntervalMillis);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
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;
@@ -72,7 +71,7 @@
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
}
public void testEviction() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -56,7 +56,7 @@
config.setEvictionConfig(evConfig);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
String dfltRootStr = "/a/";
String testRootStr = "/test/";
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
config.setEvictionConfig(buildEvictionConfig());
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
}
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -70,8 +70,8 @@
private void initCaches()
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Object> instance = new UnitTestCacheFactory<Object, Object>();
- cache = (CacheSPI<Object, Object>) instance.createCache(conf, false);
+ UnitTestCacheFactory<Object, Object> instance = new UnitTestCacheFactory<Object, Object>();
+ cache = (CacheSPI<Object, Object>) instance.createCache(conf, false, getClass());
EvictionConfig erc = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new LRUAlgorithmConfig(0, 0, 10)), 200);
conf.setEvictionConfig(erc);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false, getClass());
cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.getConfiguration().getEvictionConfig().setWakeupInterval(wakeupIntervalMillis);
@@ -41,7 +41,7 @@
cache1.getNotifier().addCacheListener(listener);
listener.resetCounter();
- cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache3.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache3.getConfiguration().setUseRegionBasedMarshalling(true);
cache3.getConfiguration().getEvictionConfig().setWakeupInterval(wakeupIntervalMillis);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/legacy/BackwardCompatibilityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -211,7 +211,7 @@
Cache cache = null;
try
{
- cache = new UnitTestCacheFactory().createCache(c);
+ cache = new UnitTestCacheFactory().createCache(c, getClass());
EvictionRegionConfig erc = cache.getRegion(Fqn.ROOT, false).getEvictionRegionConfig();
assert erc.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig;
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/minttl/MinTTLTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
ec.setWakeupInterval(200);
ec.addEvictionRegionConfig(regionCfg);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setEvictionConfig(ec);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryUnitTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,7 +15,7 @@
{
public void testConstruction()
{
- Cache c = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
+ Cache c = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), getClass());
c.put("/a", "b", "c");
TestingUtil.killCaches(c);
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -25,7 +25,7 @@
public void setUp() throws Exception
{
Configuration c = new Configuration();
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorConstructionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -157,14 +157,14 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
- CacheFactory cacheFactory2 = new UnitTestCacheFactory<Object, Object>();
- CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config);
+ UnitTestCacheFactory cacheFactory2 = new UnitTestCacheFactory<Object, Object>();
+ CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config, getClass());
defaultInterceptroCount = tmpCacheSPI.getInterceptorChain().size();
tmpCacheSPI.stop();
- CacheFactory cacheFactory = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cacheFactory = new UnitTestCacheFactory<Object, Object>();
config.setCustomInterceptors(interceptorConfig);
- cache = (CacheSPI) cacheFactory.createCache(config, true);
+ cache = (CacheSPI) cacheFactory.createCache(config, true, getClass());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
configuration.setCacheMode(LOCAL);
configuration.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
configuration.setUseLazyDeserialization(false);
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configuration,false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(configuration,false, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LateConfigurationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
}
@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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -428,7 +428,7 @@
Configuration c = new Configuration();
c.setCacheMode(cache_mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
return retval;
}
Modified: core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/integration/UnitTestCacheFactoryCacheManager.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -73,7 +73,7 @@
@Override
protected Cache<Object, Object> createCache(Configuration config)
{
- return new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ return new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
}
Modified: core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -55,8 +55,8 @@
private Cache<String, Object> createCache(boolean optimistic)
{
- CacheFactory<String, Object> cf = new UnitTestCacheFactory<String, Object>();
- Cache<String, Object> cache = cf.createCache("configs/local-tx.xml", false);
+ UnitTestCacheFactory<String, Object> cf = new UnitTestCacheFactory<String, Object>();
+ Cache<String, Object> cache = cf.createCache("configs/local-tx.xml", false, getClass());
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
caches.add(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
@BeforeMethod
public void createLatches()
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/MarshalledValueInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,13 +32,13 @@
public void testDefaultInterceptorStack()
{
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
TestingUtil.killCaches(c);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setUseLazyDeserialization(true);
c.start();
@@ -49,7 +49,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(true);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg, getClass());
System.out.println(CachePrinter.printCacheInterceptors(c));
assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) != null;
@@ -59,7 +59,7 @@
{
Configuration cfg = new Configuration();
cfg.setUseLazyDeserialization(false);
- c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg);
+ c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cfg, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -876,7 +876,7 @@
if (optimistic) c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
toClean.add(cache);
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -66,8 +66,8 @@
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setEvictionConfig(ec);
- c1 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
- c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), false);
+ c1 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
+ c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -45,8 +45,8 @@
c1.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c2.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml");
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/local-tx.xml", getClass());
tm = cache.getTransactionManager();
}
@@ -151,7 +151,7 @@
cache = null;
}
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/replSync.xml", false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache("configs/replSync.xml", false, getClass());
cache.getConfiguration().setCacheMode(CacheMode.REPL_ASYNC);
cache.start();
tm = cache.getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/JmxRegistrationManagerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.jmx;
-import com.mchange.v2.c3p0.util.TestUtils;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
@@ -35,9 +34,8 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import org.jboss.cache.CacheSPI;
+
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.util.TestingUtil;
/**
* Tester class for {@link JmxRegistrationManager}.
@@ -67,7 +65,7 @@
{
Configuration localConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL);
localConfig.setExposeManagementStatistics(true);
- Cache cache = cacheFactory.createCache(localConfig);
+ Cache cache = cacheFactory.createCache(localConfig, getClass());
JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.LOCAL_CACHE_PREFIX) == 0;
regManager.registerAllMBeans();
@@ -82,7 +80,7 @@
{
Configuration localConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
localConfig.setExposeManagementStatistics(true);
- Cache cache = cacheFactory.createCache(localConfig);
+ Cache cache = cacheFactory.createCache(localConfig, getClass());
JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.REPLICATED_CACHE_PREFIX) == 0;
regManager.registerAllMBeans();
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -111,8 +111,8 @@
protected Cache<String, String> createCache(Configuration config)
{
- CacheFactory<String, String> factory = new UnitTestCacheFactory<String, String>();
- cache = factory.createCache(config, false);
+ UnitTestCacheFactory<String, String> factory = new UnitTestCacheFactory<String, String>();
+ cache = factory.createCache(config, false, getClass());
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/NotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -280,8 +280,8 @@
private CacheSPI<Object, Object> createCache(String clusterName) throws Exception
{
Configuration config = createConfiguration(clusterName);
- CacheFactory<Object, Object> factory = new UnitTestCacheFactory<Object, Object>();
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) factory.createCache(config, false);
+ UnitTestCacheFactory<Object, Object> factory = new UnitTestCacheFactory<Object, Object>();
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) factory.createCache(config, false, getClass());
cache.create();
// start the cache after the listener has been registered
Modified: core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -68,8 +68,8 @@
{
newImpl = getNewCacheLoader((Properties) props.clone());
oldImpl = getOldLoader((Properties) props.clone());
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
- cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
+ cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
protected void configureCache(String props) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -130,7 +130,7 @@
* name and TransactionManagerLookupClass (transactional) propertes only.
* the CacheSPI object is not used otherwise during testing.
*/
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setClusterName("myCluster");
if (transactional)
{
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
public void setUp() throws Exception
{
if (cache != null) tearDown();
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, false));
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,7 +42,7 @@
public void testSingleLoaderNoPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
String s = "bin=" + getClass().getName();
@@ -67,7 +67,7 @@
public void testSingleLoaderPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
String s = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), s, false, false, false, true));
@@ -94,7 +94,7 @@
public void testTwoLoadersPurge() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
String xml =
" <loaders passivation=\"false\">\n" +
" <loader class=\"org.jboss.cache.loader.DummySharedInMemoryCacheLoader\" fetchPersistentState=\"true\"\n" +
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
@BeforeMethod
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration c = cache.getConfiguration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -10,8 +10,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
@@ -44,11 +42,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "debug=true", false, true, false));
cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "debug=true", false, true, false));
cache2.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(ignoreMods1, ignoreMods2));
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -65,8 +65,8 @@
c2.setUseRegionBasedMarshalling(useRegionBasedMarshalling);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.getConfiguration().setSerializationExecutorPoolSize(0);
cache2.getConfiguration().setSerializationExecutorPoolSize(0);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ConcurrentPutRemoveEvictTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
CacheLoaderConfig cacheLoaderConfig = getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false);
Configuration cfg = new Configuration();
cfg.setCacheLoaderConfig(cacheLoaderConfig);
- cache = new UnitTestCacheFactory<String, String>().createCache(cfg);
+ cache = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
cache.put(fqn, key, "value");
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/DataSourceIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -75,7 +75,7 @@
// expected
}
props = TestDbPropertiesFactory.getTestDbProperties();
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(props));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
public void testBlockingProblem() throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
//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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,7 +27,7 @@
public void setUp() throws Exception
{
props = TestDbPropertiesFactory.getTestDbProperties();
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", JDBCCacheLoader.class.getName(), props, false, false, true));
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -93,11 +93,11 @@
public void testSimpleStateTransfer() throws Exception
{
- first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1));
+ first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
first.put("/a/b/c", "key", "value");
first.put("/a/b/d", "key", "value");
first.put("/a/b/e", "key", "value");
- second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2));
+ second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());
assert second.get("/a/b/c","key").equals("value");
assert second.get("/a/b/d","key").equals("value");
assert second.get("/a/b/e","key").equals("value");
@@ -111,7 +111,7 @@
{
long startTime = System.currentTimeMillis();
- first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1));
+ first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
long cacheStartTime = System.currentTimeMillis() - startTime;
System.out.println("cacheStartTime = " + cacheStartTime);
for (int i = 0; i < 5012; i++)
@@ -120,7 +120,7 @@
if (i%1000 == 0) System.out.println(i + " operations executed so far");
}
startTime = System.currentTimeMillis();
- second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2));
+ second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());
long stateTranferTime = System.currentTimeMillis() - startTime - cacheStartTime;
for (int i = 0; i < 5012; i+=100)
Modified: core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -14,7 +14,7 @@
protected void configureCache() throws Exception
{
- delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/PreloadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -29,13 +29,13 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL);
String props = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/a", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
cache.put(fqn, key, value);
assertExists();
cache.destroy();
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
}
@@ -44,22 +44,22 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.LOCAL);
String props = "bin=" + getClass().getName();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/a", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
cache.put(fqn, key, value);
assertExists();
cache.destroy();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/c,/a,/b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig("/c, /a, /b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
c.setCacheLoaderConfig(getSingleCacheLoaderConfig(" /c, /a, /b", DummySharedInMemoryCacheLoader.class.getName(), props, false, false, false));
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone());
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
assertExists();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,8 +46,8 @@
c1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, true));
c2.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCountingCacheLoader.class.getName(), "", false, false, true));
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,9 +46,9 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
+ cache3 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache1.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache2.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setCacheLoaderConfig(getCacheLoaderConfig());
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
cache.start();
loader = cache.getCacheLoaderManager().getCacheLoader();
@@ -121,7 +121,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -133,7 +133,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
@@ -145,7 +145,7 @@
{
createTcpCacheServer();
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
c1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
// cache1.setReplQueueInterval(3000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
cache1.create();
cache1.start();
@@ -51,7 +51,7 @@
c2.setLockAcquisitionTimeout(2000);
// cache2.setReplQueueInterval(3000);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache2.create();
cache2.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingSetDataTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -17,7 +17,6 @@
import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -44,7 +43,7 @@
private void setUp(NodeLockingScheme locking) throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
clc.addIndividualCacheLoaderConfig(iclc);
@@ -146,8 +145,8 @@
assertEquals(m0, cache.peek(parent, false).getData());
verify(mockCacheLoader);
- CachePrinter.printCacheDetails(cache);
- cache.toString();
+ CachePrinter.printCacheDetails(cache);
+ cache.toString();
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
clc.addIndividualCacheLoaderConfig(iclc);
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -124,7 +124,7 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -154,7 +154,7 @@
throw new IllegalStateException(cacheID + " already created");
}
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockParentRootFlagTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -69,7 +69,7 @@
Cache c = null;
try
{
- c = new UnitTestCacheFactory().createCache(false);
+ c = new UnitTestCacheFactory().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(nls);
c.getConfiguration().setLockParentForChildInsertRemove(set);
if (nls.isVersionedScheme())
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -78,7 +78,7 @@
CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticAcquireAllTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -83,7 +83,7 @@
private CacheSPI<Object, Object> createCache(Configuration.CacheMode mode, IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.getConfiguration().setCacheMode(mode);
c.getConfiguration().setIsolationLevel(level);
Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -91,7 +91,7 @@
private CacheSPI<Object, Object> createCache(IsolationLevel level)
{
- CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setStateRetrievalTimeout(10000);
Modified: core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/WriteLockOnParentTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -24,7 +24,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
// reduce LAT so the test runs faster
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -16,7 +16,6 @@
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -42,7 +41,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -80,7 +80,7 @@
// Use marshaller
c.setUseLazyDeserialization(useMarshalledValues);
c.setUseRegionBasedMarshalling(!useMarshalledValues);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingJDBCTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -99,7 +99,7 @@
// ensure cleanup after each test
prop.setProperty("cache.jdbc.table.drop", "true");
- Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
Configuration config = cache.getConfiguration();
config.setUseRegionBasedMarshalling(useRegionBased);
config.setInactiveOnStartup(useRegionBased);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -15,7 +15,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
@@ -128,7 +127,7 @@
Configuration config = new Configuration();
config.setUseRegionBasedMarshalling(useRegionBased);
config.setInactiveOnStartup(useRegionBased);
- Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
EvictionConfig ec = new EvictionConfig();
ec.setWakeupInterval(1000000); // a long time; really disabled
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -281,7 +281,7 @@
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- Cache<Object, Object> cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ Cache<Object, Object> cache = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,7 +35,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- c1 = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false);
+ c1 = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_ASYNC), false, getClass());
c1.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
String jgroupsCfg = c1.getConfiguration().getClusterConfig();
@@ -50,7 +50,7 @@
c1.getConfiguration().setUseRegionBasedMarshalling(true);
c1.start();
- c2 = new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone());
+ c2 = new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone(), getClass());
replListener2 = ReplicationListener.getReplicationListener(c2);
TestingUtil.blockUntilViewsReceived(60000, c1, c2);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,12 +49,12 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false, getClass());
if (cache1.getConfiguration().getBuddyReplicationConfig() != null)
cache1.getConfiguration().setBuddyReplicationConfig(null);
cache1.getConfiguration().setUseLazyDeserialization(true);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false, getClass());
cache1.start();
cache2.start();
@@ -259,8 +259,8 @@
public void testCacheLoaders() throws CloneNotSupportedException
{
tearDown();
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false, getClass());
CacheLoaderConfig clc = new CacheLoaderConfig();
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -48,7 +48,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -30,7 +30,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache();
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
Configuration c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setUseRegionBasedMarshalling(true);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
c1.setUseRegionBasedMarshalling(!useMarshalledValues);
c1.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c1.setSyncReplTimeout(60000);// to aid with debugging
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
cache1.start();
Configuration c2 = new Configuration();
@@ -58,7 +58,7 @@
c2.setUseRegionBasedMarshalling(!useMarshalledValues);
c2.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c2.setSyncReplTimeout(60000);// to aid with debugging
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
cache2.start();
classLoader = getClassLoader();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,8 +27,8 @@
Configuration c = new Configuration();
c.setCacheMode(CacheMode.REPL_SYNC);
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
- cache1 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone());
- cache2 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone());
+ cache1 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());
+ cache2 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -76,7 +76,7 @@
private CacheSPI<Object, Object> createCache(String name)
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false, getClass());
cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setClusterName(name + "-" + Thread.currentThread().getName());
// Use marshaller
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -152,6 +152,6 @@
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,7 +34,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setExposeManagementStatistics(true);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -92,14 +92,14 @@
private CacheSPI<String, Object> createCache() throws Exception
{
- CacheFactory<String, Object> instance = new UnitTestCacheFactory<String, Object>();
+ UnitTestCacheFactory<String, Object> instance = new UnitTestCacheFactory<String, Object>();
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setCacheLoaderConfig(getCacheLoaderConfig());
c.setExposeManagementStatistics(true);
- CacheSPI<String, Object> cache = (CacheSPI<String, Object>) instance.createCache(c, false);
+ CacheSPI<String, Object> cache = (CacheSPI<String, Object>) instance.createCache(c, false, getClass());
cache.create();
cache.start();
return cache;
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -217,7 +217,7 @@
c.setExposeManagementStatistics(true);
c.setClusterName(clusterName);
CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>)
- new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -32,7 +32,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK));
- cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/ChannelInjectionPreferenceTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,7 +34,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
config.setClusterConfig(UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK));
- cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());
cacheStarted = false;
}
Modified: core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/mvcc/MVCCFullStackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -29,7 +29,7 @@
public void testDefaultConfiguration()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache();
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
assert TestingUtil.findInterceptor(cache, MVCCLockingInterceptor.class) != null : "MVCC interceptor should be in stack";
assert cache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.MVCC;
@@ -65,7 +65,7 @@
Configuration c = new Configuration();
c.setNodeLockingScheme(NodeLockingScheme.MVCC);
c.setIsolationLevel(configuredWith);
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
assert cache.getConfiguration().getIsolationLevel() == expected : "Expected to change isolation level from " + configuredWith + " to " + expected + " but was " + cache.getConfiguration().getIsolationLevel();
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/AsyncNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -18,7 +18,7 @@
Cache<String, String> c = null;
try
{
- c = new UnitTestCacheFactory<String, String>().createCache();
+ c = new UnitTestCacheFactory<String, String>().createCache(getClass());
CountDownLatch latch = new CountDownLatch(2);
AbstractListener syncListener = new Listener(latch);
AbstractListener asyncListener = new AsyncListener(latch);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/BuddyGroupChangeNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,16 +34,16 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
+ UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
Configuration conf = new Configuration();
conf.setCacheMode(Configuration.CacheMode.REPL_SYNC);
BuddyReplicationConfig brc = new BuddyReplicationConfig();
brc.setEnabled(true);
conf.setBuddyReplicationConfig(brc);
- c1 = cf.createCache(conf, false);
- c2 = cf.createCache(conf.clone(), false);
- c3 = cf.createCache(conf.clone(), false);
+ c1 = cf.createCache(conf, false, getClass());
+ c2 = cf.createCache(conf.clone(), false, getClass());
+ c3 = cf.createCache(conf.clone(), false, getClass());
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
clc.setPassivation(true);
c.setCacheLoaderConfig(clc);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,7 +59,7 @@
if (optLocking)
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/ConcurrentNotificationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,7 +40,7 @@
{
// need 2 caches to test viewChange notifications
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration conf1 = new Configuration();
Configuration conf2 = new Configuration();
@@ -54,8 +54,8 @@
conf2.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
conf1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), (Properties)null, false, false, false));
- cache1 = instance.createCache(conf1, false);
- cache2 = instance.createCache(conf2, false);
+ cache1 = instance.createCache(conf1, false, getClass());
+ cache2 = instance.createCache(conf2, false, getClass());
listener = new TestCacheListener();
cache1.addCacheListener(listener);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifyNodeInvalidatedTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -26,8 +26,8 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.INVALIDATION_SYNC, false);
cfg.setNodeLockingScheme(NodeLockingScheme.MVCC);
- c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone());
- c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone());
+ c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
+ c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
EventLog eventLog = new EventLog();
c2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
c2.put("/a/b/c", "x", "y");
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -86,9 +86,9 @@
// more time to help with debugging
c.setSyncReplTimeout(60000);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache1 = instance.createCache(c);
- cache2 = instance.createCache(c.clone());
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache1 = instance.createCache(c, getClass());
+ cache2 = instance.createCache(c.clone(), getClass());
eventLog1.events.clear();
eventLog2.events.clear();
@@ -649,8 +649,8 @@
cache1.put(fqnB, data);
// create cache2
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache2 = instance.createCache(cache1.getConfiguration().clone(), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache2 = instance.createCache(cache1.getConfiguration().clone(), false, getClass());
cache2.create();
eventLog2.events.clear();
cache2.addCacheListener(eventLog2);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,7 +60,7 @@
protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL), false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL), false, getClass());
if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
return cache;
}
@@ -140,7 +140,7 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
@@ -159,7 +159,7 @@
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.create();
cache.start();
@@ -193,7 +193,7 @@
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.getConfiguration().setSerializationExecutorPoolSize(0);
if (start)
@@ -231,7 +231,7 @@
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setCacheLoaderConfig(getCacheLoaderConfig(shared, false));
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.create();
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
@BeforeMethod
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,7 +33,7 @@
public void setUp() throws IOException
{
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -33,14 +33,14 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
caches = new ArrayList<Cache<Object, Object>>(2);
- caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false));
+ caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass()));
caches.get(0).start();
c = new Configuration();
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
- caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false));
+ caches.add(new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass()));
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -35,12 +35,12 @@
Configuration c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cacheModeLocal = new Option();
cacheModeLocal.setCacheModeLocal(true);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -52,7 +52,7 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c);
+ return (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,8 +40,8 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,14 +60,14 @@
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
Configuration c = new Configuration();
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.setNodeLockingScheme(nodeLockingScheme);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(c);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(c, getClass());
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticFailSilentlyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,8 +41,8 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(false, getClass());
// very short acquisition timeout
cache.getConfiguration().setLockAcquisitionTimeout(100);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticLockAcquisitionTimeoutTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/PessimisticSuppressLockingTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -43,9 +43,9 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
config.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI<String, String>) instance.createCache(config);
+ cache = (CacheSPI<String, String>) instance.createCache(config, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -62,7 +62,7 @@
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setClusterName("test");
@@ -72,7 +72,7 @@
c.setCacheMode(cacheMode);
c.setSerializationExecutorPoolSize(0);
- cache1 = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache1 = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache1.start();
c = new Configuration();
@@ -83,7 +83,7 @@
c.setCacheMode(cacheMode);
c.setSerializationExecutorPoolSize(0);
- cache2 = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache2 = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache2.start();
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,17 +7,68 @@
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.jboss.cache.*;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationOptLocksTest")
public class SyncInvalidationOptLocksTest extends CacheModeLocalTestBase
{
+
public SyncInvalidationOptLocksTest()
{
cacheMode = Configuration.CacheMode.INVALIDATION_SYNC;
nodeLockingScheme = "OPTIMISTIC";
isInvalidation = true;
}
+
+
+ private void assertInvalidated(Cache cache, Fqn fqn, String msg)
+ {
+ assert cache.getRoot().getChild(fqn) == null : msg;
+ NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
+ assert true : msg;
+ assert !n.isValid() : msg;
+ }
+
+ public void testMoveInvalidations() throws Exception
+ {
+
+ Node rootNode = cache1.getRoot();
+
+ Node<Object, Object> nodeA = rootNode.addChild(Fqn.fromString("/a"));
+ Node<Object, Object> nodeB = nodeA.addChild(Fqn.fromString("/b"));
+
+ nodeA.put("key", "valueA");
+ nodeB.put("key", "valueB");
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/a")).getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromRelativeElements(Fqn.fromString("/a"), Fqn.fromString("/b").getLastElement()), "Should be invalidated");
+
+ // now move...
+ cache1.move(nodeB.getFqn(), Fqn.ROOT);
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromString("/b"), "Should be invalidated");
+
+ // now make sure a node exists on cache 2
+ cache2.getRoot().addChild(Fqn.fromString("/a")).put("k2", "v2");
+
+ // te invalidation will happen in afterCompletion, hence no exception!
+ try
+ {
+ cache1.move(Fqn.fromString("/b"), Fqn.fromString("/a"));// should throw an NPE
+ }
+ catch (Exception expected)
+ {
+ assert false : "Should not have thrown an exception!";
+ }
+ }
+
}
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -7,17 +7,66 @@
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.jboss.cache.*;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.SyncInvalidationPessLocksTest")
public class SyncInvalidationPessLocksTest extends CacheModeLocalTestBase
{
- public SyncInvalidationPessLocksTest()
+
+ public SyncInvalidationPessLocksTest()
{
cacheMode = Configuration.CacheMode.INVALIDATION_SYNC;
nodeLockingScheme = "PESSIMISTIC";
isInvalidation = true;
}
+
+ public void testMoveInvalidations() throws Exception
+ {
+
+ Node rootNode = cache1.getRoot();
+
+ Node<Object, Object> nodeA = rootNode.addChild(Fqn.fromString("/a"));
+ Node<Object, Object> nodeB = nodeA.addChild(Fqn.fromString("/b"));
+
+ nodeA.put("key", "valueA");
+ nodeB.put("key", "valueB");
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/a")).getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromRelativeElements(Fqn.fromString("/a"), Fqn.fromString("/b").getLastElement()), "Should be invalidated");
+
+ // now move...
+ cache1.move(nodeB.getFqn(), Fqn.ROOT);
+
+ assertEquals("valueA", cache1.getRoot().getChild(Fqn.fromString("/a")).get("key"));
+ assertEquals("valueB", cache1.getRoot().getChild(Fqn.fromString("/b")).get("key"));
+
+ assertInvalidated(cache2, Fqn.fromString("/a"), "Should be invalidated");
+ assertInvalidated(cache2, Fqn.fromString("/b"), "Should be invalidated");
+
+ // now make sure a node exists on cache 2
+ cache2.getRoot().addChild(Fqn.fromString("/a")).put("k2", "v2");
+
+ // te invalidation will happen in afterCompletion, hence no exception!
+ try
+ {
+ cache1.move(Fqn.fromString("/b"), Fqn.fromString("/a"));// should throw an NPE
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ private void assertInvalidated(Cache cache, Fqn fqn, String msg)
+ {
+ assert cache.getRoot().getChild(fqn) == null : msg;
+ NodeSPI n = ((CacheSPI) cache).peek(fqn, true, true);
+ }
+
+
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -58,8 +58,8 @@
private void initCaches()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Object listener = new TestCacheListener();
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -47,8 +47,8 @@
private void initCaches()
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -43,8 +43,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.xml"), false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
cache.getConfiguration().setUseRegionBasedMarshalling(true);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -51,8 +51,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
configureEviction();
configureCacheLoader();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,7 +42,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
configureCache();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -4,7 +4,6 @@
import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.LocalDelegatingCacheLoaderConfig;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
@@ -24,7 +23,7 @@
protected void configureCache() throws Exception
{
- CacheSPI delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false);
+ CacheSPI delegating_cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
delegating_cache.create();
delegating_cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplAndStateTransferWithPassivationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -27,7 +27,6 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -38,8 +37,6 @@
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.Test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.util.HashSet;
import java.util.Set;
@@ -99,8 +96,8 @@
nameSet.add("b");
nameSet.add("c");
- cache1 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", true, false, true));
- cache2 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", true, false, true));
+ cache1 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", true, false, true), getClass());
+ cache2 = (CacheSPI) new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", true, false, true), getClass());
Region r1 = cache1.getRegionManager().getRegion(subtree, true);
Region r2 = cache2.getRegionManager().getRegion(subtree, true);
@@ -140,7 +137,7 @@
nameSet.add(B.getLastElement());
nameSet.add(C.getLastElement());
- cache1 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", false, useBR, true));
+ cache1 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache1", false, useBR, true), getClass());
cache1.put(A, "k", "v");
cache1.put(B, "k", "v");
@@ -149,7 +146,7 @@
cache1.evict(A);
- cache2 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", false, useBR, true));
+ cache2 = new UnitTestCacheFactory().createCache(buildConf(nls, "cache2", false, useBR, true), getClass());
if (useBR)
{
Set backupNameSet = new HashSet(nameSet);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -68,12 +68,12 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache1 = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache1 = (CacheSPI<String, String>) instance.createCache(getCfg(), false, getClass());
cache1.getConfiguration().setUseRegionBasedMarshalling(true);
cache1.start();
- cache2 = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
+ cache2 = (CacheSPI<String, String>) instance.createCache(getCfg(), false, getClass());
cache2.getConfiguration().setUseRegionBasedMarshalling(true);
cache2.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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -23,7 +23,7 @@
public void setUp()
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
- cache = new UnitTestCacheFactory<Object, Object>().createCache(cfg, false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(cfg, false, getClass());
}
@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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -19,7 +19,7 @@
public void testConstruction() throws InterruptedException
{
- for (int i = 0; i < WARMUP; i++) new UnitTestCacheFactory<Object, Object>().createCache();
+ for (int i = 0; i < WARMUP; i++) new UnitTestCacheFactory<Object, Object>().createCache(getClass());
System.out.println("Finished warmup.");
System.gc();
Thread.sleep(1000);
@@ -31,7 +31,7 @@
{
for (int i = 0; i < LOOPS; i++)
{
- new UnitTestCacheFactory<Object, Object>().createCache();
+ new UnitTestCacheFactory<Object, Object>().createCache(getClass());
if (i % 100 == 0) System.out.println("In loop num " + i);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/MemoryFootprintTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -19,7 +19,7 @@
public void testLocal() throws IOException
{
- Cache<String, String> c = new UnitTestCacheFactory<String, String>().createCache(false);
+ Cache<String, String> c = new UnitTestCacheFactory<String, String>().createCache(false, getClass());
c.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
c.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
// c.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileMapViewTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,7 +53,7 @@
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL);
cfg.setNodeLockingScheme(NodeLockingScheme.MVCC);
cfg.setConcurrencyLevel(500);
- cache = new UnitTestCacheFactory<String, String>().createCache(cfg, false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(cfg, false, getClass());
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -60,7 +60,7 @@
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
c.setClusterName(name);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
// Call the hook that allows mux integration
configureMultiplexer(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -36,14 +36,14 @@
c.setSyncRollbackPhase(true);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
c = new Configuration();
c.setSyncCommitPhase(true);
c.setSyncRollbackPhase(true);
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -100,8 +100,8 @@
c1.setLockAcquisitionTimeout(5000);
c2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false, getClass());
configureMultiplexer(cache1);
configureMultiplexer(cache2);
@@ -610,8 +610,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- final CacheSPI<Object, Object> c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- final CacheSPI<Object, Object> c2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ final CacheSPI<Object, Object> c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ final CacheSPI<Object, Object> c2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -73,7 +73,7 @@
private void initCaches(Configuration.CacheMode caching_mode)
{
- CacheFactory<String, ContainerData> instance = new UnitTestCacheFactory<String, ContainerData>();
+ UnitTestCacheFactory<String, ContainerData> instance = new UnitTestCacheFactory<String, ContainerData>();
Configuration conf1 = new Configuration();
Configuration conf2 = new Configuration();
@@ -91,8 +91,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<String, ContainerData>) instance.createCache(conf1, false);
- cache2 = (CacheSPI<String, ContainerData>) instance.createCache(conf2, false);
+ cache1 = (CacheSPI<String, ContainerData>) instance.createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<String, ContainerData>) instance.createCache(conf2, false, getClass());
cache1.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -95,8 +95,8 @@
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
- cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false);
- cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false);
+ cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf1, false, getClass());
+ cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf2, false, getClass());
cache1.start();
cache2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -34,8 +34,8 @@
{
System.out.println("*** In setUp()");
Cache<Object, Object>[] caches = new Cache[2];
- caches[0] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
- caches[1] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+ caches[0] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
+ caches[1] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
cachesTL.set(caches);
TestingUtil.blockUntilViewsReceived(caches, 5000);
System.out.println("*** Finished setUp()");
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,7 +59,7 @@
c.setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
c.setStateRetrievalTimeout(60000);
- CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
// Put the cache in the map before starting, so if it fails in
// start it can still be destroyed later
@@ -79,7 +79,7 @@
c.setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
c.setStateRetrievalTimeout(60000);
- CacheSPI recipient = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI recipient = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
//Put the cache in the map before starting, so if it fails in
// start it can still be destroyed later
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
Cache<String, String> c1 = null, c2 = null;
try
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration cfg = new Configuration();
cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cfg.setCacheMode(CacheMode.REPL_SYNC);
@@ -52,13 +52,13 @@
cfg.setCacheLoaderConfig(clc);
cfg.setNodeLockingScheme(nls);
- c1 = cf.createCache(cfg.clone());
+ c1 = cf.createCache(cfg.clone(), getClass());
c1.put(fqn, k, v);
assert c1.get(fqn, k).equals(v);
assert getLoader(c1).get(fqn).get(k).equals(v);
- c2 = cf.createCache(cfg.clone());
+ c2 = cf.createCache(cfg.clone(), getClass());
assert c2.get(fqn, k).equals(v);
assert getLoader(c2).get(fqn).get(k).equals(v);
}
@@ -73,7 +73,7 @@
Cache<String, String> c1 = null, c2 = null;
try
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
Configuration cfg = new Configuration();
cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cfg.setCacheMode(CacheMode.REPL_SYNC);
@@ -89,13 +89,13 @@
cfg.setCacheLoaderConfig(clc);
cfg.setNodeLockingScheme(nls);
- c1 = cf.createCache(cfg.clone());
+ c1 = cf.createCache(cfg.clone(), getClass());
c1.put(fqn, k, v);
assert c1.get(fqn, k).equals(v);
assert getLoader(c1).get(fqn).get(k).equals(v);
- c2 = cf.createCache(cfg.clone());
+ c2 = cf.createCache(cfg.clone(), getClass());
assert c2.get(fqn, k).equals(v);
assert getLoader(c2).get(fqn) == null;
}
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -476,14 +476,14 @@
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict1", cache1);
cache1.put(Fqn.fromString("/a/b/c"), "key", "value");
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict2", cache2);
RegionImpl region = (RegionImpl) cache2.getRegion(Fqn.ROOT, false);
@@ -507,7 +507,7 @@
{
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
Map<String, Cache> caches = cachesTL.get();
caches.put("evict1", cache1);
@@ -531,7 +531,7 @@
c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
additionalConfiguration(c);
- final Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c);
+ final Cache<Object, Object> cache2 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
caches.put("evict2", cache2);
Node<Object, Object> parent;// = cache2.getRoot().getChild(Fqn.fromString("/org/jboss/test/data"));
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -152,7 +152,7 @@
}
additionalConfiguration(c);
- CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> tree = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -99,8 +99,8 @@
cfg1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cfg2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache1 = new UnitTestCacheFactory<Object, Object>().createCache(cfg1, true);
- cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false);
+ cache1 = new UnitTestCacheFactory<Object, Object>().createCache(cfg1, true, getClass());
+ cache2 = new UnitTestCacheFactory<Object, Object>().createCache(cfg2, false, getClass());
UserTransaction tx1 = (UserTransaction) new InitialContext(p).lookup("UserTransaction");
writer = new Writer(cache1, tx1);
try
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -53,8 +53,8 @@
public void setUp() throws Exception
{
Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
- CacheFactory<Object, Integer> instance = new UnitTestCacheFactory<Object, Integer>();
- cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false);
+ UnitTestCacheFactory<Object, Integer> instance = new UnitTestCacheFactory<Object, Integer>();
+ cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false, getClass());
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,7 +49,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setStateRetrievalTimeout(10000);
c.setClusterName("test");
@@ -59,7 +59,7 @@
c.setLockParentForChildInsertRemove(true);
c.setLockAcquisitionTimeout(3000);
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.create();
cache.start();
thread_ex = null;
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -41,7 +41,7 @@
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setLockAcquisitionTimeout(2000);
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
cache.start();
return cache;
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -54,12 +54,12 @@
writerError = null;
readerError = null;
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setIsolationLevel(IsolationLevel.READ_COMMITTED);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -55,8 +55,8 @@
config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache(config);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(config, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -42,13 +42,13 @@
writerFailed = false;
writerError = null;
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setLockAcquisitionTimeout(1000);
- cache = (CacheSPI<String, String>) instance.createCache(c, false);
+ cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
cache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -49,8 +49,8 @@
config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
config.setLockAcquisitionTimeout(1000);
config.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = instance.createCache(config);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = instance.createCache(config, getClass());
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -46,7 +46,7 @@
@BeforeMethod
public void setUp() throws CloneNotSupportedException
{
- c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(REPL_SYNC));
+ c1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(REPL_SYNC), getClass());
}
@AfterMethod
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -51,7 +51,7 @@
configuration.setCacheMode(Configuration.CacheMode.LOCAL);
configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
configuration.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI) new UnitTestCacheFactory().createCache(configuration);
+ cache = (CacheSPI) new UnitTestCacheFactory().createCache(configuration, getClass());
dataContainer = (DataContainerImpl) cache.getComponentRegistry().getComponent(DataContainer.class);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -102,14 +102,14 @@
public void setUp() throws Exception
{
exception = null;
- CacheFactory<Boolean, Boolean> instance = new UnitTestCacheFactory<Boolean, Boolean>();
+ UnitTestCacheFactory<Boolean, Boolean> instance = new UnitTestCacheFactory<Boolean, Boolean>();
// setup and start the source cache
Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setSyncCommitPhase(true);
c.setLockAcquisitionTimeout(LOCK_ACQUISITION_TIMEOUT);
- srcCache = (CacheSPI<Boolean, Boolean>) instance.createCache(c, false);
+ srcCache = (CacheSPI<Boolean, Boolean>) instance.createCache(c, false, getClass());
srcCache.create();
srcCache.start();
@@ -119,7 +119,7 @@
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setSyncCommitPhase(true);
c.setLockAcquisitionTimeout(LOCK_ACQUISITION_TIMEOUT);
- dstCache = (CacheSPI) instance.createCache(c, false);
+ dstCache = (CacheSPI) instance.createCache(c, false, getClass());
dstCache.create();
dstCache.start();
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,7 +38,7 @@
protected void setUp() throws Exception
{
if (cache == null) {
- cache = new UnitTestCacheFactory<Object, Object>().createCache(false);
+ cache = new UnitTestCacheFactory<Object, Object>().createCache(false, getClass());
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -28,8 +28,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
cache.start();
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-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/isolationlevels/IsolationLevelTestBase.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -40,8 +40,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- cache = cf.createCache(false);
+ UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+ cache = cf.createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setIsolationLevel(isolationLevel);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AbortionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -61,7 +61,7 @@
conf.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
conf.setClusterConfig(getJGroupsStack());
conf.setFetchInMemoryState(false);
- CacheSPI c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
+ CacheSPI c = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, false, getClass());
if (!notifying)
{
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/AsyncRollbackTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -38,8 +38,8 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
c.setSerializationExecutorPoolSize(0);
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(c);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(c, getClass());
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
tm.setTransactionTimeout(txTimeout);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/ConcurrentTransactionalTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -9,7 +9,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.transaction.TransactionSetup;
@@ -56,7 +55,7 @@
conf.setIsolationLevel(level);
conf.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
conf.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf);
+ cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
cache.put("/a/b/c", null);
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/IsolationLevelNoneTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -45,8 +45,8 @@
public void testWithoutTransactions() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -61,8 +61,8 @@
public void testWithTransactions() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
@@ -80,8 +80,8 @@
public void testWithTransactionsRepeatableRead() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PessimisticTransactionTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -59,8 +59,8 @@
public void setUp() throws Exception
{
- CacheFactory<String, Comparable> instance = new UnitTestCacheFactory<String, Comparable>();
- cache = (CacheSPI<String, Comparable>) instance.createCache(false);
+ UnitTestCacheFactory<String, Comparable> instance = new UnitTestCacheFactory<String, Comparable>();
+ cache = (CacheSPI<String, Comparable>) instance.createCache(false, getClass());
cache.getConfiguration().setClusterName("test");
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setStateRetrievalTimeout(10000);
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/PrepareTxTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -31,8 +31,8 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
- cache = (CacheSPI<String, String>) instance.createCache(false);
+ UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
+ cache = (CacheSPI<String, String>) instance.createCache(false, getClass());
cache.getConfiguration().setCacheMode("local");
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/pessimistic/StatusUnknownTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -39,7 +39,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory<String, String>().createCache(false);
+ cache = new UnitTestCacheFactory<String, String>().createCache(false, getClass());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(HeuristicFailingDummyTransactionManagerLookup.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java 2008-12-11 20:26:09 UTC (rev 7283)
+++ core/trunk/src/test/java/org/jboss/cache/util/CachesTest.java 2008-12-12 05:00:02 UTC (rev 7284)
@@ -37,7 +37,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = new UnitTestCacheFactory().createCache();
+ cache = new UnitTestCacheFactory().createCache(getClass());
}
@AfterMethod(alwaysRun = true)
16 years, 3 months
JBoss Cache SVN: r7283 - in core/trunk/src: test/java/org/jboss/cache/buddyreplication and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-12-11 15:26:09 -0500 (Thu, 11 Dec 2008)
New Revision: 7283
Added:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/AbstractNodeBasedBuddyTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy4Nodes2BackupsTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesNoBuddyPoolTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolWithDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoStateTransfer.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesWithPoolNoDataGravitationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy4Nodes2BackupsTest.java
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestXmlConfigurationParser.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderHsqldbDSTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy2NodesBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy4Nodes2BackupsTest.java
Removed:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/DisabledStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyGroupAssignmentTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyReplicationFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/testng/Base.java
core/trunk/src/test/java/org/jboss/cache/testng/Derived.java
core/trunk/src/test/java/org/jboss/cache/testng/Other.java
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java
Log:
performance improvements to buddy repl tests
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -485,7 +485,7 @@
public boolean needMoreResponses()
{
- return numValidResponses < 1 && pendingResponders.size() > 0;
+ return numValidResponses < 1 && pendingResponders.size() == 0;
}
}
}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/AbstractNodeBasedBuddyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/AbstractNodeBasedBuddyTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/AbstractNodeBasedBuddyTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,35 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterMethod;
+
+import java.util.List;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+public abstract class AbstractNodeBasedBuddyTest extends BuddyReplicationTestsBase
+{
+ protected List<CacheSPI<Object, Object>> caches;
+
+ protected final String key = "key";
+ protected final String value = "value";
+
+ @BeforeClass
+ public abstract void createCaches() throws Exception;
+
+ @AfterClass
+ public void killCaches() throws Exception
+ {
+ super.cleanupCaches(caches, true);
+ }
+
+ @AfterMethod
+ public void tearDown() throws Exception
+ {
+ super.cleanupCaches(caches, false);
+ }
+}
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Region;
+import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.config.BuddyReplicationConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+
+/**
+ * Tests handling of the buddy backup region during region
+ * activation and inactivation
+ *
+ * @author Brian Stansberry
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy2NodesBackupActivationInactivationTest")
+public class Buddy2NodesBackupActivationInactivationTest extends AbstractNodeBasedBuddyTest
+{
+ public static final Fqn A = Fqn.fromString("/a");
+ public static final Fqn A_B = Fqn.fromString("/a/b");
+ public static final String JOE = "JOE";
+
+
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ super.caches = new ArrayList<CacheSPI<Object, Object>>(2);
+ caches.add(createCache());
+ caches.add(createCache());
+ }
+
+ public void testBuddyBackupActivation() throws Exception
+ {
+ CacheSPI cache1 = caches.get(0);
+ CacheSPI cache2 = caches.get(1);
+ Fqn A = Fqn.fromString("/a");
+ TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
+
+ // create the regions on the two cachePool first
+ Region c1 = cache1.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
+ Region c2 = cache2.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
+
+ assertFalse(c1.isActive());
+ assertFalse(c2.isActive());
+
+ c1.activate();
+ cache1.put(A_B, "name", JOE);
+
+ waitForBuddy(cache2, cache1, true);
+ waitForBuddy(cache1, cache2, true);
+
+// TestingUtil.sleepThread(getSleepTimeout());
+
+ System.out.println("Cache dump BEFORE activation");
+ System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
+ System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
+
+ c2.activate();
+
+ System.out.println("Cache dump AFTER activation");
+ System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
+ System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
+
+ Fqn fqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
+
+ assertEquals("State transferred with activation", JOE, cache2.get(fqn, "name"));
+ }
+
+ public void testReplToInactiveRegion() throws Exception
+ {
+ CacheSPI cache1 = caches.get(0);
+ CacheSPI cache2 = caches.get(1);
+
+ TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
+ Fqn backupFqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
+ Fqn A = Fqn.fromString("/a");
+
+ Region regionA = cache1.getRegion(A, true);
+ regionA.registerContextClassLoader(getClass().getClassLoader());
+ regionA.activate();
+
+ // Activate the buddy backup subtree in the recipient so any
+ // repl message doesn't get rejected due to that tree being inactive
+ cache2.getRegionManager().activate(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
+ cache2.getRegionManager().deactivate(A);
+
+ cache1.put(A_B, "name", JOE);
+
+ assertNull("Should be no replication to inactive region", cache2.get(A_B, "name"));
+
+ assertNull("Should be no replication to inactive backup region", cache2.get(backupFqn, "name"));
+ }
+
+ public void testBuddyBackupInactivation() throws Exception
+ {
+ CacheSPI cache1 = caches.get(0);
+ Fqn A = Fqn.fromString("/a");
+ Region regionA = cache1.getRegion(A, true);
+ regionA.registerContextClassLoader(getClass().getClassLoader());
+ regionA.activate();
+
+ Fqn fqn = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
+ fqn = Fqn.fromRelativeFqn(fqn, A_B);
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache1.put(fqn, "name", JOE);
+
+ assertEquals("Put should have been OK", JOE, cache1.get(fqn, "name"));
+
+ regionA.deactivate();
+
+ assertNull("Inactivation should have cleared region", cache1.get(fqn, "name"));
+ }
+
+ protected CacheSPI<Object, Object> createCache() throws Exception
+ {
+ CacheMode mode = CacheMode.REPL_SYNC;
+ Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
+ cache.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache.getConfiguration().setInactiveOnStartup(true);
+ cache.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
+ cache.create();
+ cache.start();
+ return cache;
+ }
+
+ private BuddyReplicationConfig getBuddyConfig() throws Exception
+ {
+ BuddyReplicationConfig brc = new BuddyReplicationConfig();
+ brc.setEnabled(true);
+ brc.setAutoDataGravitation(false);
+ return brc;
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesBackupActivationInactivationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy2NodesNoBuddyPoolTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,144 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.CachePrinter;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import org.testng.annotations.*;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", sequential = true, testName = "buddyreplication.Buddy2NodesNoBuddyPoolTest")
+public class Buddy2NodesNoBuddyPoolTest extends AbstractNodeBasedBuddyTest
+{
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ caches = createCaches(2, false);
+ }
+
+ public void testAddingNewCaches() throws Exception
+ {
+ // get some data in there.
+
+ caches.get(0).put("/cache0", "k", "v");
+ caches.get(1).put("/cache1", "k", "v");
+
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ System.out.println("*** Testing cache 1:");
+ waitForBuddy(caches.get(1), caches.get(0), true);
+
+ assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
+ assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
+
+ assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
+ assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
+
+ caches.add(createCache(1, null));
+
+ TestingUtil.blockUntilViewsReceived(60000, caches);
+
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ waitForBuddy(caches.get(1), caches.get(2), true);
+ waitForBuddy(caches.get(2), caches.get(0), true);
+
+
+ assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
+ assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should have backup region for non-buddy";
+ assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have backup region for buddy";
+
+ assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
+ assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
+ assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
+
+ assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
+ assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
+ assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for self";
+
+ // ensure no state transfer has happened!!
+ assert caches.get(2).peek(Fqn.fromString("/cache0"), false) == null : "Unnecessary state should not have been transferred!";
+ assert caches.get(2).peek(Fqn.fromString("/cache1"), false) == null : "Unnecessary state should not have been transferred!";
+
+ // ensure backup state has been transferred.
+ assert caches.get(2).peek(fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), Fqn.fromString("/cache1")), false) != null : "Backup state should have transferred!";
+ }
+
+
+ public void testBuddyJoin() throws Exception
+ {
+ CacheSPI<Object, Object> cache2 = null;
+ String key = "key";
+ String value = "value";
+
+ try
+ {
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), fqn);
+
+ assertNoStaleLocks(caches);
+
+ // put something in cache 1
+ caches.get(1).put(fqn, key, value);
+
+ assertNoStaleLocks(caches);
+
+ // this should be in neither of the other cachePool' "main" trees
+ assertEquals(value, caches.get(1).get(fqn, key));
+ assertFalse("Should be false", caches.get(0).exists(fqn));
+
+ // check the backup trees
+ assertEquals("Buddy should have data in backup tree", value, caches.get(0).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+
+ // now add a new cache to the cluster
+ cache2 = createCache(1, null);
+
+ // allow this cache a few msecs to join
+ TestingUtil.blockUntilViewsReceived(3000, caches.get(0), caches.get(1), cache2);
+
+ TestingUtil.sleepThread(2000); // allow buddy group reorg
+
+ List<CacheSPI<Object, Object>> dump = new ArrayList<CacheSPI<Object, Object>>(caches);
+ dump.add(cache2);
+
+ // now cachePool.get(1)'s buddy should be cache2, not cache[0]
+ assertIsBuddy(caches.get(1), cache2, true);
+ // this should still be the same
+ assertIsBuddy(caches.get(0), caches.get(1), true);
+ // and cache2's buddy should be cache[0]
+ assertIsBuddy(cache2, caches.get(0), true);
+
+ // so now the backup data we saw on cache[0] should have been removed.
+ assertFalse("This backup data should have been removed", caches.get(0).exists(backupFqn));
+
+ // while cache2 should now posess this backup (due to a state transfer)
+ assertEquals("Backup state should have been transferred to this new cache instance", value, cache2.get(backupFqn, key));
+
+ caches.get(1).removeNode(fqn);
+ assertNoStaleLocks(caches);
+
+
+ assertFalse("Should be null", caches.get(0).exists(fqn));
+ assertFalse("Should be null", caches.get(1).exists(fqn));
+ assertFalse("Should be null", cache2.exists(fqn));
+
+ // check the backup trees
+ assertFalse("Should be null", caches.get(0).exists(backupFqn));
+ assertFalse("Should be null", caches.get(1).exists(backupFqn));
+ assertFalse("Should be null", cache2.exists(backupFqn));
+ assertNoStaleLocks(caches);
+ }
+ finally
+ {
+ if (cache2 != null) cache2.stop();
+ }
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolNoDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,178 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
+import org.testng.annotations.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.List;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy3NodesNoPoolNoDataGravitationTest")
+public class Buddy3NodesNoPoolNoDataGravitationTest extends AbstractNodeBasedBuddyTest
+{
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ caches = createCaches(3, false, false);
+ }
+
+ public void testSingleBuddy() throws Exception
+ {
+ System.out.println("*** Testing cache 0:");
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ System.out.println("*** Testing cache 1:");
+ waitForBuddy(caches.get(1), caches.get(2), true);
+ System.out.println("*** Testing cache 2:");
+ waitForBuddy(caches.get(2), caches.get(0), true);
+
+ System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
+ System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
+ System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
+ }
+
+ public void testRemovalFromClusterSingleBuddy() throws Exception
+ {
+ try
+ {
+ System.out.println("*** Testing cache 0");
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ System.out.println("*** Testing cache 1");
+ waitForBuddy(caches.get(1), caches.get(2), true);
+ System.out.println("*** Testing cache 2");
+ waitForBuddy(caches.get(2), caches.get(0), true);
+
+ // now remove a cache from the cluster
+ caches.get(2).stop();
+
+ TestingUtil.sleepThread(getSleepTimeout());
+
+ // now test new buddy groups
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ waitForBuddy(caches.get(1), caches.get(0), true);
+ assertNoLocks(caches);
+ }
+ finally
+ {
+ caches.get(2).start();
+ }
+ }
+
+ public void testSimplePut() throws Exception
+ {
+ String fqn = "/test";
+ String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
+
+ assertNoStaleLocks(caches);
+
+ // put something in cache 1
+ caches.get(0).put(fqn, key, value);
+
+ assertNoStaleLocks(caches);
+
+ // this should be in neither of the other cachePool' "main" trees
+ assertEquals(value, caches.get(0).get(fqn, key));
+ assertNull("Should be null", caches.get(1).get(fqn, key));
+ assertNull("Should be null", caches.get(2).get(fqn, key));
+
+ // check the backup trees
+
+ assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
+ assertNull("Should be null", caches.get(2).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+
+ System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
+ System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
+ System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
+ }
+
+
+ public void testPutAndRemove() throws Exception
+ {
+ String fqn = "/test";
+ String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
+
+ assertNoStaleLocks(caches);
+
+ // put something in cache 1
+ caches.get(0).put(fqn, key, value);
+
+ assertNoStaleLocks(caches);
+
+ // this should be in neither of the other cachePool' "main" trees
+ assertEquals(value, caches.get(0).get(fqn, key));
+ assertNull("Should be null", caches.get(1).get(fqn, key));
+ assertNull("Should be null", caches.get(2).get(fqn, key));
+
+ // check the backup trees
+
+ assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
+ assertNull("Should be null", caches.get(2).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+
+ // now remove
+ caches.get(0).removeNode(fqn);
+ assertNoStaleLocks(caches);
+
+
+ assertNull("Should be null", caches.get(0).get(fqn, key));
+ assertNull("Should be null", caches.get(1).get(fqn, key));
+ assertNull("Should be null", caches.get(2).get(fqn, key));
+
+ // check the backup trees
+ assertNull("Should be null", caches.get(0).get(backupFqn, key));
+ assertNull("Should be null", caches.get(1).get(backupFqn, key));
+ assertNull("Should be null", caches.get(2).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+ }
+
+ public void testDataReplicationSuppression() throws Exception
+ {
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
+ caches.get(0).put(fqn, key, value);
+
+ TestingUtil.dumpCacheContents(caches);
+
+ assertEquals("value", caches.get(0).get(fqn, key));
+ assertFalse(caches.get(0).exists(backupFqn));
+ assertEquals("value", caches.get(1).get(backupFqn, key));
+ assertFalse(caches.get(1).exists(fqn));
+ assertFalse(caches.get(2).exists(fqn));
+ assertFalse(caches.get(2).exists(backupFqn));
+
+ assertNoLocks(caches);
+
+ backupFqn = fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), fqn);
+
+ System.out.println("*** Calling get() on cache[1] with force option");
+
+ ReplicationListener replicationListener0 = ReplicationListener.getReplicationListener(caches.get(0));
+ replicationListener0.expect(DataGravitationCleanupCommand.class);
+
+ caches.get(1).getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
+ assertEquals("value", caches.get(1).get(fqn, key));
+ replicationListener0.waitForReplicationToOccur(); // cleanup commands are async
+
+ TestingUtil.dumpCacheContents(caches);
+
+ assertFalse(caches.get(1).exists(backupFqn));
+ assertEquals("value", caches.get(2).get(backupFqn, key));
+ assertFalse(caches.get(2).exists(fqn));
+ assertFalse(caches.get(0).exists(fqn));
+ assertFalse(caches.get(0).exists(backupFqn));
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,520 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.CacheBlocked;
+import org.jboss.cache.notifications.annotation.CacheUnblocked;
+import org.jboss.cache.notifications.event.Event;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeClass;
+
+import javax.transaction.TransactionManager;
+import java.util.List;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy3NodesNoPoolWithDataGravitationTest")
+public class Buddy3NodesNoPoolWithDataGravitationTest extends AbstractNodeBasedBuddyTest
+{
+ private Fqn fqn = Fqn.fromString("test");
+
+ private String key = "key";
+ private String value = "value";
+
+
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ caches = createCaches(3, false, true);
+ }
+
+ public void testDataGravitationDontKillOwner() throws Exception
+ {
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
+
+ TestingUtil.dumpCacheContents(caches);
+
+ caches.get(0).put(fqn, key, value);
+
+ TestingUtil.dumpCacheContents(caches);
+
+ assertEquals("Value should exist", value, caches.get(0).get(fqn, key));
+
+ TestingUtil.dumpCacheContents(caches);
+
+ // use exists instead of get() to prevent going up the interceptor stack
+ assertTrue("Should be false", !caches.get(1).exists(fqn));
+ assertTrue("Should be false", !caches.get(2).exists(fqn));
+
+ assertFalse("Should be false", caches.get(0).exists(backupFqn));
+ assertTrue("Value be true", caches.get(1).exists(backupFqn));
+ assertFalse("Should be false", caches.get(2).exists(backupFqn));
+
+ System.out.println("***** Killed original data owner, about to call a get on a different cache instance. *****");
+
+ ReplicationListener replListener = ReplicationListener.getReplicationListener(caches.get(1));
+ replListener.expect(DataGravitationCleanupCommand.class);
+
+ // according to data gravitation, a call to *any* cache should retrieve the data, and move the data to the new cache.
+ assertEquals("Value should have gravitated", value, caches.get(2).get(fqn, key));
+ replListener.waitForReplicationToOccur();
+
+ TestingUtil.dumpCacheContents(caches);
+
+ // now lets test the eviction part of gravitation
+ Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
+
+ // use exists instead of get() to prevent going up the interceptor stack
+ assertTrue("Should be false", !caches.get(0).exists(fqn));
+ assertTrue("Should be false", !caches.get(1).exists(fqn));
+
+ // the old backup should no longer exist
+ assertFalse("Should be null", caches.get(0).exists(backupFqn));
+ assertFalse("Should be null", caches.get(1).exists(backupFqn));
+ assertFalse("Should be null", caches.get(2).exists(backupFqn));
+
+ // and the backup should now exist in caches.get(2)'s buddy which is caches.get(0)
+ assertEquals("Value should exist", value, caches.get(0).get(newBackupFqn, key));
+ assertFalse("Should be null", caches.get(1).exists(newBackupFqn));
+ assertFalse("Should be null", caches.get(2).exists(newBackupFqn));
+ }
+
+
+ public void testCompleteStateSurvival() throws Exception
+ {
+ CacheBlockListener blockListener = new CacheBlockListener();
+
+ caches.get(0).addCacheListener(blockListener);
+ caches.get(1).addCacheListener(blockListener);
+ caches.get(2).addCacheListener(blockListener);
+
+ caches.get(0).put("/0", "key", "value");
+ caches.get(1).put("/1", "key", "value");
+ caches.get(2).put("/2", "key", "value");
+
+// TestingUtil.sleepThread(getSleepTimeout());
+ //TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
+ blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
+
+ caches.get(2).stop();
+
+ blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
+
+ assertEquals("value", caches.get(0).get("/2", "key"));
+
+ blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
+
+ caches.get(1).stop();
+
+ // cache[0] is all thats left!!
+
+ assertEquals("value", caches.get(0).get("/0", "key"));
+
+ try
+ {
+ assertEquals("value", caches.get(0).get("/1", "key"));
+ }
+ catch (RuntimeException e)
+ {
+ // may barf the first time around since we are unable to contact our buddy and store this data.
+ assertEquals(IllegalArgumentException.class, e.getCause().getClass());
+ }
+
+ // now try the assertion again since the local gravitation would have worked.
+
+ System.out.println("Cache contents " + CachePrinter.printCacheDetails(caches.get(0)));
+
+ assertEquals("value", caches.get(0).get("/1", "key"));
+ assertEquals("value", caches.get(0).get("/2", "key"));
+ caches.get(1).start();
+ caches.get(2).start();
+ caches.get(0).removeCacheListener(blockListener);
+ caches.get(1).removeCacheListener(blockListener);
+ caches.get(2).removeCacheListener(blockListener);
+
+ waitForSingleBuddy(caches);
+ }
+
+ public void testTransactionsCommit() throws Exception
+ {
+
+
+ caches.get(0).put(fqn, key, value);
+ Fqn oldBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + "/test");
+ Fqn newBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test");
+
+// dumpCacheContents(caches);
+
+ TransactionManager txman = caches.get(2).getTransactionManager();
+
+
+ assertTrue(caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(!caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+
+ txman.begin();
+
+// dumpCacheContents(caches);
+ // will cause gravitation
+ caches.get(2).get(fqn, key);
+// dumpCacheContents(caches);
+
+ assertTrue(caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(!caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+ txman.commit();
+ cleanupDelay(); // cleanup commands are async
+
+// dumpCacheContents(caches);
+
+ assertTrue(!caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(!caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+// dumpCacheContents(caches);
+
+ assertNoLocks(caches);
+ }
+
+ private void cleanupDelay()
+ {
+ TestingUtil.sleepThread(250);
+ }
+
+ public void testTransactionsRollback() throws Exception
+ {
+ System.out.println("Buddy3NodesNoPoolWithDataGravitationTest.testTransactionsRollback****************************");
+ TestingUtil.dumpCacheContents(caches.get(0));
+ TestingUtil.dumpCacheContents(caches.get(1));
+ TestingUtil.dumpCacheContents(caches.get(2));
+ System.out.println("Buddy3NodesNoPoolWithDataGravitationTest.testTransactionsRollback****************************");
+
+ caches.get(0).put(fqn, key, value);
+ Fqn oldBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + "/test");
+ Fqn newBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test");
+
+// dumpCacheContents(caches);
+
+ TransactionManager txman = caches.get(2).getTransactionManager();
+
+
+ assertTrue(caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(!caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+
+ txman.begin();
+
+// dumpCacheContents(caches);
+ caches.get(2).get(fqn, key);
+// dumpCacheContents(caches);
+
+ assertTrue(caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(!caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+ txman.rollback();
+
+// dumpCacheContents(caches);
+
+ assertTrue(caches.get(0).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(2).exists(fqn));
+ assertTrue(!caches.get(0).exists(oldBackupFqn));
+ assertTrue(caches.get(1).exists(oldBackupFqn));
+ assertTrue(!caches.get(2).exists(oldBackupFqn));
+ assertTrue(!caches.get(0).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+
+ assertNoLocks(caches);
+ }
+
+ public void testSubtreeRetrieval() throws Exception
+ {
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn fqn2 = Fqn.fromString("/test/subtree");
+
+ Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
+ Fqn backupFqn2 = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn2);
+
+ caches.get(0).put(fqn, key, value);
+ caches.get(0).put(fqn2, key, value);
+
+ // test backup replication to buddy
+ assertEquals(value, caches.get(0).get(fqn, key));
+ assertEquals(value, caches.get(0).get(fqn2, key));
+ assertEquals(value, caches.get(1).get(backupFqn, key));
+ assertEquals(value, caches.get(1).get(backupFqn2, key));
+
+ assertTrue(!caches.get(0).exists(backupFqn));
+ assertTrue(!caches.get(0).exists(backupFqn2));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn2));
+ assertTrue(!caches.get(2).exists(fqn));
+ assertTrue(!caches.get(2).exists(fqn2));
+ assertTrue(!caches.get(2).exists(backupFqn));
+ assertTrue(!caches.get(2).exists(backupFqn2));
+
+ assertNoLocks(caches);
+
+ // gravitate to 2:
+ ReplicationListener replListener1 = ReplicationListener.getReplicationListener(caches.get(0));
+ replListener1.expect(DataGravitationCleanupCommand.class);
+ caches.get(2).getNode(fqn); // expectWithTx entire subtree to gravitate.
+ replListener1.waitForReplicationToOccur(); // cleanup commands are async
+
+ Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
+ Fqn newBackupFqn2 = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn2);
+
+ assertEquals(value, caches.get(2).get(fqn, key));
+ assertTrue(caches.get(2).exists(fqn2));
+ assertEquals(value, caches.get(0).get(newBackupFqn, key));
+ assertTrue(caches.get(0).exists(newBackupFqn2));
+
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn2));
+ assertTrue(!caches.get(0).exists(fqn));
+ assertTrue(!caches.get(0).exists(fqn2));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn2));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn2));
+
+ TestingUtil.dumpCacheContents(caches);
+
+ for (CacheSPI<Object, Object> cache : caches)
+ {
+ assertTrue(!cache.exists(backupFqn));
+ assertTrue(!cache.exists(backupFqn2));
+ }
+
+ assertNoLocks(caches);
+ }
+
+ private void testDataOwner(boolean optimistic) throws Exception
+ {
+ List<CacheSPI<Object, Object>> caches = createCaches(1, 2, false, true, optimistic);
+ cachesTL.set(caches);
+
+ // add some stuff on the primary
+ CacheSPI dataOwner = caches.get(0);
+ CacheSPI buddy = caches.get(1);
+
+ dataOwner.put(fqn, key, value);
+
+ System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
+
+ assert dataOwner.peek(fqn, false) != null : "Should have data";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+
+ assert buddy.peek(fqn, false) == null : "Should not have data";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) != null : "Should have backup data";
+
+ // now do a gravitate call.
+ assert buddy.get(fqn, key).equals(value) : "Data should have gravitated!";
+ // gravitation cleanup calls are async.
+ cleanupDelay();
+
+ System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
+
+ assert buddy.peek(fqn, false) != null : "Should have data";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+
+ assert dataOwner.peek(fqn, false) == null : "Should not have data";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert dataOwner.peek(fqnTransformer.getBackupFqn(buddy.getLocalAddress(), fqn), false) != null : "Should have backup data";
+ }
+
+ public void testStaleRegionOnDataOwner() throws Exception
+ {
+ // add some stuff on the primary
+ CacheSPI first = caches.get(0);
+ CacheSPI second = caches.get(1);
+ CacheSPI third = caches.get(2);
+
+ first.put(fqn, key, value);
+
+ System.out.println("first: " + CachePrinter.printCacheDetails(first));
+ System.out.println("second: " + CachePrinter.printCacheDetails(second));
+
+ assert first.peek(fqn, false) != null : "Should have data";
+ assert first.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(third.getLocalAddress())), false) != null : "Should have backup node for second";
+ assert first.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(first.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+
+ assert second.peek(fqn, false) == null : "Should not have data";
+ assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(second.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(first.getLocalAddress())), false) != null : "Should have backup node for second";
+ assert second.peek(fqnTransformer.getBackupFqn(first.getLocalAddress(), fqn), false) != null : "Should have backup data";
+
+ // now do a gravitate call.
+ assert second.get(fqn, key).equals(value) : "Data should have gravitated!";
+ // gravitation cleanup calls are async.
+ cleanupDelay();
+
+ System.out.println("first: " + CachePrinter.printCacheDetails(first));
+ System.out.println("second: " + CachePrinter.printCacheDetails(second));
+
+ assert second.peek(fqn, false) != null : "Should have data";
+ assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(first.getLocalAddress())), false) != null : "Should have backup node for second";
+ assert second.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(second.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+
+ assert third.peek(fqn, false) == null : "Should not have data";
+ assert third.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(third.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert third.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(second.getLocalAddress())), false) != null : "Should have backup node for second";
+ assert third.peek(fqnTransformer.getBackupFqn(second.getLocalAddress(), fqn), false) != null : "Should have backup data";
+ }
+
+ public void testStaleRegionOnBuddy() throws Exception
+ {
+ Fqn fqn = Fqn.fromString("/a/b/c");
+ Object key = "key", value = "value";
+
+ // add some stuff on the primary
+ CacheSPI dataOwner = caches.get(0);
+ CacheSPI buddy = caches.get(1);
+ CacheSPI thirdInstance = caches.get(2);
+
+ assertIsBuddy(dataOwner, buddy, true);
+ assertIsBuddy(buddy, thirdInstance, true);
+ assertIsBuddy(thirdInstance, dataOwner, true);
+
+ dataOwner.put(fqn, key, value);
+
+ System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
+ System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
+
+ assert dataOwner.peek(fqn, false) != null : "Should have data";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for 2nd instance!";
+
+ assert buddy.peek(fqn, false) == null : "Should not have data";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) != null : "Should have backup data";
+
+ // now do a gravitate call.
+ assert thirdInstance.get(fqn, key).equals(value) : "Data should have gravitated!";
+
+ // gravitation cleanup calls are async.
+ TestingUtil.sleepThread(250);
+
+ System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
+ System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
+
+ assert thirdInstance.peek(fqn, false) != null : "Should have data";
+ assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+
+ assert dataOwner.peek(fqn, false) == null : "Should not have data";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
+ assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) != null : "Should have backup node for buddy";
+ assert dataOwner.peek(fqnTransformer.getBackupFqn(thirdInstance.getLocalAddress(), fqn), false) != null : "Should have backup data";
+ assert buddy.peek(fqn, false) == null : "Should not have data";
+ assert buddy.peek(fqn.getParent(), false) == null : "Should not have any part of the data";
+ assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) == null : "Should NOT have backup data";
+ }
+
+ @CacheListener
+ public static class CacheBlockListener
+ {
+ private int blocks = 0;
+
+ @CacheBlocked
+ public void processBlock(Event e)
+ {
+ if (e.isPre())
+ {
+ System.out.println(">>>>>>>> Got BLOCK on cache " + e.getCache().getLocalAddress());
+ synchronized (this)
+ {
+ blocks++;
+ notifyAll();
+ }
+ }
+ }
+
+ @CacheUnblocked
+ public void processUnblock(Event e)
+ {
+ if (e.isPre())
+ {
+ System.out.println(">>>>>>>> Got UNBLOCK on cache " + e.getCache().getLocalAddress());
+ synchronized (this)
+ {
+ blocks--;
+ notifyAll();
+ }
+ }
+ }
+
+ public void blockUntilAllCachesAreUnblocked(long maxWait) throws InterruptedException
+ {
+ synchronized (this)
+ {
+ if (blocks > 1)
+ {
+ wait(maxWait);
+ }
+ // try returning anyway?
+ blocks = 0;
+ /*
+ if (blocks > 1)
+ throw new RuntimeException("Timed out waiting for unblocks. Number of blocks = " + blocks);
+ if (blocks == 1) blocks = 0;
+ */
+ }
+ }
+ }
+}
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/DisabledStateTransferTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,72 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.util.CachePrinter;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+/**
+ * This is to test JBCACHE-1229
+ *
+ * @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
+ * @since 2.1.0
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy3NodesNoStateTransfer")
+public class Buddy3NodesNoStateTransfer extends BuddyReplicationTestsBase
+{
+ public void testCachesWithoutStateTransfer() throws Exception
+ {
+ List<CacheSPI<Object, Object>> caches = createCaches(1, 3, false, false, false, false);
+ cachesTL.set(caches);
+
+ int cacheNumber = 0;
+ for (CacheSPI c : caches)
+ {
+ c.getConfiguration().setFetchInMemoryState(false);
+ c.start();
+ c.put("/" + cacheNumber++, "k", "v");
+ }
+
+ waitForBuddy(caches.get(0), caches.get(1), true);
+ waitForBuddy(caches.get(1), caches.get(2), true);
+ waitForBuddy(caches.get(2), caches.get(0), true);
+ Thread.sleep(2000);//wait for state transfer
+
+ for (CacheSPI c : caches)
+ System.out.println("Cache (local address " + c.getLocalAddress() + ") contents: " + CachePrinter.printCacheLockingInfo(c));
+
+ for (int i = 0; i < 3; i++)
+ {
+ int backupIndex = i == 2 ? 0 : i + 1;
+
+ assert caches.get(i).exists("/" + i) : "Data should exist on owner (cache #" + i + ")";
+ Fqn backup = fqnTransformer.getBackupFqn(caches.get(i).getLocalAddress(), Fqn.fromString("/" + i));
+
+ assert caches.get(backupIndex).exists(backup.getParent()) : "Backup region should have been created on buddy (cache #" + backupIndex + ")";
+ boolean backupStatePropagated = caches.get(backupIndex).exists(backup);
+ boolean backupOlderThanOwner = backupIndex < i;
+ assert (!backupStatePropagated && !backupOlderThanOwner) || (backupStatePropagated && backupOlderThanOwner) : "Backup state should NOT have been transferred to buddy (cache #" + backupIndex + ")";
+ }
+
+ // now NEW state should transfer just fine.
+
+ cacheNumber = 0;
+ for (CacheSPI c : caches)
+ {
+ c.put("/" + (cacheNumber++) + "_NEW", "k", "v");
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ int backupIndex = i == 2 ? 0 : i + 1;
+
+ assert caches.get(i).exists("/" + i + "_NEW") : "Data should exist on owner (cache #" + i + ")";
+ Fqn backup = fqnTransformer.getBackupFqn(caches.get(i).getLocalAddress(), Fqn.fromString("/" + i + "_NEW"));
+
+ assert caches.get(backupIndex).exists(backup.getParent()) : "Backup region should have been created on buddy (cache #" + backupIndex + ")";
+ assert caches.get(backupIndex).exists(backup) : "Backup state should NOT have been transferred to buddy (cache #" + backupIndex + ")";
+ }
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesNoStateTransfer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
+import org.jgroups.JChannel;
+import org.jgroups.protocols.DISCARD;
+import static org.testng.AssertJUnit.*;
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+/**
+ * Tests behaviour when data owners fail - essentially this tests data gravitation
+ *
+ * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy3NodesWithFailoverTest")
+public class Buddy3NodesWithFailoverTest extends BuddyReplicationTestsBase
+{
+ protected boolean optimisticLocks = false;
+ protected String key = "key";
+ protected String value = "value";
+ BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
+
+ public void testSubtreeRetrieval() throws Exception
+ {
+ List<CacheSPI<Object, Object>> caches = createCaches(3, false, true, optimisticLocks);
+ cachesTL.set(caches);
+
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn fqn2 = Fqn.fromString("/test/subtree");
+
+ Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
+ Fqn backupFqn2 = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn2);
+
+ caches.get(0).put(fqn, key, value);
+ caches.get(0).put(fqn2, key, value);
+
+ // test backup replication to buddy
+ assertEquals(value, caches.get(0).get(fqn, key));
+ assertEquals(value, caches.get(0).get(fqn2, key));
+ assertEquals(value, caches.get(1).get(backupFqn, key));
+ assertEquals(value, caches.get(1).get(backupFqn2, key));
+
+ assertTrue(!caches.get(0).exists(backupFqn));
+ assertTrue(!caches.get(0).exists(backupFqn2));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn2));
+ assertTrue(!caches.get(2).exists(fqn));
+ assertTrue(!caches.get(2).exists(fqn2));
+ assertTrue(!caches.get(2).exists(backupFqn));
+ assertTrue(!caches.get(2).exists(backupFqn2));
+
+ assertNoLocks(caches);
+
+ // gravitate to 2:
+ ReplicationListener replListener1 = ReplicationListener.getReplicationListener(caches.get(0));
+ replListener1.expect(DataGravitationCleanupCommand.class);
+ caches.get(2).getNode(fqn); // expectWithTx entire subtree to gravitate.
+ replListener1.waitForReplicationToOccur(); // cleanup commands are async
+
+ Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
+ Fqn newBackupFqn2 = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn2);
+
+ assertEquals(value, caches.get(2).get(fqn, key));
+ assertTrue(caches.get(2).exists(fqn2));
+ assertEquals(value, caches.get(0).get(newBackupFqn, key));
+ assertTrue(caches.get(0).exists(newBackupFqn2));
+
+ assertTrue(!caches.get(2).exists(newBackupFqn));
+ assertTrue(!caches.get(2).exists(newBackupFqn2));
+ assertTrue(!caches.get(0).exists(fqn));
+ assertTrue(!caches.get(0).exists(fqn2));
+ assertTrue(!caches.get(1).exists(fqn));
+ assertTrue(!caches.get(1).exists(fqn2));
+ assertTrue(!caches.get(1).exists(newBackupFqn));
+ assertTrue(!caches.get(1).exists(newBackupFqn2));
+
+ TestingUtil.dumpCacheContents(caches);
+
+ for (CacheSPI<Object, Object> cache : caches)
+ {
+ assertTrue(!cache.exists(backupFqn));
+ assertTrue(!cache.exists(backupFqn2));
+ }
+
+ assertNoLocks(caches);
+ }
+
+ @Test
+ public void testDataGravitationKillOwner() throws Exception
+ {
+ List<CacheSPI<Object, Object>> cachePool = createCaches(3, false, true);
+ Fqn fqn = Fqn.fromString("/test");
+ Fqn backupFqn = fqnTransformer.getBackupFqn(cachePool.get(0).getLocalAddress(), fqn);
+
+ TestingUtil.dumpCacheContents(cachePool);
+
+ cachePool.get(0).put(fqn, key, value);
+
+ TestingUtil.dumpCacheContents(cachePool);
+
+ assertEquals("Value should exist", value, cachePool.get(0).get(fqn, key));
+
+ TestingUtil.dumpCacheContents(cachePool);
+
+ // use exists instead of get() to prevent going up the interceptor stack
+ assertTrue("Should be false", !cachePool.get(1).exists(fqn));
+ assertTrue("Should be false", !cachePool.get(2).exists(fqn));
+
+ assertFalse("Should be false", cachePool.get(0).exists(backupFqn));
+ assertTrue("Value be true", cachePool.get(1).exists(backupFqn));
+ assertFalse("Should be false", cachePool.get(2).exists(backupFqn));
+
+ System.out.println("***** About to kill original data owner (" + cachePool.get(0).getLocalAddress() + "). *****");
+ // forcefully kill data owner.
+ amendDiscard(cachePool.get(0), cachePool.get(1), 2, true);
+ waitForSingleBuddy(cachePool.get(1), cachePool.get(2));
+
+ System.out.println("Killed. Testing backup roots.");
+ TestingUtil.dumpCacheContents(cachePool);
+ // assert that the remaining cachePool have picked new buddies. Cache 1 should have cache 2's backup data.
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
+ assert cachePool.get(1).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), 1), false) != null : "Should have dead node as a defunct backup root.";
+
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
+ assert cachePool.get(2).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
+
+ System.out.println("***** Killed original data owner, about to call a get on a different cache instance. *****");
+
+ ReplicationListener replListener = ReplicationListener.getReplicationListener(cachePool.get(1));
+ replListener.expect(DataGravitationCleanupCommand.class);
+
+ // according to data gravitation, a call to *any* cache should retrieve the data, and move the data to the new cache.
+ assertEquals("Value should have gravitated", value, cachePool.get(2).get(fqn, key));
+ replListener.waitForReplicationToOccur();
+
+ TestingUtil.dumpCacheContents(cachePool);
+
+ // now lets test the eviction part of gravitation
+ Fqn newBackupFqn = fqnTransformer.getBackupFqn(cachePool.get(2).getLocalAddress(), fqn);
+
+ // use exists instead of get() to prevent going up the interceptor stack
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
+ assert cachePool.get(1).peek(fqnTransformer.getBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
+ assert cachePool.get(1).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
+ assert cachePool.get(1).peek(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a defunct backup root.";
+
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
+ assert cachePool.get(2).peek(fqnTransformer.getBackupRoot(cachePool.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
+ assert cachePool.get(2).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cachePool.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
+ assertTrue("Should be false", !cachePool.get(1).exists(fqn));
+
+ // the old backup should no longer exist
+ assertFalse("Should be null", cachePool.get(1).exists(backupFqn));
+ assertFalse("Should be null", cachePool.get(2).exists(backupFqn));
+ }
+
+ private void amendDiscard(CacheSPI cacheToKill, CacheSPI anotherCache, int finalExpectedClusterSize, boolean enable)
+ {
+ JChannel channel = (JChannel) cacheToKill.getRPCManager().getChannel();
+ DISCARD discard = (DISCARD) channel.getProtocolStack().findProtocol(DISCARD.class);
+ if (discard != null)
+ {
+ discard.setDiscardAll(enable);
+ TestingUtil.blockUntilViewReceived(anotherCache, finalExpectedClusterSize, 10000, false);
+ // an extra second, for some reason we need this.
+ TestingUtil.sleepThread(1000);
+ }
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithFailoverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy3NodesWithPoolNoDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,91 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.CacheSPI;
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "buddyreplication.Buddy3NodesWithPoolNoDataGravitationTest")
+public class Buddy3NodesWithPoolNoDataGravitationTest extends AbstractNodeBasedBuddyTest
+{
+
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ caches = createCaches(3, true, false);
+ }
+
+ public void testChangingBuddyPoolMembership() throws Exception
+ {
+ Map map = caches.get(0).getBuddyManager().buddyPool;
+
+ // first test the values
+ assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
+ assertEquals("Failed on cache 1", "B", map.get(caches.get(1).getLocalAddress()));
+ assertEquals("Failed on cache 1", "C", map.get(caches.get(2).getLocalAddress()));
+
+ // now test against each other
+ checkConsistentPoolState(caches);
+
+ caches.get(2).stop();
+ CacheSPI<Object, Object> newlyCreated = createCache(1, "Z");
+
+ waitForSingleBuddy(caches.get(0), caches.get(1), newlyCreated);
+// TestingUtil.blockUntilViewsReceived(cachePool.toArray(new CacheSPI[0]), VIEW_BLOCK_TIMEOUT);
+// TestingUtil.sleepThread(getSleepTimeout());
+
+ // first test the values
+ assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
+ assertEquals("Failed on cache 1", "B", map.get(caches.get(1).getLocalAddress()));
+ assertEquals("Failed on cache 1", "Z", map.get(newlyCreated.getLocalAddress()));
+
+ // now test against each other
+ checkConsistentPoolState(caches);
+
+ newlyCreated.stop();
+ newlyCreated.destroy();
+
+ waitForSingleBuddy(caches.get(0), caches.get(1));
+
+ caches.get(2).start();
+
+ waitForSingleBuddy(caches.get(0), caches.get(1), caches.get(2));
+ }
+
+
+
+ public void test3CachesWithPoolNames() throws Exception
+ {
+ long st = System.currentTimeMillis();
+ System.out.println("Setup: " + (System.currentTimeMillis() - st));
+ st = System.currentTimeMillis();
+
+ BuddyManager m = caches.get(0).getBuddyManager();
+ Map groupMap = m.buddyPool;
+
+ assertEquals("A", groupMap.get(caches.get(0).getLocalAddress()));
+ assertEquals("B", groupMap.get(caches.get(1).getLocalAddress()));
+ assertEquals("C", groupMap.get(caches.get(2).getLocalAddress()));
+ System.out.println("Test: " + (System.currentTimeMillis() - st));
+ }
+
+ public void testBuddyPoolSync() throws Exception
+ {
+ Map map = caches.get(0).getBuddyManager().buddyPool;
+
+ // first test the values
+ assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
+ assertEquals("Failed on cache 1", "B", map.get(caches.get(1).getLocalAddress()));
+ assertEquals("Failed on cache 1", "C", map.get(caches.get(2).getLocalAddress()));
+
+ // now test against each other
+ checkConsistentPoolState(caches);
+ }
+
+
+}
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy4Nodes2BackupsTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy4Nodes2BackupsTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy4Nodes2BackupsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.buddyreplication;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Cache;
+import org.jboss.cache.util.TestingUtil;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.BeforeClass;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+
+/**
+ * Tests how groups are formed and disbanded
+ *
+ * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
+ */
+@Test(groups = {"functional", "jgroups"}, testName = "buddyreplication.Buddy4Nodes2BackupsTest")
+public class Buddy4Nodes2BackupsTest extends AbstractNodeBasedBuddyTest
+{
+ @BeforeClass
+ public void createCaches() throws Exception
+ {
+ caches = createCaches(2, 4, false);
+ }
+
+ private Log log = LogFactory.getLog(Buddy4Nodes2BackupsTest.class);
+ BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
+
+ public void test2Buddies() throws Exception
+ {
+ TestingUtil.blockUntilViewsReceived(5000, caches.toArray(new Cache[0]));
+
+ waitForBuddy(caches.get(0), caches.get(1), false);
+ waitForBuddy(caches.get(0), caches.get(2), false);
+
+ waitForBuddy(caches.get(1), caches.get(2), false);
+ waitForBuddy(caches.get(1), caches.get(3), false);
+
+ waitForBuddy(caches.get(2), caches.get(3), false);
+ waitForBuddy(caches.get(2), caches.get(0), false);
+
+ waitForBuddy(caches.get(3), caches.get(0), false);
+ waitForBuddy(caches.get(3), caches.get(1), false);
+ }
+
+
+ public void testPutAndRemove2() throws Exception
+ {
+ String fqn = "/test";
+ String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
+
+ // put something in cache 1
+ assertNoStaleLocks(caches);
+
+ caches.get(0).put(fqn, key, value);
+
+ assertNoStaleLocks(caches);
+
+ // this should be in neither of the other cachePool' "main" trees
+ assertEquals(value, caches.get(0).get(fqn, key));
+ assertNull("Should be null", caches.get(1).get(fqn, key));
+ assertNull("Should be null", caches.get(2).get(fqn, key));
+ assertNull("Should be null", caches.get(3).get(fqn, key));
+
+ // check the backup trees
+ assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
+ assertEquals("Buddy should have data in backup tree", value, caches.get(2).get(backupFqn, key));
+ assertNull("Should be null", caches.get(3).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+
+ // now remove
+ caches.get(0).removeNode(fqn);
+ assertNoStaleLocks(caches);
+
+ assertNull("Should be null", caches.get(0).get(fqn, key));
+ assertNull("Should be null", caches.get(1).get(fqn, key));
+ assertNull("Should be null", caches.get(2).get(fqn, key));
+ assertNull("Should be null", caches.get(3).get(fqn, key));
+
+ // check the backup trees
+ assertNull("Should be null", caches.get(0).get(backupFqn, key));
+ assertNull("Should be null", caches.get(1).get(backupFqn, key));
+ assertNull("Should be null", caches.get(2).get(backupFqn, key));
+ assertNull("Should be null", caches.get(3).get(backupFqn, key));
+
+ assertNoStaleLocks(caches);
+ }
+
+
+ @Test (dependsOnMethods = {"test2Buddies", "testPutAndRemove2"} )
+ public void testRemovalFromCluster2Buddies() throws Throwable
+{
+ assertNoLocks(caches);
+
+ TestingUtil.sleepThread(getSleepTimeout());
+
+ waitForBuddy(caches.get(0), caches.get(1), false);
+ waitForBuddy(caches.get(0), caches.get(2), false);
+
+ waitForBuddy(caches.get(1), caches.get(2), false);
+ waitForBuddy(caches.get(1), caches.get(3), false);
+
+ waitForBuddy(caches.get(2), caches.get(3), false);
+ waitForBuddy(caches.get(2), caches.get(0), false);
+
+ waitForBuddy(caches.get(3), caches.get(0), false);
+ waitForBuddy(caches.get(3), caches.get(1), false);
+
+ // now remove a cache from the cluster
+ caches.get(1).stop();
+ caches.set(1, null);
+
+ TestingUtil.sleepThread(getSleepTimeout());
+
+ // now test new buddy groups
+ waitForBuddy(caches.get(0), caches.get(2), false);
+ waitForBuddy(caches.get(0), caches.get(3), false);
+
+ waitForBuddy(caches.get(2), caches.get(3), false);
+ waitForBuddy(caches.get(2), caches.get(0), false);
+
+ waitForBuddy(caches.get(3), caches.get(0), false);
+ waitForBuddy(caches.get(3), caches.get(2), false);
+ assertNoLocks(caches);
+ }
+
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/Buddy4Nodes2BackupsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,216 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Region;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.util.CachePrinter;
-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.HashMap;
-import java.util.Map;
-import org.jboss.cache.UnitTestCacheFactory;
-
-/**
- * Tests handling of the buddy backup region during region
- * activation and inactivation
- *
- * @author Brian Stansberry
- */
-@Test(groups = "functional", testName = "buddyreplication.BuddyBackupActivationInactivationTest")
-public class BuddyBackupActivationInactivationTest extends BuddyReplicationTestsBase
-{
- public static final Fqn A = Fqn.fromString("/a");
- public static final Fqn A_B = Fqn.fromString("/a/b");
- public static final String JOE = "JOE";
-
- protected ThreadLocal<Map<String, Cache>> cachesTL = new ThreadLocal<Map<String, Cache>>();
- private ThreadLocal<ClassLoader> orig_TCL_TL = new ThreadLocal<ClassLoader>();
-
- public void testBuddyBackupActivation() throws Exception
- {
- CacheSPI cache1 = createCache("cache1", true, true, true);
- CacheSPI cache2 = createCache("cache2", true, true, true);
- Fqn A = Fqn.fromString("/a");
- TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
-
- // create the regions on the two caches first
- Region c1 = cache1.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
- Region c2 = cache2.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
-
- assertFalse(c1.isActive());
- assertFalse(c2.isActive());
-
- c1.activate();
- cache1.put(A_B, "name", JOE);
-
- waitForBuddy(cache2, cache1, true);
- waitForBuddy(cache1, cache2, true);
-
-// TestingUtil.sleepThread(getSleepTimeout());
-
- System.out.println("Cache dump BEFORE activation");
- System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
- System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
-
- c2.activate();
-
- System.out.println("Cache dump AFTER activation");
- System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
- System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
-
- Fqn fqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
-
- assertEquals("State transferred with activation", JOE, cache2.get(fqn, "name"));
- }
-
- public void testReplToInactiveRegion() throws Exception
- {
- CacheSPI cache1 = createCache("cache1", true, true, true);
- CacheSPI cache2 = createCache("cache2", true, true, true);
-
- TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
- Fqn backupFqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
- Fqn A = Fqn.fromString("/a");
-
- Region regionA = cache1.getRegion(A, true);
- regionA.registerContextClassLoader(getClass().getClassLoader());
- regionA.activate();
-
- // Activate the buddy backup subtree in the recipient so any
- // repl message doesn't get rejected due to that tree being inactive
- cache2.getRegionManager().activate(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
- cache2.getRegionManager().deactivate(A);
-
- cache1.put(A_B, "name", JOE);
-
-// TestingUtil.sleepThread(getSleepTimeout());
- assertNull("Should be no replication to inactive region", cache2.get(A_B, "name"));
-
- assertNull("Should be no replication to inactive backup region", cache2.get(backupFqn, "name"));
- }
-
- public void testBuddyBackupInactivation() throws Exception
- {
- CacheSPI cache1 = createCache("cache1", true, true, true);
- Fqn A = Fqn.fromString("/a");
- Region regionA = cache1.getRegion(A, true);
- regionA.registerContextClassLoader(getClass().getClassLoader());
- regionA.activate();
-
- Fqn fqn = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
- fqn = Fqn.fromRelativeFqn(fqn, A_B);
- cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache1.put(fqn, "name", JOE);
-
- assertEquals("Put should have been OK", JOE, cache1.get(fqn, "name"));
-
- regionA.deactivate();
-
- assertNull("Inactivation should have cleared region", cache1.get(fqn, "name"));
- }
-
- protected CacheSPI<?, ?> createCache(String cacheID,
- boolean sync,
- boolean useMarshalling,
- boolean startCache)
- throws Exception
- {
-
- Map<String, Cache> caches = cachesTL.get();
-
- if (caches.get(cacheID) != null)
- {
- throw new IllegalStateException(cacheID + " already created");
- }
-
- CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
- Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
-
- CacheSPI<?, ?> cache = (CacheSPI<?, ?>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);
-
- //cache.getConfiguration().setClusterName("TestCluster");
- if (useMarshalling)
- {
- cache.getConfiguration().setUseRegionBasedMarshalling(true);
- cache.getConfiguration().setInactiveOnStartup(true);
- }
- cache.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
- // Put the cache in the map before starting, so if it fails in
- // start it can still be destroyed later
- caches.put(cacheID, cache);
-
- if (startCache)
- {
- cache.create();
- cache.start();
- }
-
- return cache;
- }
-
- @BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
- {
- Map<String, Cache> caches = new HashMap<String, Cache>();
- cachesTL.set(caches);
-
- // Save the TCL in case a test changes it
- orig_TCL_TL.set(Thread.currentThread().getContextClassLoader());
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- super.tearDown();
-
- // Restore the TCL in case a test changed it
- Thread.currentThread().setContextClassLoader(orig_TCL_TL.get());
- Map<String, Cache> caches = new HashMap<String, Cache>();
-
- for (String cacheID : caches.keySet())
- {
- stopCache(caches.get(cacheID));
- }
- cachesTL.set(null);
- }
-
- protected void stopCache(Cache cache)
- {
- if (cache != null)
- {
- try
- {
- cache.stop();
- cache.destroy();
- }
- catch (Exception e)
- {
- System.out.println("Exception stopping cache " + e.getMessage());
- e.printStackTrace(System.out);
- }
- }
- }
-
- private BuddyReplicationConfig getBuddyConfig() throws Exception
- {
- BuddyReplicationConfig brc = new BuddyReplicationConfig();
- brc.setEnabled(true);
- brc.setAutoDataGravitation(false);
- return brc;
- }
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.util.CachePrinter;
-import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * Tests how groups are formed and disbanded
- *
- * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
- */
-@Test(groups = {"functional", "jgroups"}, testName = "buddyreplication.BuddyGroupAssignmentTest")
-public class BuddyGroupAssignmentTest extends BuddyReplicationTestsBase
-{
- private Log log = LogFactory.getLog(BuddyGroupAssignmentTest.class);
- BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
-
- public void testSingleBuddy() throws Exception
- {
- log.debug("Running testSingleBuddy");
- List<CacheSPI<Object, Object>> caches = createCaches(3, false);
- cachesTL.set(caches);
-
- System.out.println("*** Testing cache 0:");
- waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1:");
- waitForBuddy(caches.get(1), caches.get(2), true);
- System.out.println("*** Testing cache 2:");
- waitForBuddy(caches.get(2), caches.get(0), true);
-
- System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
- System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
- System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
- }
-
- public void test2Buddies() throws Exception
- {
- log.debug("Running test2Buddies");
- List<CacheSPI<Object, Object>> caches = createCaches(2, 3, false);
- cachesTL.set(caches);
-
- TestingUtil.blockUntilViewsReceived(5000, caches.toArray(new Cache[0]));
-// TestingUtil.sleepThread(2000);
-
- System.out.println("*** Testing cache 0");
- waitForBuddy(caches.get(0), caches.get(1), false);
- waitForBuddy(caches.get(0), caches.get(2), false);
- System.out.println("*** Testing cache 1");
- waitForBuddy(caches.get(1), caches.get(2), false);
- waitForBuddy(caches.get(1), caches.get(0), false);
- System.out.println("*** Testing cache 2");
- waitForBuddy(caches.get(2), caches.get(1), false);
- waitForBuddy(caches.get(2), caches.get(0), false);
- }
-
- public void testRemovalFromClusterSingleBuddy() throws Exception
- {
- log.debug("Running testRemovalFromClusterSingleBuddy");
- List<CacheSPI<Object, Object>> caches = createCaches(3, false);
- cachesTL.set(caches);
-
- System.out.println("*** Testing cache 0");
- waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1");
- waitForBuddy(caches.get(1), caches.get(2), true);
- System.out.println("*** Testing cache 2");
- waitForBuddy(caches.get(2), caches.get(0), true);
-
- // now remove a cache from the cluster
- caches.get(1).stop();
- caches.set(1, null);
-
- TestingUtil.sleepThread(getSleepTimeout());
-
- // now test new buddy groups
- System.out.println("*** Testing cache 0");
- waitForBuddy(caches.get(0), caches.get(2), true);
- System.out.println("*** Testing cache 2");
- waitForBuddy(caches.get(2), caches.get(0), true);
- System.out.println("*** Completed successfully ***");
- assertNoLocks(caches);
- }
-
- public void testRemovalFromCluster2Buddies() throws Throwable
-{
- log.debug("Running testRemovalFromCluster2Buddies");
- List<CacheSPI<Object, Object>> caches = createCaches(2, 4, false);
- cachesTL.set(caches);
- assertNoLocks(caches);
-
- TestingUtil.sleepThread(getSleepTimeout());
-
- System.out.println("*** Testing cache 0");
- waitForBuddy(caches.get(0), caches.get(1), false);
- waitForBuddy(caches.get(0), caches.get(2), false);
- System.out.println("*** Testing cache 1");
- waitForBuddy(caches.get(1), caches.get(2), false);
- waitForBuddy(caches.get(1), caches.get(3), false);
- System.out.println("*** Testing cache 2");
- waitForBuddy(caches.get(2), caches.get(3), false);
- waitForBuddy(caches.get(2), caches.get(0), false);
- System.out.println("*** Testing cache 3");
- waitForBuddy(caches.get(3), caches.get(0), false);
- waitForBuddy(caches.get(3), caches.get(1), false);
-
- // now remove a cache from the cluster
- caches.get(1).stop();
- caches.set(1, null);
-
- TestingUtil.sleepThread(getSleepTimeout());
-
- // now test new buddy groups
- System.out.println("*** Testing cache 0");
- waitForBuddy(caches.get(0), caches.get(2), false);
- waitForBuddy(caches.get(0), caches.get(3), false);
- System.out.println("*** Testing cache 2");
- waitForBuddy(caches.get(2), caches.get(3), false);
- waitForBuddy(caches.get(2), caches.get(0), false);
- System.out.println("*** Testing cache 3");
- waitForBuddy(caches.get(3), caches.get(0), false);
- waitForBuddy(caches.get(3), caches.get(2), false);
- assertNoLocks(caches);
- }
-
- public void testAddingNewCaches() throws Exception
- {
- log.debug("Running testAddingNewCaches");
- List<CacheSPI<Object, Object>> caches = createCaches(2, false);
- cachesTL.set(caches);
-
- // get some data in there.
-
- caches.get(0).put("/cache0", "k", "v");
- caches.get(1).put("/cache1", "k", "v");
-
- System.out.println("*** Testing cache 0:");
- waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1:");
- waitForBuddy(caches.get(1), caches.get(0), true);
-
- assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
- assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
-
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
-
- caches.add(createCache(1, null));
-
- TestingUtil.blockUntilViewsReceived(60000, caches);
-
- System.out.println("*** Testing cache 0:");
- waitForBuddy(caches.get(0), caches.get(1), true);
- System.out.println("*** Testing cache 1:");
- waitForBuddy(caches.get(1), caches.get(2), true);
- System.out.println("*** Testing cache 2:");
- waitForBuddy(caches.get(2), caches.get(0), true);
-
-
- System.out.println("0 Lock info: " + CachePrinter.printCacheLockingInfo(caches.get(0)));
- System.out.println("1 Lock info: " + CachePrinter.printCacheLockingInfo(caches.get(1)));
- System.out.println("2 Lock info: " + CachePrinter.printCacheLockingInfo(caches.get(2)));
-
- assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
- assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should have backup region for non-buddy";
- assert caches.get(0).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have backup region for buddy";
-
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
-
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for self";
-
- // ensure no state transfer has happened!!
- assert caches.get(2).peek(Fqn.fromString("/cache0"), false) == null : "Unnecessary state should not have been transferred!";
- assert caches.get(2).peek(Fqn.fromString("/cache1"), false) == null : "Unnecessary state should not have been transferred!";
-
- // ensure backup state has been transferred.
- assert caches.get(2).peek(fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), Fqn.fromString("/cache1")), false) != null : "Backup state should have transferred!";
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -29,24 +29,6 @@
{
private Log log = LogFactory.getLog(BuddyPoolBroadcastTest.class);
- private void checkConsistentPoolState(List<CacheSPI<Object, Object>> caches)
- {
- for (int i = 0; i < caches.size(); i++)
- {
- Map groupMap = caches.get(i).getBuddyManager().buddyPool;
- for (int j = 0; j < caches.size(); j++)
- {
- if (i != j)
- {
- Map groupMap2 = caches.get(j).getBuddyManager().buddyPool;
- for (CacheSPI cache : caches)
- {
- assertEquals("Comparing contents of cache " + (i + 1) + " pool map with cache " + (j + 1), groupMap.get(cache), groupMap2.get(cache));
- }
- }
- }
- }
- }
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
@@ -61,7 +43,6 @@
log.error("Running test2CachesWithPoolNames");
List<CacheSPI<Object, Object>> caches = createCaches(2, true);
cachesTL.set(caches);
- log.error("Created 2 caches");
BuddyManager m = caches.get(0).getBuddyManager();
Map groupMap = m.buddyPool;
@@ -70,72 +51,6 @@
assertEquals("B", groupMap.get(caches.get(1).getLocalAddress()));
}
- public void test3CachesWithPoolNames() throws Exception
- {
- log.debug("Running test3CachesWithPoolNames");
- long st = System.currentTimeMillis();
- List<CacheSPI<Object, Object>> caches = createCaches(3, true);
- cachesTL.set(caches);
- System.out.println("Setup: " + (System.currentTimeMillis() - st));
- st = System.currentTimeMillis();
-
- BuddyManager m = caches.get(0).getBuddyManager();
- Map groupMap = m.buddyPool;
-
- assertEquals("A", groupMap.get(caches.get(0).getLocalAddress()));
- assertEquals("B", groupMap.get(caches.get(1).getLocalAddress()));
- assertEquals("C", groupMap.get(caches.get(2).getLocalAddress()));
- System.out.println("Test: " + (System.currentTimeMillis() - st));
- }
-
- public void testBuddyPoolSync() throws Exception
- {
- log.debug("Running testBuddyPoolSync");
- List<CacheSPI<Object, Object>> caches = createCaches(3, true);
- cachesTL.set(caches);
-
- Map map = caches.get(0).getBuddyManager().buddyPool;
-
- // first test the values
- assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
- assertEquals("Failed on cache 1", "B", map.get(caches.get(1).getLocalAddress()));
- assertEquals("Failed on cache 1", "C", map.get(caches.get(2).getLocalAddress()));
-
- // now test against each other
- checkConsistentPoolState(caches);
- }
-
- public void testChangingBuddyPoolMembership() throws Exception
- {
- log.debug("Running testChangingBuddyPoolMembership");
- List<CacheSPI<Object, Object>> caches = createCaches(3, true);
- cachesTL.set(caches);
-
- Map map = caches.get(0).getBuddyManager().buddyPool;
-
- // first test the values
- assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
- assertEquals("Failed on cache 1", "B", map.get(caches.get(1).getLocalAddress()));
- assertEquals("Failed on cache 1", "C", map.get(caches.get(2).getLocalAddress()));
-
- // now test against each other
- checkConsistentPoolState(caches);
-
- caches.get(1).stop();
- caches.set(1, createCache(1, "Z"));
-
- TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheSPI[0]), VIEW_BLOCK_TIMEOUT);
- TestingUtil.sleepThread(getSleepTimeout());
-
- // first test the values
- assertEquals("Failed on cache 1", "A", map.get(caches.get(0).getLocalAddress()));
- assertEquals("Failed on cache 1", "Z", map.get(caches.get(1).getLocalAddress()));
- assertEquals("Failed on cache 1", "C", map.get(caches.get(2).getLocalAddress()));
-
- // now test against each other
- checkConsistentPoolState(caches);
- }
-
public void testConcurrency() throws Exception
{
int numCaches = 4;
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,351 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.notifications.annotation.CacheBlocked;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheUnblocked;
-import org.jboss.cache.notifications.event.Event;
-import org.jboss.cache.util.CachePrinter;
-import org.jboss.cache.util.TestingUtil;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Teststhe transfer of content under *normal* operation
- *
- * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
- */
-@Test(groups = {"functional"}, testName = "buddyreplication.BuddyReplicationTestsBase")
-public class BuddyReplicationContentTest extends BuddyReplicationTestsBase
-{
- private final String key = "key";
- private final String value = "value";
- private Log log = LogFactory.getLog(BuddyGroupAssignmentTest.class);
-
- private void assertNoStaleLocks(List<CacheSPI<Object, Object>> caches)
- {
- for (CacheSPI<Object, Object> cache : caches) assertNoStaleLocks(cache);
- }
-
- private void assertNoStaleLocks(CacheSPI<Object, Object> cache)
- {
- assertEquals("Number of locks in cache instance " + cache + " should be 0", 0, cache.getNumberOfLocksHeld());
- }
-
- public void testSimplePut() throws Exception
- {
- log.debug("Running testSimplePut");
- List<CacheSPI<Object, Object>> caches = createCaches(3, false);
- cachesTL.set(caches);
-
- String fqn = "/test";
- String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
-
- assertNoStaleLocks(caches);
-
- // put something in cache 1
- caches.get(0).put(fqn, key, value);
-
- assertNoStaleLocks(caches);
-
- // this should be in neither of the other caches' "main" trees
- assertEquals(value, caches.get(0).get(fqn, key));
- assertNull("Should be null", caches.get(1).get(fqn, key));
- assertNull("Should be null", caches.get(2).get(fqn, key));
-
- // check the backup trees
-
- assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
- assertNull("Should be null", caches.get(2).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
-
- System.out.println("Cache 0 = " + CachePrinter.printCacheLockingInfo(caches.get(0)));
- System.out.println("Cache 1 = " + CachePrinter.printCacheLockingInfo(caches.get(1)));
- System.out.println("Cache 2 = " + CachePrinter.printCacheLockingInfo(caches.get(2)));
- }
-
- public void testPutAndRemove() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(3, false);
- cachesTL.set(caches);
- log.debug("Running testPutAndRemove");
-
- String fqn = "/test";
- String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
-
- assertNoStaleLocks(caches);
-
- // put something in cache 1
- caches.get(0).put(fqn, key, value);
-
- assertNoStaleLocks(caches);
-
- // this should be in neither of the other caches' "main" trees
- assertEquals(value, caches.get(0).get(fqn, key));
- assertNull("Should be null", caches.get(1).get(fqn, key));
- assertNull("Should be null", caches.get(2).get(fqn, key));
-
- // check the backup trees
-
- assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
- assertNull("Should be null", caches.get(2).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
-
- // now remove
- caches.get(0).removeNode(fqn);
- assertNoStaleLocks(caches);
-
-
- assertNull("Should be null", caches.get(0).get(fqn, key));
- assertNull("Should be null", caches.get(1).get(fqn, key));
- assertNull("Should be null", caches.get(2).get(fqn, key));
-
- // check the backup trees
- assertNull("Should be null", caches.get(0).get(backupFqn, key));
- assertNull("Should be null", caches.get(1).get(backupFqn, key));
- assertNull("Should be null", caches.get(2).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
- }
-
- public void testPutAndRemove2() throws Exception
- {
- log.debug("Running testPutAndRemove2");
- List<CacheSPI<Object, Object>> caches = createCaches(2, 4, false);
- cachesTL.set(caches);
-
- String fqn = "/test";
- String backupFqn = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + fqn;
-
- // put something in cache 1
- assertNoStaleLocks(caches);
-
- caches.get(0).put(fqn, key, value);
-
- assertNoStaleLocks(caches);
-
- // this should be in neither of the other caches' "main" trees
- assertEquals(value, caches.get(0).get(fqn, key));
- assertNull("Should be null", caches.get(1).get(fqn, key));
- assertNull("Should be null", caches.get(2).get(fqn, key));
- assertNull("Should be null", caches.get(3).get(fqn, key));
-
- // check the backup trees
- assertEquals("Buddy should have data in backup tree", value, caches.get(1).get(backupFqn, key));
- assertEquals("Buddy should have data in backup tree", value, caches.get(2).get(backupFqn, key));
- assertNull("Should be null", caches.get(3).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
-
- // now remove
- caches.get(0).removeNode(fqn);
- assertNoStaleLocks(caches);
-
- assertNull("Should be null", caches.get(0).get(fqn, key));
- assertNull("Should be null", caches.get(1).get(fqn, key));
- assertNull("Should be null", caches.get(2).get(fqn, key));
- assertNull("Should be null", caches.get(3).get(fqn, key));
-
- // check the backup trees
- assertNull("Should be null", caches.get(0).get(backupFqn, key));
- assertNull("Should be null", caches.get(1).get(backupFqn, key));
- assertNull("Should be null", caches.get(2).get(backupFqn, key));
- assertNull("Should be null", caches.get(3).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
- }
-
- public void testBuddyJoin() throws Exception
- {
- log.debug("Running testBuddyJoin");
- List<CacheSPI<Object, Object>> caches = createCaches(2, false);
- cachesTL.set(caches);
- CacheSPI<Object, Object> cache2 = null;
-
- try
- {
- Fqn fqn = Fqn.fromString("/test");
- Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), fqn);
-
- assertNoStaleLocks(caches);
-
- // put something in cache 1
- caches.get(1).put(fqn, key, value);
-
- assertNoStaleLocks(caches);
-
- // this should be in neither of the other caches' "main" trees
- assertEquals(value, caches.get(1).get(fqn, key));
- assertFalse("Should be false", caches.get(0).exists(fqn));
-
- // check the backup trees
- assertEquals("Buddy should have data in backup tree", value, caches.get(0).get(backupFqn, key));
-
- assertNoStaleLocks(caches);
-
- // now add a new cache to the cluster
- cache2 = createCache(1, null);
-
- // allow this cache a few msecs to join
- TestingUtil.blockUntilViewsReceived(3000, caches.get(0), caches.get(1), cache2);
-
- TestingUtil.sleepThread(2000); // allow buddy group reorg
-
- List<CacheSPI<Object, Object>> dump = new ArrayList<CacheSPI<Object, Object>>(caches);
- dump.add(cache2);
- TestingUtil.dumpCacheContents(dump);
-
- // now caches.get(1)'s buddy should be cache2, not cache[0]
- assertIsBuddy(caches.get(1), cache2, true);
- // this should still be the same
- assertIsBuddy(caches.get(0), caches.get(1), true);
- // and cache2's buddy should be cache[0]
- assertIsBuddy(cache2, caches.get(0), true);
-
- // so now the backup data we saw on cache[0] should have been removed.
- assertFalse("This backup data should have been removed", caches.get(0).exists(backupFqn));
-
- // while cache2 should now posess this backup (due to a state transfer)
- assertEquals("Backup state should have been transferred to this new cache instance", value, cache2.get(backupFqn, key));
-
- caches.get(1).removeNode(fqn);
- assertNoStaleLocks(caches);
-
-
- assertFalse("Should be null", caches.get(0).exists(fqn));
- assertFalse("Should be null", caches.get(1).exists(fqn));
- assertFalse("Should be null", cache2.exists(fqn));
-
- // check the backup trees
- assertFalse("Should be null", caches.get(0).exists(backupFqn));
- assertFalse("Should be null", caches.get(1).exists(backupFqn));
- assertFalse("Should be null", cache2.exists(backupFqn));
-
- assertNoStaleLocks(caches);
-
- }
- finally
- {
- if (cache2 != null) cache2.stop();
- }
- }
-
- //@Test (invocationCount = 25)
- public void testCompleteStateSurvival() throws Exception
- {
- log.debug("Running testCompleteStateSurvival");
- List<CacheSPI<Object, Object>> caches = createCaches(3, false, true);
- cachesTL.set(caches);
- CacheBlockListener blockListener = new CacheBlockListener();
-
- caches.get(0).addCacheListener(blockListener);
- caches.get(1).addCacheListener(blockListener);
- caches.get(2).addCacheListener(blockListener);
-
- caches.get(0).put("/0", "key", "value");
- caches.get(1).put("/1", "key", "value");
- caches.get(2).put("/2", "key", "value");
-
-// TestingUtil.sleepThread(getSleepTimeout());
- //TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
- blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
-
- log.info("stopping 2");
- caches.get(2).stop();
-
- blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
-
- assertEquals("value", caches.get(0).get("/2", "key"));
-
- blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
-
- caches.get(1).stop();
-
- // cache[0] is all thats left!!
-
- assertEquals("value", caches.get(0).get("/0", "key"));
-
- try
- {
- assertEquals("value", caches.get(0).get("/1", "key"));
- }
- catch (RuntimeException e)
- {
- // may barf the first time around since we are unable to contact our buddy and store this data.
- assertEquals(IllegalArgumentException.class, e.getCause().getClass());
- }
-
- // now try the assertion again since the local gravitation would have worked.
-
- System.out.println("Cache contents " + CachePrinter.printCacheDetails(caches.get(0)));
-
- assertEquals("value", caches.get(0).get("/1", "key"));
- assertEquals("value", caches.get(0).get("/2", "key"));
- }
-
- @CacheListener
- public static class CacheBlockListener
- {
- private int blocks = 0;
-
- @CacheBlocked
- public void processBlock(Event e)
- {
- if (e.isPre())
- {
- System.out.println(">>>>>>>> Got BLOCK on cache " + e.getCache().getLocalAddress());
- synchronized (this)
- {
- blocks++;
- notifyAll();
- }
- }
- }
-
- @CacheUnblocked
- public void processUnblock(Event e)
- {
- if (e.isPre())
- {
- System.out.println(">>>>>>>> Got UNBLOCK on cache " + e.getCache().getLocalAddress());
- synchronized (this)
- {
- blocks--;
- notifyAll();
- }
- }
- }
-
- public void blockUntilAllCachesAreUnblocked(long maxWait) throws InterruptedException
- {
- synchronized (this)
- {
- if (blocks > 1)
- {
- wait(maxWait);
- }
- // try returning anyway?
- blocks = 0;
- /*
- if (blocks > 1)
- throw new RuntimeException("Timed out waiting for unblocks. Number of blocks = " + blocks);
- if (blocks == 1) blocks = 0;
- */
- }
- }
- }
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,260 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
-import org.jgroups.JChannel;
-import org.jgroups.protocols.DISCARD;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * Tests behaviour when data owners fail - essentially this tests data gravitation
- *
- * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
- */
-@Test(groups = "functional", testName = "buddyreplication.BuddyReplicationFailoverTest")
-public class BuddyReplicationFailoverTest extends BuddyReplicationTestsBase
-{
- protected boolean optimisticLocks = false;
- private String key = "key";
- private String value = "value";
- BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
-
- public void testDataGravitationKillOwner() throws Exception
- {
- testDataGravitation(true);
- }
-
- public void testDataGravitationDontKillOwner() throws Exception
- {
- testDataGravitation(false);
- }
-
- private void testDataGravitation(boolean killOwner) throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(3, false, true, optimisticLocks);
- cachesTL.set(caches);
-
- Fqn fqn = Fqn.fromString("/test");
- Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
-
- TestingUtil.dumpCacheContents(caches);
-
- caches.get(0).put(fqn, key, value);
-
- TestingUtil.dumpCacheContents(caches);
-
- assertEquals("Value should exist", value, caches.get(0).get(fqn, key));
-
- TestingUtil.dumpCacheContents(caches);
-
- // use exists instead of get() to prevent going up the interceptor stack
- assertTrue("Should be false", !caches.get(1).exists(fqn));
- assertTrue("Should be false", !caches.get(2).exists(fqn));
-
- assertFalse("Should be false", caches.get(0).exists(backupFqn));
- assertTrue("Value be true", caches.get(1).exists(backupFqn));
- assertFalse("Should be false", caches.get(2).exists(backupFqn));
-
- if (killOwner)
- {
- System.out.println("***** About to kill original data owner (" + caches.get(0).getLocalAddress() + "). *****");
- // forcefully kill data owner.
- killChannel(caches.get(0), caches.get(1), 2);
- waitForSingleBuddy(caches.get(1), caches.get(2));
-
- System.out.println("Killed. Testing backup roots.");
- TestingUtil.dumpCacheContents(caches);
- // assert that the remaining caches have picked new buddies. Cache 1 should have cache 2's backup data.
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
- assert caches.get(1).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) != null : "Should have dead node as a defunct backup root.";
-
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
- assert caches.get(2).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
- }
-
- System.out.println("***** Killed original data owner, about to call a get on a different cache instance. *****");
-
- ReplicationListener replListener = ReplicationListener.getReplicationListener(caches.get(1));
- replListener.expect(DataGravitationCleanupCommand.class);
-
- // according to data gravitation, a call to *any* cache should retrieve the data, and move the data to the new cache.
- assertEquals("Value should have gravitated", value, caches.get(2).get(fqn, key));
- replListener.waitForReplicationToOccur();
-
- TestingUtil.dumpCacheContents(caches);
-
- // now lets test the eviction part of gravitation
- Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
-
- // use exists instead of get() to prevent going up the interceptor stack
- if (!killOwner)
- {
- assertTrue("Should be false", !caches.get(0).exists(fqn));
- }
- else
- {
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
- assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
- assert caches.get(1).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
- assert caches.get(1).peek(fqnTransformer.getDeadBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a defunct backup root.";
-
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
- assert caches.get(2).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
- assert caches.get(2).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
- }
- assertTrue("Should be false", !caches.get(1).exists(fqn));
-
- // the old backup should no longer exist
- if (!killOwner) assertFalse("Should be null", caches.get(0).exists(backupFqn));
- assertFalse("Should be null", caches.get(1).exists(backupFqn));
- assertFalse("Should be null", caches.get(2).exists(backupFqn));
-
- // and the backup should now exist in caches.get(2)'s buddy which is caches.get(0)
- if (killOwner)
- {
- assertEquals("Value should exist", value, caches.get(1).get(newBackupFqn, key));
- }
- else
- {
- assertEquals("Value should exist", value, caches.get(0).get(newBackupFqn, key));
- assertFalse("Should be null", caches.get(1).exists(newBackupFqn));
- }
- assertFalse("Should be null", caches.get(2).exists(newBackupFqn));
- }
-
- private void killChannel(CacheSPI cacheToKill, CacheSPI anotherCache, int finalExpectedClusterSize)
- {
- JChannel channel = (JChannel) cacheToKill.getRPCManager().getChannel();
- DISCARD discard = (DISCARD) channel.getProtocolStack().findProtocol(DISCARD.class);
- if (discard != null)
- {
- discard.setDiscardAll(true);
- TestingUtil.blockUntilViewReceived(anotherCache, finalExpectedClusterSize, 10000, false);
- // an extra second, for some reason we need this.
- TestingUtil.sleepThread(1000);
- }
- }
-
- public void testDataReplicationSuppression() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(3, false, false, optimisticLocks);
- cachesTL.set(caches);
-
- Fqn fqn = Fqn.fromString("/test");
- Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
- caches.get(0).put(fqn, key, value);
-
- TestingUtil.dumpCacheContents(caches);
-
- assertEquals("value", caches.get(0).get(fqn, key));
- assertFalse(caches.get(0).exists(backupFqn));
- assertEquals("value", caches.get(1).get(backupFqn, key));
- assertFalse(caches.get(1).exists(fqn));
- assertFalse(caches.get(2).exists(fqn));
- assertFalse(caches.get(2).exists(backupFqn));
-
- assertNoLocks(caches);
-
- backupFqn = fqnTransformer.getBackupFqn(caches.get(1).getLocalAddress(), fqn);
-
- System.out.println("*** Calling get() on cache[1] with force option");
-
- ReplicationListener replicationListener0 = ReplicationListener.getReplicationListener(caches.get(0));
- replicationListener0.expect(DataGravitationCleanupCommand.class);
-
- caches.get(1).getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
- assertEquals("value", caches.get(1).get(fqn, key));
- replicationListener0.waitForReplicationToOccur(); // cleanup commands are async
-
- TestingUtil.dumpCacheContents(caches);
-
- assertFalse(caches.get(1).exists(backupFqn));
- assertEquals("value", caches.get(2).get(backupFqn, key));
- assertFalse(caches.get(2).exists(fqn));
- assertFalse(caches.get(0).exists(fqn));
- assertFalse(caches.get(0).exists(backupFqn));
- }
-
- public void testSubtreeRetrieval() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(3, false, true, optimisticLocks);
- cachesTL.set(caches);
-
- Fqn fqn = Fqn.fromString("/test");
- Fqn fqn2 = Fqn.fromString("/test/subtree");
-
- Fqn backupFqn = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
- Fqn backupFqn2 = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn2);
-
- caches.get(0).put(fqn, key, value);
- caches.get(0).put(fqn2, key, value);
-
- // test backup replication to buddy
- assertEquals(value, caches.get(0).get(fqn, key));
- assertEquals(value, caches.get(0).get(fqn2, key));
- assertEquals(value, caches.get(1).get(backupFqn, key));
- assertEquals(value, caches.get(1).get(backupFqn2, key));
-
- assertTrue(!caches.get(0).exists(backupFqn));
- assertTrue(!caches.get(0).exists(backupFqn2));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn2));
- assertTrue(!caches.get(2).exists(fqn));
- assertTrue(!caches.get(2).exists(fqn2));
- assertTrue(!caches.get(2).exists(backupFqn));
- assertTrue(!caches.get(2).exists(backupFqn2));
-
- assertNoLocks(caches);
-
- // gravitate to 2:
- ReplicationListener replListener1 = ReplicationListener.getReplicationListener(caches.get(0));
- replListener1.expect(DataGravitationCleanupCommand.class);
- caches.get(2).getNode(fqn); // expectWithTx entire subtree to gravitate.
- replListener1.waitForReplicationToOccur(); // cleanup commands are async
-
- Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
- Fqn newBackupFqn2 = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn2);
-
- assertEquals(value, caches.get(2).get(fqn, key));
- assertTrue(caches.get(2).exists(fqn2));
- assertEquals(value, caches.get(0).get(newBackupFqn, key));
- assertTrue(caches.get(0).exists(newBackupFqn2));
-
- assertTrue(!caches.get(2).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn2));
- assertTrue(!caches.get(0).exists(fqn));
- assertTrue(!caches.get(0).exists(fqn2));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn2));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn2));
-
- TestingUtil.dumpCacheContents(caches);
-
- for (CacheSPI<Object, Object> cache : caches)
- {
- assertTrue(!cache.exists(backupFqn));
- assertTrue(!cache.exists(backupFqn2));
- }
-
- assertNoLocks(caches);
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -6,10 +6,7 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.*;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
@@ -23,12 +20,13 @@
import org.jboss.cache.util.TestingUtil;
import org.jgroups.Address;
import static org.testng.AssertJUnit.*;
+import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* Base class for BR tests
@@ -54,50 +52,57 @@
{
if (c != null && c.getBuddyManager() != null) c.getBuddyManager().stop();
}
+ cleanupCaches(caches, true);
+ }
+ cachesTL.set(null);
+ System.gc();
+ new UnitTestCacheFactory().cleanUp();
+ }
- for (CacheSPI c : caches)
+ protected void cleanupCaches(List<CacheSPI<Object, Object>> caches, boolean stop)
+ {
+ for (CacheSPI c : caches)
+ {
+ if (c != null)
{
- if (c != null)
+ TransactionManager tm = c.getTransactionManager();
+ if (tm != null)
{
- TransactionManager tm = c.getTransactionManager();
- if (tm != null)
+ try
{
- try
- {
- if (tm.getTransaction() != null) tm.rollback();
- }
- catch (Exception e)
- {
- // error rolling back gtx2EntryMap
- e.printStackTrace();
- }
+ if (tm.getTransaction() != null) tm.rollback();
}
+ catch (Exception e)
+ {
+ // error rolling back gtx2EntryMap
+ e.printStackTrace();
+ }
+ }
- CacheLoaderManager clm = c.getCacheLoaderManager();
- if (clm != null)
+ CacheLoaderManager clm = c.getCacheLoaderManager();
+ if (clm != null)
+ {
+ CacheLoader cl = c.getCacheLoaderManager().getCacheLoader();
+ try
{
- CacheLoader cl = c.getCacheLoaderManager().getCacheLoader();
- try
- {
- if (cl != null) cl.remove(Fqn.ROOT);
- }
- catch (Exception e)
- {
- // unable to clean cache loader
- e.printStackTrace();
- }
+ if (cl != null) cl.remove(Fqn.ROOT);
}
-
+ catch (Exception e)
+ {
+ // unable to clean cache loader
+ e.printStackTrace();
+ }
+ }
+ if (stop)
+ {
c.stop();
- c = null;
}
+ else
+ {
+ c.removeNode(Fqn.ROOT);
+ }
}
}
- cachesTL.set(null);
- System.gc();
-
- new UnitTestCacheFactory().cleanUp();
-
}
protected final static int VIEW_BLOCK_TIMEOUT = 5000;
@@ -137,7 +142,6 @@
BuddyReplicationConfig brc = new BuddyReplicationConfig();
if (buddyPoolName != null) brc.setBuddyPoolName(buddyPoolName);
brc.setEnabled(true);
-// brc.setBuddyCommunicationTimeout(500000);
brc.setDataGravitationRemoveOnFind(removeOnFind);
brc.setDataGravitationSearchBackupTrees(true);
brc.setAutoDataGravitation(useDataGravitation);
@@ -220,7 +224,7 @@
caches.add(createCacheWithCacheLoader(useDataGravitation, removeOnFind, passivation, fetchPersistent, true));
}
- // allow some time for the caches to start up and discover each other
+ // allow some time for the cachePool to start up and discover each other
TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), VIEW_BLOCK_TIMEOUT);
TestingUtil.sleepThread(getSleepTimeout());
return caches;
@@ -269,7 +273,7 @@
if (start)
{
- // allow some time for the caches to start up and discover each other
+ // allow some time for the cachePool to start up and discover each other
TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), VIEW_BLOCK_TIMEOUT);
TestingUtil.sleepThread(getSleepTimeout());
}
@@ -279,10 +283,10 @@
protected void printBuddyGroup(Cache cache)
{
- BuddyManager bm = ((CacheSPI) cache).getBuddyManager();
- BuddyGroup bg = bm.buddyGroup;
- System.out.println("*** " + bg);
- System.out.println(" Groups I participate in: " + bm.buddyGroupsIParticipateIn.keySet());
+// BuddyManager bm = ((CacheSPI) cache).getBuddyManager();
+// BuddyGroup bg = bm.buddyGroup;
+// System.out.println("*** " + bg);
+// System.out.println(" Groups I participate in: " + bm.buddyGroupsIParticipateIn.keySet());
}
/**
@@ -298,7 +302,6 @@
Address dataOwnerLocalAddress = dataOwner.getLocalAddress();
Address buddyLocalAddress = buddy.getLocalAddress();
- System.out.println("*** assert with groups. Testing that " + buddyLocalAddress + " is a buddy for owner " + dataOwnerLocalAddress + " only buddy? " + onlyBuddy);
printBuddyGroup(dataOwner);
BuddyManager dataOwnerBuddyManager = ((CacheSPI) dataOwner).getBuddyManager();
@@ -311,8 +314,6 @@
// and now on the buddy end
BuddyGroup group = buddyBuddyManager.buddyGroupsIParticipateIn.get(dataOwnerLocalAddress);
- System.out.println("*** Groups I participate in: " + buddyBuddyManager.buddyGroupsIParticipateIn);
- System.out.println("*** Buddy's version of dataOwner's group " + group);
assertTrue("buddy's list of groups it participates in should contain data owner's group name", buddyBuddyManager.buddyGroupsIParticipateIn.containsKey(dataOwnerLocalAddress));
if (onlyBuddy) assertEquals(1, group.getBuddies().size());
@@ -324,6 +325,14 @@
waitForBuddy(dataOwner, buddy, onlyBuddy, 60000);
}
+
+
+ public void waitForSingleBuddy(List caches) throws Exception
+ {
+ Cache[] array = (Cache[]) caches.toArray(new Cache[0]);
+ waitForSingleBuddy(array);
+ }
+
/**
* Will wait for 60 secs + 10sec * caches.length for the given caches to become buddys.
* The caches should be ordered as per underlying view.
@@ -379,4 +388,32 @@
}
}
+ public void assertNoStaleLocks(List<CacheSPI<Object, Object>> caches)
+ {
+ for (CacheSPI<Object, Object> cache : caches) assertNoStaleLocks(cache);
+ }
+
+ private void assertNoStaleLocks(CacheSPI<Object, Object> cache)
+ {
+ assertEquals("Number of locks in cache instance " + cache + " should be 0", 0, cache.getNumberOfLocksHeld());
+ }
+
+ protected void checkConsistentPoolState(List<CacheSPI<Object, Object>> caches)
+ {
+ for (int i = 0; i < caches.size(); i++)
+ {
+ Map groupMap = caches.get(i).getBuddyManager().buddyPool;
+ for (int j = 0; j < caches.size(); j++)
+ {
+ if (i != j)
+ {
+ Map groupMap2 = caches.get(j).getBuddyManager().buddyPool;
+ for (CacheSPI cache : caches)
+ {
+ assertEquals("Comparing contents of cache " + (i + 1) + " pool map with cache " + (j + 1), groupMap.get(cache), groupMap2.get(cache));
+ }
+ }
+ }
+ }
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -66,7 +66,7 @@
private void dataGravitationDefaultTest(boolean autoGravitate)
throws Exception
{
- // create 3 caches
+ // create 3 cachePool
List<CacheSPI<Object, Object>> caches = createCachesWithCacheLoader(3, autoGravitate, true, passivation);
cachesTL.set(caches);
@@ -171,7 +171,7 @@
private void dataGravitationEvictionTest(boolean autoGravitate)
throws Exception
{
- // create 3 caches
+ // create 3 cachePool
List<CacheSPI<Object, Object>> caches = createCachesWithCacheLoader(3, autoGravitate, false, passivation);
cachesTL.set(caches);
CacheLoader[] loaders = getLoaders(caches);
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
- */
-@Test(groups = {"functional", "jgroups", "optimistic"}, testName = "buddyreplication.BuddyReplicationFailoverTest")
-public class BuddyReplicationWithOptimisticLockingTest extends BuddyReplicationFailoverTest
-{
- public BuddyReplicationWithOptimisticLockingTest()
- {
- optimisticLocks = true;
- }
-
- @Override
- public void testDataGravitationKillOwner() throws Exception
- {
- super.testDataGravitationKillOwner();
- }
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.buddyreplication;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
-import static org.jboss.cache.util.TestingUtil.dumpCacheContents;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-
-import javax.transaction.TransactionManager;
-import java.util.List;
-
-/**
- * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
- */
-@Test(groups = {"functional", "jgroups"}, testName = "buddyreplication.BuddyReplicationWithTransactionsTest")
-public class BuddyReplicationWithTransactionsTest extends BuddyReplicationTestsBase
-{
- private Fqn fqn = Fqn.fromString("test");
- private String key = "key";
- private String value = "value";
- BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
-
- public void testTransactionsCommit() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = caches = createCaches(3, false, true, false);
- cachesTL.set(caches);
-
-
- caches.get(0).put(fqn, key, value);
- Fqn oldBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + "/test");
- Fqn newBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test");
-
- dumpCacheContents(caches);
-
- TransactionManager txman = caches.get(2).getTransactionManager();
-
-
- assertTrue(caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(!caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(!caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
-
- txman.begin();
-
- dumpCacheContents(caches);
- // will cause gravitation
- caches.get(2).get(fqn, key);
- dumpCacheContents(caches);
-
- assertTrue(caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(!caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
- txman.commit();
- cleanupDelay(); // cleanup commands are async
-
- dumpCacheContents(caches);
-
- assertTrue(!caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(!caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
- dumpCacheContents(caches);
-
- assertNoLocks(caches);
- }
-
- private void cleanupDelay()
- {
- TestingUtil.sleepThread(250);
- }
-
- public void testTransactionsRollback() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = caches = createCaches(3, false, true, false);
- cachesTL.set(caches);
-
- caches.get(0).put(fqn, key, value);
- Fqn oldBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(0).getLocalAddress()) + "/test");
- Fqn newBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + fqnTransformer.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test");
-
- dumpCacheContents(caches);
-
- TransactionManager txman = caches.get(2).getTransactionManager();
-
-
- assertTrue(caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(!caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(!caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
-
- txman.begin();
-
- dumpCacheContents(caches);
- caches.get(2).get(fqn, key);
- dumpCacheContents(caches);
-
- assertTrue(caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(!caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
- txman.rollback();
-
- dumpCacheContents(caches);
-
- assertTrue(caches.get(0).exists(fqn));
- assertTrue(!caches.get(1).exists(fqn));
- assertTrue(!caches.get(2).exists(fqn));
- assertTrue(!caches.get(0).exists(oldBackupFqn));
- assertTrue(caches.get(1).exists(oldBackupFqn));
- assertTrue(!caches.get(2).exists(oldBackupFqn));
- assertTrue(!caches.get(0).exists(newBackupFqn));
- assertTrue(!caches.get(1).exists(newBackupFqn));
- assertTrue(!caches.get(2).exists(newBackupFqn));
-
- assertNoLocks(caches);
- }
-
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/DisabledStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/DisabledStateTransferTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/DisabledStateTransferTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,73 +0,0 @@
-package org.jboss.cache.buddyreplication;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.util.CachePrinter;
-import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * This is to test JBCACHE-1229
- *
- * @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
- * @since 2.1.0
- */
-@Test(groups = "functional", testName = "buddyreplication.DisabledStateTransferTest")
-public class DisabledStateTransferTest extends BuddyReplicationTestsBase
-{
- public void testCachesWithoutStateTransfer() throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(1, 3, false, false, false, false);
- cachesTL.set(caches);
-
- int cacheNumber = 0;
- for (CacheSPI c : caches)
- {
- c.getConfiguration().setFetchInMemoryState(false);
- c.start();
- c.put("/" + cacheNumber++, "k", "v");
- }
-
- waitForBuddy(caches.get(0), caches.get(1), true);
- waitForBuddy(caches.get(1), caches.get(2), true);
- waitForBuddy(caches.get(2), caches.get(0), true);
- Thread.sleep(2000);//wait for state transfer
-
- for (CacheSPI c : caches)
- System.out.println("Cache (local address " + c.getLocalAddress() + ") contents: " + CachePrinter.printCacheLockingInfo(c));
-
- for (int i = 0; i < 3; i++)
- {
- int backupIndex = i == 2 ? 0 : i + 1;
-
- assert caches.get(i).exists("/" + i) : "Data should exist on owner (cache #" + i + ")";
- Fqn backup = fqnTransformer.getBackupFqn(caches.get(i).getLocalAddress(), Fqn.fromString("/" + i));
-
- assert caches.get(backupIndex).exists(backup.getParent()) : "Backup region should have been created on buddy (cache #" + backupIndex + ")";
- boolean backupStatePropagated = caches.get(backupIndex).exists(backup);
- boolean backupOlderThanOwner = backupIndex < i;
- assert (!backupStatePropagated && !backupOlderThanOwner) || (backupStatePropagated && backupOlderThanOwner) : "Backup state should NOT have been transferred to buddy (cache #" + backupIndex + ")";
- }
-
- // now NEW state should transfer just fine.
-
- cacheNumber = 0;
- for (CacheSPI c : caches)
- {
- c.put("/" + (cacheNumber++) + "_NEW", "k", "v");
- }
-
- for (int i = 0; i < 3; i++)
- {
- int backupIndex = i == 2 ? 0 : i + 1;
-
- assert caches.get(i).exists("/" + i + "_NEW") : "Data should exist on owner (cache #" + i + ")";
- Fqn backup = fqnTransformer.getBackupFqn(caches.get(i).getLocalAddress(), Fqn.fromString("/" + i + "_NEW"));
-
- assert caches.get(backupIndex).exists(backup.getParent()) : "Backup region should have been created on buddy (cache #" + backupIndex + ")";
- assert caches.get(backupIndex).exists(backup) : "Backup state should NOT have been transferred to buddy (cache #" + backupIndex + ")";
- }
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -23,26 +23,6 @@
Object key = "key", value = "value";
BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
- public void testStaleRegionOnDataOwnerPessimistic() throws Exception
- {
- testDataOwner(false);
- }
-
- public void testStaleRegionOnDataOwnerOptimistic() throws Exception
- {
- testDataOwner(true);
- }
-
- public void testStaleRegionOnBuddyPessimistic() throws Exception
- {
- testBuddy(false);
- }
-
- public void testStaleRegionOnBuddyOptimistic() throws Exception
- {
- testBuddy(true);
- }
-
/**
* UT for https://jira.jboss.org/jira/browse/JBCACHE-1445.
*/
@@ -82,100 +62,7 @@
}
- private void testDataOwner(boolean optimistic) throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(1, 2, false, true, optimistic);
- cachesTL.set(caches);
- // add some stuff on the primary
- CacheSPI dataOwner = caches.get(0);
- CacheSPI buddy = caches.get(1);
-
- dataOwner.put(fqn, key, value);
-
- System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
-
- assert dataOwner.peek(fqn, false) != null : "Should have data";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
-
- assert buddy.peek(fqn, false) == null : "Should not have data";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) != null : "Should have backup data";
-
- // now do a gravitate call.
- assert buddy.get(fqn, key).equals(value) : "Data should have gravitated!";
- // gravitation cleanup calls are async.
- cleanupDelay();
-
- System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
-
- assert buddy.peek(fqn, false) != null : "Should have data";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
-
- assert dataOwner.peek(fqn, false) == null : "Should not have data";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert dataOwner.peek(fqnTransformer.getBackupFqn(buddy.getLocalAddress(), fqn), false) != null : "Should have backup data";
- }
-
- private void testBuddy(boolean optimistic) throws Exception
- {
- List<CacheSPI<Object, Object>> caches = createCaches(1, 3, false, true, optimistic);
- cachesTL.set(caches);
-
- // add some stuff on the primary
- CacheSPI dataOwner = caches.get(0);
- CacheSPI buddy = caches.get(1);
- CacheSPI thirdInstance = caches.get(2);
-
- assertIsBuddy(dataOwner, buddy, true);
- assertIsBuddy(buddy, thirdInstance, true);
- assertIsBuddy(thirdInstance, dataOwner, true);
-
- dataOwner.put(fqn, key, value);
-
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
- System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
-
- assert dataOwner.peek(fqn, false) != null : "Should have data";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for 2nd instance!";
-
- assert buddy.peek(fqn, false) == null : "Should not have data";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
- assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) != null : "Should have backup data";
-
- // now do a gravitate call.
- assert thirdInstance.get(fqn, key).equals(value) : "Data should have gravitated!";
-
- // gravitation cleanup calls are async.
- cleanupDelay();
-
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
- System.out.println("thirdInstance: " + CachePrinter.printCacheLockingInfo(thirdInstance));
-
- assert thirdInstance.peek(fqn, false) != null : "Should have data";
- assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert thirdInstance.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
-
- assert dataOwner.peek(fqn, false) == null : "Should not have data";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) == null : "Should NOT have backup node for self!";
- assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(thirdInstance.getLocalAddress())), false) != null : "Should have backup node for buddy";
- assert dataOwner.peek(fqnTransformer.getBackupFqn(thirdInstance.getLocalAddress(), fqn), false) != null : "Should have backup data";
- assert buddy.peek(fqn, false) == null : "Should not have data";
- assert buddy.peek(fqn.getParent(), false) == null : "Should not have any part of the data";
- assert buddy.peek(fqnTransformer.getBackupFqn(dataOwner.getLocalAddress(), fqn), false) == null : "Should NOT have backup data";
- }
-
private void cleanupDelay()
{
TestingUtil.sleepThread(250);
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesBackupActivationInactivationTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesBackupActivationInactivationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.Buddy2NodesBackupActivationInactivationTest")
+public class Buddy2NodesBackupActivationInactivationTest extends org.jboss.cache.buddyreplication.Buddy2NodesBackupActivationInactivationTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesBackupActivationInactivationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesNoBuddyPoolTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesNoBuddyPoolTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy2NodesNoBuddyPoolTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,19 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test (groups = "functional", testName = "buddyreplication.mvcc.Buddy2NodesNoBuddyPoolTest")
+public class Buddy2NodesNoBuddyPoolTest extends org.jboss.cache.buddyreplication.Buddy2NodesNoBuddyPoolTest
+{
+ @Override
+ protected Configuration.NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return Configuration.NodeLockingScheme.MVCC;
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolNoDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolNoDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,18 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.testng.annotations.Test;
+import org.jboss.cache.config.Configuration;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "mvcc.buddyreplication.Buddy3NodesNoPoolNoDataGravitationTest")
+public class Buddy3NodesNoPoolNoDataGravitationTest extends org.jboss.cache.buddyreplication.Buddy3NodesNoPoolNoDataGravitationTest
+{
+ @Override
+ protected Configuration.NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return Configuration.NodeLockingScheme.MVCC;
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolWithDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolWithDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoPoolWithDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,18 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.testng.annotations.Test;
+import org.jboss.cache.config.Configuration;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "buddyreplication.mvcc.Buddy3NodesNoPoolWithDataGravitationTest")
+public class Buddy3NodesNoPoolWithDataGravitationTest extends org.jboss.cache.buddyreplication.Buddy3NodesNoPoolWithDataGravitationTest
+{
+ @Override
+ protected Configuration.NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return Configuration.NodeLockingScheme.MVCC;
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoStateTransfer.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoStateTransfer.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesNoStateTransfer.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,18 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration;
+import org.testng.annotations.Test;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "buddyreplication.mvcc.Buddy3NodesNoStateTransfer")
+public class Buddy3NodesNoStateTransfer extends org.jboss.cache.buddyreplication.Buddy3NodesNoStateTransfer
+{
+ @Override
+ protected Configuration.NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return Configuration.NodeLockingScheme.MVCC;
+ }
+
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesWithPoolNoDataGravitationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesWithPoolNoDataGravitationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy3NodesWithPoolNoDataGravitationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,19 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.testng.annotations.Test;
+import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
+import org.jboss.cache.config.Configuration;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test(groups = "functional", testName = "mvcc.buddyreplication.Buddy3NodesWithPoolNoDataGravitationTest")
+public class Buddy3NodesWithPoolNoDataGravitationTest extends org.jboss.cache.buddyreplication.Buddy3NodesWithPoolNoDataGravitationTest
+{
+ @Override
+ protected Configuration.NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return Configuration.NodeLockingScheme.MVCC;
+ }
+
+}
Copied: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy4Nodes2BackupsTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy4Nodes2BackupsTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy4Nodes2BackupsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.Buddy4Nodes2BackupsTest")
+public class Buddy4Nodes2BackupsTest extends org.jboss.cache.buddyreplication.Buddy4Nodes2BackupsTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/Buddy4Nodes2BackupsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,14 +0,0 @@
-package org.jboss.cache.buddyreplication.mvcc;
-
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.testng.annotations.Test;
-
-@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.BuddyBackupActivationInactivationTest")
-public class BuddyBackupActivationInactivationTest extends org.jboss.cache.buddyreplication.BuddyBackupActivationInactivationTest
-{
- @Override
- protected NodeLockingScheme getNonOptimisticLockingScheme()
- {
- return NodeLockingScheme.MVCC;
- }
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,14 +0,0 @@
-package org.jboss.cache.buddyreplication.mvcc;
-
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.testng.annotations.Test;
-
-@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.BuddyGroupAssignmentTest")
-public class BuddyGroupAssignmentTest extends org.jboss.cache.buddyreplication.BuddyGroupAssignmentTest
-{
- @Override
- protected NodeLockingScheme getNonOptimisticLockingScheme()
- {
- return NodeLockingScheme.MVCC;
- }
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,14 +0,0 @@
-package org.jboss.cache.buddyreplication.mvcc;
-
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.testng.annotations.Test;
-
-@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.BuddyReplicationContentTest")
-public class BuddyReplicationContentTest extends org.jboss.cache.buddyreplication.BuddyReplicationContentTest
-{
- @Override
- protected NodeLockingScheme getNonOptimisticLockingScheme()
- {
- return NodeLockingScheme.MVCC;
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,10 +1,11 @@
package org.jboss.cache.buddyreplication.mvcc;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.buddyreplication.Buddy3NodesWithFailoverTest;
import org.testng.annotations.Test;
-@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.BuddyReplicationFailoverTest")
-public class BuddyReplicationFailoverTest extends org.jboss.cache.buddyreplication.BuddyReplicationFailoverTest
+@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.Buddy3NodesWithFailoverTest")
+public class BuddyReplicationFailoverTest extends Buddy3NodesWithFailoverTest
{
@Override
protected NodeLockingScheme getNonOptimisticLockingScheme()
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,14 +0,0 @@
-package org.jboss.cache.buddyreplication.mvcc;
-
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.testng.annotations.Test;
-
-@Test(groups = {"functional", "mvcc"}, testName = "buddyreplication.mvcc.BuddyReplicationWithTransactionsTest")
-public class BuddyReplicationWithTransactionsTest extends org.jboss.cache.buddyreplication.BuddyReplicationWithTransactionsTest
-{
- @Override
- protected NodeLockingScheme getNonOptimisticLockingScheme()
- {
- return NodeLockingScheme.MVCC;
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -11,16 +11,4 @@
{
return NodeLockingScheme.MVCC;
}
-
- @Override
- public void testStaleRegionOnDataOwnerOptimistic()
- {
- // noop
- }
-
- @Override
- public void testStaleRegionOnBuddyOptimistic()
- {
- // noop
- }
}
Added: core/trunk/src/test/java/org/jboss/cache/factories/UnitTestXmlConfigurationParser.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/UnitTestXmlConfigurationParser.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/factories/UnitTestXmlConfigurationParser.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,124 @@
+package org.jboss.cache.factories;
+
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.jboss.cache.config.parsing.XmlConfigHelper;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.util.FileLookup;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * The purpose of this class is to make sure that the parsing of the test files is only performed once.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+class UnitTestXmlConfigurationParser
+{
+ private static Log log = LogFactory.getLog(UnitTestCacheConfigurationFactory.class);
+ public static final String DEFAULT_CONFIGURATION_FILE = "unit-test-cache-service.xml";
+ public static final String JGROUPS_CHANNEL;
+ public static final String JGROUPS_STACK_TYPE = "jgroups.stack";
+
+ static
+ {
+ JGROUPS_CHANNEL = System.getProperty(JGROUPS_STACK_TYPE);
+ }
+
+
+ private volatile static UnitTestXmlConfigurationParser instance;
+ private volatile Configuration confCache;
+ private volatile Map<String, Element> elementCache = new HashMap<String, Element>();
+
+
+ public static Configuration getConfiguration(Configuration.CacheMode cacheMode, boolean useTcp)
+ {
+ if (instance == null)
+ {
+ synchronized (UnitTestXmlConfigurationParser.class)
+ {
+ if (instance == null)
+ {
+ instance = new UnitTestXmlConfigurationParser();
+ instance.parseFile();
+ }
+ }
+ }
+ if (instance == null)
+ {
+ log.error("instance is null after creating node!!!");
+ throw new IllegalStateException();
+ }
+ //if there is an enforced jgroups stack, then only consider that one
+ if (JGROUPS_CHANNEL != null)
+ {
+ useTcp = JGROUPS_CHANNEL.trim().equals("tcp");
+ }
+ String resultKey = useTcp ? "tcp-" : "udp-";
+ resultKey += cacheMode.isSynchronous() ? "sync" : "async";
+ Configuration resultConf;
+ try
+ {
+ resultConf = instance.confCache.clone();
+ } catch (CloneNotSupportedException e)
+ {
+ log.error("Could not clone:", e);
+ throw new IllegalStateException(e);
+ }
+ Element stack = instance.elementCache.get(resultKey);
+ if (stack == null)
+ {
+ log.error("stack is null!!!");
+ throw new NullPointerException();
+ }
+ resultConf.setClusterConfig(stack);
+ if (resultConf.getClusterConfig() == null)
+ {
+ log.error("Null cluster config");
+ throw new IllegalStateException();
+ }
+ resultConf.setCacheMode(cacheMode);
+ return resultConf;
+ }
+
+ private void parseFile()
+ {
+ parseStream(new FileLookup().lookupFile(DEFAULT_CONFIGURATION_FILE));
+ }
+
+ private void parseStream(InputStream stream)
+ {
+ try
+ {
+// loop through all elements in XML.
+ if (stream == null) throw new ConfigurationException("Input stream for configuration xml is null!");
+
+ Element root = XmlConfigHelper.getDocumentRoot(stream);
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ confCache = parser.parseElement(root);
+ if (confCache == null) throw new NullPointerException("Null conf cache!!");
+
+ Element list = (Element) root.getElementsByTagNameNS("*", "protocol_stacks").item(0);
+ NodeList stacks = list.getElementsByTagNameNS("*", "stack");
+
+ for (int i = 0; i < stacks.getLength(); i++)
+ {
+ Element stack = (Element) stacks.item(i);
+ String stackName = stack.getAttribute("name");
+ Element jgroupsStack = (Element) stack.getElementsByTagNameNS("*", "config").item(0);
+ elementCache.put(stackName, jgroupsStack);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ throw new IllegalStateException(e);
+ }
+ }
+}
Deleted: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,155 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.loader;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.util.TestDbPropertiesFactory;
-import org.jboss.cache.util.TestingUtil;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-import org.hsqldb.jdbc.jdbcDataSource;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import java.util.Properties;
-
-/**
- * This test runs cache loader tests using Database as the cache loader store.
- * The default test is configured using MySQL.
- * The server and database configuration is read from a properties file located at
- * /etc/cache-jdbc.properties.
- * <p/>
- * The appropriate JDBC driver (i.e mysql-connector-java-3.0.10-stable-bin.jar)
- * must be in the lib directory for this test to run successfuly
- *
- * @author <a href="hmesha(a)novell.com">Hany Mesha</a>
- * @version <tt>$Revision$</tt>
- */
-@Test(groups = {"functional"}, testName = "loader.JDBCCacheLoaderDerbyDSTest")
-public class JDBCCacheLoaderDerbyDSTest extends CacheLoaderTestsBase
-{
- //private String old_factory = null;
- private final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
- private final String JNDI_NAME = "java:/DerbyDS";
- private Properties prop;
- private jdbcDataSource ds;
-
- protected void configureCache() throws Exception
- {
- //old_factory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
- DummyTransactionManager.getInstance();
-
- Context context = new InitialContext();
- try
- {
- Object obj = context.lookup(JNDI_NAME);
- assertNull(JNDI_NAME + " not bound", obj);
- }
- catch (NameNotFoundException n)
- {
- // expected
- }
-
- prop = TestDbPropertiesFactory.getTestDbProperties();
-
- ds = new jdbcDataSource();
- ds.setDatabase(prop.getProperty("cache.jdbc.url"));
- ds.setUser("sa");
-
- String props = "cache.jdbc.datasource =" + JNDI_NAME + "\n" +
- "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
- "cache.jdbc.sql-concat= 1 || 2" + "\n" +
- "cache.jdbc.table.name=jbosscache" + "\n" +
- "cache.jdbc.table.primarykey=jbosscache_pk";
-
- CacheLoaderConfig config = getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, true, false);
- cache.getConfiguration().setCacheLoaderConfig(config);
- cache.create();
-
-
- context.bind(JNDI_NAME, ds);
- assertNotNull(JNDI_NAME + " bound", context.lookup(JNDI_NAME));
- }
-
- protected void cleanup()
- {
-// ds.setShutdownDatabase("shutdown");
- TestDbPropertiesFactory.shutdownInMemoryDatabase(prop);
- }
-
- public void testLargeObject()
- {
- try
- {
- String key = "LargeObj";
- // create an object with size bigger than 4k (k=1024 bytes)
- StringBuilder text = new StringBuilder("LargeObject");
- while (text.toString().getBytes().length < (1024 * 100))
- {
- text.append(text);
- }
- String initialValue = text.toString();
- // insert it into the cache loader
- loader.remove(Fqn.fromString("/"));
-
- Object retVal = loader.put(FQN, key, initialValue);
- assertNull(retVal);
- addDelay();
- // load the object from the cache loader and validate it
- assertEquals(initialValue, (String) loader.get(FQN).get(key));
- // update the object and validate it
- String updatedValue = initialValue.concat(("UpdatedValue"));
- retVal = loader.put(FQN, key, updatedValue);
- assertEquals(initialValue, (String) retVal);
- assertEquals(updatedValue, (String) loader.get(FQN).get(key));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
-
- public void testTransactionRollback() throws Exception
- {
- // no-op
- }
-
- public void testIntegratedTransactionRollback() throws Exception
- {
- // no-op
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- super.tearDown();
- Properties icProps = new Properties();
- icProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
- Context ctx = new InitialContext(icProps);
- ctx.unbind(JNDI_NAME);
- /*
- if (old_factory != null)
- {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, old_factory);
- }
- else
- {
- System.getProperties().remove(Context.INITIAL_CONTEXT_FACTORY);
- }
- */
- }
-
- public void testRemoveData()
- {
- super.testRemoveData();
- }
-}
Copied: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderHsqldbDSTest.java (from rev 7269, core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderHsqldbDSTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderHsqldbDSTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.transaction.DummyTransactionManager;
+import org.jboss.cache.util.TestDbPropertiesFactory;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+import org.hsqldb.jdbc.jdbcDataSource;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import java.util.Properties;
+
+/**
+ * This test runs cache loader tests using Database as the cache loader store.
+ * The default test is configured using MySQL.
+ * The server and database configuration is read from a properties file located at
+ * /etc/cache-jdbc.properties.
+ * <p/>
+ * The appropriate JDBC driver (i.e mysql-connector-java-3.0.10-stable-bin.jar)
+ * must be in the lib directory for this test to run successfuly
+ *
+ * @author <a href="hmesha(a)novell.com">Hany Mesha</a>
+ * @version <tt>$Revision$</tt>
+ */
+@Test(groups = {"functional"}, testName = "loader.JDBCCacheLoaderHsqldbDSTest")
+public class JDBCCacheLoaderHsqldbDSTest extends CacheLoaderTestsBase
+{
+ //private String old_factory = null;
+ private final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
+ private final String JNDI_NAME = "java:/DerbyDS";
+ private Properties prop;
+ private jdbcDataSource ds;
+
+ protected void configureCache() throws Exception
+ {
+ //old_factory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
+ DummyTransactionManager.getInstance();
+
+ Context context = new InitialContext();
+ try
+ {
+ Object obj = context.lookup(JNDI_NAME);
+ assertNull(JNDI_NAME + " not bound", obj);
+ }
+ catch (NameNotFoundException n)
+ {
+ // expected
+ }
+
+ prop = TestDbPropertiesFactory.getTestDbProperties();
+
+ ds = new jdbcDataSource();
+ ds.setDatabase(prop.getProperty("cache.jdbc.url"));
+ ds.setUser("sa");
+
+ String props = "cache.jdbc.datasource =" + JNDI_NAME + "\n" +
+ "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
+ "cache.jdbc.sql-concat= 1 || 2" + "\n" +
+ "cache.jdbc.table.name=jbosscache" + "\n" +
+ "cache.jdbc.table.primarykey=jbosscache_pk";
+
+ CacheLoaderConfig config = getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, true, false);
+ cache.getConfiguration().setCacheLoaderConfig(config);
+ cache.create();
+
+
+ context.bind(JNDI_NAME, ds);
+ assertNotNull(JNDI_NAME + " bound", context.lookup(JNDI_NAME));
+ }
+
+ protected void cleanup()
+ {
+// ds.setShutdownDatabase("shutdown");
+ TestDbPropertiesFactory.shutdownInMemoryDatabase(prop);
+ }
+
+ public void testLargeObject()
+ {
+ try
+ {
+ String key = "LargeObj";
+ // create an object with size bigger than 4k (k=1024 bytes)
+ StringBuilder text = new StringBuilder("LargeObject");
+ while (text.toString().getBytes().length < (1024 * 100))
+ {
+ text.append(text);
+ }
+ String initialValue = text.toString();
+ // insert it into the cache loader
+ loader.remove(Fqn.fromString("/"));
+
+ Object retVal = loader.put(FQN, key, initialValue);
+ assertNull(retVal);
+ addDelay();
+ // load the object from the cache loader and validate it
+ assertEquals(initialValue, (String) loader.get(FQN).get(key));
+ // update the object and validate it
+ String updatedValue = initialValue.concat(("UpdatedValue"));
+ retVal = loader.put(FQN, key, updatedValue);
+ assertEquals(initialValue, (String) retVal);
+ assertEquals(updatedValue, (String) loader.get(FQN).get(key));
+ }
+ catch (Exception e)
+ {
+ fail(e.toString());
+ }
+ }
+
+ public void testTransactionRollback() throws Exception
+ {
+ // no-op
+ }
+
+ public void testIntegratedTransactionRollback() throws Exception
+ {
+ // no-op
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ Properties icProps = new Properties();
+ icProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
+ Context ctx = new InitialContext(icProps);
+ ctx.unbind(JNDI_NAME);
+ /*
+ if (old_factory != null)
+ {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, old_factory);
+ }
+ else
+ {
+ System.getProperties().remove(Context.INITIAL_CONTEXT_FACTORY);
+ }
+ */
+ }
+
+ public void testRemoveData()
+ {
+ super.testRemoveData();
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderHsqldbDSTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy2NodesBackupActivationInactivationTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyBackupActivationInactivationTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy2NodesBackupActivationInactivationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy2NodesBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache.multiplexer;
+
+import org.jboss.cache.Cache;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Repeats the superclass tests, but with the multiplexer enabled.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+@Test(enabled = true, testName = "multiplexer.Buddy2NodesBackupActivationInactivationTest")
+public class Buddy2NodesBackupActivationInactivationTest extends org.jboss.cache.buddyreplication.Buddy2NodesBackupActivationInactivationTest
+{
+ private ThreadLocal<MultiplexerTestHelper> muxHelperTL = new ThreadLocal<MultiplexerTestHelper>();
+
+ @BeforeMethod(alwaysRun = true)
+ protected void setUp() throws Exception
+ {
+ muxHelperTL.set(new MultiplexerTestHelper());
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ try
+ {
+ super.tearDown();
+ }
+ finally
+ {
+ if (muxHelperTL.get() != null)
+ muxHelperTL.get().tearDown();
+ muxHelperTL.set(null);
+ }
+ }
+
+ @Override
+ protected void configureMultiplexer(Cache cache) throws Exception
+ {
+ muxHelperTL.get().configureCacheForMux(cache);
+ }
+
+ @Override
+ protected void validateMultiplexer(Cache cache)
+ {
+ assertTrue("Cache is using multiplexer", cache.getConfiguration().isUsingMultiplexer());
+ }
+
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy2NodesBackupActivationInactivationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy4Nodes2BackupsTest.java (from rev 7262, core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyGroupAssignmentTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy4Nodes2BackupsTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy4Nodes2BackupsTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache.multiplexer;
+
+import org.jboss.cache.Cache;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Repeats the superclass tests, but with the multiplexer enabled.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+@Test(enabled = true, testName = "multiplexer.Buddy4Nodes2BackupsTest")
+public class Buddy4Nodes2BackupsTest extends org.jboss.cache.buddyreplication.Buddy4Nodes2BackupsTest
+{
+ private MultiplexerTestHelper muxHelper;
+
+ @BeforeMethod(alwaysRun = true)
+ public void setUp() throws Exception
+ {
+ muxHelper = new MultiplexerTestHelper();
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ try
+ {
+ super.tearDown();
+ }
+ finally
+ {
+ if (muxHelper != null)
+ muxHelper.tearDown();
+ muxHelper = null;
+ }
+ }
+
+ @Override
+ protected void configureMultiplexer(Cache cache) throws Exception
+ {
+ muxHelper.configureCacheForMux(cache);
+ }
+
+ @Override
+ protected void validateMultiplexer(Cache cache)
+ {
+ assertTrue("Cache is using multiplexer", cache.getConfiguration().isUsingMultiplexer());
+ }
+
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/multiplexer/Buddy4Nodes2BackupsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyBackupActivationInactivationTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyBackupActivationInactivationTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.multiplexer;
-
-import org.jboss.cache.Cache;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * Repeats the superclass tests, but with the multiplexer enabled.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-@Test(enabled = true, testName = "multiplexer.BuddyBackupActivationInactivationTest")
-public class BuddyBackupActivationInactivationTest
- extends org.jboss.cache.buddyreplication.BuddyBackupActivationInactivationTest
-{
- private ThreadLocal<MultiplexerTestHelper> muxHelperTL = new ThreadLocal<MultiplexerTestHelper>();
-
- @BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
- {
- muxHelperTL.set(new MultiplexerTestHelper());
-
- super.setUp();
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- try
- {
- super.tearDown();
- }
- finally
- {
- if (muxHelperTL.get() != null)
- muxHelperTL.get().tearDown();
- muxHelperTL.set(null);
- }
- }
-
- @Override
- protected void configureMultiplexer(Cache cache) throws Exception
- {
- muxHelperTL.get().configureCacheForMux(cache);
- }
-
- @Override
- protected void validateMultiplexer(Cache cache)
- {
- assertTrue("Cache is using multiplexer", cache.getConfiguration().isUsingMultiplexer());
- }
-
-}
Deleted: core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyGroupAssignmentTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyGroupAssignmentTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.multiplexer;
-
-import org.jboss.cache.Cache;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * Repeats the superclass tests, but with the multiplexer enabled.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-@Test(enabled = true, testName = "multiplexer.BuddyGroupAssignmentTest")
-public class BuddyGroupAssignmentTest extends org.jboss.cache.buddyreplication.BuddyGroupAssignmentTest
-{
- private MultiplexerTestHelper muxHelper;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
- {
- muxHelper = new MultiplexerTestHelper();
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- try
- {
- super.tearDown();
- }
- finally
- {
- if (muxHelper != null)
- muxHelper.tearDown();
- muxHelper = null;
- }
- }
-
- @Override
- protected void configureMultiplexer(Cache cache) throws Exception
- {
- muxHelper.configureCacheForMux(cache);
- }
-
- @Override
- protected void validateMultiplexer(Cache cache)
- {
- assertTrue("Cache is using multiplexer", cache.getConfiguration().isUsingMultiplexer());
- }
-
-}
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyReplicationFailoverTest.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BuddyReplicationFailoverTest.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -22,6 +22,7 @@
package org.jboss.cache.multiplexer;
import org.jboss.cache.Cache;
+import org.jboss.cache.buddyreplication.Buddy3NodesWithFailoverTest;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -34,9 +35,8 @@
* @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
* @version $Revision$
*/
-@Test(groups={"functional", "jgroups"}, enabled = true, testName = "multiplexer.BuddyReplicationFailoverTest")
-public class BuddyReplicationFailoverTest
- extends org.jboss.cache.buddyreplication.BuddyReplicationFailoverTest
+@Test(groups={"functional", "jgroups"}, enabled = true, testName = "multiplexer.Buddy3NodesWithFailoverTest")
+public class BuddyReplicationFailoverTest extends Buddy3NodesWithFailoverTest
{
private ThreadLocal<MultiplexerTestHelper> muxHelperTL = new ThreadLocal<MultiplexerTestHelper>();
Modified: core/trunk/src/test/java/org/jboss/cache/testng/Base.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/testng/Base.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/testng/Base.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -1,21 +1,69 @@
package org.jboss.cache.testng;
-import org.testng.annotations.Test;
+import org.testng.annotations.*;
/**
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional", testName = "Base")
+@Test(groups = "functional", testName = "sadsadsa")
public class Base
{
+ private int value = -5;
+
+ static int count;
+
+ public Base(int value)
+ {
+ this.value = value;
+ }
+
+ public Base()
+ {
+ }
+
+ @Factory
+ public static Object[] createInstances()
+ {
+ Base base = new Base(1);
+ Base base2 = new Base(2);
+ return new Object[]{base, base2};
+ }
+
+
+ @BeforeClass
+ public void beforeTest()
+ {
+ System.out.println("Base.beforeTest" + value);
+ }
+
+ @AfterClass
+ public void afterTest()
+ {
+ System.out.println("Base.afterTest" + value);
+ }
+
public void testBaseAaaaaa()
{
- System.out.println( getThreadName() + "aaaaaaaaaaaa");
+ System.out.println(getThreadName() + "aaaaaaaaaaaa" + value);
}
+ @BeforeMethod
+ public void beforeMethod()
+ {
+ System.out.println("Base.beforeMethod" + value);
+ }
+
+ @AfterMethod
+ public void afterMethod()
+ {
+ System.out.println("Base.afterMethod" + value);
+ }
+
public void testBaseBbbbbbb()
{
- System.out.println( getThreadName() + "bbbbbbbbbbbbb");
+ count++;
+// if (count == 2) throw new RuntimeException();
+ System.out.println(getThreadName() + "bbbbbbbbbbbbb" + value);
}
protected String getThreadName()
Modified: core/trunk/src/test/java/org/jboss/cache/testng/Derived.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/testng/Derived.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/testng/Derived.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -5,21 +5,26 @@
/**
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional" , testName = "testng.Derived")
+@Test(groups = "functional" , testName = "Same")
public class Derived extends Base
{
- public void testDerivedCcccc()
+ public Derived(int value)
{
- System.out.println(getThreadName() + "ccccccccccccccccc");
+ super(value);
}
- public void testDerivedDdddd()
- {
- System.out.println(getThreadName() + "dddddddddddddddddddd");
- }
-
- protected String getThreadName()
- {
- return "[" + getClass() + " ************ -> " + Thread.currentThread().getName() + "] ";
- }
+ // public void testDerivedCcccc()
+// {
+// System.out.println(getThreadName() + "ccccccccccccccccc");
+// }
+//
+// public void testDerivedDdddd()
+// {
+// System.out.println(getThreadName() + "dddddddddddddddddddd");
+// }
+//
+// protected String getThreadName()
+// {
+// return "[" + getClass() + " ************ -> " + Thread.currentThread().getName() + "] ";
+// }
}
Modified: core/trunk/src/test/java/org/jboss/cache/testng/Other.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/testng/Other.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/testng/Other.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -5,7 +5,7 @@
/**
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional", testName = "Other")
+@Test(groups = "functional", enabled = false, testName = "Same")
public class Other
{
public void eeeeeeeeeeee() {
Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java 2008-12-11 16:33:03 UTC (rev 7282)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java 2008-12-11 20:26:09 UTC (rev 7283)
@@ -75,10 +75,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 ((realMarshaller instanceof RegionMarshallerDelegate) || (realMarshaller instanceof MarshallerDelegate))
+// {
+// throw new RuntimeException("Illegal state");
+// }
if (realDispatcher instanceof InactiveRegionAwareRpcDispatcher)
delegate = new RegionMarshallerDelegate((Marshaller) realMarshaller);
else
16 years, 3 months
JBoss Cache SVN: r7282 - in core/branches/flat/src: test/java/org/jboss/starobrno and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-12-11 11:33:03 -0500 (Thu, 11 Dec 2008)
New Revision: 7282
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheNameExistsException.java
core/branches/flat/src/main/java/org/jboss/starobrno/manager/NamedCacheNotFoundException.java
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java
core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/UnitTestCacheManager.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java
core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java
Log:
Cache manager improvements
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -21,83 +21,265 @@
*/
package org.jboss.starobrno.manager;
-import org.jboss.cache.DefaultCacheFactory;
import org.jboss.starobrno.Cache;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.parsing.XmlConfigurationParser;
import org.jboss.starobrno.lifecycle.Lifecycle;
-import org.jboss.starobrno.tree.TreeCache;
-import org.jboss.starobrno.tree.TreeCacheImpl;
+import java.io.InputStream;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
- * // TODO: MANIK: Document this
+ * A <tt>CacheManager</tt> is the primary mechanism for retrieving a {@link Cache} instance, and is often used as a
+ * starting point to using the {@link Cache}.
+ * <p/>
+ * <tt>CacheManager</tt>s are heavyweight objects, and we foresee no more than one <tt>CacheManager</tt> being used per
+ * JVM (unless specific configuration requirements require more than one; but either way, this would be a minimal and
+ * finite number of instances).
+ * <p/>
+ * Constructing a <tt>CacheManager</tt> is done via one of its constructors, which optionally take in a
+ * {@link org.jboss.starobrno.config.Configuration} or a path or URL to a configuration XML file.
+ * <p/>
+ * Lifecycle - <tt>CacheManager</tt>s have a lifecycle (it implements {@link Lifecycle}) and the default constructors also
+ * call {@link #start()}. Overloaded versions of the constructors are available, that do not start the <tt>CacheManager</tt>,
+ * although it must be kept in mind that <tt>CacheManager</tt>s need to be started before they can be used to create <tt>Cache</tt>
+ * instances.
+ * <p/>
+ * Once constructed, <tt>CacheManager</tt>s should be made available to any component that requires a <tt>Cache</tt>,
+ * via JNDI or via some other mechanism such as an IoC container.
+ * <p/>
+ * You obtain <tt>Cache</tt> instances from the <tt>CacheManager</tt> by using one of the overloaded <tt>getCache()</tt>,
+ * methods. Note that with <tt>getCache()</tt>, there is no guarantee that the instance you get is brand-new and empty,
+ * since caches are named and shared. Because of this, the <tt>CacheManager</tt> also acts as a repository of <tt>Cache</tt>s,
+ * and is an effective mechanism of looking up or creating <tt>Cache</tt>s on demand.
+ * <p/>
+ * When the system shuts down, it should call {@link #stop()} on the <tt>CacheManager</tt>. This will ensure all caches
+ * within its scope are properly stopped as well.
+ * <p/>
+ * Sample usage:
+ * <code>
+ * CacheManager manager = CacheManager.getInstance("my-config-file.xml");
+ * Cache entityCache = manager.getCache("myEntityCache");
+ * entityCache.put("aPerson", new Person());
+ * <p/>
+ * Configuration myNewConfiguration = new Configuration();
+ * myNewConfiguration.setCacheMode(Configuration.CacheMode.LOCAL);
+ * manager.defineCache("myLocalCache", myNewConfiguration);
+ * Cache localCache = manager.getCache("myLocalCache");
+ * </code>
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
- * @since 3.0
*/
public class CacheManager implements Lifecycle
{
- protected Configuration c;
+ public static final String DEFAULT_CACHE_NAME = "org.jboss.starobrno.manager.CacheManager.DEFAULT_CACHE_NAME";
+ protected Configuration configuration;
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
- private final ConcurrentMap<String, TreeCache> treeCaches = new ConcurrentHashMap<String, TreeCache>();
+ private final ConcurrentMap<String, Configuration> configurationOverrides = new ConcurrentHashMap<String, Configuration>();
- public CacheManager(Configuration c)
+ /**
+ * Constructs and starts a default instance of the CacheManager, using configuration defaults.
+ */
+ public CacheManager()
{
- //if a config is shared between multiple managers, then each registers it's
- // own chnnel in runtime
- this.c = c.clone();
+ this(false);
}
- public void start()
+ /**
+ * Constructs a default instance of the CacheManager, using configuration defaults.
+ *
+ * @param start if true, the cache manager is started
+ */
+ public CacheManager(boolean start)
{
- // this will bootstrap the cache manager
+ configuration = new Configuration();
+ if (start) start();
}
- public void stop()
+ /**
+ * Constructs and starts a new instance of the CacheManager, using the configuration file passed in.
+ *
+ * @param configuration configuration file to use as a template for all caches created
+ */
+ public CacheManager(Configuration configuration)
{
- // this will stop the cache manager.
+ this(configuration, true);
}
- public Cache createCache(String cacheName)
+ /**
+ * Constructs a new instance of the CacheManager, using the configuration file passed in.
+ *
+ * @param configuration configuration file to use as a template for all caches created
+ * @param start if true, the cache manager is started
+ */
+ public CacheManager(Configuration configuration, boolean start)
{
- if (!caches.containsKey(cacheName))
- caches.putIfAbsent(cacheName, createNewCache());
+ this.configuration = configuration.clone();
+ if (start) start();
+ }
- Cache c = caches.get(cacheName);
- c.start();
- return c;
+ /**
+ * Constructs and starts a new instance of the CacheManager, using the configuration file name passed in. This constructor
+ * first searches for the named file on the classpath, and failing that, treats the file name as an absolute
+ * path.
+ *
+ * @param configurationFile name of configuration file to use as a template for all caches created
+ * @throws org.jboss.starobrno.config.ConfigurationException
+ * if there is a problem with the configuration file.
+ */
+ public CacheManager(String configurationFile) throws ConfigurationException
+ {
+ this(configurationFile, true);
}
- public TreeCache createTreeCache(String cacheName)
+ /**
+ * Constructs a new instance of the CacheManager, using the configuration file name passed in. This constructor
+ * first searches for the named file on the classpath, and failing that, treats the file name as an absolute
+ * path.
+ *
+ * @param configurationFile name of configuration file to use as a template for all caches created
+ * @param start if true, the cache manager is started
+ * @throws org.jboss.starobrno.config.ConfigurationException
+ * if there is a problem with the configuration file.
+ */
+ public CacheManager(String configurationFile, boolean start) throws ConfigurationException
{
- if (!treeCaches.containsKey(cacheName))
- treeCaches.putIfAbsent(cacheName, createTreeCache());
- TreeCache tc = treeCaches.get(cacheName);
- return tc;
+ try
+ {
+ // todo - need to update parser as per https://docspace.corp.redhat.com/clearspace/docs/DOC-16643
+ // todo - need to store named cache overrides
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ configuration = parser.parseFile(configurationFile);
+ }
+ catch (ConfigurationException ce)
+ {
+ throw ce;
+ }
+ catch (RuntimeException re)
+ {
+ throw new ConfigurationException(re);
+ }
+ if (start) start();
}
- public void destroyCache(String cacheName)
+ /**
+ * Constructs and starts a new instance of the CacheManager, using the input stream passed in to read configuration file contents.
+ *
+ * @param configurationStream stream containing configuration file contents, to use as a template for all caches created
+ * @throws org.jboss.starobrno.config.ConfigurationException
+ * if there is a problem with the configuration stream.
+ */
+ public CacheManager(InputStream configurationStream) throws ConfigurationException
{
- Cache c = caches.remove(cacheName);
- if (c != null) c.stop();
+ this(configurationStream, true);
}
- protected TreeCache createTreeCache()
+ /**
+ * Constructs a new instance of the CacheManager, using the input stream passed in to read configuration file contents.
+ *
+ * @param configurationStream stream containing configuration file contents, to use as a template for all caches created
+ * @param start if true, the cache manager is started
+ * @throws org.jboss.starobrno.config.ConfigurationException
+ * if there is a problem with the configuration stream.
+ */
+ public CacheManager(InputStream configurationStream, boolean start) throws ConfigurationException
{
- Configuration cfg = null;
- cfg = c.clone();
+ try
+ {
+ // todo - need to update parser as per https://docspace.corp.redhat.com/clearspace/docs/DOC-16643
+ // todo - need to store named cache overrides
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ configuration = parser.parseStream(configurationStream);
+ }
+ catch (ConfigurationException ce)
+ {
+ throw ce;
+ }
+ catch (RuntimeException re)
+ {
+ throw new ConfigurationException(re);
+ }
+ if (start) start();
+ }
- cfg.setInvocationBatchingEnabled(true); // needed for the TreeCache
- DefaultCacheFactory dcf = new DefaultCacheFactory();
- return new TreeCacheImpl(dcf.createCache(cfg));
+ /**
+ * Defines a named cache. Named caches can be defined by using this method, in which case the configuration
+ * passed in is used to override the default configuration used when this cache manager instance was created.
+ * <p/>
+ * The other way to define named caches is declaratively, in the XML file passed in to the cache manager.
+ * <p/>
+ * A combination of approaches may also be used, provided the names do not conflict.
+ *
+ * @param cacheName name of cache to define
+ * @param configurationOverride configuration overrides to use
+ * @throws CacheNameExistsException if the name is already in use.
+ */
+ public void defineCache(String cacheName, Configuration configurationOverride) throws CacheNameExistsException
+ {
+ if (cacheName == null || configurationOverrides == null)
+ throw new NullPointerException("Null arguments not allowed");
+ if (cacheName.equals(DEFAULT_CACHE_NAME))
+ throw new IllegalArgumentException("Cache name cannot be used as it is a reserved, internal name");
+ if (configurationOverrides.putIfAbsent(cacheName, configurationOverride) != null)
+ throw new CacheNameExistsException("Cache name [" + cacheName + "] already in use!");
}
- protected Cache createNewCache()
+
+ /**
+ * Retrieves the default cache associated with this cache manager. Note that the default cache does not need to be
+ * explicitly created with {@link #createCache(String)} since it is automatically created lazily when first used.
+ * <p/>
+ * As such, this method is always guaranteed to return the default cache.
+ *
+ * @return the default cache.
+ */
+ public Cache getCache()
{
- // for now latch on to the existing cache creation mechanisms
- DefaultCacheFactory dcf = new DefaultCacheFactory();
- return dcf.createCache(c);
+ return getOrCreateCache(DEFAULT_CACHE_NAME);
}
+
+ /**
+ * Retrieves a named cache from the system. The named cache must have been created previously using the {@link #createCache(String)}
+ * or {@link #getOrCreateCache(String)} methods, or have been declared in the configuration file used by this <tt>CacheManager</tt>
+ * instance, or this method will throw a {@link org.jboss.starobrno.manager.NamedCacheNotFoundException}.
+ *
+ * @param cacheName name of cache to retrieve
+ * @return a cache instance identified by cacheName
+ * @throws NamedCacheNotFoundException if the named cache does not exist, or is not defined declaratively.
+ */
+ public Cache getCache(String cacheName) throws NamedCacheNotFoundException
+ {
+ if (cacheName == null) throw new NullPointerException("Null arguments not allowed");
+ return getOrCreateCache(cacheName);
+ }
+
+ private Cache getOrCreateCache(String cacheName)
+ {
+ // todo
+ return null;
+ }
+
+
+ private Cache createCache(String cacheName)
+ {
+ // todo
+// if (!caches.containsKey(cacheName))
+// caches.putIfAbsent(cacheName, createNewCache());
+
+ Cache c = caches.get(cacheName);
+ c.start();
+ return c;
+ }
+
+ public void start()
+ {
+ // todo
+ }
+
+ public void stop()
+ {
+ // todo
+ }
}
Added: core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheNameExistsException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheNameExistsException.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheNameExistsException.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -0,0 +1,26 @@
+package org.jboss.starobrno.manager;
+
+/**
+ * Thrown if a cache creation is attempted but the name already exists
+ */
+public class CacheNameExistsException extends Exception
+{
+ public CacheNameExistsException()
+ {
+ }
+
+ public CacheNameExistsException(String message)
+ {
+ super(message);
+ }
+
+ public CacheNameExistsException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public CacheNameExistsException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: core/branches/flat/src/main/java/org/jboss/starobrno/manager/NamedCacheNotFoundException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/manager/NamedCacheNotFoundException.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/manager/NamedCacheNotFoundException.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -0,0 +1,26 @@
+package org.jboss.starobrno.manager;
+
+/**
+ * Thrown when a named cache cannot be found.
+ */
+public class NamedCacheNotFoundException extends Exception
+{
+ public NamedCacheNotFoundException()
+ {
+ }
+
+ public NamedCacheNotFoundException(String message)
+ {
+ super(message);
+ }
+
+ public NamedCacheNotFoundException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public NamedCacheNotFoundException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -21,17 +21,18 @@
*/
package org.jboss.starobrno;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.manager.CacheManager;
+import org.jboss.starobrno.manager.NamedCacheNotFoundException;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.Test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
@Test(groups = "functional")
public class BasicTest
{
- public void basicTest()
+ public void basicTest() throws Exception
{
// create a cache manager
Configuration c = new Configuration(); // LOCAL mode
@@ -40,7 +41,7 @@
try
{
cm.start();
- Cache cache = cm.createCache("test");
+ Cache cache = cm.getCache("test");
String key = "key", value = "value";
assert cache.isEmpty();
@@ -60,13 +61,13 @@
}
finally
{
- cm.destroyCache("test");
cm.stop();
}
}
public static final Log log = LogFactory.getLog(BasicTest.class);
- public void testBasicReplication()
+
+ public void testBasicReplication() throws NamedCacheNotFoundException
{
Configuration configuration = new Configuration();
configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -79,13 +80,13 @@
firstManager.start();
secondManager.start();
- CacheSPI firstCache = (CacheSPI) firstManager.createCache("test");
- CacheSPI secondCache = (CacheSPI) secondManager.createCache("test");
+ CacheSPI firstCache = (CacheSPI) firstManager.getCache("test");
+ CacheSPI secondCache = (CacheSPI) secondManager.getCache("test");
TestingUtil.blockUntilViewReceived(secondCache, 2, 3000);
- firstCache.put("key","value");
+ firstCache.put("key", "value");
assert secondCache.get("key").equals("value");
assert firstCache.get("key").equals("value");
@@ -93,10 +94,11 @@
assert firstCache.get("key").equals("value2");
firstCache.remove("key");
assert secondCache.get("key") == null;
- } finally
+ }
+ finally
{
- firstManager.destroyCache("test");
- secondManager.destroyCache("test");
+ firstManager.stop();
+ secondManager.stop();
}
}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/UnitTestCacheManager.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/UnitTestCacheManager.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/UnitTestCacheManager.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -6,22 +6,27 @@
package org.jboss.starobrno;
import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.manager.CacheManager;
/**
- *
* @author dpospisi
*/
-public class UnitTestCacheManager extends CacheManager
+public class UnitTestCacheManager
{
- public UnitTestCacheManager(Configuration c) {
- super(c);
+ Configuration c;
+
+ public UnitTestCacheManager(Configuration c)
+ {
+ this.c = c;
}
-
- @Override
- protected Cache createNewCache()
+
+ protected Cache createNewCache()
{
UnitTestCacheFactory dcf = new UnitTestCacheFactory();
- return dcf.createCache(c);
+ return dcf.createCache(c);
}
+
+ public Cache createCache(String name)
+ {
+ return createNewCache();
+ }
}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -1,5 +1,6 @@
package org.jboss.starobrno.api.tree;
+import org.jboss.starobrno.Cache;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.manager.CacheManager;
@@ -7,6 +8,7 @@
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.Node;
import org.jboss.starobrno.tree.TreeCache;
+import org.jboss.starobrno.tree.TreeCacheImpl;
import org.jboss.starobrno.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -37,7 +39,9 @@
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
CacheManager cm = new CacheManager(c);
- cache = cm.createTreeCache(getClass().getSimpleName());
+ Cache flatcache = cm.getCache(getClass().getSimpleName());
+ cache = new TreeCacheImpl(flatcache);
+
tm = ((CacheSPI) cache.getCache()).getTransactionManager();
}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -12,7 +12,6 @@
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheManager;
import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.manager.CacheManager;
import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.jboss.starobrno.util.internals.ReplicationListener;
@@ -35,7 +34,7 @@
{
private Configuration configuration;
private CacheSPI<Object, Object> cache1, cache2;
- private CacheManager cacheManager1, cacheManager2;
+ private UnitTestCacheManager cacheManager1, cacheManager2;
private ReplicationListener replListener1, replListener2;
}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java 2008-12-11 14:44:12 UTC (rev 7281)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java 2008-12-11 16:33:03 UTC (rev 7282)
@@ -24,7 +24,6 @@
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheManager;
import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.manager.CacheManager;
import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.Test;
@@ -39,7 +38,7 @@
{
Configuration cfg = new Configuration();
cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheManager cm = new UnitTestCacheManager(cfg);
+ UnitTestCacheManager cm = new UnitTestCacheManager(cfg);
return (CacheSPI<String, String>) cm.createCache("test");
}
16 years, 3 months
JBoss Cache SVN: r7281 - in core/branches/flat/src: main/docbook/userguide/en/modules and 26 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-12-11 09:44:12 -0500 (Thu, 11 Dec 2008)
New Revision: 7281
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/BatchModeTransactionManager.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyBaseTransactionManager.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransaction.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManager.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyUserTransaction.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/GenericTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossStandaloneJTAManagerLookup.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/starobrno/transaction/TransactionManagerLookup.java
Removed:
core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyBaseTransactionManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContext.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContextFactory.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyUserTransaction.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java
Modified:
core/branches/flat/src/main/docbook/faq/en/master.xml
core/branches/flat/src/main/docbook/userguide/en/modules/configuration.xml
core/branches/flat/src/main/docbook/userguide/en/modules/configuration_reference.xml
core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java
core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java
core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/WriteCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor_Legacy.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/lock/LockUtil.java
core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/TransactionManagerFactory.java
core/branches/flat/src/main/resources/config-samples/all.xml
core/branches/flat/src/main/resources/config-samples/buddy-replication.xml
core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml
core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml
core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml
core/branches/flat/src/main/resources/config-samples/invalidation-async.xml
core/branches/flat/src/main/resources/config-samples/local.xml
core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml
core/branches/flat/src/main/resources/config-samples/total-replication.xml
core/branches/flat/src/test/java/org/jboss/starobrno/api/CacheAPITest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/batch/BatchWithTM.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/PutForExternalReadTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/repeatable_read/WriteSkewTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeAPITest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeReplicatedMoveTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/SyncReplTxTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java
core/branches/flat/src/test/java/org/jboss/starobrno/atomic/APITest.java
core/branches/flat/src/test/java/org/jboss/starobrno/eviction/FIFOPolicyTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/notifications/CacheListenerTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/profiling/TreeProfileTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/replication/ExceptionTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/replication/ReplicationExceptionTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/replication/SyncCacheListenerTest.java
core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java
core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml
core/branches/flat/src/test/resources/configs/clonable-config.xml
core/branches/flat/src/test/resources/configs/local-lru-eviction.xml
core/branches/flat/src/test/resources/configs/local-passivation.xml
core/branches/flat/src/test/resources/configs/local-tx.xml
core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml
core/branches/flat/src/test/resources/configs/mux.xml
core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml
core/branches/flat/src/test/resources/configs/parser-test-async.xml
core/branches/flat/src/test/resources/configs/parser-test.xml
core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml
core/branches/flat/src/test/resources/configs/replSync.xml
core/branches/flat/src/test/resources/jbc3-registry-configs.xml
core/branches/flat/src/test/resources/unit-test-cache-service.xml
Log:
Moved transaction stuff to Starobrno
Modified: core/branches/flat/src/main/docbook/faq/en/master.xml
===================================================================
--- core/branches/flat/src/main/docbook/faq/en/master.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/docbook/faq/en/master.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,352 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "../../../../docbook-support/support/docbook-dtd/docbookx.dtd"
- >
+ "../../../../docbook-support/support/docbook-dtd/docbookx.dtd"
+ >
<book lang="en">
- <bookinfo>
- <title>Frequently Asked Questions about JBoss Cache</title>
- <!-- Release version and date -->
- <releaseinfo>Release 3.0.0 Naga</releaseinfo>
- <pubdate>October 2008</pubdate>
+ <bookinfo>
+ <title>Frequently Asked Questions about JBoss Cache</title>
+ <!-- Release version and date -->
+ <releaseinfo>Release 3.0.0 Naga</releaseinfo>
+ <pubdate>October 2008</pubdate>
- <author>
- <firstname>Manik</firstname>
- <surname>Surtani</surname>
- <email>manik(a)jboss.org</email>
- </author>
+ <author>
+ <firstname>Manik</firstname>
+ <surname>Surtani</surname>
+ <email>manik(a)jboss.org</email>
+ </author>
- <author>
- <firstname>Ben</firstname>
- <surname>Wang</surname>
- <email>ben.wang(a)jboss.com</email>
- </author>
+ <author>
+ <firstname>Ben</firstname>
+ <surname>Wang</surname>
+ <email>ben.wang(a)jboss.com</email>
+ </author>
- <author>
- <firstname>Bela</firstname>
- <surname>Ban</surname>
- <email>bela(a)jboss.com</email>
- </author>
+ <author>
+ <firstname>Bela</firstname>
+ <surname>Ban</surname>
+ <email>bela(a)jboss.com</email>
+ </author>
- <author>
- <firstname>Scott</firstname>
- <surname>Marlow</surname>
- <email>smarlow(a)novell.com</email>
- </author>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Marlow</surname>
+ <email>smarlow(a)novell.com</email>
+ </author>
- <author>
- <firstname>Galder</firstname>
- <surname>Zamarreño</surname>
- <email>galder.zamarreno(a)jboss.com</email>
- </author>
+ <author>
+ <firstname>Galder</firstname>
+ <surname>Zamarreño</surname>
+ <email>galder.zamarreno(a)jboss.com</email>
+ </author>
- <abstract>
- <para>This is a compilation of the most frequently asked
- questions about JBoss Cache. Please report any bugs,
- inconsistencies, or omissions you find in this FAQ on the
- <ulink url="http://jboss.org/index.html?module=bb&op=main&c=29">JBoss Cache User Form
- </ulink>
- .
- </para>
- <para>
- This FAQ is divided into specific sections, all pertaining to the core JBoss Cache library. PojoCache has a
- separate FAQ
- document pertaining to PojoCache specifics.
- </para>
- </abstract>
+ <abstract>
+ <para>This is a compilation of the most frequently asked
+ questions about JBoss Cache. Please report any bugs,
+ inconsistencies, or omissions you find in this FAQ on the
+ <ulink url="http://jboss.org/index.html?module=bb&op=main&c=29">JBoss Cache User Form
+ </ulink>
+ .
+ </para>
+ <para>
+ This FAQ is divided into specific sections, all pertaining to the core JBoss Cache library. PojoCache
+ has a
+ separate FAQ
+ document pertaining to PojoCache specifics.
+ </para>
+ </abstract>
- <!-- copyright info -->
- <copyright>
- <year>2005</year>
- <year>2006</year>
- <year>2007</year>
- <year>2008</year>
- <holder>JBoss, a division of Red Hat Inc.</holder>
- </copyright>
- </bookinfo>
+ <!-- copyright info -->
+ <copyright>
+ <year>2005</year>
+ <year>2006</year>
+ <year>2007</year>
+ <year>2008</year>
+ <holder>JBoss, a division of Red Hat Inc.</holder>
+ </copyright>
+ </bookinfo>
- <chapter id="general">
- <title>General Information</title>
- <qandaset>
+ <chapter id="general">
+ <title>General Information</title>
+ <qandaset>
- <qandaentry>
- <question>
- <para>What is JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What is JBoss Cache?</para>
+ </question>
- <answer>
- <para>JBoss Cache is a replicated and transactional cache. It is
- replicated since multiple JBoss Cache instances can be distributed
- (either within the same JVM or across several JVMs whether they reside on
- the same machine or on different machines on a network) and data is
- replicated across the whole group. It is transactional because a
- user can configure a
- <ulink url="http://java.sun.com/products/jta/">JTA</ulink>
- compliant transaction
- manager and make any cache
- interaction transactional. Note that the cache can also be run without
- any replication; this is the local mode.
- </para>
+ <answer>
+ <para>JBoss Cache is a replicated and transactional cache. It is
+ replicated since multiple JBoss Cache instances can be distributed
+ (either within the same JVM or across several JVMs whether they reside on
+ the same machine or on different machines on a network) and data is
+ replicated across the whole group. It is transactional because a
+ user can configure a
+ <ulink url="http://java.sun.com/products/jta/">JTA</ulink>
+ compliant transaction
+ manager and make any cache
+ interaction transactional. Note that the cache can also be run without
+ any replication; this is the local mode.
+ </para>
- <para>JBoss Cache comes in two flavours: Core and Pojo versions. The core library
- (using the
- <literal>org.jboss.cache.Cache_Legacy</literal>
- interface
- ) is the underlying library that organises data in a tree-like structure and handles all locking,
- passivation,
- eviction and replication characteristics of data in the cache. The pojo library (using the
- <literal>org.jboss.cache.pojo.PojoCache</literal>
- interface) is built atop the core library and allows introspection
- of objects in the cache providing transparent coherence by using JBoss AOP. Note that the Pojo version
- of JBoss Cache
- (referred to as PojoCache) comes with a separate set of documentation (user guide, FAQ, etc.)
- available on the
- <ulink url="http://labs.jboss.com/portal/jbosscache/docs/index.html">JBoss Cache documentation site
- </ulink>
- .
- </para>
+ <para>JBoss Cache comes in two flavours: Core and Pojo versions. The core library
+ (using the
+ <literal>org.jboss.cache.Cache_Legacy</literal>
+ interface
+ ) is the underlying library that organises data in a tree-like structure and handles all
+ locking,
+ passivation,
+ eviction and replication characteristics of data in the cache. The pojo library (using the
+ <literal>org.jboss.cache.pojo.PojoCache</literal>
+ interface) is built atop the core library and allows introspection
+ of objects in the cache providing transparent coherence by using JBoss AOP. Note that the Pojo
+ version
+ of JBoss Cache
+ (referred to as PojoCache) comes with a separate set of documentation (user guide, FAQ, etc.)
+ available on the
+ <ulink url="http://labs.jboss.com/portal/jbosscache/docs/index.html">JBoss Cache documentation
+ site
+ </ulink>
+ .
+ </para>
- <para>
- JBoss Cache is made available in one of four different packages:
- <itemizedlist>
- <listitem>
- <para>
- <literal>jboss-cache-core</literal>
- </para>
- contains the core Cache library for users who do not wish to use the additional functionality
- offered by PojoCache.
- </listitem>
- <listitem>
- <para>
- <literal>jboss-cache-pojo</literal>
- </para>
- contains the core Cache library as well as the PojoCache extensions and dependencies.
- </listitem>
- <listitem>
- <para>
- <literal>jboss-cache-all</literal>
- </para>
- contains all of the above, including unit tests and source code.
- </listitem>
- <listitem>
- <para>
- <literal>jboss-cache-core-JDK140</literal>
- </para>
- contains a JDK 1.4 compatible version of the core Cache library. Note that PojoCache is only
- available for JDK 5.0.
- </listitem>
- </itemizedlist>
- </para>
- </answer>
- </qandaentry>
+ <para>
+ JBoss Cache is made available in one of four different packages:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>jboss-cache-core</literal>
+ </para>
+ contains the core Cache library for users who do not wish to use the additional
+ functionality
+ offered by PojoCache.
+ </listitem>
+ <listitem>
+ <para>
+ <literal>jboss-cache-pojo</literal>
+ </para>
+ contains the core Cache library as well as the PojoCache extensions and dependencies.
+ </listitem>
+ <listitem>
+ <para>
+ <literal>jboss-cache-all</literal>
+ </para>
+ contains all of the above, including unit tests and source code.
+ </listitem>
+ <listitem>
+ <para>
+ <literal>jboss-cache-core-JDK140</literal>
+ </para>
+ contains a JDK 1.4 compatible version of the core Cache library. Note that PojoCache is
+ only
+ available for JDK 5.0.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Who are the JBoss Cache developers?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Who are the JBoss Cache developers?</para>
+ </question>
- <answer>
- <para>
- JBoss Cache has an active community of developers and contributors. The project was founded by Bela
- Ban
- and is currently led by Manik Surtani. Jason Greene is the lead for the PojoCache subsystem, and other
- contributors both past and present include Ben Wang, Harald Gliebe, Brian Stansberry, Vladimir
- Blagojevic,
- Mircea Markus, Jimmy Wilson, Galder Zamarreño and Elias Ross.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ JBoss Cache has an active community of developers and contributors. The project was founded by
+ Bela
+ Ban
+ and is currently led by Manik Surtani. Jason Greene is the lead for the PojoCache subsystem, and
+ other
+ contributors both past and present include Ben Wang, Harald Gliebe, Brian Stansberry, Vladimir
+ Blagojevic,
+ Mircea Markus, Jimmy Wilson, Galder Zamarreño and Elias Ross.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>What is the license for JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What is the license for JBoss Cache?</para>
+ </question>
- <answer>
- <para>JBoss Cache is licensed under
- <ulink url="http://www.gnu.org/licenses/lgpl.html">LGPL</ulink>
- .
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>JBoss Cache is licensed under
+ <ulink url="http://www.gnu.org/licenses/lgpl.html">LGPL</ulink>
+ .
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Where can I download JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Where can I download JBoss Cache?</para>
+ </question>
- <answer>
- <para>The JBoss Cache
- <ulink url="http://www.jboss.com/products/jbosscache/downloads">product download page</ulink>
- has prebuilt binaries as well as source distributions. You can also grab snapshots from the JBoss CVS
- repository (see
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=CVSRepository">this wiki page</ulink>
- ) - the module name is
- <emphasis role="bold">JBossCache</emphasis>
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>The JBoss Cache
+ <ulink url="http://www.jboss.com/products/jbosscache/downloads">product download page</ulink>
+ has prebuilt binaries as well as source distributions. You can also grab snapshots from the
+ JBoss CVS
+ repository (see
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=CVSRepository">this wiki page</ulink>
+ ) - the module name is
+ <emphasis role="bold">JBossCache</emphasis>
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I build JBoss Cache from CVS sources?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I build JBoss Cache from CVS sources?</para>
+ </question>
- <answer>
- <para>To build, do
- <literal>sh build.sh
- jar
- </literal>
- . This will produce
- <literal>jboss-cache.jar</literal>
- and
- <literal>pojocache.jar</literal>
- in the
- <literal>dist/lib</literal>
- directory. Note that you will need to
- use JDK 5 to build the distribution.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>To build, do
+ <literal>sh build.sh
+ jar
+ </literal>
+ . This will produce
+ <literal>jboss-cache.jar</literal>
+ and
+ <literal>pojocache.jar</literal>
+ in the
+ <literal>dist/lib</literal>
+ directory. Note that you will need to
+ use JDK 5 to build the distribution.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Which versions of the JDK are supported by JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Which versions of the JDK are supported by JBoss Cache?</para>
+ </question>
- <answer>
- <para>
- JBoss Cache is baselined on Java 5.0 and this is the platform on which JBoss Cache is most thoroughly
- tested.
- If, for whatever reason you have to use Java 1.4, you could build a retroweaved version of the core
- cache
- library that is Java 1.4 compatible, using the simple instructions on this wiki page
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHabaneroJava1.4">on building and
- running JBoss Cache on Java 1.4.
- </ulink>
- . Note that Red Hat Inc. does not offer commercial support for retroweaved binaries at this stage.
- </para>
- <para>
- Java 6 should work as well, and we haven't heard of any specific problems of JBoss Cache run under
- Java 6.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ JBoss Cache is baselined on Java 5.0 and this is the platform on which JBoss Cache is most
+ thoroughly
+ tested.
+ If, for whatever reason you have to use Java 1.4, you could build a retroweaved version of the
+ core
+ cache
+ library that is Java 1.4 compatible, using the simple instructions on this wiki page
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHabaneroJava1.4">on building and
+ running JBoss Cache on Java 1.4.
+ </ulink>
+ . Note that Red Hat Inc. does not offer commercial support for retroweaved binaries at this
+ stage.
+ </para>
+ <para>
+ Java 6 should work as well, and we haven't heard of any specific problems of JBoss Cache run
+ under
+ Java 6.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I know the version of JBoss Cache that I am using?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I know the version of JBoss Cache that I am using?</para>
+ </question>
- <answer>
- <para>
- <code>java -jar jbosscache.jar</code>
- will spit out version details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ <code>java -jar jbosscache.jar</code>
+ will spit out version details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I run JBoss Cache outside of JBoss Application
- Server?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I run JBoss Cache outside of JBoss Application
+ Server?
+ </para>
+ </question>
- <answer>
- <para>
- Of course! Even though JBoss Cache comes integrated with JBoss Application Server as an MBean service,
- it
- can also be run standalone, in any Java EE server such as BEA WebLogic, IBM Websphere or Tomcat. It
- can also run in
- a standalone Java process, completely outside of an application server. See the user guide for more
- details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ Of course! Even though JBoss Cache comes integrated with JBoss Application Server as an MBean
+ service,
+ it
+ can also be run standalone, in any Java EE server such as BEA WebLogic, IBM Websphere or Tomcat.
+ It
+ can also run in
+ a standalone Java process, completely outside of an application server. See the user guide for
+ more
+ details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How can I migrate my application and configuration from using JBoss Cache 1.x to 2.x?</para>
- </question>
- <answer>
- <para>Look at
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCache200Migration">this wiki page</ulink>
- for help.
- </para>
- </answer>
- </qandaentry>
+ <qandaentry>
+ <question>
+ <para>How can I migrate my application and configuration from using JBoss Cache 1.x to 2.x?</para>
+ </question>
+ <answer>
+ <para>Look at
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCache200Migration">this wiki page
+ </ulink>
+ for help.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Where can I report bugs or problems?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Where can I report bugs or problems?</para>
+ </question>
- <answer>
- <para>Please report any bugs or problems to
- <ulink
- url="http://jboss.org/index.html?module=bb&op=main&c=29">JBoss Cache
- User Forum
- </ulink>
- .
- </para>
- </answer>
- </qandaentry>
- </qandaset>
- </chapter>
+ <answer>
+ <para>Please report any bugs or problems to
+ <ulink
+ url="http://jboss.org/index.html?module=bb&op=main&c=29">JBoss Cache
+ User Forum
+ </ulink>
+ .
+ </para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+ </chapter>
- <chapter id="TreeCache">
- <title>JBoss Cache - Core</title>
+ <chapter id="TreeCache">
+ <title>JBoss Cache - Core</title>
- <qandaset>
+ <qandaset>
- <qandaentry>
- <question>
- <para>How do I deploy JBoss Cache as a MBean service?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I deploy JBoss Cache as a MBean service?</para>
+ </question>
- <answer>
- <para>To deploy JBoss Cache as an MBean inside JBoss, you can copy the
- configuration xml file over to the
- <literal>deploy</literal>
- directory (from
- <literal>all</literal>
- configuration whereby the
- necessary jars are present). Under the standalone package
- <literal>etc/config-samples</literal>
- directory, there are example
- configuration files for different cache modes that can be used to
- deploy JBoss Cache as well.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>To deploy JBoss Cache as an MBean inside JBoss, you can copy the
+ configuration xml file over to the
+ <literal>deploy</literal>
+ directory (from
+ <literal>all</literal>
+ configuration whereby the
+ necessary jars are present). Under the standalone package
+ <literal>etc/config-samples</literal>
+ directory, there are example
+ configuration files for different cache modes that can be used to
+ deploy JBoss Cache as well.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I know if my JBoss Cache MBean has been deployed?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I know if my JBoss Cache MBean has been deployed?</para>
+ </question>
- <answer>
- <para>To verify that your JBoss Cache MBean is deployed correctly,
- you can first check the log output under the command console. Next
- you can verify it from JBoss JMX console. Look for
- <literal>jboss.cache</literal>
- domain.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>To verify that your JBoss Cache MBean is deployed correctly,
+ you can first check the log output under the command console. Next
+ you can verify it from JBoss JMX console. Look for
+ <literal>jboss.cache</literal>
+ domain.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I access the JBoss Cache MBean?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I access the JBoss Cache MBean?</para>
+ </question>
- <answer>
- <para>Accessing the JBoss Cache MBean is just like accessing any
- JBoss MBean. Here is a code snippet:
- </para>
+ <answer>
+ <para>Accessing the JBoss Cache MBean is just like accessing any
+ JBoss MBean. Here is a code snippet:
+ </para>
- <programlisting role="JAVA"><![CDATA[
+ <programlisting role="JAVA"><![CDATA[
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.mx.util.MBeanProxyExt;
@@ -388,686 +405,698 @@
}
]]></programlisting>
- </answer>
- </qandaentry>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I run multiple JBoss Cache instances on the same VM?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I run multiple JBoss Cache instances on the same VM?</para>
+ </question>
- <answer>
- <para>Yes. There are some scenarios where you may want to run
- multiple instances of JBoss Cache. For example, you want to run
- multiple local cache instances with each instance having its own
- configuration (e.g., different cache policy). In this case, you will
- need multiple xml configuration files.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. There are some scenarios where you may want to run
+ multiple instances of JBoss Cache. For example, you want to run
+ multiple local cache instances with each instance having its own
+ configuration (e.g., different cache policy). In this case, you will
+ need multiple xml configuration files.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can JBoss Cache run as a second level cache inside
- Hibernate?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can JBoss Cache run as a second level cache inside
+ Hibernate?
+ </para>
+ </question>
- <answer>
- <para>Yes. Since Hibernate 3.0 release, you can configure it to use
- JBoss Cache as a second level cache. For details,
- see Hibernate documentation, and also see
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">
- http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate
- </ulink>
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. Since Hibernate 3.0 release, you can configure it to use
+ JBoss Cache as a second level cache. For details,
+ see Hibernate documentation, and also see
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">
+ http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate
+ </ulink>
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>What about using Pojo Cache as a Hibernate cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What about using Pojo Cache as a Hibernate cache?</para>
+ </question>
- <answer>
- <para>It is not necessary to use PojoCache for second level
- cache inside Hibernate because Hibernate
- manages fine-grained fields in Java objects. Using PojoCache won't
- provide any advantage.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>It is not necessary to use PojoCache for second level
+ cache inside Hibernate because Hibernate
+ manages fine-grained fields in Java objects. Using PojoCache won't
+ provide any advantage.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How can I configure JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How can I configure JBoss Cache?</para>
+ </question>
- <answer>
- <para>You can configure the JBoss Cache through a configuration xml
- file or programmatically using a
- <literal>org.jboss.cache.config.Configuration</literal>
- object, passed in to the
- <literal>org.jboss.cache.CacheFactory</literal>
- instance.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>You can configure the JBoss Cache through a configuration xml
+ file or programmatically using a
+ <literal>org.jboss.cache.config.Configuration</literal>
+ object, passed in to the
+ <literal>org.jboss.cache.CacheFactory</literal>
+ instance.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>In the configuration xml file, there are tags such as
- <literal>class</literal>
- ,
- <literal>MBean</literal>
- , etc. What are
- these?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>In the configuration xml file, there are tags such as
+ <literal>class</literal>
+ ,
+ <literal>MBean</literal>
+ , etc. What are
+ these?
+ </para>
+ </question>
- <answer>
- <para>These are tags for deploying JBoss Cache as a JBoss MBean
- service. For consistency, we have kept them in the
- standalone package as well, specifically, the
- <literal>MBean</literal>
- tag. If you run in standalone mode,
- JBoss Cache will ignore these elements.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>These are tags for deploying JBoss Cache as a JBoss MBean
+ service. For consistency, we have kept them in the
+ standalone package as well, specifically, the
+ <literal>MBean</literal>
+ tag. If you run in standalone mode,
+ JBoss Cache will ignore these elements.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>What is the difference between the different cache
- modes?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What is the difference between the different cache
+ modes?
+ </para>
+ </question>
- <answer>
- <para>JBossCache has five different cache modes, i.e.,
- <literal>LOCAL</literal>
- ,
- <literal>REPL_SYNC</literal>
- ,
- <literal>REPL_ASYNC</literal>
- ,
- <literal>INVALIDATION_SYNC</literal>
- and
- <literal>INVALIDATION_ASYNC</literal>
- . If you want to run JBoss Cache as a
- single instance, then you should set the cache mode to
- <literal>LOCAL</literal>
- so that it won't attempt to replicate anything.
- If you want to have synchronous replication among different
- JBoss Cache instances, you set it to
- <literal>REPL_SYNC</literal>
- .
- For asynchronous replication, use
- <literal>AYSNC_REPL</literal>
- . If you do not wish to replicate cached data but simply inform other caches in a cluster that data
- under
- specific addresses are now stale and should be evicted from memory, use
- <literal>INVALIDATION_SYNC</literal>
- or
- <literal>INVALIDTAION_ASYNC</literal>
- . Synchronous and asynchronous behavior applies to invalidation as well as replication.
- </para>
+ <answer>
+ <para>JBossCache has five different cache modes, i.e.,
+ <literal>LOCAL</literal>
+ ,
+ <literal>REPL_SYNC</literal>
+ ,
+ <literal>REPL_ASYNC</literal>
+ ,
+ <literal>INVALIDATION_SYNC</literal>
+ and
+ <literal>INVALIDATION_ASYNC</literal>
+ . If you want to run JBoss Cache as a
+ single instance, then you should set the cache mode to
+ <literal>LOCAL</literal>
+ so that it won't attempt to replicate anything.
+ If you want to have synchronous replication among different
+ JBoss Cache instances, you set it to
+ <literal>REPL_SYNC</literal>
+ .
+ For asynchronous replication, use
+ <literal>AYSNC_REPL</literal>
+ . If you do not wish to replicate cached data but simply inform other caches in a cluster that
+ data
+ under
+ specific addresses are now stale and should be evicted from memory, use
+ <literal>INVALIDATION_SYNC</literal>
+ or
+ <literal>INVALIDTAION_ASYNC</literal>
+ . Synchronous and asynchronous behavior applies to invalidation as well as replication.
+ </para>
- <para>Note that
- <literal>ASYNC_REPL</literal>
- and
- <literal>INVALIDATION_ASYNC</literal>
- are non-blocking. This
- can be useful when you want to have another JBoss Cache serving as a
- mirror or backup and you don't want to wait for confirmation that this mirror has received your
- messages.
- </para>
- </answer>
- </qandaentry>
+ <para>Note that
+ <literal>ASYNC_REPL</literal>
+ and
+ <literal>INVALIDATION_ASYNC</literal>
+ are non-blocking. This
+ can be useful when you want to have another JBoss Cache serving as a
+ mirror or backup and you don't want to wait for confirmation that this mirror has received your
+ messages.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How does JBoss Cache's replication mechanism work?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How does JBoss Cache's replication mechanism work?</para>
+ </question>
- <answer>
- <para>JBoss Cache leverages
- <ulink url="http://www.jgroups.org">JGroups</ulink>
- as a replication layer. A user
- can configure the cluster of JBoss Cache instances by sharing the
- same cluster name (
- <literal>cluster name</literal>
- ). There is also
- an option of whether to populate the cache data upon starting a new
- instance in the
- <literal>ClusterConfig</literal>
- attribute.
- </para>
+ <answer>
+ <para>JBoss Cache leverages
+ <ulink url="http://www.jgroups.org">JGroups</ulink>
+ as a replication layer. A user
+ can configure the cluster of JBoss Cache instances by sharing the
+ same cluster name (
+ <literal>cluster name</literal>
+ ). There is also
+ an option of whether to populate the cache data upon starting a new
+ instance in the
+ <literal>ClusterConfig</literal>
+ attribute.
+ </para>
- <para>Note that once all instances join the same replication group,
- every replication change is propagated to all participating members.
- There is no mechanism for sub-partitioning where some replication
- can be done within only a subset of members, unless you use the Buddy Replication features. See the
- user guide for more details on this.
- </para>
- </answer>
- </qandaentry>
+ <para>Note that once all instances join the same replication group,
+ every replication change is propagated to all participating members.
+ There is no mechanism for sub-partitioning where some replication
+ can be done within only a subset of members, unless you use the Buddy Replication features. See
+ the
+ user guide for more details on this.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>I run a 2 node cluster. If the network dies, do the caches continue to run?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>I run a 2 node cluster. If the network dies, do the caches continue to run?</para>
+ </question>
- <answer>
- <para>Yes, both will continue to run, but depending on your replication mode, all transactions or
- operations may not complete. If
- <literal>REPL_SYNC</literal>
- is used, operations will fail while if
- <literal>REPL_ASYNC</literal>
- is used they will succeed. Even if they succeed though, caches will be out of sync.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes, both will continue to run, but depending on your replication mode, all transactions or
+ operations may not complete. If
+ <literal>REPL_SYNC</literal>
+ is used, operations will fail while if
+ <literal>REPL_ASYNC</literal>
+ is used they will succeed. Even if they succeed though, caches will be out of sync.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I plug in library X instead of JGroups to handle remote calls and group communications?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I plug in library X instead of JGroups to handle remote calls and group communications?
+ </para>
+ </question>
- <answer>
- <para>At this stage the answer is no. We do have an abstraction layer between the
- communication suite and JBoss Cache in the pipelines, and this may appear as a feature at some stage
- in
- the future.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>At this stage the answer is no. We do have an abstraction layer between the
+ communication suite and JBoss Cache in the pipelines, and this may appear as a feature at some
+ stage
+ in
+ the future.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does the cache need to replicate to every other instance in the cluster? Isn't this slow if the
- cluster is large?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does the cache need to replicate to every other instance in the cluster? Isn't this slow if
+ the
+ cluster is large?
+ </para>
+ </question>
- <answer>
- <para>Replication need not occur to every node in the cluster. This feature -
- called Buddy Replication -
- allows each node to pick one or more 'buddies' in the cluster and only replicate to its buddies. This
- allows a cluster to scale
- very easily with no extra impact on memory or network traffic with each node added.
- </para>
- <para>
- See the User Guide for more information on Buddy Replication, and how it can be used to achieve very
- high
- scalability.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Replication need not occur to every node in the cluster. This feature -
+ called Buddy Replication -
+ allows each node to pick one or more 'buddies' in the cluster and only replicate to its buddies.
+ This
+ allows a cluster to scale
+ very easily with no extra impact on memory or network traffic with each node added.
+ </para>
+ <para>
+ See the User Guide for more information on Buddy Replication, and how it can be used to achieve
+ very
+ high
+ scalability.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>If I have the need for different configuration properties (e.g.,
- <literal>CacheMode</literal>
- and
- <literal>IsolationLevel</literal>
- ), do I simply need to create multiple
- <literal>org.jboss.cache.Cache_Legacy</literal>
- instances with the appropriate configuration?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>If I have the need for different configuration properties (e.g.,
+ <literal>CacheMode</literal>
+ and
+ <literal>IsolationLevel</literal>
+ ), do I simply need to create multiple
+ <literal>org.jboss.cache.Cache_Legacy</literal>
+ instances with the appropriate configuration?
+ </para>
+ </question>
- <answer>
- <para>Yes. All the above mentioned properties are per cache
- instance. Therefore you will need separate
- <literal>org.jboss.cache.Cache_Legacy</literal>
- instances.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. All the above mentioned properties are per cache
+ instance. Therefore you will need separate
+ <literal>org.jboss.cache.Cache_Legacy</literal>
+ instances.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Isn't this expensive from a networking standpoint, i.e., needing to create sockets for each
- <literal>org.jboss.cache.Cache_Legacy</literal>
- instance?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Isn't this expensive from a networking standpoint, i.e., needing to create sockets for each
+ <literal>org.jboss.cache.Cache_Legacy</literal>
+ instance?
+ </para>
+ </question>
- <answer>
- <para>
- Yes, it can be. For such cases it is recommended that you configure your cache using the JGroups
- Multiplexer, which allows several caches to share
- a single JGroups channel. Please see the User Guide for details on how to configure the JGroups
- Multiplexer.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ Yes, it can be. For such cases it is recommended that you configure your cache using the JGroups
+ Multiplexer, which allows several caches to share
+ a single JGroups channel. Please see the User Guide for details on how to configure the JGroups
+ Multiplexer.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does the
- <literal>ClusterName</literal>
- configuration element have
- any relation to the JBoss AS cluster
- <literal>PartitionName</literal>
- ?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does the
+ <literal>ClusterName</literal>
+ configuration element have
+ any relation to the JBoss AS cluster
+ <literal>PartitionName</literal>
+ ?
+ </para>
+ </question>
- <answer>
- <para>Yes. They are both JGroups group names. Besides the notion of
- a channel in JGroups, it also can partition the channel into different
- group names.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. They are both JGroups group names. Besides the notion of
+ a channel in JGroups, it also can partition the channel into different
+ group names.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>When using multiple JGroups based components
- [cluster-service.xml, cache (multiple instances)], what is the
- correct/valid way to configure those components to make sure my
- multicast addresses don't conflict?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>When using multiple JGroups based components
+ [cluster-service.xml, cache (multiple instances)], what is the
+ correct/valid way to configure those components to make sure my
+ multicast addresses don't conflict?
+ </para>
+ </question>
- <answer>
- <para>There are two parameters to consider: multicast address (plus
- port) and the group name. At minimum, you will have to run
- components using a different group name. But whether to run them on
- the same channel depends upon whether the communication performance
- is critical for you or not. If it is, then it'd be best to run them
- on different channels.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>There are two parameters to consider: multicast address (plus
+ port) and the group name. At minimum, you will have to run
+ components using a different group name. But whether to run them on
+ the same channel depends upon whether the communication performance
+ is critical for you or not. If it is, then it'd be best to run them
+ on different channels.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support cache persistence
- storage?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support cache persistence
+ storage?
+ </para>
+ </question>
- <answer>
- <para>Yes. JBoss Cache has a cache loader
- interface that supports cache persistence. See below for more FAQs on cache loaders.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. JBoss Cache has a cache loader
+ interface that supports cache persistence. See below for more FAQs on cache loaders.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support cache passivation/ overflow
- to a data store?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support cache passivation/ overflow
+ to a data store?
+ </para>
+ </question>
- <answer>
- <para>Yes. JBoss Cache uses the
- cache loader to support cache passivation/ overflow. See
- documentation on how to configure and use this feature.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. JBoss Cache uses the
+ cache loader to support cache passivation/ overflow. See
+ documentation on how to configure and use this feature.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Is JBoss Cache thread safe?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Is JBoss Cache thread safe?</para>
+ </question>
- <answer>
- <para>Yes, it is thread safe.</para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes, it is thread safe.</para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support XA (2PC) transactions now?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support XA (2PC) transactions now?</para>
+ </question>
- <answer>
- <para>No, although it is also on our to do list. Our internal
- implementation does use a procedure similar to 2PC to coordinate a
- transactions among different instances, but JBoss Cache is not an XA resource.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>No, although it is also on our to do list. Our internal
+ implementation does use a procedure similar to 2PC to coordinate a
+ transactions among different instances, but JBoss Cache is not an XA resource.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Which transaction managers are supported by
- JBoss Cache?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Which transaction managers are supported by
+ JBoss Cache?
+ </para>
+ </question>
- <answer>
- <para>JBoss Cache supports any TransactionManager that is
- <ulink url="http://java.sun.com/products/jta/">JTA</ulink>
- compliant such as JBossTM or JBossTS. JBoss Cache ships with a
- dummy transaction manager
- (
- <literal>org.jboss.cache.transaction.DummyTransactionManager</literal>
- ) for
- testing purposes only. But note that
- <literal>DummyTransactionManager</literal>
- is not thread safe .i.e.,
- it does not support concurrent transactions. Instead, only one
- transaction is allowed at a time.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>JBoss Cache supports any TransactionManager that is
+ <ulink url="http://java.sun.com/products/jta/">JTA</ulink>
+ compliant such as JBossTM or JBossTS. JBoss Cache ships with a
+ dummy transaction manager
+ (
+ <literal>org.jboss.starobrno.transaction.DummyTransactionManager</literal>
+ ) for
+ testing purposes only. But note that
+ <literal>DummyTransactionManager</literal>
+ is not thread safe .i.e.,
+ it does not support concurrent transactions. Instead, only one
+ transaction is allowed at a time.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I set up the cache to be transactional?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I set up the cache to be transactional?</para>
+ </question>
- <answer>
- <para>You either use the default transaction manager that ships with JBoss AS
- or you have to implement the
- <literal>org.jboss.cache.transaction.TransactionManagerLookup</literal>
- interface, and return an
- instance of your
- <literal>javax.transaction.TransactionManager</literal>
- implementation. The
- configuration property
- <literal>TransactionManagerLookupClass</literal>
- defines the class
- to be used by the cache to fetch a reference to a
- transaction manager. It is trivial to implement this interface to support
- other transaction managers. Once this attribute is specified, the
- cache will look up the transaction context from this transaction
- manager.
- </para>
+ <answer>
+ <para>You either use the default transaction manager that ships with JBoss AS
+ or you have to implement the
+ <literal>org.jboss.starobrno.transaction.TransactionManagerLookup</literal>
+ interface, and return an
+ instance of your
+ <literal>javax.transaction.TransactionManager</literal>
+ implementation. The
+ configuration property
+ <literal>TransactionManagerLookupClass</literal>
+ defines the class
+ to be used by the cache to fetch a reference to a
+ transaction manager. It is trivial to implement this interface to support
+ other transaction managers. Once this attribute is specified, the
+ cache will look up the transaction context from this transaction
+ manager.
+ </para>
- </answer>
- </qandaentry>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I control the cache locking level?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I control the cache locking level?</para>
+ </question>
- <answer>
- <para>JBoss Cache lets you control the cache locking level through
- the transaction isolation level. This is configured through the
- attribute
- <literal>IsolationLevel</literal>
- . The transaction
- isolation levels correspond to database
- isolation levels, namely,
- <literal>NONE</literal>
- ,
- <literal>READ_UNCOMMITTED</literal>
- ,
- <literal>READ_COMMITTED</literal>
- ,
- <literal>REPEATABLE_READ</literal>
- , and
- <literal>SERIALIZABLE</literal>
- . Note that these isolation levels are ignored if optimistic locking is used. For details, please
- refer
- to the
- user manual.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>JBoss Cache lets you control the cache locking level through
+ the transaction isolation level. This is configured through the
+ attribute
+ <literal>IsolationLevel</literal>
+ . The transaction
+ isolation levels correspond to database
+ isolation levels, namely,
+ <literal>NONE</literal>
+ ,
+ <literal>READ_UNCOMMITTED</literal>
+ ,
+ <literal>READ_COMMITTED</literal>
+ ,
+ <literal>REPEATABLE_READ</literal>
+ , and
+ <literal>SERIALIZABLE</literal>
+ . Note that these isolation levels are ignored if optimistic locking is used. For details,
+ please
+ refer
+ to the
+ user manual.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How does JBoss Cache lock data for concurrent access?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How does JBoss Cache lock data for concurrent access?</para>
+ </question>
- <answer>
- <para>By default JBoss Cache uses pessimistic locking to lock data nodes, based on the isolation level
- configured. We also offer optimistic locking to allow for greater concurrency
- at
- the cost of slight processing overhead and performance. See the documentation for a more detailed
- discussion on concurrency and locking in JBoss Cache.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>By default JBoss Cache uses pessimistic locking to lock data nodes, based on the isolation
+ level
+ configured. We also offer optimistic locking to allow for greater concurrency
+ at
+ the cost of slight processing overhead and performance. See the documentation for a more
+ detailed
+ discussion on concurrency and locking in JBoss Cache.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I enable Optimistic Locking in JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I enable Optimistic Locking in JBoss Cache?</para>
+ </question>
- <answer>
- <para>Use the XMl attribute
- <code>NodeLockingScheme</code>
- . Note that
- <code>IsolationLevel</code>
- is ignored if
- <code>NodeLockingScheme</code>
- is set to
- <code>OPTIMISTIC</code>
- . Also note that
- <code>NodeLockingScheme</code>
- defaults to
- <code>PESSIMISTIC</code>
- if omitted.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Use the XMl attribute
+ <code>NodeLockingScheme</code>
+ . Note that
+ <code>IsolationLevel</code>
+ is ignored if
+ <code>NodeLockingScheme</code>
+ is set to
+ <code>OPTIMISTIC</code>
+ . Also note that
+ <code>NodeLockingScheme</code>
+ defaults to
+ <code>PESSIMISTIC</code>
+ if omitted.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How does the write lock apply to an Fqn node, say,
- "/org/jboss/test"?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How does the write lock apply to an Fqn node, say,
+ "/org/jboss/test"?
+ </para>
+ </question>
- <answer>
- <para>First of all, JBoss Cache has a notion of
- <literal>root</literal>
- that serves as a starting point for every navigational operation.
- The default is "/" (since the default separator is "/" for the fqn).
- The locking then is applied to the node under root, for example
- "/org" (no locking "/").
- </para>
+ <answer>
+ <para>First of all, JBoss Cache has a notion of
+ <literal>root</literal>
+ that serves as a starting point for every navigational operation.
+ The default is "/" (since the default separator is "/" for the fqn).
+ The locking then is applied to the node under root, for example
+ "/org" (no locking "/").
+ </para>
- <para>Furthermore, let's say when JBoss Cache needs to apply a write
- lock on node "/org/jboss/test", it will first try to obtain read
- lock from the parent nodes recursively (in this example, "/org", and
- "/org/jboss"). Only when it succeeds then it will try to obtain a
- write lock on "/org/jboss/test".
- </para>
- </answer>
- </qandaentry>
+ <para>Furthermore, let's say when JBoss Cache needs to apply a write
+ lock on node "/org/jboss/test", it will first try to obtain read
+ lock from the parent nodes recursively (in this example, "/org", and
+ "/org/jboss"). Only when it succeeds then it will try to obtain a
+ write lock on "/org/jboss/test".
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I use the cache locking level even without a transaction
- context?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I use the cache locking level even without a transaction
+ context?
+ </para>
+ </question>
- <answer>
- <para>Yes. JBoss Cache controls the individual node locking behavior
- through the isolation level semantics. This means even if you don't
- use a transaction, you can specify the lock level via isolation
- level. You can think of the node locking behavior outside of a
- transaction as if it is under transaction with
- <literal>auto_commit</literal>
- on.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. JBoss Cache controls the individual node locking behavior
+ through the isolation level semantics. This means even if you don't
+ use a transaction, you can specify the lock level via isolation
+ level. You can think of the node locking behavior outside of a
+ transaction as if it is under transaction with
+ <literal>auto_commit</literal>
+ on.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>With replication (REPL_SYNC/REPL_ASYNC) or invalidation (INVALIDATION_SYNC/INVALIDATION_ASYNC), how
- often does the cache broadcast messages over the network?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>With replication (REPL_SYNC/REPL_ASYNC) or invalidation
+ (INVALIDATION_SYNC/INVALIDATION_ASYNC), how
+ often does the cache broadcast messages over the network?
+ </para>
+ </question>
- <answer>
- <para>If the updates are under transaction, then the broadcasts
- happen only when the transaction is about to commit (actually
- during the prepare stage internally). That is, it will be a batch
- update. However, if the operations are not under transaction
- context, then each update will trigger replication. Note that this
- has performance implication if network transport is heavy (it
- usually is).
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>If the updates are under transaction, then the broadcasts
+ happen only when the transaction is about to commit (actually
+ during the prepare stage internally). That is, it will be a batch
+ update. However, if the operations are not under transaction
+ context, then each update will trigger replication. Note that this
+ has performance implication if network transport is heavy (it
+ usually is).
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How can I do a mass removal?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How can I do a mass removal?</para>
+ </question>
- <answer>
- <para>If you do a cache.removeNode(Fqn.fromString("/myroot")), it will recursively remove
- all the entries under "/myroot".
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>If you do a cache.removeNode(Fqn.fromString("/myroot")), it will recursively remove
+ all the entries under "/myroot".
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I monitor and manage the JBoss Cache?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I monitor and manage the JBoss Cache?</para>
+ </question>
- <answer>
- <para>Yes, using a JMX console such as the one shipped with JBoss AS or Java 5's
- <literal>jconsole</literal>
- utility. See the chapter titled
- <emphasis role="bold">Management Information</emphasis>
- in the JBoss Cache user guide for more details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes, using a JMX console such as the one shipped with JBoss AS or Java 5's
+ <literal>jconsole</literal>
+ utility. See the chapter titled
+ <emphasis role="bold">Management Information</emphasis>
+ in the JBoss Cache user guide for more details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I disable JBoss Cache management attributes?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I disable JBoss Cache management attributes?</para>
+ </question>
- <answer>
- <para>Yes, you can. Set the
- <literal>UseInterceptorMbeans</literal>
- configuration attribute to
- <literal>false</literal>
- (this defaults to
- <literal>true</literal>
- ). See the chapter titled
- <emphasis role="bold">Management Information</emphasis>
- in the JBoss Cache user guide for more details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes, you can. Set the
+ <literal>UseInterceptorMbeans</literal>
+ configuration attribute to
+ <literal>false</literal>
+ (this defaults to
+ <literal>true</literal>
+ ). See the chapter titled
+ <emphasis role="bold">Management Information</emphasis>
+ in the JBoss Cache user guide for more details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>What happened to jboss-serialization.jar?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What happened to jboss-serialization.jar?</para>
+ </question>
- <answer>
- <para>
- As of JBoss Cache 2.0.0, the dependency on JBoss Serialization has been dropped since most of the
- benefits of JBoss Serialization are available in updated Java 5 VMs. Since JBoss Cache 2.0.0 is
- baselined on Java 5, there was no need to provide these benefits separately.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ As of JBoss Cache 2.0.0, the dependency on JBoss Serialization has been dropped since most of
+ the
+ benefits of JBoss Serialization are available in updated Java 5 VMs. Since JBoss Cache 2.0.0 is
+ baselined on Java 5, there was no need to provide these benefits separately.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support partitioning?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support partitioning?</para>
+ </question>
- <answer>
- <para>Not right now. JBoss Cache does not support partitioning that a
- user can configure to have different set of data residing on
- different cache instances while still participating as a replication
- group.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Not right now. JBoss Cache does not support partitioning that a
+ user can configure to have different set of data residing on
+ different cache instances while still participating as a replication
+ group.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache handle the concept of application classloading
- inside, say, a J2EE container?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache handle the concept of application classloading
+ inside, say, a J2EE container?
+ </para>
+ </question>
- <answer>
- <para>Application-specific classloading is used widely inside a Java EE
- container. For example, a web application may require a new
- classloader to scope a specific version of the user library.
- However, by default JBoss Cache is agnostic to the classloader. In
- general, this leads to two kinds of problems:
- </para>
+ <answer>
+ <para>Application-specific classloading is used widely inside a Java EE
+ container. For example, a web application may require a new
+ classloader to scope a specific version of the user library.
+ However, by default JBoss Cache is agnostic to the classloader. In
+ general, this leads to two kinds of problems:
+ </para>
- <itemizedlist>
- <listitem>
- <para>Object instance is stored in cache1 and replicated to
- cache2. As a result, the instance in cache2 is created by the
- system classloader. The replication may fail if the system
- classloader on cache2 does not have access to the required
- class. Even if replication doesn't fail, a user thread in cache2
- may not be able to access the object if the user thread is
- expecting a type defined by the application classloader.
- </para>
- </listitem>
+ <itemizedlist>
+ <listitem>
+ <para>Object instance is stored in cache1 and replicated to
+ cache2. As a result, the instance in cache2 is created by the
+ system classloader. The replication may fail if the system
+ classloader on cache2 does not have access to the required
+ class. Even if replication doesn't fail, a user thread in cache2
+ may not be able to access the object if the user thread is
+ expecting a type defined by the application classloader.
+ </para>
+ </listitem>
- <listitem>
- <para>Object instance is created by thread 1 and will be
- accessed by thread 2 (with two different classloaders).
- JBoss Cache has no notion of the different classloaders involved.
- As a result, you will have a
- <literal>ClassCastException</literal>
- . This is a standard
- problem in passing an object from one application space to
- another; JBoss Cache just adds a level of indirection in passing
- the object.
- </para>
- </listitem>
- </itemizedlist>
+ <listitem>
+ <para>Object instance is created by thread 1 and will be
+ accessed by thread 2 (with two different classloaders).
+ JBoss Cache has no notion of the different classloaders involved.
+ As a result, you will have a
+ <literal>ClassCastException</literal>
+ . This is a standard
+ problem in passing an object from one application space to
+ another; JBoss Cache just adds a level of indirection in passing
+ the object.
+ </para>
+ </listitem>
+ </itemizedlist>
- <para>To solve the first kind of issue JBoss Cache uses a
- <literal>CacheMarshaller</literal>
- .
- Basically, this allows application code to register a classloader
- with a portion of the cache tree for use in handling objects
- replicated to that portion. See the
- <literal>CacheMarshaller</literal>
- section of
- the user guide for more details.
- </para>
+ <para>To solve the first kind of issue JBoss Cache uses a
+ <literal>CacheMarshaller</literal>
+ .
+ Basically, this allows application code to register a classloader
+ with a portion of the cache tree for use in handling objects
+ replicated to that portion. See the
+ <literal>CacheMarshaller</literal>
+ section of
+ the user guide for more details.
+ </para>
- <para>To solve the second kind of issue, the only solution (that we
- know of) is to cache "serialized" byte code and only de-serialize it
- during every object get (and this will be expensive!). That is,
- during a put operation, the object instance will be serialized and
- therefore can be deserialized safely by a "foreign" classloader.
- However, the performance penalty of this approach is quite severe so
- in general another local in-vm version will need to be used as a
- "near-line" cache. Note also that each time the serialized bytes are
- deserialized, a new instance of the object is created.
- </para>
+ <para>To solve the second kind of issue, the only solution (that we
+ know of) is to cache "serialized" byte code and only de-serialize it
+ during every object get (and this will be expensive!). That is,
+ during a put operation, the object instance will be serialized and
+ therefore can be deserialized safely by a "foreign" classloader.
+ However, the performance penalty of this approach is quite severe so
+ in general another local in-vm version will need to be used as a
+ "near-line" cache. Note also that each time the serialized bytes are
+ deserialized, a new instance of the object is created.
+ </para>
- <para>To help with this kind of handling, JBoss has a utility class
- called
- <literal>MarshalledValue</literal>
- that wraps around the
- serialized object. Here is a code snippet that illustrates how you
- can create a wrapper around JBoss Cache to handle the classloader
- issue:
- </para>
+ <para>To help with this kind of handling, JBoss has a utility class
+ called
+ <literal>MarshalledValue</literal>
+ that wraps around the
+ serialized object. Here is a code snippet that illustrates how you
+ can create a wrapper around JBoss Cache to handle the classloader
+ issue:
+ </para>
- <programlisting role="JAVA">
- <![CDATA[
+ <programlisting role="JAVA">
+ <![CDATA[
import org.jboss.invocation.MarshalledValue;
public class CacheService
@@ -1099,553 +1128,577 @@
}
}
]]></programlisting>
- </answer>
- </qandaentry>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache currently support pre-event and post-event
- notification?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache currently support pre-event and post-event
+ notification?
+ </para>
+ </question>
- <answer>
- <para>Yes. A boolean is passed in to each notification callback identifying whether the callback is
- before
- or after the event. See the
- <literal>org.jboss.cache.CacheListener</literal>
- interface for details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. A boolean is passed in to each notification callback identifying whether the callback is
+ before
+ or after the event. See the
+ <literal>org.jboss.cache.CacheListener</literal>
+ interface for details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>How do I implement a custom listener to listen to
- cache events?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>How do I implement a custom listener to listen to
+ cache events?
+ </para>
+ </question>
- <answer>
- <para>
- Either implement
- <literal>org.jboss.cache.CacheListener</literal>
- or extend
- <literal>org.jboss.cache.AbstractCacheListener</literal>
- and override for the events you are interested in. You can then register the listener using the
- <literal>org.jboss.cache.Cache_Legacy.addCacheListener()</literal>
- API.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ Either implement
+ <literal>org.jboss.cache.CacheListener</literal>
+ or extend
+ <literal>org.jboss.cache.AbstractCacheListener</literal>
+ and override for the events you are interested in. You can then register the listener using the
+ <literal>org.jboss.cache.Cache_Legacy.addCacheListener()</literal>
+ API.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I use
- <literal>UseRegionBasedMarshalling</literal>
- attribute in JBoss Cache in order to get
- around ClassCastExceptions happening when accessing data in the cache that has just been redeployed?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I use
+ <literal>UseRegionBasedMarshalling</literal>
+ attribute in JBoss Cache in order to get
+ around ClassCastExceptions happening when accessing data in the cache that has just been
+ redeployed?
+ </para>
+ </question>
- <answer>
- <para>Yes, you can. Originally, cache Marshalling was designed as a
- workaround for those replicated caches that upon state transfer did not have access to the
- classloaders defining the objects in the cache.
- </para>
+ <answer>
+ <para>Yes, you can. Originally, cache Marshalling was designed as a
+ workaround for those replicated caches that upon state transfer did not have access to the
+ classloaders defining the objects in the cache.
+ </para>
- <para>On each deployment, JBoss creates a new classloader per the top level deployment artifact, for
- example an EAR. You also have to bear in mind that a class in an application server is defined not
- only by the class name but also its classloader. So, assuming that the cache is not deployed as part
- of your deployment, you could deploy an application and put instances of classes belonging to this
- deployment inside the cache. If you did a redeployment and try to do a get operation of the data
- previously put, this would result on a ClassCastException. This is because even though the class names
- are the same, the class definitions are not. The current classloader is different to the one when
- the classes were originally put.
- </para>
+ <para>On each deployment, JBoss creates a new classloader per the top level deployment artifact, for
+ example an EAR. You also have to bear in mind that a class in an application server is defined
+ not
+ only by the class name but also its classloader. So, assuming that the cache is not deployed as
+ part
+ of your deployment, you could deploy an application and put instances of classes belonging to
+ this
+ deployment inside the cache. If you did a redeployment and try to do a get operation of the data
+ previously put, this would result on a ClassCastException. This is because even though the class
+ names
+ are the same, the class definitions are not. The current classloader is different to the one
+ when
+ the classes were originally put.
+ </para>
- <para>By enabling marshalling, you can control the lifecycle of the data in the cache and if on
- undeployment, you deactivate the region and unregister the classloader that you'd have registered on
- deployment, you'd evict the data in the cache locally. That means that in the next deployment, the
- data won't be in the cache, therefore avoiding the problem. Obviously, using marshalling to get
- around this problem is only recommended when you have some kind of persistence backing where the data
- survives, for example using CacheLoaders, or when JBoss Cache is used as a second level cache in a
- persistence framework.
- </para>
+ <para>By enabling marshalling, you can control the lifecycle of the data in the cache and if on
+ undeployment, you deactivate the region and unregister the classloader that you'd have
+ registered on
+ deployment, you'd evict the data in the cache locally. That means that in the next deployment,
+ the
+ data won't be in the cache, therefore avoiding the problem. Obviously, using marshalling to get
+ around this problem is only recommended when you have some kind of persistence backing where the
+ data
+ survives, for example using CacheLoaders, or when JBoss Cache is used as a second level cache in
+ a
+ persistence framework.
+ </para>
- <para>To implement this feature, please follow the instructions indicated in the example located
- in the CacheMarshaller section of the user's guide. It's worth noting that instead of a
- <literal>ServletContextListener</literal>
- , you could add this code into an
- <literal>MBean</literal>
- that contained lifecycle methods, such as
- <literal>start()</literal>
- and
- <literal>stop()</literal>
- .
- The key would be for this MBean to depend on the target cache, so that it can operate as long as the
- cache is up and running.
- </para>
- </answer>
- </qandaentry>
+ <para>To implement this feature, please follow the instructions indicated in the example located
+ in the CacheMarshaller section of the user's guide. It's worth noting that instead of a
+ <literal>ServletContextListener</literal>
+ , you could add this code into an
+ <literal>MBean</literal>
+ that contained lifecycle methods, such as
+ <literal>start()</literal>
+ and
+ <literal>stop()</literal>
+ .
+ The key would be for this MBean to depend on the target cache, so that it can operate as long as
+ the
+ cache is up and running.
+ </para>
+ </answer>
+ </qandaentry>
- </qandaset>
- </chapter>
+ </qandaset>
+ </chapter>
- <chapter id="eviction">
- <title>Eviction Policies</title>
- <qandaset>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support eviction policies?</para>
- </question>
+ <chapter id="eviction">
+ <title>Eviction Policies</title>
+ <qandaset>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support eviction policies?</para>
+ </question>
- <answer>
- <para>Yes. JBoss Cache currently supports multiple eviction policies such as LRU, MRU, and FIFO.
- Users can also plug in their own eviction policy algorithms. See user
- manual for details.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. JBoss Cache currently supports multiple eviction policies such as LRU, MRU, and FIFO.
+ Users can also plug in their own eviction policy algorithms. See user
+ manual for details.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache's eviction policy operates in
- replication mode?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache's eviction policy operates in
+ replication mode?
+ </para>
+ </question>
- <answer>
- <para>Yes and no. :-)</para>
+ <answer>
+ <para>Yes and no. :-)</para>
- <para>The eviction policy only operates in local mode. That is, nodes are
- only evicted locally. This may cause the cache contents not to be
- synchronized temporarily. But when a user tries to obtain the cached
- contents of an evicted node and finds out that is null (e.g.,
- <literal>get</literal>
- returns null), it should get it from the
- other data source and re-populate the data in the cache. During this
- moment, the node content will be propagated and the cache content
- will be in sync.
- </para>
+ <para>The eviction policy only operates in local mode. That is, nodes are
+ only evicted locally. This may cause the cache contents not to be
+ synchronized temporarily. But when a user tries to obtain the cached
+ contents of an evicted node and finds out that is null (e.g.,
+ <literal>get</literal>
+ returns null), it should get it from the
+ other data source and re-populate the data in the cache. During this
+ moment, the node content will be propagated and the cache content
+ will be in sync.
+ </para>
- <para>However, you still can run eviction policies with cache mode
- set to either
- <literal>REPL_SYNC</literal>
- or
- <literal>REPL_ASYNC</literal>
- . Depending on your use case, you can
- set multiple cache instances to have their own eviction policy
- (which are applied locally) or just have selected instances with
- eviction policies activated.
- </para>
+ <para>However, you still can run eviction policies with cache mode
+ set to either
+ <literal>REPL_SYNC</literal>
+ or
+ <literal>REPL_ASYNC</literal>
+ . Depending on your use case, you can
+ set multiple cache instances to have their own eviction policy
+ (which are applied locally) or just have selected instances with
+ eviction policies activated.
+ </para>
- <para>Also note that, with cache loader option, a locally evicted
- node can also be persisted to the backend store and a user can
- retrieve it from the store later on.
- </para>
- </answer>
- </qandaentry>
+ <para>Also note that, with cache loader option, a locally evicted
+ node can also be persisted to the backend store and a user can
+ retrieve it from the store later on.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does JBoss Cache support
- <literal>Region</literal>
- ?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does JBoss Cache support
+ <literal>Region</literal>
+ ?
+ </para>
+ </question>
- <answer>
- <para>Yes. JBoss Cache has the notion of region where a user can
- configure the eviction policy parameters (e.g.,
- <literal>maxNodes</literal>
- or
- <literal>timeToIdleSeconds</literal>
- )
- </para>
+ <answer>
+ <para>Yes. JBoss Cache has the notion of region where a user can
+ configure the eviction policy parameters (e.g.,
+ <literal>maxNodes</literal>
+ or
+ <literal>timeToIdleSeconds</literal>
+ )
+ </para>
- <para>A region in JBoss Cache denotes a portion of tree hierarchy,
- e.g., a fully qualified name (
- <literal>org.jboss.cache.Fqn</literal>
- ). For example,
- a user can define
- <literal>/org/jboss</literal>
- and
- <literal>/org/foocom</literal>
- as two separate regions. But note
- that you can configure the region programmatically now, i.e.,
- everything has to be configured through the xml file.
- </para>
- </answer>
- </qandaentry>
+ <para>A region in JBoss Cache denotes a portion of tree hierarchy,
+ e.g., a fully qualified name (
+ <literal>org.jboss.cache.Fqn</literal>
+ ). For example,
+ a user can define
+ <literal>/org/jboss</literal>
+ and
+ <literal>/org/foocom</literal>
+ as two separate regions. But note
+ that you can configure the region programmatically now, i.e.,
+ everything has to be configured through the xml file.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>What are the
- <literal>EvictionPolicyConfig</literal>
- tag
- parameters for
- <literal>org.jboss.cache.eviction.LRUPolicy</literal>
- ?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What are the
+ <literal>EvictionPolicyConfig</literal>
+ tag
+ parameters for
+ <literal>org.jboss.cache.eviction.LRUPolicy</literal>
+ ?
+ </para>
+ </question>
- <answer>
- <para>They are:</para>
+ <answer>
+ <para>They are:</para>
- <table>
- <title>Parameters</title>
+ <table>
+ <title>Parameters</title>
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>eventQueueSize</entry>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>eventQueueSize</entry>
- <entry>A fine-tuning parameter where you can configure the size of the eviction notification
- event queue. Defaults to 200,000.
- </entry>
- </row>
+ <entry>A fine-tuning parameter where you can configure the size of the eviction
+ notification
+ event queue. Defaults to 200,000.
+ </entry>
+ </row>
- <row>
- <entry>wakeUpIntervalInSeconds</entry>
+ <row>
+ <entry>wakeUpIntervalInSeconds</entry>
- <entry>Interval where the clean up thread wakes to process
- the sitting queue and sweep away the old data.
- </entry>
- </row>
+ <entry>Interval where the clean up thread wakes to process
+ the sitting queue and sweep away the old data.
+ </entry>
+ </row>
- <row>
- <entry>region</entry>
+ <row>
+ <entry>region</entry>
- <entry>A area where each eviction policy parameters are
- specified. Note that it needs a minimum of
- <literal>/_default</literal>
- region.
- </entry>
- </row>
+ <entry>A area where each eviction policy parameters are
+ specified. Note that it needs a minimum of
+ <literal>/_default</literal>
+ region.
+ </entry>
+ </row>
- <row>
- <entry>maxNodes</entry>
+ <row>
+ <entry>maxNodes</entry>
- <entry>Max number of nodes allowed in the eviction queue. 0
- means no limit.
- </entry>
- </row>
+ <entry>Max number of nodes allowed in the eviction queue. 0
+ means no limit.
+ </entry>
+ </row>
- <row>
- <entry>timeToLiveInSeconds</entry>
+ <row>
+ <entry>timeToLiveInSeconds</entry>
- <entry>Age (in seconds) for the node to be evicted in the
- queue. 0 denotes no limit.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </answer>
- </qandaentry>
+ <entry>Age (in seconds) for the node to be evicted in the
+ queue. 0 denotes no limit.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>I have turned on the eviction policy, why do I still get "out
- of memory" (OOM) exception?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>I have turned on the eviction policy, why do I still get "out
+ of memory" (OOM) exception?
+ </para>
+ </question>
- <answer>
- <para>OOM can happen when the speed of cache access exceeds the
- speed of eviction policy handling timer. Eviction policy handler
- will wake up every
- <literal>wakeUpIntervalInSeconds</literal>
- seconds to process the eviction event queue. So when the queue size is full, it will create a
- backlog and cause out-of-memory exceptions to happen unless the eviction timer catches
- up. To address this problem, in addition to increase the VM heap
- size, you can also reduce the
- <literal>wakeUpIntervaleInSeconds</literal>
- so the timer thread
- processes the queue more frequently.
- </para>
+ <answer>
+ <para>OOM can happen when the speed of cache access exceeds the
+ speed of eviction policy handling timer. Eviction policy handler
+ will wake up every
+ <literal>wakeUpIntervalInSeconds</literal>
+ seconds to process the eviction event queue. So when the queue size is full, it will create a
+ backlog and cause out-of-memory exceptions to happen unless the eviction timer catches
+ up. To address this problem, in addition to increase the VM heap
+ size, you can also reduce the
+ <literal>wakeUpIntervaleInSeconds</literal>
+ so the timer thread
+ processes the queue more frequently.
+ </para>
- <para>The eviction queue size is configurable.
- </para>
- </answer>
- </qandaentry>
- </qandaset>
- </chapter>
- <chapter id="cacheloaders">
- <title>Cache Loaders</title>
- <qandaset>
+ <para>The eviction queue size is configurable.
+ </para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+ </chapter>
+ <chapter id="cacheloaders">
+ <title>Cache Loaders</title>
+ <qandaset>
- <qandaentry>
- <question>
- <para>What is a cache loader?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>What is a cache loader?</para>
+ </question>
- <answer>
- <para>A cache loader is the connection of JBoss Cache to a
- (persistent) data store. The cache loader is called by JBoss Cache to
- fetch data from a store when that data is not in the cache, and when
- modifications are made to data in the cache the Cache Loader is
- called to store those modifications back to the store.
- </para>
+ <answer>
+ <para>A cache loader is the connection of JBoss Cache to a
+ (persistent) data store. The cache loader is called by JBoss Cache to
+ fetch data from a store when that data is not in the cache, and when
+ modifications are made to data in the cache the Cache Loader is
+ called to store those modifications back to the store.
+ </para>
- <para>In conjunction with eviction policies, JBoss Cache with a
- cache loader allows a user to maintain a bounded cache for a large
- backend datastore. Frequently used data is fetched from the
- datastore into the cache, and the least used data is evicted, in
- order to provide fast access to frequently accessed data. This is
- all configured through XML, and the programmer doesn't have to take
- care of loading and eviction.
- </para>
+ <para>In conjunction with eviction policies, JBoss Cache with a
+ cache loader allows a user to maintain a bounded cache for a large
+ backend datastore. Frequently used data is fetched from the
+ datastore into the cache, and the least used data is evicted, in
+ order to provide fast access to frequently accessed data. This is
+ all configured through XML, and the programmer doesn't have to take
+ care of loading and eviction.
+ </para>
- <para>JBoss Cache currently ships with several cache loader
- implementations, including:
- </para>
+ <para>JBoss Cache currently ships with several cache loader
+ implementations, including:
+ </para>
- <para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>org.jboss.cache.loader.FileCacheLoader</literal>
- : this implementation uses the file
- system to store and retrieve data. JBoss Cache nodes are mapped
- to directories, subnodes to subdirectories etc. Attributes of
- a node are mapped to a data file
- inside the
- directory.
- </para>
- </listitem>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>org.jboss.cache.loader.FileCacheLoader</literal>
+ : this implementation uses the file
+ system to store and retrieve data. JBoss Cache nodes are mapped
+ to directories, subnodes to subdirectories etc. Attributes of
+ a node are mapped to a data file
+ inside the
+ directory.
+ </para>
+ </listitem>
- <listitem>
- <para>
- <literal>org.jboss.cache.loader.BdbjeCacheLoader</literal>
- : this implementation is based on the
- Oracle's Berkeley DB Java Edition database, a fast and efficient
- transactional database. It uses a single file for the entire
- store. Note that if you use the Berkeley DB cache loader with
- JBoss Cache and wish to ship your product, you will have to acquire a
- <ulink url="http://www.sleepycat.com/jeforjbosscache">commercial license from Oracle
- </ulink>
- .
- </para>
- </listitem>
+ <listitem>
+ <para>
+ <literal>org.jboss.cache.loader.BdbjeCacheLoader</literal>
+ : this implementation is based on the
+ Oracle's Berkeley DB Java Edition database, a fast and efficient
+ transactional database. It uses a single file for the entire
+ store. Note that if you use the Berkeley DB cache loader with
+ JBoss Cache and wish to ship your product, you will have to acquire a
+ <ulink url="http://www.sleepycat.com/jeforjbosscache">commercial license from Oracle
+ </ulink>
+ .
+ </para>
+ </listitem>
- <listitem>
- <para>
- <literal>org.jboss.cache.loader.JDBCCacheLoader</literal>
- : this implementation uses the relational database as the persistent
- storage.
- </para>
- </listitem>
+ <listitem>
+ <para>
+ <literal>org.jboss.cache.loader.JDBCCacheLoader</literal>
+ : this implementation uses the relational database as the persistent
+ storage.
+ </para>
+ </listitem>
- <listitem>
- <para>And more. See the chapter on cache loaders in the User Guide for more details.</para>
- </listitem>
- </itemizedlist>
- </para>
- </answer>
- </qandaentry>
+ <listitem>
+ <para>And more. See the chapter on cache loaders in the User Guide for more details.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Is the FileCacheLoader recommended for production use?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Is the FileCacheLoader recommended for production use?</para>
+ </question>
- <answer>
- <para>
- No, it is not. The FileCacheLoader has some severe limitations which restrict it's use in a production
- environment, or if used in such an environment, it should be used with due care and sufficient
- understanding of these limitations.
- <itemizedlist>
- <listitem>Due to the way the FileCacheLoader represents a tree structure on disk (directories and
- files) traversal is inefficient for deep trees.
- </listitem>
- <listitem>Usage on shared filesystems like NFS, Windows shares, etc. should be avoided as these do
- not implement proper file locking and can cause data corruption.
- </listitem>
- <listitem>Usage with an isolation level of NONE can cause corrupt writes as multiple threads
- attempt to write to the same file.
- </listitem>
- <listitem>File systems are inherently not transactional, so when attempting to use your cache in a
- transactional context, failures when writing to the file (which happens during the commit phase)
- cannot be recovered.
- </listitem>
- </itemizedlist>
+ <answer>
+ <para>
+ No, it is not. The FileCacheLoader has some severe limitations which restrict it's use in a
+ production
+ environment, or if used in such an environment, it should be used with due care and sufficient
+ understanding of these limitations.
+ <itemizedlist>
+ <listitem>Due to the way the FileCacheLoader represents a tree structure on disk
+ (directories and
+ files) traversal is inefficient for deep trees.
+ </listitem>
+ <listitem>Usage on shared filesystems like NFS, Windows shares, etc. should be avoided as
+ these do
+ not implement proper file locking and can cause data corruption.
+ </listitem>
+ <listitem>Usage with an isolation level of NONE can cause corrupt writes as multiple threads
+ attempt to write to the same file.
+ </listitem>
+ <listitem>File systems are inherently not transactional, so when attempting to use your
+ cache in a
+ transactional context, failures when writing to the file (which happens during the
+ commit phase)
+ cannot be recovered.
+ </listitem>
+ </itemizedlist>
- As a rule of thumb, it is recommended that the FileCacheLoader not be used in a highly concurrent,
- transactional or stressful environment, and it's use is restricted to testing.
- </para>
- </answer>
- </qandaentry>
+ As a rule of thumb, it is recommended that the FileCacheLoader not be used in a highly
+ concurrent,
+ transactional or stressful environment, and it's use is restricted to testing.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can writing to cache loaders be asynchronous?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can writing to cache loaders be asynchronous?</para>
+ </question>
- <answer>
- <para>Yes. Set the
- <literal>async</literal>
- attrobute to true. See the JBoss Cache User Guide for a more
- detailed discussion. By default though, all cache loader writes are
- synchronous and will block.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. Set the
+ <literal>async</literal>
+ attrobute to true. See the JBoss Cache User Guide for a more
+ detailed discussion. By default though, all cache loader writes are
+ synchronous and will block.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I write my own cache loader ?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I write my own cache loader ?</para>
+ </question>
- <answer>
- <para>Yes. A cache loader is a class implementing
- <literal>org.jboss.cache.loader.CacheLoader</literal>
- or extending
- <literal>org.jboss.cache.loader.AbstractCacheLoader</literal>
- . It is
- configured via the XML file (see JBoss Cache User Guide).
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. A cache loader is a class implementing
+ <literal>org.jboss.cache.loader.CacheLoader</literal>
+ or extending
+ <literal>org.jboss.cache.loader.AbstractCacheLoader</literal>
+ . It is
+ configured via the XML file (see JBoss Cache User Guide).
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Does a cache loader have to use a persistent store ?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Does a cache loader have to use a persistent store ?</para>
+ </question>
- <answer>
- <para>No, a cache loader could for example fetch (and possibly store)
- its data from a webdav-capable webserver. Another example is a
- caching proxy server, which fetches contents from the web. Note that
- an implementation of CacheLoader may not implement the 'store'
- functionality in this case, but just the 'load'
- functionality.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>No, a cache loader could for example fetch (and possibly store)
+ its data from a webdav-capable webserver. Another example is a
+ caching proxy server, which fetches contents from the web. Note that
+ an implementation of CacheLoader may not implement the 'store'
+ functionality in this case, but just the 'load'
+ functionality.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Do I have to pay to use Oracle's Berkeley DB CacheLoader?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Do I have to pay to use Oracle's Berkeley DB CacheLoader?</para>
+ </question>
- <answer>
- <para>Not if you use it only for personal use. As soon as you
- distribute your product with BdbjeCacheLoader, you have to purchase
- a commercial license from Oracle. See details at
- <ulink
- url="http://www.sleepycat.com/jeforjbosscache">http://www.sleepycat.com/jeforjbosscache
- </ulink>
- .
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Not if you use it only for personal use. As soon as you
+ distribute your product with BdbjeCacheLoader, you have to purchase
+ a commercial license from Oracle. See details at
+ <ulink
+ url="http://www.sleepycat.com/jeforjbosscache">http://www.sleepycat.com/jeforjbosscache
+ </ulink>
+ .
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Are there any tools available to monitor the Berkeley DB instance?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Are there any tools available to monitor the Berkeley DB instance?</para>
+ </question>
- <answer>
- <para>
- Yes. Oracle ships a JMX-based monitoring tool, called
- <ulink
- url="http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sl...">
- JEMonitor
- </ulink>
- which can be downloaded from the Oracle website.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ Yes. Oracle ships a JMX-based monitoring tool, called
+ <ulink
+ url="http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sl...">
+ JEMonitor
+ </ulink>
+ which can be downloaded from the Oracle website.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>When tuning my Berkeley DB instance, where should I put my je.properties file?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>When tuning my Berkeley DB instance, where should I put my je.properties file?</para>
+ </question>
- <answer>
- <para>
- <literal>je.properties</literal>
- should reside in your Berkeley DB home directory. This is the directory you pass
- in to the BDBJECacheLoader's
- <literal>location</literal>
- configuration property.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ <literal>je.properties</literal>
+ should reside in your Berkeley DB home directory. This is the directory you pass
+ in to the BDBJECacheLoader's
+ <literal>location</literal>
+ configuration property.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I use more than one cache loader?</para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I use more than one cache loader?</para>
+ </question>
- <answer>
- <para>Yes. Within the CacheLoaderConfiguration XML
- element (see user guide chapter on cache loaders) you can
- describe several cache loaders. The impact is that the cache will
- look at all of the cache loaders in the order they've been
- configured, until it finds a valid, non-null element of data. When
- performing writes, all cache loaders are written to (except if the
- ignoreModifications element has been set to true for a specific
- cache loader.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. Within the CacheLoaderConfiguration XML
+ element (see user guide chapter on cache loaders) you can
+ describe several cache loaders. The impact is that the cache will
+ look at all of the cache loaders in the order they've been
+ configured, until it finds a valid, non-null element of data. When
+ performing writes, all cache loaders are written to (except if the
+ ignoreModifications element has been set to true for a specific
+ cache loader.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>Can I migrate a JDBCacheLoader or FileCacheLoader based cache store containing data formatted with
- JBoss Cache 1.x.x to JBoss Cache 2.0 format?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>Can I migrate a JDBCacheLoader or FileCacheLoader based cache store containing data formatted
+ with
+ JBoss Cache 1.x.x to JBoss Cache 2.0 format?
+ </para>
+ </question>
- <answer>
- <para>Yes. See "Transforming Cache Loaders" section within the "Cache Loaders" section located in the
- JBoss Cache users guide.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>Yes. See "Transforming Cache Loaders" section within the "Cache Loaders" section located in
+ the
+ JBoss Cache users guide.
+ </para>
+ </answer>
+ </qandaentry>
- <qandaentry>
- <question>
- <para>
- Is the TCPDelegatingCacheLoader resilient to TCPCacheServer restarts?
- </para>
- </question>
+ <qandaentry>
+ <question>
+ <para>
+ Is the TCPDelegatingCacheLoader resilient to TCPCacheServer restarts?
+ </para>
+ </question>
- <answer>
- <para>
- As of JBoss Cache 2.1.0, the answer is yes. See the User Guide for details on how to configure and
- tune
- your retries and wait period for reestablishing the TCP connection.
- </para>
- <para>
- Prior to that, restarting the TCPCacheServer would also mean
- restarting your application that uses the cache.
- </para>
- </answer>
- </qandaentry>
+ <answer>
+ <para>
+ As of JBoss Cache 2.1.0, the answer is yes. See the User Guide for details on how to configure
+ and
+ tune
+ your retries and wait period for reestablishing the TCP connection.
+ </para>
+ <para>
+ Prior to that, restarting the TCPCacheServer would also mean
+ restarting your application that uses the cache.
+ </para>
+ </answer>
+ </qandaentry>
- </qandaset>
- </chapter>
- <chapter id="troubleshooting">
- <title>Troubleshooting</title>
- <qandaset>
+ </qandaset>
+ </chapter>
+ <chapter id="troubleshooting">
+ <title>Troubleshooting</title>
+ <qandaset>
- <qandaentry>
- <question>
- <para>I am having problems getting JBoss Cache to work, where can I get information on troubleshooting?
- </para>
- </question>
- <answer>
- <para>Troubleshooting section can be found in the following
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheTroubleshooting">wiki link</ulink>
- .
- </para>
- </answer>
- </qandaentry>
- </qandaset>
- </chapter>
+ <qandaentry>
+ <question>
+ <para>I am having problems getting JBoss Cache to work, where can I get information on
+ troubleshooting?
+ </para>
+ </question>
+ <answer>
+ <para>Troubleshooting section can be found in the following
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheTroubleshooting">wiki link
+ </ulink>
+ .
+ </para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+ </chapter>
</book>
Modified: core/branches/flat/src/main/docbook/userguide/en/modules/configuration.xml
===================================================================
--- core/branches/flat/src/main/docbook/userguide/en/modules/configuration.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/docbook/userguide/en/modules/configuration.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,70 +1,70 @@
<chapter id="configuration">
- <title>Configuration</title>
+ <title>Configuration</title>
- <section>
- <title>Configuration Overview</title>
+ <section>
+ <title>Configuration Overview</title>
- <para>
- The
- <literal>org.jboss.cache.config.Configuration</literal>
- class
- (along with its
- <link linkend="configuration.elements">component parts</link>
- )
- is a Java Bean that encapsulates the configuration of the
- <literal>Cache</literal>
- and all of its architectural elements
- (cache loaders, evictions policies, etc.)
- </para>
+ <para>
+ The
+ <literal>org.jboss.cache.config.Configuration</literal>
+ class
+ (along with its
+ <link linkend="configuration.elements">component parts</link>
+ )
+ is a Java Bean that encapsulates the configuration of the
+ <literal>Cache</literal>
+ and all of its architectural elements
+ (cache loaders, evictions policies, etc.)
+ </para>
- <para>
- The
- <literal>Configuration</literal>
- exposes numerous properties which
- are summarized in the
- <link linkend="configuration_reference">configuration reference</link>
- section of this book and many of which are discussed in later
- chapters. Any time you see a configuration option
- discussed in this book, you can assume that the
- <literal>Configuration</literal>
- class or one of its component parts exposes a simple property setter/getter for that configuration option.
- </para>
+ <para>
+ The
+ <literal>Configuration</literal>
+ exposes numerous properties which
+ are summarized in the
+ <link linkend="configuration_reference">configuration reference</link>
+ section of this book and many of which are discussed in later
+ chapters. Any time you see a configuration option
+ discussed in this book, you can assume that the
+ <literal>Configuration</literal>
+ class or one of its component parts exposes a simple property setter/getter for that configuration option.
+ </para>
- </section>
+ </section>
- <section id="configuration.creation">
- <title>Creating a
- <literal>Configuration</literal>
- </title>
+ <section id="configuration.creation">
+ <title>Creating a
+ <literal>Configuration</literal>
+ </title>
- <para>
- As discussed in the
- <link linkend="api.create_start">User API section</link>
- ,
- before a
- <literal>Cache</literal>
- can be created, the
- <literal>CacheFactory</literal>
- must be provided with a
- <literal>Configuration</literal>
- object or with a file name or
- input stream to use to parse a
- <literal>Configuration</literal>
- from XML. The following sections describe how to accomplish this.
- </para>
+ <para>
+ As discussed in the
+ <link linkend="api.create_start">User API section</link>
+ ,
+ before a
+ <literal>Cache</literal>
+ can be created, the
+ <literal>CacheFactory</literal>
+ must be provided with a
+ <literal>Configuration</literal>
+ object or with a file name or
+ input stream to use to parse a
+ <literal>Configuration</literal>
+ from XML. The following sections describe how to accomplish this.
+ </para>
- <section>
- <title>Parsing an XML-based Configuration File</title>
- <para>
- The most convenient way to configure JBoss Cache is via an XML file. The JBoss Cache distribution ships
- with a number of configuration files for common use cases. It is recommended that these files be used as
- a starting point, and tweaked to meet specific needs.
- </para>
+ <section>
+ <title>Parsing an XML-based Configuration File</title>
+ <para>
+ The most convenient way to configure JBoss Cache is via an XML file. The JBoss Cache distribution ships
+ with a number of configuration files for common use cases. It is recommended that these files be used as
+ a starting point, and tweaked to meet specific needs.
+ </para>
- <para>
- Here is a simple example configuration file:
- </para>
- <programlisting role="XML"><![CDATA[
+ <para>
+ Here is a simple example configuration file:
+ </para>
+ <programlisting role="XML"><![CDATA[<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
@@ -74,12 +74,12 @@
<!-- ===================================================================== -->
<server>
-
+
<mbean code="org.jboss.cache.jmx.CacheJmxWrapper" name="jboss.cache:service=Cache">
-
+
<!-- Configure the TransactionManager -->
<attribute name="TransactionManagerLookupClass">
- org.jboss.cache.transaction.GenericTransactionManagerLookup
+ org.jboss.starobrno.transaction.GenericTransactionManagerLookup
</attribute>
<!-- Node locking level : SERIALIZABLE
@@ -118,72 +118,73 @@
</attribute>
</mbean>
</server>
-]]></programlisting>
+]]>]]>
+ </programlisting>
- <para>
- Another, more complete, sample XML file is included in the
- <link linkend="sample_xml_file">configuration reference</link>
- section of this book,
- along with
- <link linkend="configuration_reference">a handy look-up table</link>
- explaining the various options.
- </para>
+ <para>
+ Another, more complete, sample XML file is included in the
+ <link linkend="sample_xml_file">configuration reference</link>
+ section of this book,
+ along with
+ <link linkend="configuration_reference">a handy look-up table</link>
+ explaining the various options.
+ </para>
- <para>
- For historical reasons, the format of the JBoss Cache configuraton
- file follows that of a JBoss AS Service Archive (SAR) deployment
- descriptor (and still can be used as such
- <link linkend="deployment.microkernel">inside JBoss AS</link>
- ). Because
- of this dual usage, you may see elements in some configuration files
- (such as
- <literal>depends</literal>
- or
- <literal>classpath</literal>
- ) that are
- not relevant outside JBoss AS. These can safely be ignored.
- </para>
+ <para>
+ For historical reasons, the format of the JBoss Cache configuraton
+ file follows that of a JBoss AS Service Archive (SAR) deployment
+ descriptor (and still can be used as such
+ <link linkend="deployment.microkernel">inside JBoss AS</link>
+ ). Because
+ of this dual usage, you may see elements in some configuration files
+ (such as
+ <literal>depends</literal>
+ or
+ <literal>classpath</literal>
+ ) that are
+ not relevant outside JBoss AS. These can safely be ignored.
+ </para>
- <para>
- Here's how you tell the
- <literal>CacheFactory</literal>
- to create
- and start a cache by finding and parsing a configuration file on the
- classpath:
- </para>
+ <para>
+ Here's how you tell the
+ <literal>CacheFactory</literal>
+ to create
+ and start a cache by finding and parsing a configuration file on the
+ classpath:
+ </para>
- <programlisting role="JAVA"><![CDATA[
+ <programlisting role="JAVA"><![CDATA[
CacheFactory factory = new DefaultCacheFactory();
Cache cache = factory.createCache("cache-configuration.xml");
]]></programlisting>
- </section>
+ </section>
- <section>
- <title>Programmatic Configuration</title>
- <para>
- In addition to the XML-based configuration above, the
- <literal>Configuration</literal>
- can be built up programatically,
- using the simple property mutators exposed by
- <literal>Configuration</literal>
- and its components. When constructed,
- the
- <literal>Configuration</literal>
- object is preset with JBoss Cache
- defaults and can even be used as-is for a quick start.
- </para>
+ <section>
+ <title>Programmatic Configuration</title>
+ <para>
+ In addition to the XML-based configuration above, the
+ <literal>Configuration</literal>
+ can be built up programatically,
+ using the simple property mutators exposed by
+ <literal>Configuration</literal>
+ and its components. When constructed,
+ the
+ <literal>Configuration</literal>
+ object is preset with JBoss Cache
+ defaults and can even be used as-is for a quick start.
+ </para>
- <para>
- Following is an example of programatically creating a
- <literal>Configuration</literal>
- configured to match the one produced
- by the XML example above, and then using it to create a
- <literal>Cache</literal>
- :
- </para>
+ <para>
+ Following is an example of programatically creating a
+ <literal>Configuration</literal>
+ configured to match the one produced
+ by the XML example above, and then using it to create a
+ <literal>Cache</literal>
+ :
+ </para>
- <programlisting role="JAVA"><![CDATA[
+ <programlisting role="JAVA"><![CDATA[
Configuration config = new Configuration();
String tmlc = GenericTransactionManagerLookup.class.getName();
config.setTransactionManagerLookupClass(tmlc);
@@ -215,226 +216,226 @@
Cache cache = factory.createCache(config);
]]></programlisting>
- <para>
- Even the above fairly simple configuration is pretty tedious programming;
- hence the preferred use of XML-based configuration. However, if your
- application requires it, there is no reason not to use XML-based
- configuration for most of the attributes, and then access the
- <literal>Configuration</literal>
- object to programatically change
- a few items from the defaults, add an eviction region, etc.
- </para>
+ <para>
+ Even the above fairly simple configuration is pretty tedious programming;
+ hence the preferred use of XML-based configuration. However, if your
+ application requires it, there is no reason not to use XML-based
+ configuration for most of the attributes, and then access the
+ <literal>Configuration</literal>
+ object to programatically change
+ a few items from the defaults, add an eviction region, etc.
+ </para>
- <para>
- Note that configuration values may not be changed programmatically when a cache is running,
- except those annotated as
- <literal>@Dynamic</literal>
- . Dynamic properties are also marked as such in the
- <link linkend="configuration_reference">configuration reference</link>
- table. Attempting to change a non-dynamic
- property will result in a
- <literal>ConfigurationException</literal>
- .
- </para>
- </section>
+ <para>
+ Note that configuration values may not be changed programmatically when a cache is running,
+ except those annotated as
+ <literal>@Dynamic</literal>
+ . Dynamic properties are also marked as such in the
+ <link linkend="configuration_reference">configuration reference</link>
+ table. Attempting to change a non-dynamic
+ property will result in a
+ <literal>ConfigurationException</literal>
+ .
+ </para>
+ </section>
- <section>
- <title>Using an IOC Framework</title>
+ <section>
+ <title>Using an IOC Framework</title>
- <para>
- The
+ <para>
+ The
+ <literal>Configuration</literal>
+ class and its
+ <link linkend="configuration.elements">component parts</link>
+ are all Java Beans that expose all config elements via simple setters
+ and getters. Therefore, any good IOC framework should be able to
+ build up a
+ <literal>Configuration</literal>
+ from an XML file in
+ the framework's own format. See the
+ <link linkend="deployment.microcontainer">deployment via the JBoss micrcontainer</link>
+ section for an example of this.
+ </para>
+ </section>
+ </section>
+
+ <section id="configuration.elements">
+ <title>Composition of a
<literal>Configuration</literal>
- class and its
- <link linkend="configuration.elements">component parts</link>
- are all Java Beans that expose all config elements via simple setters
- and getters. Therefore, any good IOC framework should be able to
- build up a
+ Object
+ </title>
+
+ <para>
+ A
<literal>Configuration</literal>
- from an XML file in
- the framework's own format. See the
- <link linkend="deployment.microcontainer">deployment via the JBoss micrcontainer</link>
- section for an example of this.
- </para>
- </section>
- </section>
+ is composed of a number of
+ subobjects:
- <section id="configuration.elements">
- <title>Composition of a
- <literal>Configuration</literal>
- Object
- </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Configuration.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
- <para>
- A
- <literal>Configuration</literal>
- is composed of a number of
- subobjects:
+ <para>
+ Following is a brief overview of the components of a
+ <literal>Configuration</literal>
+ . See the javadoc and the linked
+ chapters in this book for a more complete explanation of the
+ configurations associated with each component.
- <mediaobject>
- <imageobject>
- <imagedata fileref="Configuration.png"/>
- </imageobject>
- </mediaobject>
- </para>
+ <itemizedlist>
+ <listitem>
+ <literal>Configuration</literal>
+ : top level object
+ in the hierarchy; exposes the configuration properties listed in the
+ <link linkend="configuration_reference">configuration reference</link>
+ section of this book.
+ </listitem>
- <para>
- Following is a brief overview of the components of a
- <literal>Configuration</literal>
- . See the javadoc and the linked
- chapters in this book for a more complete explanation of the
- configurations associated with each component.
+ <listitem>
+ <literal>BuddyReplicationConfig</literal>
+ : only relevant if
+ <link linkend="br">buddy replication</link>
+ is used. General
+ buddy replication configuration options. Must include a:
+ </listitem>
- <itemizedlist>
- <listitem>
- <literal>Configuration</literal>
- : top level object
- in the hierarchy; exposes the configuration properties listed in the
- <link linkend="configuration_reference">configuration reference</link>
- section of this book.
- </listitem>
+ <listitem>
+ <literal>BuddyLocatorConfig</literal>
+ : implementation-specific
+ configuration object for the
+ <literal>BuddyLocator</literal>
+ implementation
+ being used. What configuration elements are exposed depends on
+ the needs of the
+ <literal>BuddyLocator</literal>
+ implementation.
+ </listitem>
- <listitem>
- <literal>BuddyReplicationConfig</literal>
- : only relevant if
- <link linkend="br">buddy replication</link>
- is used. General
- buddy replication configuration options. Must include a:
- </listitem>
+ <listitem>
+ <literal>EvictionConfig</literal>
+ : only relevant if
+ <link linkend="eviction_policies">eviction</link>
+ is used. General
+ eviction configuration options. Must include at least one:
+ </listitem>
- <listitem>
- <literal>BuddyLocatorConfig</literal>
- : implementation-specific
- configuration object for the
- <literal>BuddyLocator</literal>
- implementation
- being used. What configuration elements are exposed depends on
- the needs of the
- <literal>BuddyLocator</literal>
- implementation.
- </listitem>
+ <listitem>
+ <literal>EvictionRegionConfig</literal>
+ : one for each
+ eviction region; names the region, etc. Must include a:
+ </listitem>
- <listitem>
- <literal>EvictionConfig</literal>
- : only relevant if
- <link linkend="eviction_policies">eviction</link>
- is used. General
- eviction configuration options. Must include at least one:
- </listitem>
+ <listitem>
+ <literal>EvictionPolicyConfig</literal>
+ : implementation-specific
+ configuration object for the
+ <literal>EvictionPolicy</literal>
+ implementation
+ being used. What configuration elements are exposed depends on
+ the needs of the
+ <literal>EvictionPolicy</literal>
+ implementation.
+ </listitem>
- <listitem>
- <literal>EvictionRegionConfig</literal>
- : one for each
- eviction region; names the region, etc. Must include a:
- </listitem>
+ <listitem>
+ <literal>CacheLoaderConfig</literal>
+ : only relevant if a
+ <link linkend="cache_loaders">cache loader</link>
+ is used. General
+ cache loader configuration options. Must include at least one:
+ </listitem>
- <listitem>
- <literal>EvictionPolicyConfig</literal>
- : implementation-specific
- configuration object for the
- <literal>EvictionPolicy</literal>
- implementation
- being used. What configuration elements are exposed depends on
- the needs of the
- <literal>EvictionPolicy</literal>
- implementation.
- </listitem>
+ <listitem>
+ <literal>IndividualCacheLoaderConfig</literal>
+ : implementation-specific
+ configuration object for the
+ <literal>CacheLoader</literal>
+ implementation
+ being used. What configuration elements are exposed depends on
+ the needs of the
+ <literal>CacheLoader</literal>
+ implementation.
+ </listitem>
- <listitem>
- <literal>CacheLoaderConfig</literal>
- : only relevant if a
- <link linkend="cache_loaders">cache loader</link>
- is used. General
- cache loader configuration options. Must include at least one:
- </listitem>
+ <listitem>
+ <literal>RuntimeConfig</literal>
+ : exposes to cache clients
+ certain information about the cache's runtime environment (e.g. membership
+ in buddy replication groups if
+ <link linkend="br">buddy replication</link>
+ is used.) Also allows
+ direct injection into the cache of needed external services like a
+ JTA
+ <literal>TransactionManager</literal>
+ or a JGroups
+ <literal>ChannelFactory</literal>
+ .
+ </listitem>
+ </itemizedlist>
+ </para>
+ </section>
- <listitem>
- <literal>IndividualCacheLoaderConfig</literal>
- : implementation-specific
- configuration object for the
- <literal>CacheLoader</literal>
- implementation
- being used. What configuration elements are exposed depends on
- the needs of the
- <literal>CacheLoader</literal>
- implementation.
- </listitem>
-
- <listitem>
- <literal>RuntimeConfig</literal>
- : exposes to cache clients
- certain information about the cache's runtime environment (e.g. membership
- in buddy replication groups if
- <link linkend="br">buddy replication</link>
- is used.) Also allows
- direct injection into the cache of needed external services like a
- JTA
- <literal>TransactionManager</literal>
- or a JGroups
- <literal>ChannelFactory</literal>
- .
- </listitem>
- </itemizedlist>
- </para>
- </section>
-
- <section>
- <title>Dynamic Reconfiguration</title>
- <para>
- Dynamically changing the configuration of
- <emphasis>some</emphasis>
- options while the cache is running is supported,
- by programmatically obtaining the
- <literal>Configuration</literal>
- object from the running cache and changing values. E.g.,
- </para>
- <programlisting role="JAVA"><![CDATA[
+ <section>
+ <title>Dynamic Reconfiguration</title>
+ <para>
+ Dynamically changing the configuration of
+ <emphasis>some</emphasis>
+ options while the cache is running is supported,
+ by programmatically obtaining the
+ <literal>Configuration</literal>
+ object from the running cache and changing values. E.g.,
+ </para>
+ <programlisting role="JAVA"><![CDATA[
Configuration liveConfig = cache.getConfiguration();
liveConfig.setLockAcquisitionTimeout(2000);
]]></programlisting>
- <para>
- A complete listing of which options may be changed dynamically is in the
- <link linkend="configuration_reference">configuration reference</link>
- section. An
- <literal>org.jboss.cache.config.ConfigurationException</literal>
- will be thrown if you attempt to change a
- setting that is not dynamic.
- </para>
- </section>
+ <para>
+ A complete listing of which options may be changed dynamically is in the
+ <link linkend="configuration_reference">configuration reference</link>
+ section. An
+ <literal>org.jboss.cache.config.ConfigurationException</literal>
+ will be thrown if you attempt to change a
+ setting that is not dynamic.
+ </para>
+ </section>
- <section id="configuration.options">
- <title>Overriding the Configuration Via the Option API</title>
- <para>
- The Option API allows you to override certain behaviours of the cache on a per invocation basis.
- This involves creating an instance of
- <literal>org.jboss.cache.config.Option</literal>
- , setting the options
- you wish to override on the
- <literal>Option</literal>
- object and passing it in the
- <literal>InvocationContext</literal>
- before invoking your method on the cache.
- </para>
- <para>
- E.g., to override the default node versioning used with optimistic locking:
- </para>
- <programlisting role="JAVA"><![CDATA[
+ <section id="configuration.options">
+ <title>Overriding the Configuration Via the Option API</title>
+ <para>
+ The Option API allows you to override certain behaviours of the cache on a per invocation basis.
+ This involves creating an instance of
+ <literal>org.jboss.cache.config.Option</literal>
+ , setting the options
+ you wish to override on the
+ <literal>Option</literal>
+ object and passing it in the
+ <literal>InvocationContext</literal>
+ before invoking your method on the cache.
+ </para>
+ <para>
+ E.g., to override the default node versioning used with optimistic locking:
+ </para>
+ <programlisting role="JAVA"><![CDATA[
DataVersion v = new MyCustomDataVersion();
cache.getInvocationContext().getOptionOverrides().setDataVersion(v);
Node ch = cache.getRoot().addChild(Fqn.fromString("/a/b/c"));
]]></programlisting>
- <para>
- E.g., to suppress replication of a put call in a REPL_SYNC cache:
- </para>
- <programlisting role="JAVA"><![CDATA[
+ <para>
+ E.g., to suppress replication of a put call in a REPL_SYNC cache:
+ </para>
+ <programlisting role="JAVA"><![CDATA[
Node node = cache.getChild(Fqn.fromString("/a/b/c"));
cache.getInvocationContext().getOptionOverrides().setLocalOnly(true);
node.put("localCounter", new Integer(2));
]]></programlisting>
- <para>
- See the javadocs on the
- <literal>Option</literal>
- class for details on the options available.
- </para>
- </section>
+ <para>
+ See the javadocs on the
+ <literal>Option</literal>
+ class for details on the options available.
+ </para>
+ </section>
</chapter>
Modified: core/branches/flat/src/main/docbook/userguide/en/modules/configuration_reference.xml
===================================================================
--- core/branches/flat/src/main/docbook/userguide/en/modules/configuration_reference.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/docbook/userguide/en/modules/configuration_reference.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,13 +1,14 @@
<chapter id="configuration_reference_chapter">
- <title>Configuration References</title>
- <section id="sample_xml_file">
- <title>Sample XML Configuration File</title>
- <para>
- This is what a typical XML configuration file looks like. It is recommended that you use one of the
- configurations
- shipped with the JBoss Cache distribution and tweak according to your needs rather than write one from scratch.
- </para>
- <programlisting role="XML"><![CDATA[
+ <title>Configuration References</title>
+ <section id="sample_xml_file">
+ <title>Sample XML Configuration File</title>
+ <para>
+ This is what a typical XML configuration file looks like. It is recommended that you use one of the
+ configurations
+ shipped with the JBoss Cache distribution and tweak according to your needs rather than write one from
+ scratch.
+ </para>
+ <programlisting role="XML"><![CDATA[<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
@@ -17,14 +18,14 @@
<!-- ===================================================================== -->
<server>
-
+
<!-- ==================================================================== -->
<!-- Defines JBoss Cache configuration -->
<!-- ==================================================================== -->
<!-- Note the value of the 'code' attribute has changed since JBC 1.x -->
<mbean code="org.jboss.cache.jmx.CacheJmxWrapper" name="jboss.cache:service=Cache">
-
+
<!-- Ensure JNDI and the TransactionManager are started before the
cache. Only works inside JBoss AS; ignored otherwise -->
<depends>jboss:service=Naming</depends>
@@ -32,7 +33,7 @@
<!-- Configure the TransactionManager -->
<attribute name="TransactionManagerLookupClass">
- org.jboss.cache.transaction.GenericTransactionManagerLookup
+ org.jboss.starobrno.transaction.GenericTransactionManagerLookup
</attribute>
<!-- Node locking level : SERIALIZABLE
@@ -53,7 +54,7 @@
<attribute name="CacheMode">REPL_ASYNC</attribute>
<!-- Name of cluster. Needs to be the same for all JBoss Cache nodes in a
- cluster in order to find each other.
+ cluster in order to find each other.
-->
<attribute name="ClusterName">JBossCache-Cluster</attribute>
@@ -61,10 +62,10 @@
This configuration is dependent on the JGroups multiplexer being
registered in an MBean server such as JBossAS. This type of
dependency injection only works in the AS; outside it's up to
- your code to inject a ChannelFactory if you want to use one.
+ your code to inject a ChannelFactory if you want to use one.
-->
<!--
- <depends optional-attribute-name="MultiplexerService"
+ <depends optional-attribute-name="MultiplexerService"
proxy-type="attribute">jgroups.mux:name=Multiplexer</depends>
<attribute name="MultiplexerStack">tcp</attribute>
-->
@@ -74,7 +75,7 @@
-->
<attribute name="ClusterConfig">
<config>
- <!-- UDP: if you have a multihomed machine, set the bind_addr
+ <!-- UDP: if you have a multihomed machine, set the bind_addr
attribute to the appropriate NIC IP address -->
<!-- UDP: On Windows machines, because of the media sense feature
being broken with multicast (even after disabling media sense)
@@ -98,7 +99,7 @@
<pbcast.STATE_TRANSFER/>
</config>
</attribute>
-
+
<!--
The max amount of time (in milliseconds) we wait until the
initial state (ie. the contents of the cache) are retrieved from
@@ -120,7 +121,7 @@
<attribute name="ShutdownHookBehavior">DEFAULT</attribute>
<!-- Enables or disables lazy unmarshalling. If omitted, the default is that lazy unmarshalling is enabled. -->
- <attribute name="UseLazyDeserialization">true</attribute>
+ <attribute name="UseLazyDeserialization">true</attribute>
<!-- Specific eviction policy configurations. This is LRU -->
<attribute name="EvictionConfig">
@@ -156,586 +157,600 @@
</attribute>
</mbean>
</server>
-]]></programlisting>
- </section>
+]]>]]>
+ </programlisting>
+ </section>
- <section id="configuration_reference">
- <title>
- Reference table of XML attributes
- </title>
- <para>A list of definitions of each of the XML attributes used above. If the
- description of an attribute states that it is
- <emphasis>dynamic</emphasis>
- ,
- that means it can be changed after the cache is created and started.
- </para>
+ <section id="configuration_reference">
+ <title>
+ Reference table of XML attributes
+ </title>
+ <para>A list of definitions of each of the XML attributes used above. If the
+ description of an attribute states that it is
+ <emphasis>dynamic</emphasis>
+ ,
+ that means it can be changed after the cache is created and started.
+ </para>
- <informaltable frame="all">
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>
- <para>Name</para>
- </entry>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>
+ <para>Name</para>
+ </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>BuddyReplicationConfig</para>
- </entry>
+ <entry>
+ <para>Description</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>BuddyReplicationConfig</para>
+ </entry>
- <entry>
- <para>An XML element that contains detailed buddy replication
- configuration. See
- <link linkend="br">section on Buddy Replication</link>
- for details.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>An XML element that contains detailed buddy replication
+ configuration. See
+ <link linkend="br">section on Buddy Replication</link>
+ for details.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>CacheLoaderConfig</para>
- </entry>
+ <row>
+ <entry>
+ <para>CacheLoaderConfig</para>
+ </entry>
- <entry>
- <para>An XML element that contains detailed cache loader
- configuration. See
- <link linkend="cache_loaders">chapter on Cache Loaders</link>
- for details.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>An XML element that contains detailed cache loader
+ configuration. See
+ <link linkend="cache_loaders">chapter on Cache Loaders</link>
+ for details.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>CacheLoaderConfiguration</para>
- </entry>
+ <row>
+ <entry>
+ <para>CacheLoaderConfiguration</para>
+ </entry>
- <entry>
- <para>
- <emphasis>Deprecated</emphasis>
- . Use
- <literal>CacheLoaderConfig</literal>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>
+ <emphasis>Deprecated</emphasis>
+ . Use
+ <literal>CacheLoaderConfig</literal>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>CacheMode</para>
- </entry>
+ <row>
+ <entry>
+ <para>CacheMode</para>
+ </entry>
- <entry>
- <para>LOCAL, REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC or
- INVALIDATION_ASYNC. Defaults to LOCAL. See the
- <link linkend="clustering">chapter on Clustering</link>
- for details.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>LOCAL, REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC or
+ INVALIDATION_ASYNC. Defaults to LOCAL. See the
+ <link linkend="clustering">chapter on Clustering</link>
+ for details.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ClusterConfig</para>
- </entry>
+ <row>
+ <entry>
+ <para>ClusterConfig</para>
+ </entry>
- <entry>
- <para>The configuration of the underlying JGroups stack.
- Ignored if
- <literal>MultiplexerService</literal>
- and
- <literal>MultiplexerStack</literal>
- are used.
- See the various *-service.xml files in the source distribution
- <literal>etc/config-samples</literal>
- folder for examples.
- See the
- <ulink url="http://www.jgroups.org">JGroups documentation</ulink>
- or the
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JGroups">JGroups wiki page</ulink>
- for more information.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>The configuration of the underlying JGroups stack.
+ Ignored if
+ <literal>MultiplexerService</literal>
+ and
+ <literal>MultiplexerStack</literal>
+ are used.
+ See the various *-service.xml files in the source distribution
+ <literal>etc/config-samples</literal>
+ folder for examples.
+ See the
+ <ulink url="http://www.jgroups.org">JGroups documentation</ulink>
+ or the
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JGroups">JGroups wiki page</ulink>
+ for more information.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ClusterName</para>
- </entry>
+ <row>
+ <entry>
+ <para>ClusterName</para>
+ </entry>
- <entry>
- <para>Name of cluster. Needs to be the same for all nodes in a
- cluster in order for them to communicate with each other.
- </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>EvictionPolicyConfig</para>
- </entry>
+ <entry>
+ <para>Name of cluster. Needs to be the same for all nodes in a
+ cluster in order for them to communicate with each other.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>EvictionPolicyConfig</para>
+ </entry>
- <entry>
- <para>Configuration parameter for the specified eviction policy.
- See
- <link linkend="eviction_policies">chapter on eviction policies</link>
- for details. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Configuration parameter for the specified eviction policy.
+ See
+ <link linkend="eviction_policies">chapter on eviction policies</link>
+ for details. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ExposeManagementStatistics</para>
- </entry>
+ <row>
+ <entry>
+ <para>ExposeManagementStatistics</para>
+ </entry>
- <entry>
- <para>
- Specifies whether interceptors that provide statistics should have statistics
- gathering enabled at startup. Also controls whether a
- <literal>CacheMgmtInterceptor</literal>
- (whose sole purpose is gathering
- statistics) should be added to the interceptor chain. Default value is
- <emphasis>true</emphasis>
- . See the
- <link linkend="jmx.statistics">JBoss Cache Statistics section</link>
- section for more details.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>
+ Specifies whether interceptors that provide statistics should have statistics
+ gathering enabled at startup. Also controls whether a
+ <literal>CacheMgmtInterceptor</literal>
+ (whose sole purpose is gathering
+ statistics) should be added to the interceptor chain. Default value is
+ <emphasis>true</emphasis>
+ . See the
+ <link linkend="jmx.statistics">JBoss Cache Statistics section</link>
+ section for more details.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>FetchInMemoryState
- </para>
- </entry>
+ <row>
+ <entry>
+ <para>FetchInMemoryState
+ </para>
+ </entry>
- <entry>
- <para>Whether or not to acquire the initial in-memory state from
- existing members. Allows for hot caches when enabled. Also
- see the
- <literal>fetchPersistentState</literal>
- element in
- <literal>CacheLoaderConfig</literal>
- . Defaults to
- <literal>true</literal>
- . This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Whether or not to acquire the initial in-memory state from
+ existing members. Allows for hot caches when enabled. Also
+ see the
+ <literal>fetchPersistentState</literal>
+ element in
+ <literal>CacheLoaderConfig</literal>
+ . Defaults to
+ <literal>true</literal>
+ . This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>InactiveOnStartup</para>
- </entry>
+ <row>
+ <entry>
+ <para>InactiveOnStartup</para>
+ </entry>
- <entry>
- <para>Whether or not the entire tree is inactive upon startup,
- only responding to replication messages after
- <literal>activateRegion()</literal>
- is called to activate one or
- more parts of the tree. If true, property
- <literal>FetchInMemoryState</literal>
- is ignored. This property
- should only be set to true if
- <literal>UseRegionBasedMarshalling</literal>
- is also
- <literal>true</literal>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Whether or not the entire tree is inactive upon startup,
+ only responding to replication messages after
+ <literal>activateRegion()</literal>
+ is called to activate one or
+ more parts of the tree. If true, property
+ <literal>FetchInMemoryState</literal>
+ is ignored. This property
+ should only be set to true if
+ <literal>UseRegionBasedMarshalling</literal>
+ is also
+ <literal>true</literal>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>StateRetrievalTimeout</para>
- </entry>
+ <row>
+ <entry>
+ <para>StateRetrievalTimeout</para>
+ </entry>
- <entry>
- <para>Time in milliseconds to wait for state
- retrieval. This should be longer than
- <literal>LockAcquisitionTimeout</literal>
- as the node
- providing state may need to wait that long to acquire
- necessary read locks on the cache. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Time in milliseconds to wait for state
+ retrieval. This should be longer than
+ <literal>LockAcquisitionTimeout</literal>
+ as the node
+ providing state may need to wait that long to acquire
+ necessary read locks on the cache. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>IsolationLevel</para>
- </entry>
+ <row>
+ <entry>
+ <para>IsolationLevel</para>
+ </entry>
- <entry>
- <para>Node locking isolation level : SERIALIZABLE, REPEATABLE_READ
- (default), READ_COMMITTED, READ_UNCOMMITTED, and NONE. Note that this is ignored if
- NodeLockingScheme is OPTIMISTIC. Case doesn't matter. See documentation on Transactions and
- Concurrency for more details.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Node locking isolation level : SERIALIZABLE, REPEATABLE_READ
+ (default), READ_COMMITTED, READ_UNCOMMITTED, and NONE. Note that this is ignored if
+ NodeLockingScheme is OPTIMISTIC. Case doesn't matter. See documentation on Transactions
+ and
+ Concurrency for more details.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>LockAcquisitionTimeout</para>
- </entry>
+ <row>
+ <entry>
+ <para>LockAcquisitionTimeout</para>
+ </entry>
- <entry>
- <para>Time in milliseconds to wait for a lock to be acquired. If
- a lock cannot be acquired an exception will be thrown. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Time in milliseconds to wait for a lock to be acquired. If
+ a lock cannot be acquired an exception will be thrown. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>LockParentForChildInsertRemove</para>
- </entry>
+ <row>
+ <entry>
+ <para>LockParentForChildInsertRemove</para>
+ </entry>
- <entry>
- <para>Controls whether inserting or removing a node requires a write
- lock on the node's parent (when pessimistic locking is used) or whether
- it results in an update of the parent node's version (when optimistic
- locking is used). The default value is
- <code>false</code>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Controls whether inserting or removing a node requires a write
+ lock on the node's parent (when pessimistic locking is used) or whether
+ it results in an update of the parent node's version (when optimistic
+ locking is used). The default value is
+ <code>false</code>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>MarshallerClass</para>
- </entry>
+ <row>
+ <entry>
+ <para>MarshallerClass</para>
+ </entry>
- <entry>
- <para>An instance of
- <literal>org.jboss.cache.marshall.Marshaller</literal>
- used to serialize data to byte streams.
- Defaults to
- <literal>org.jboss.cache.marshall.VersionAwareMarshaller</literal>
- if not specified.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>An instance of
+ <literal>org.jboss.cache.marshall.Marshaller</literal>
+ used to serialize data to byte streams.
+ Defaults to
+ <literal>org.jboss.cache.marshall.VersionAwareMarshaller</literal>
+ if not specified.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>MultiplexerService</para>
- </entry>
+ <row>
+ <entry>
+ <para>MultiplexerService</para>
+ </entry>
- <entry>
- <para>The JMX object name of the service that defines the JGroups multiplexer.
- In JBoss AS 5.0 this service is normally defined in the jgroups-multiplexer.sar.
- This XML attribute can only be handled by the JBoss AS MBean deployment services;
- if it is included in a file passed to a
- <literal>CacheFactory</literal>
- the
- factory's creation of the cache will fail. Inside JBoss AS, the attribute should
- be specified using the "depends optional-attribute-name" syntax shown in
- the example above. Inside the AS if this attribute
- is defined, an instance of
- <literal>org.jgroups.jmx.JChannelFactoryMBean</literal>
- will be injected into the
- <literal>CacheJmxWrapper</literal>
- which will use
- it to obtain a multiplexed JGroups channel. The configuration
- of the channel will be that associated with
- <literal>MultiplexerStack</literal>
- .
- The
- <literal>ClusterConfig</literal>
- attribute will be ignored.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>The JMX object name of the service that defines the JGroups multiplexer.
+ In JBoss AS 5.0 this service is normally defined in the jgroups-multiplexer.sar.
+ This XML attribute can only be handled by the JBoss AS MBean deployment services;
+ if it is included in a file passed to a
+ <literal>CacheFactory</literal>
+ the
+ factory's creation of the cache will fail. Inside JBoss AS, the attribute should
+ be specified using the "depends optional-attribute-name" syntax shown in
+ the example above. Inside the AS if this attribute
+ is defined, an instance of
+ <literal>org.jgroups.jmx.JChannelFactoryMBean</literal>
+ will be injected into the
+ <literal>CacheJmxWrapper</literal>
+ which will use
+ it to obtain a multiplexed JGroups channel. The configuration
+ of the channel will be that associated with
+ <literal>MultiplexerStack</literal>
+ .
+ The
+ <literal>ClusterConfig</literal>
+ attribute will be ignored.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>MultiplexerStack</para>
- </entry>
+ <row>
+ <entry>
+ <para>MultiplexerStack</para>
+ </entry>
- <entry>
- <para>The name of the JGroups stack to be used with the cache cluster.
- Stacks are defined in the configuration of the external
- <literal>MultiplexerService</literal>
- discussed above. In JBoss AS 5 this is normally done in the
- jgroups-multiplexer.sar/META-INF/multiplexer-stacks.xml file.
- The default stack is
- <literal>udp</literal>
- . This attribute is used in conjunction with
- <literal>MultiplexerService</literal>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>The name of the JGroups stack to be used with the cache cluster.
+ Stacks are defined in the configuration of the external
+ <literal>MultiplexerService</literal>
+ discussed above. In JBoss AS 5 this is normally done in the
+ jgroups-multiplexer.sar/META-INF/multiplexer-stacks.xml file.
+ The default stack is
+ <literal>udp</literal>
+ . This attribute is used in conjunction with
+ <literal>MultiplexerService</literal>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>NodeLockingScheme</para>
- </entry>
+ <row>
+ <entry>
+ <para>NodeLockingScheme</para>
+ </entry>
- <entry>
- <para>May be PESSIMISTIC (default) or OPTIMISTIC.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>May be PESSIMISTIC (default) or OPTIMISTIC.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ReplicationVersion</para>
- </entry>
- <entry>
- <para>Tells the cache to serialize cluster traffic
- in a format consistent with that used by the given release
- of JBoss Cache. Different JBoss Cache versions use different
- wire formats; setting this attribute tells a cache from a later
- release to serialize data using the format from an earlier
- release. This allows caches from different releases to
- interoperate. For example, a 2.1.0 cache could have this
- value set to "2.0.0", allowing it to interoperate with a 2.0.0
- cache. Valid values are a dot-separated release number, with
- any final qualifer also separated by a dot, e.g. "2.0.0" or "2.0.0.GA".
- Values that indicate a 1.x release are not supported in the 2.x series.
- </para>
- </entry>
- </row>
+ <row>
+ <entry>
+ <para>ReplicationVersion</para>
+ </entry>
+ <entry>
+ <para>Tells the cache to serialize cluster traffic
+ in a format consistent with that used by the given release
+ of JBoss Cache. Different JBoss Cache versions use different
+ wire formats; setting this attribute tells a cache from a later
+ release to serialize data using the format from an earlier
+ release. This allows caches from different releases to
+ interoperate. For example, a 2.1.0 cache could have this
+ value set to "2.0.0", allowing it to interoperate with a 2.0.0
+ cache. Valid values are a dot-separated release number, with
+ any final qualifer also separated by a dot, e.g. "2.0.0" or "2.0.0.GA".
+ Values that indicate a 1.x release are not supported in the 2.x series.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ReplQueueInterval</para>
- </entry>
+ <row>
+ <entry>
+ <para>ReplQueueInterval</para>
+ </entry>
- <entry>
- <para>Time in milliseconds for elements from the replication
- queue to be replicated. Only used if
- <literal>UseReplQueue</literal>
- is enabled. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Time in milliseconds for elements from the replication
+ queue to be replicated. Only used if
+ <literal>UseReplQueue</literal>
+ is enabled. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ReplQueueMaxElements</para>
- </entry>
+ <row>
+ <entry>
+ <para>ReplQueueMaxElements</para>
+ </entry>
- <entry>
- <para>Max number of elements in the replication queue until
- replication kicks in. Only used if
- <literal>UseReplQueue</literal>
- is enabled. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>Max number of elements in the replication queue until
+ replication kicks in. Only used if
+ <literal>UseReplQueue</literal>
+ is enabled. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>SyncCommitPhase</para>
- </entry>
+ <row>
+ <entry>
+ <para>SyncCommitPhase</para>
+ </entry>
- <entry>
- <para>This option is used to control the behaviour of the commit part of a 2-phase commit protocol,
- when
- using REPL_SYNC (does not apply to other cache modes). By default this is set to
- <literal>false</literal>
- . There is a performance penalty to enabling this, especially when running
- in a large cluster, but the upsides are greater cluster-wide data integrity. See the chapter on
- clustered caches for more information on this. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>This option is used to control the behaviour of the commit part of a 2-phase commit
+ protocol,
+ when
+ using REPL_SYNC (does not apply to other cache modes). By default this is set to
+ <literal>false</literal>
+ . There is a performance penalty to enabling this, especially when running
+ in a large cluster, but the upsides are greater cluster-wide data integrity. See the
+ chapter on
+ clustered caches for more information on this. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>SyncReplTimeout</para>
- </entry>
+ <row>
+ <entry>
+ <para>SyncReplTimeout</para>
+ </entry>
- <entry>
- <para>For synchronous replication: time in milliseconds to wait
- until replication acks have been received from all nodes in the
- cluster. It is usually best that this is greater than
- <literal>LockAcquisitionTimeout</literal>
- .
- This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>For synchronous replication: time in milliseconds to wait
+ until replication acks have been received from all nodes in the
+ cluster. It is usually best that this is greater than
+ <literal>LockAcquisitionTimeout</literal>
+ .
+ This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>SyncRollbackPhase</para>
- </entry>
+ <row>
+ <entry>
+ <para>SyncRollbackPhase</para>
+ </entry>
- <entry>
- <para>This option is used to control the behaviour of the rollback part of a 2-phase commit
- protocol, when
- using REPL_SYNC (does not apply to other cache modes). By default this is set to
- <literal>false</literal>
- . There is a performance penalty to enabling this, especially when running
- in a large cluster, but the upsides are greater cluster-wide data integrity. See the chapter on
- clustered caches for more information on this. This property is
- <emphasis>dynamic</emphasis>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>This option is used to control the behaviour of the rollback part of a 2-phase commit
+ protocol, when
+ using REPL_SYNC (does not apply to other cache modes). By default this is set to
+ <literal>false</literal>
+ . There is a performance penalty to enabling this, especially when running
+ in a large cluster, but the upsides are greater cluster-wide data integrity. See the
+ chapter on
+ clustered caches for more information on this. This property is
+ <emphasis>dynamic</emphasis>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>TransactionManagerLookupClass</para>
- </entry>
+ <row>
+ <entry>
+ <para>TransactionManagerLookupClass</para>
+ </entry>
- <entry>
- <para>The fully qualified name of a class implementing
- TransactionManagerLookup. Default is
- JBossTransactionManagerLookup. There is also an option of
- GenericTransactionManagerLookup for example.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>The fully qualified name of a class implementing
+ TransactionManagerLookup. Default is
+ JBossTransactionManagerLookup. There is also an option of
+ GenericTransactionManagerLookup for example.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>UseInterceptorMbeans</para>
- </entry>
+ <row>
+ <entry>
+ <para>UseInterceptorMbeans</para>
+ </entry>
- <entry>
- <para>
- <emphasis>Deprecated</emphasis>
- . Use
- <literal>ExposeManagementStatistics</literal>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>
+ <emphasis>Deprecated</emphasis>
+ . Use
+ <literal>ExposeManagementStatistics</literal>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>UseRegionBasedMarshalling</para>
- </entry>
+ <row>
+ <entry>
+ <para>UseRegionBasedMarshalling</para>
+ </entry>
- <entry>
- <para>When unmarshalling replicated data, this option specifies whether or not to
- support use of different classloaders for different cache regions. This defaults to
- <literal>false</literal>
- if unspecified.
- <p/>
- <b>DEPRECATED.</b>
- This option will disappear in JBoss Cache 3.x. See
- <literal>UseLazyDeserialization</literal>
- instead.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>When unmarshalling replicated data, this option specifies whether or not to
+ support use of different classloaders for different cache regions. This defaults to
+ <literal>false</literal>
+ if unspecified.
+ <p/>
+ <b>DEPRECATED.</b>
+ This option will disappear in JBoss Cache 3.x. See
+ <literal>UseLazyDeserialization</literal>
+ instead.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>UseReplQueue</para>
- </entry>
+ <row>
+ <entry>
+ <para>UseReplQueue</para>
+ </entry>
- <entry>
- <para>For asynchronous replication: whether or not to use a
- replication queue. Defaults to
- <literal>false</literal>
- .
- </para>
- </entry>
- </row>
+ <entry>
+ <para>For asynchronous replication: whether or not to use a
+ replication queue. Defaults to
+ <literal>false</literal>
+ .
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ShutdownHookBehavior</para>
- </entry>
+ <row>
+ <entry>
+ <para>ShutdownHookBehavior</para>
+ </entry>
- <entry>
- <para>An optional parameter that controls whether JBoss Cache registers a shutdown hook with the
- JVM
- runtime. Allowed values are<literal>DEFAULT</literal>,
- <literal>REGISTER</literal>
- and
- <literal>DONT_REGISTER</literal>.
- <literal>REGISTER</literal>
- and
- <literal>DONT_REGISTER</literal>
- forces or suppresses the registration of a shutdown hook, respectively, and
- <literal>DEFAULT</literal>
- registers one if an MBean server (other than the JDK default) cannot be found and it is assumed
- that the
- cache is running in a managed environment. The default if unspecified is, as expected,<literal>
- DEFAULT</literal>.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>An optional parameter that controls whether JBoss Cache registers a shutdown hook with
+ the
+ JVM
+ runtime. Allowed values are<literal>DEFAULT</literal>,
+ <literal>REGISTER</literal>
+ and
+ <literal>DONT_REGISTER</literal>.
+ <literal>REGISTER</literal>
+ and
+ <literal>DONT_REGISTER</literal>
+ forces or suppresses the registration of a shutdown hook, respectively, and
+ <literal>DEFAULT</literal>
+ registers one if an MBean server (other than the JDK default) cannot be found and it is
+ assumed
+ that the
+ cache is running in a managed environment. The default if unspecified is, as expected,
+ <literal>
+ DEFAULT</literal>.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>UseLazyDeserialization</para>
- </entry>
+ <row>
+ <entry>
+ <para>UseLazyDeserialization</para>
+ </entry>
- <entry>
- <para>An optional parameter that can be used to enable or disable the use of lazy deserialization
- for cached objects. Defaults to<literal>false</literal>, since it adds a small processing
- overhead.
- If lazy deserialization is disabled, support for implicitly using context class loaders
- registered
- with the calling thread goes away.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>An optional parameter that can be used to enable or disable the use of lazy
+ deserialization
+ for cached objects. Defaults to<literal>false</literal>, since it adds a small
+ processing
+ overhead.
+ If lazy deserialization is disabled, support for implicitly using context class loaders
+ registered
+ with the calling thread goes away.
+ </para>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>ObjectInputStreamPoolSize and ObjectOutputStreamPoolSize</para>
- </entry>
+ <row>
+ <entry>
+ <para>ObjectInputStreamPoolSize and ObjectOutputStreamPoolSize</para>
+ </entry>
- <entry>
- <para>
- Since JBoss Cache 2.1.0, object input and output streams - used to serialize and deserialize RPC
- calls in a cluster - are pooled to reduce the overhead of constructing such streams. They are
- reused
- by making use of special resettable stream implementations.
- </para>
- <para>
- by default, these stream pools are set at
- <literal>50</literal>
- objects each. You could increase or decrease the pool
- size if, while profiling, you see a lot of threads blocking on
- <literal>ObjectStreamPool.getInputStream()</literal>
- or<literal>ObjectStreamPool.getOutputStream()</literal>. In general, having more streams is
- better
- than having fewer than needed. Based on your application, make sure you have more streams
- available
- than number of threads you expect to concurrently write to the cache.
- </para>
- </entry>
- </row>
+ <entry>
+ <para>
+ Since JBoss Cache 2.1.0, object input and output streams - used to serialize and
+ deserialize RPC
+ calls in a cluster - are pooled to reduce the overhead of constructing such streams.
+ They are
+ reused
+ by making use of special resettable stream implementations.
+ </para>
+ <para>
+ by default, these stream pools are set at
+ <literal>50</literal>
+ objects each. You could increase or decrease the pool
+ size if, while profiling, you see a lot of threads blocking on
+ <literal>ObjectStreamPool.getInputStream()</literal>
+ or<literal>ObjectStreamPool.getOutputStream()</literal>. In general, having more streams
+ is
+ better
+ than having fewer than needed. Based on your application, make sure you have more
+ streams
+ available
+ than number of threads you expect to concurrently write to the cache.
+ </para>
+ </entry>
+ </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
</chapter>
\ No newline at end of file
Modified: core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -24,7 +24,7 @@
import static org.jboss.cache.AbstractNode.NodeFlags.REMOVED;
import static org.jboss.cache.AbstractNode.NodeFlags.RESIDENT;
import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -28,11 +28,11 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.notifications.Notifier;
import org.jboss.starobrno.statetransfer.StateTransferManager;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import javax.transaction.Transaction;
Modified: core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -22,7 +22,7 @@
package org.jboss.cache;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -26,10 +26,10 @@
import org.jboss.cache.annotations.Compat;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.util.Immutables;
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,7 +23,7 @@
import net.jcip.annotations.NotThreadSafe;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -33,7 +33,6 @@
import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.RuntimeConfig;
@@ -45,6 +44,7 @@
import org.jboss.starobrno.notifications.Notifier;
import org.jboss.starobrno.remoting.SuspectException;
import org.jboss.starobrno.statetransfer.DefaultStateTransferManager;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.transaction.TransactionTable;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.util.ReflectionUtil;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -28,7 +28,7 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.*;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import org.jgroups.Address;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -34,12 +34,12 @@
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.*;
import org.jboss.cache.interceptors.InterceptorChain;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.notifications.Notifier;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import org.jgroups.Address;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/WriteCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/WriteCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/WriteCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.commands;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
/**
* A write command that has a reference to a {@link org.jboss.cache.transaction.GlobalTransaction}.
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -32,8 +32,8 @@
import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.interceptors.InterceptorChain;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.List;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,7 +23,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
/**
* Base class for transaction boundary commands that deal with global transactions
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,7 +23,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
/**
* Represents a commit() call, the 2nd part of a 2-phase commit.
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -25,7 +25,7 @@
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jgroups.Address;
import java.util.ArrayList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,7 +23,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
/**
* The rollback phase of a 2-phase commit.
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -26,8 +26,8 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.starobrno.notifications.Notifier;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
/**
@@ -106,4 +106,4 @@
{
throw new UnsupportedOperationException();
}
-}
\ No newline at end of file
+}
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -26,7 +26,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -30,8 +30,8 @@
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.starobrno.notifications.Notifier;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -27,7 +27,7 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,7 +23,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -27,7 +27,7 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -26,7 +26,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -26,7 +26,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -33,10 +33,10 @@
import org.jboss.cache.commands.write.*;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import javax.transaction.SystemException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -24,17 +24,17 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.RPCManager;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.starobrno.cluster.ReplicationQueue;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.interceptors.base.CommandInterceptor;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.cluster.ReplicationQueue;
import org.jboss.starobrno.config.Option;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jgroups.Address;
import javax.transaction.Transaction;
@@ -214,4 +214,4 @@
}
return false;
}
-}
\ No newline at end of file
+}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -23,11 +23,11 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.interceptors.base.CommandInterceptor;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.config.Option;
import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import javax.transaction.Status;
import javax.transaction.SystemException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -37,11 +37,11 @@
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.starobrno.config.CacheLoaderConfig;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import javax.transaction.SystemException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor_Legacy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor_Legacy.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor_Legacy.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -32,12 +32,12 @@
import org.jboss.cache.commands.write.*;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.config.Option;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import javax.transaction.SystemException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -27,16 +27,10 @@
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-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.transaction.GlobalTransaction;
+import org.jboss.cache.commands.write.*;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.GlobalTransaction;
/**
* Takes care of replicating modifications to other nodes in a cluster. Also
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -32,7 +32,6 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.batch.BatchContainer;
@@ -44,6 +43,7 @@
import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.starobrno.notifications.Notifier;
import org.jboss.starobrno.statetransfer.StateTransferManager;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.util.Immutables;
import org.jgroups.Address;
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -25,9 +25,9 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.*;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/LockUtil.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -27,9 +27,9 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import javax.transaction.Status;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -27,10 +27,10 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.CommandsFactory;
import static org.jboss.cache.lock.LockType.WRITE;
-import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.lock.TimeoutException;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.tree.Fqn;
import java.util.List;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManager.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Not really a transaction manager in the truest sense of the word. Only used to batch up operations. Proper
- * transactional symantics of rollbacks and recovery are NOT used here. This is used by PojoCache.
- *
- * @author bela
- * @version $Revision$
- * Date: May 15, 2003
- * Time: 4:11:37 PM
- */
-public class BatchModeTransactionManager extends DummyBaseTransactionManager
-{
- static BatchModeTransactionManager instance = null;
- static Log log = LogFactory.getLog(BatchModeTransactionManager.class);
- private static final long serialVersionUID = 5656602677430350961L;
-
- public static BatchModeTransactionManager getInstance()
- {
- if (instance == null)
- {
- instance = new BatchModeTransactionManager();
- }
- return instance;
- }
-
- public static void destroy()
- {
- if (instance == null) return;
- instance.setTransaction(null);
- instance = null;
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyBaseTransactionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyBaseTransactionManager.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyBaseTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,256 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * @author bela
- * @version $Revision$
- * Date: May 15, 2003
- * Time: 4:11:37 PM
- */
-public class DummyBaseTransactionManager implements TransactionManager, java.io.Serializable
-{
- static ThreadLocal<Transaction> thread_local = new ThreadLocal<Transaction>();
- private static final long serialVersionUID = -6716097342564237376l;
- private static final Log log = LogFactory.getLog(DummyBaseTransactionManager.class);
- private static final boolean trace = log.isTraceEnabled();
-
- /**
- * Starts a new transaction, and associate it with the calling thread.
- *
- * @throws javax.transaction.NotSupportedException
- * If the calling thread is already
- * associated with a transaction, and nested transactions are
- * not supported.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public void begin() throws NotSupportedException, SystemException
- {
- Transaction currentTx;
- if ((currentTx = getTransaction()) != null)
- throw new NotSupportedException(Thread.currentThread() +
- " is already associated with a transaction (" + currentTx + ")");
- DummyTransaction tx = new DummyTransaction(this);
- setTransaction(tx);
- }
-
- /**
- * Commit the transaction associated with the calling thread.
- *
- * @throws javax.transaction.RollbackException
- * If the transaction was marked for rollback
- * only, the transaction is rolled back and this exception is
- * thrown.
- * @throws IllegalStateException If the calling thread is not associated
- * with a transaction.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- * @throws javax.transaction.HeuristicMixedException
- * If a heuristic decision was made and
- * some some parts of the transaction have been committed while
- * other parts have been rolled back.
- * @throws javax.transaction.HeuristicRollbackException
- * If a heuristic decision to roll
- * back the transaction was made.
- * @throws SecurityException If the caller is not allowed to commit this
- * transaction.
- */
- public void commit() throws RollbackException, HeuristicMixedException,
- HeuristicRollbackException, SecurityException,
- IllegalStateException, SystemException
- {
- int status;
- Transaction tx = getTransaction();
- if (tx == null)
- throw new IllegalStateException("thread not associated with transaction");
- status = tx.getStatus();
- if (status == Status.STATUS_MARKED_ROLLBACK)
- throw new RollbackException();
- tx.commit();
-
- // Disassociate tx from thread.
- setTransaction(null);
- }
-
- /**
- * Rolls back the transaction associated with the calling thread.
- *
- * @throws IllegalStateException If the transaction is in a state
- * where it cannot be rolled back. This could be because the
- * calling thread is not associated with a transaction, or
- * because it is in the
- * {@link javax.transaction.Status#STATUS_PREPARED prepared state}.
- * @throws SecurityException If the caller is not allowed to roll back
- * this transaction.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public void rollback() throws IllegalStateException, SecurityException,
- SystemException
- {
- Transaction tx = getTransaction();
- if (tx == null)
- throw new IllegalStateException("no transaction associated with thread");
- tx.rollback();
-
- // Disassociate tx from thread.
- setTransaction(null);
- }
-
- /**
- * Mark the transaction associated with the calling thread for rollback
- * only.
- *
- * @throws IllegalStateException If the transaction is in a state
- * where it cannot be rolled back. This could be because the
- * calling thread is not associated with a transaction, or
- * because it is in the
- * {@link javax.transaction.Status#STATUS_PREPARED prepared state}.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public void setRollbackOnly() throws IllegalStateException, SystemException
- {
- Transaction tx = getTransaction();
- if (tx == null)
- throw new IllegalStateException("no transaction associated with calling thread");
- tx.setRollbackOnly();
- }
-
- /**
- * Get the status of the transaction associated with the calling thread.
- *
- * @return The status of the transaction. This is one of the
- * {@link javax.transaction.Status} constants. If no transaction is associated
- * with the calling thread,
- * {@link javax.transaction.Status#STATUS_NO_TRANSACTION} is returned.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public int getStatus() throws SystemException
- {
- Transaction tx = getTransaction();
- return tx != null ? tx.getStatus() : Status.STATUS_NO_TRANSACTION;
- }
-
- /**
- * Get the transaction associated with the calling thread.
- *
- * @return The transaction associated with the calling thread, or
- * <code>null</code> if the calling thread is not associated
- * with a transaction.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public Transaction getTransaction() throws SystemException
- {
- return thread_local.get();
- }
-
- /**
- * Change the transaction timeout for transactions started by the calling
- * thread with the {@link #begin()} method.
- *
- * @param seconds The new timeout value, in seconds. If this parameter
- * is <code>0</code>, the timeout value is reset to the default
- * value.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public void setTransactionTimeout(int seconds) throws SystemException
- {
- throw new SystemException("not supported");
- }
-
- /**
- * Suspend the association the calling thread has to a transaction,
- * and return the suspended transaction.
- * When returning from this method, the calling thread is no longer
- * associated with a transaction.
- *
- * @return The transaction that the calling thread was associated with,
- * or <code>null</code> if the calling thread was not associated
- * with a transaction.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public Transaction suspend() throws SystemException
- {
- Transaction retval = getTransaction();
- setTransaction(null);
- if (trace) log.trace("Suspending tx " + retval);
- return retval;
- }
-
- /**
- * Resume the association of the calling thread with the given
- * transaction.
- *
- * @param tx The transaction to be associated with the calling thread.
- * @throws javax.transaction.InvalidTransactionException
- * If the argument does not represent
- * a valid transaction.
- * @throws IllegalStateException If the calling thread is already
- * associated with a transaction.
- * @throws javax.transaction.SystemException
- * If the transaction service fails in an
- * unexpected way.
- */
- public void resume(Transaction tx) throws InvalidTransactionException, IllegalStateException, SystemException
- {
- if (trace) log.trace("Resuming tx " + tx);
- setTransaction(tx);
- }
-
- /**
- * Just used for unit tests
- *
- * @param tx
- */
- public void setTransaction(Transaction tx)
- {
- thread_local.set(tx);
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,602 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import javax.naming.Binding;
-import javax.naming.CompoundName;
-import javax.naming.Context;
-import javax.naming.ContextNotEmptyException;
-import javax.naming.Name;
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InvalidAttributesException;
-import java.util.HashMap;
-import java.util.Hashtable;
-
-/**
- * @author bela
- * Date: May 15, 2003
- * Time: 6:21:37 PM
- */
-public class DummyContext implements Context
-{
-
- HashMap<String, Object> bindings = new HashMap<String, Object>();
-
- /**
- * Retrieves the named object.
- * If <tt>name</tt> is empty, returns a new instance of this context
- * (which represents the same naming context as this context, but its
- * environment may be modified independently and it may be accessed
- * concurrently).
- *
- * @param name the name of the object to look up
- * @return the object bound to <tt>name</tt>
- * @throws NamingException if a naming exception is encountered
- * @see #lookup(String)
- * @see #lookupLink(Name)
- */
- public Object lookup(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the named object.
- * See {@link #lookup(Name)} for details.
- *
- * @param name the name of the object to look up
- * @return the object bound to <tt>name</tt>
- * @throws NamingException if a naming exception is encountered
- */
- public Object lookup(String name) throws NamingException
- {
- return bindings.get(name);
- }
-
- /**
- * Binds a name to an object.
- * All intermediate contexts and the target context (that named by all
- * but terminal atomic component of the name) must already exist.
- *
- * @param name the name to bind; may not be empty
- * @param obj the object to bind; possibly null
- * @throws NameAlreadyBoundException if name is already bound
- * @throws InvalidAttributesException if object did not supply all mandatory attributes
- * @throws NamingException if a naming exception is encountered
- * @see #bind(String,Object)
- * @see #rebind(Name,Object)
- * @see DirContext#bind(Name,Object,
- * Attributes)
- */
- public void bind(Name name, Object obj) throws NamingException
- {
- }
-
- /**
- * Binds a name to an object.
- * See {@link #bind(Name,Object)} for details.
- *
- * @param name the name to bind; may not be empty
- * @param obj the object to bind; possibly null
- * @throws NameAlreadyBoundException if name is already bound
- * @throws InvalidAttributesException if object did not supply all mandatory attributes
- * @throws NamingException if a naming exception is encountered
- */
- public void bind(String name, Object obj) throws NamingException
- {
- bindings.put(name, obj);
- }
-
- /**
- * Binds a name to an object, overwriting any existing binding.
- * All intermediate contexts and the target context (that named by all
- * but terminal atomic component of the name) must already exist.
- * <p/>
- * <p> If the object is a <tt>DirContext</tt>, any existing attributes
- * associated with the name are replaced with those of the object.
- * Otherwise, any existing attributes associated with the name remain
- * unchanged.
- *
- * @param name the name to bind; may not be empty
- * @param obj the object to bind; possibly null
- * @throws InvalidAttributesException if object did not supply all mandatory attributes
- * @throws NamingException if a naming exception is encountered
- * @see #rebind(String,Object)
- * @see #bind(Name,Object)
- * @see DirContext#rebind(Name,Object,
- * Attributes)
- * @see DirContext
- */
- public void rebind(Name name, Object obj) throws NamingException
- {
- }
-
- /**
- * Binds a name to an object, overwriting any existing binding.
- * See {@link #rebind(Name,Object)} for details.
- *
- * @param name the name to bind; may not be empty
- * @param obj the object to bind; possibly null
- * @throws InvalidAttributesException if object did not supply all mandatory attributes
- * @throws NamingException if a naming exception is encountered
- */
- public void rebind(String name, Object obj) throws NamingException
- {
- bindings.put(name, obj);
- }
-
- /**
- * Unbinds the named object.
- * Removes the terminal atomic name in <code>name</code>
- * from the target context--that named by all but the terminal
- * atomic part of <code>name</code>.
- * <p/>
- * <p> This method is idempotent.
- * It succeeds even if the terminal atomic name
- * is not bound in the target context, but throws
- * <tt>NameNotFoundException</tt>
- * if any of the intermediate contexts do not exist.
- * <p/>
- * <p> Any attributes associated with the name are removed.
- * Intermediate contexts are not changed.
- *
- * @param name the name to unbind; may not be empty
- * @throws NameNotFoundException if an intermediate context does not exist
- * @throws NamingException if a naming exception is encountered
- * @see #unbind(String)
- */
- public void unbind(Name name) throws NamingException
- {
- }
-
- /**
- * Unbinds the named object.
- * See {@link #unbind(Name)} for details.
- *
- * @param name the name to unbind; may not be empty
- * @throws NameNotFoundException if an intermediate context does not exist
- * @throws NamingException if a naming exception is encountered
- */
- public void unbind(String name) throws NamingException
- {
- bindings.remove(name);
- }
-
- /**
- * Binds a new name to the object bound to an old name, and unbinds
- * the old name. Both names are relative to this context.
- * Any attributes associated with the old name become associated
- * with the new name.
- * Intermediate contexts of the old name are not changed.
- *
- * @param oldName the name of the existing binding; may not be empty
- * @param newName the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if <tt>newName</tt> is already bound
- * @throws NamingException if a naming exception is encountered
- * @see #rename(String,String)
- * @see #bind(Name,Object)
- * @see #rebind(Name,Object)
- */
- public void rename(Name oldName, Name newName) throws NamingException
- {
- }
-
- /**
- * Binds a new name to the object bound to an old name, and unbinds
- * the old name.
- * See {@link #rename(Name,Name)} for details.
- *
- * @param oldName the name of the existing binding; may not be empty
- * @param newName the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if <tt>newName</tt> is already bound
- * @throws NamingException if a naming exception is encountered
- */
- public void rename(String oldName, String newName) throws NamingException
- {
- }
-
- /**
- * Enumerates the names bound in the named context, along with the
- * class names of objects bound to them.
- * The contents of any subcontexts are not included.
- * <p/>
- * <p> If a binding is added to or removed from this context,
- * its effect on an enumeration previously returned is undefined.
- *
- * @param name the name of the context to list
- * @return an enumeration of the names and class names of the
- * bindings in this context. Each element of the
- * enumeration is of type <tt>NameClassPair</tt>.
- * @throws NamingException if a naming exception is encountered
- * @see #list(String)
- * @see #listBindings(Name)
- * @see NameClassPair
- */
- public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Enumerates the names bound in the named context, along with the
- * class names of objects bound to them.
- * See {@link #list(Name)} for details.
- *
- * @param name the name of the context to list
- * @return an enumeration of the names and class names of the
- * bindings in this context. Each element of the
- * enumeration is of type <tt>NameClassPair</tt>.
- * @throws NamingException if a naming exception is encountered
- */
- public NamingEnumeration<NameClassPair> list(String name) throws NamingException
- {
- return null;
- }
-
- /**
- * Enumerates the names bound in the named context, along with the
- * objects bound to them.
- * The contents of any subcontexts are not included.
- * <p/>
- * <p> If a binding is added to or removed from this context,
- * its effect on an enumeration previously returned is undefined.
- *
- * @param name the name of the context to list
- * @return an enumeration of the bindings in this context.
- * Each element of the enumeration is of type
- * <tt>Binding</tt>.
- * @throws NamingException if a naming exception is encountered
- * @see #listBindings(String)
- * @see #list(Name)
- * @see Binding
- */
- public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Enumerates the names bound in the named context, along with the
- * objects bound to them.
- * See {@link #listBindings(Name)} for details.
- *
- * @param name the name of the context to list
- * @return an enumeration of the bindings in this context.
- * Each element of the enumeration is of type
- * <tt>Binding</tt>.
- * @throws NamingException if a naming exception is encountered
- */
- public NamingEnumeration<Binding> listBindings(String name) throws NamingException
- {
- return null;
- }
-
- /**
- * Destroys the named context and removes it from the namespace.
- * Any attributes associated with the name are also removed.
- * Intermediate contexts are not destroyed.
- * <p/>
- * <p> This method is idempotent.
- * It succeeds even if the terminal atomic name
- * is not bound in the target context, but throws
- * <tt>NameNotFoundException</tt>
- * if any of the intermediate contexts do not exist.
- * <p/>
- * <p> In a federated naming system, a context from one naming system
- * may be bound to a name in another. One can subsequently
- * look up and perform operations on the foreign context using a
- * composite name. However, an attempt destroy the context using
- * this composite name will fail with
- * <tt>NotContextException</tt>, because the foreign context is not
- * a "subcontext" of the context in which it is bound.
- * Instead, use <tt>unbind()</tt> to remove the
- * binding of the foreign context. Destroying the foreign context
- * requires that the <tt>destroySubcontext()</tt> be performed
- * on a context from the foreign context's "native" naming system.
- *
- * @param name the name of the context to be destroyed; may not be empty
- * @throws NameNotFoundException if an intermediate context does not exist
- * @throws NotContextException if the name is bound but does not name a
- * context, or does not name a context of the appropriate type
- * @throws ContextNotEmptyException if the named context is not empty
- * @throws NamingException if a naming exception is encountered
- * @see #destroySubcontext(String)
- */
- public void destroySubcontext(Name name) throws NamingException
- {
- }
-
- /**
- * Destroys the named context and removes it from the namespace.
- * See {@link #destroySubcontext(Name)} for details.
- *
- * @param name the name of the context to be destroyed; may not be empty
- * @throws NameNotFoundException if an intermediate context does not exist
- * @throws NotContextException if the name is bound but does not name a
- * context, or does not name a context of the appropriate type
- * @throws ContextNotEmptyException if the named context is not empty
- * @throws NamingException if a naming exception is encountered
- */
- public void destroySubcontext(String name) throws NamingException
- {
- }
-
- /**
- * Creates and binds a new context.
- * Creates a new context with the given name and binds it in
- * the target context (that named by all but terminal atomic
- * component of the name). All intermediate contexts and the
- * target context must already exist.
- *
- * @param name the name of the context to create; may not be empty
- * @return the newly created context
- * @throws NameAlreadyBoundException if name is already bound
- * @throws InvalidAttributesException if creation of the subcontext requires specification of
- * mandatory attributes
- * @throws NamingException if a naming exception is encountered
- * @see #createSubcontext(String)
- * @see DirContext#createSubcontext
- */
- public Context createSubcontext(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Creates and binds a new context.
- * See {@link #createSubcontext(Name)} for details.
- *
- * @param name the name of the context to create; may not be empty
- * @return the newly created context
- * @throws NameAlreadyBoundException if name is already bound
- * @throws InvalidAttributesException if creation of the subcontext requires specification of
- * mandatory attributes
- * @throws NamingException if a naming exception is encountered
- */
- public Context createSubcontext(String name) throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the named object, following links except
- * for the terminal atomic component of the name.
- * If the object bound to <tt>name</tt> is not a link,
- * returns the object itself.
- *
- * @param name the name of the object to look up
- * @return the object bound to <tt>name</tt>, not following the
- * terminal link (if any).
- * @throws NamingException if a naming exception is encountered
- * @see #lookupLink(String)
- */
- public Object lookupLink(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the named object, following links except
- * for the terminal atomic component of the name.
- * See {@link #lookupLink(Name)} for details.
- *
- * @param name the name of the object to look up
- * @return the object bound to <tt>name</tt>, not following the
- * terminal link (if any)
- * @throws NamingException if a naming exception is encountered
- */
- public Object lookupLink(String name) throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the parser associated with the named context.
- * In a federation of namespaces, different naming systems will
- * parse names differently. This method allows an application
- * to get a parser for parsing names into their atomic components
- * using the naming convention of a particular naming system.
- * Within any single naming system, <tt>NameParser</tt> objects
- * returned by this method must be equal (using the <tt>equals()</tt>
- * test).
- *
- * @param name the name of the context from which to get the parser
- * @return a name parser that can parse compound names into their atomic
- * components
- * @throws NamingException if a naming exception is encountered
- * @see #getNameParser(String)
- * @see CompoundName
- */
- public NameParser getNameParser(Name name) throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the parser associated with the named context.
- * See {@link #getNameParser(Name)} for details.
- *
- * @param name the name of the context from which to get the parser
- * @return a name parser that can parse compound names into their atomic
- * components
- * @throws NamingException if a naming exception is encountered
- */
- public NameParser getNameParser(String name) throws NamingException
- {
- return null;
- }
-
- /**
- * Composes the name of this context with a name relative to
- * this context.
- * Given a name (<code>name</code>) relative to this context, and
- * the name (<code>prefix</code>) of this context relative to one
- * of its ancestors, this method returns the composition of the
- * two names using the syntax appropriate for the naming
- * system(s) involved. That is, if <code>name</code> names an
- * object relative to this context, the result is the name of the
- * same object, but relative to the ancestor context. None of the
- * names may be null.
- * <p/>
- * For example, if this context is named "wiz.com" relative
- * to the initial context, then
- * <pre>
- * composeName("east", "wiz.com") </pre>
- * might return <code>"east.wiz.com"</code>.
- * If instead this context is named "org/research", then
- * <pre>
- * composeName("user/jane", "org/research") </pre>
- * might return <code>"org/research/user/jane"</code> while
- * <pre>
- * composeName("user/jane", "research") </pre>
- * returns <code>"research/user/jane"</code>.
- *
- * @param name a name relative to this context
- * @param prefix the name of this context relative to one of its ancestors
- * @return the composition of <code>prefix</code> and <code>name</code>
- * @throws NamingException if a naming exception is encountered
- * @see #composeName(String,String)
- */
- public Name composeName(Name name, Name prefix) throws NamingException
- {
- return null;
- }
-
- /**
- * Composes the name of this context with a name relative to
- * this context.
- * See {@link #composeName(Name,Name)} for details.
- *
- * @param name a name relative to this context
- * @param prefix the name of this context relative to one of its ancestors
- * @return the composition of <code>prefix</code> and <code>name</code>
- * @throws NamingException if a naming exception is encountered
- */
- public String composeName(String name, String prefix)
- throws NamingException
- {
- return null;
- }
-
- /**
- * Adds a new environment property to the environment of this
- * context. If the property already exists, its value is overwritten.
- * See class description for more details on environment properties.
- *
- * @param propName the name of the environment property to add; may not be null
- * @param propVal the value of the property to add; may not be null
- * @return the previous value of the property, or null if the property was
- * not in the environment before
- * @throws NamingException if a naming exception is encountered
- * @see #getEnvironment()
- * @see #removeFromEnvironment(String)
- */
- public Object addToEnvironment(String propName, Object propVal)
- throws NamingException
- {
- return null;
- }
-
- /**
- * Removes an environment property from the environment of this
- * context. See class description for more details on environment
- * properties.
- *
- * @param propName the name of the environment property to remove; may not be null
- * @return the previous value of the property, or null if the property was
- * not in the environment
- * @throws NamingException if a naming exception is encountered
- * @see #getEnvironment()
- * @see #addToEnvironment(String,Object)
- */
- public Object removeFromEnvironment(String propName)
- throws NamingException
- {
- return null;
- }
-
- /**
- * Retrieves the environment in effect for this context.
- * See class description for more details on environment properties.
- * <p/>
- * <p> The caller should not make any changes to the object returned:
- * their effect on the context is undefined.
- * The environment of this context may be changed using
- * <tt>addToEnvironment()</tt> and <tt>removeFromEnvironment()</tt>.
- *
- * @return the environment of this context; never null
- * @throws NamingException if a naming exception is encountered
- * @see #addToEnvironment(String,Object)
- * @see #removeFromEnvironment(String)
- */
- public Hashtable<?, ?> getEnvironment() throws NamingException
- {
- return null;
- }
-
- /**
- * Closes this context.
- * This method releases this context's resources immediately, instead of
- * waiting for them to be released automatically by the garbage collector.
- * <p/>
- * <p> This method is idempotent: invoking it on a context that has
- * already been closed has no effect. Invoking any other method
- * on a closed context is not allowed, and results in undefined behaviour.
- *
- * @throws NamingException if a naming exception is encountered
- */
- public void close() throws NamingException
- {
- }
-
- /**
- * Retrieves the full name of this context within its own namespace.
- * <p/>
- * <p> Many naming services have a notion of a "full name" for objects
- * in their respective namespaces. For example, an LDAP entry has
- * a distinguished name, and a DNS record has a fully qualified name.
- * This method allows the client application to retrieve this name.
- * The string returned by this method is not a JNDI composite name
- * and should not be passed directly to context methods.
- * In naming systems for which the notion of full name does not
- * make sense, <tt>OperationNotSupportedException</tt> is thrown.
- *
- * @return this context's name in its own namespace; never null
- * @throws OperationNotSupportedException if the naming system does
- * not have the notion of a full name
- * @throws NamingException if a naming exception is encountered
- * @since 1.3
- */
- public String getNameInNamespace() throws NamingException
- {
- return null;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContextFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContextFactory.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyContextFactory.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-import java.util.Hashtable;
-
-/**
- * @author bela
- * Date: May 15, 2003
- * Time: 6:22:02 PM
- */
-public class DummyContextFactory implements InitialContextFactory
-{
-
- static Context instance = null;
-
- /**
- * Creates an Initial Context for beginning name resolution.
- * Special requirements of this context are supplied
- * using <code>environment</code>.
- * <p/>
- * The environment parameter is owned by the caller.
- * The implementation will not modify the object or keep a reference
- * to it, although it may keep a reference to a clone or copy.
- *
- * @param environment The possibly null environment
- * specifying information to be used in the creation
- * of the initial context.
- * @return A non-null initial context object that implements the Context
- * interface.
- * @throws NamingException If cannot create an initial context.
- */
- public Context getInitialContext(Hashtable environment) throws NamingException
- {
- if (instance == null)
- instance = new DummyContext();
- return instance;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,313 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.xa.XAResource;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-/**
- * @author bela
- * @version $Revision$
- * Date: May 15, 2003
- * Time: 4:20:17 PM
- */
-public class DummyTransaction implements Transaction
-{
- private int status = Status.STATUS_UNKNOWN;
- private static final Log log = LogFactory.getLog(DummyTransaction.class);
- protected DummyBaseTransactionManager tm_;
-
- protected final Set<Synchronization> participants = new CopyOnWriteArraySet<Synchronization>();
-
- public DummyTransaction(DummyBaseTransactionManager tm)
- {
- tm_ = tm;
- status = Status.STATUS_ACTIVE;
- }
-
- /**
- * Attempt to commit this transaction.
- *
- * @throws RollbackException If the transaction was marked for rollback
- * only, the transaction is rolled back and this exception is
- * thrown.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- * @throws HeuristicMixedException If a heuristic decision was made and
- * some some parts of the transaction have been committed while
- * other parts have been rolled back.
- * @throws HeuristicRollbackException If a heuristic decision to roll
- * back the transaction was made.
- * @throws SecurityException If the caller is not allowed to commit this
- * transaction.
- */
- public void commit()
- throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
- SecurityException, SystemException
- {
- boolean doCommit;
- status = Status.STATUS_PREPARING;
- try
- {
- boolean outcome = notifyBeforeCompletion();
- // status=Status.STATUS_PREPARED;
- if (outcome && status != Status.STATUS_MARKED_ROLLBACK)
- {
- status = Status.STATUS_COMMITTING;
- doCommit = true;
- }
- else
- {
- status = Status.STATUS_ROLLING_BACK;
- doCommit = false;
- }
- notifyAfterCompletion(doCommit ? Status.STATUS_COMMITTED : Status.STATUS_MARKED_ROLLBACK);
- status = doCommit ? Status.STATUS_COMMITTED : Status.STATUS_MARKED_ROLLBACK;
- if (!doCommit) throw new RollbackException("outcome is " + outcome + " status: " + status);
- }
- finally
- {
- // Disassociate tx from thread.
- tm_.setTransaction(null);
- }
- }
-
- /**
- * Rolls back this transaction.
- *
- * @throws IllegalStateException If the transaction is in a state
- * where it cannot be rolled back. This could be because the
- * transaction is no longer active, or because it is in the
- * {@link Status#STATUS_PREPARED prepared state}.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void rollback() throws IllegalStateException, SystemException
- {
- try
- {
- // JBCACHE-360 -- to match JBossTM (and presumable the spec) a
- // rollback transaction should have status ROLLEDBACK before
- // calling afterCompletion().
- //status=Status.STATUS_ROLLING_BACK;
- status = Status.STATUS_ROLLEDBACK;
- notifyAfterCompletion(Status.STATUS_ROLLEDBACK);
- }
- catch (Throwable t)
- {
- }
- status = Status.STATUS_ROLLEDBACK;
-
- // Disassociate tx from thread.
- tm_.setTransaction(null);
- }
-
- /**
- * Mark the transaction so that the only possible outcome is a rollback.
- *
- * @throws IllegalStateException If the transaction is not in an active
- * state.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void setRollbackOnly() throws IllegalStateException, SystemException
- {
- status = Status.STATUS_MARKED_ROLLBACK;
- }
-
- /**
- * Get the status of the transaction.
- *
- * @return The status of the transaction. This is one of the
- * {@link Status} constants.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public int getStatus() throws SystemException
- {
- return status;
- }
-
- /**
- * Change the transaction timeout for transactions started by the calling
- * thread with the {@link DummyTransactionManager#begin()} method.
- *
- * @param seconds The new timeout value, in seconds. If this parameter
- * is <code>0</code>, the timeout value is reset to the default
- * value.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void setTransactionTimeout(int seconds) throws SystemException
- {
- throw new SystemException("not supported");
- }
-
- /**
- * Enlist an XA resource with this transaction.
- *
- * @return <code>true</code> if the resource could be enlisted with
- * this transaction, otherwise <code>false</code>.
- * @throws RollbackException If the transaction is marked for rollback
- * only.
- * @throws IllegalStateException If the transaction is in a state
- * where resources cannot be enlisted. This could be because the
- * transaction is no longer active, or because it is in the
- * {@link Status#STATUS_PREPARED prepared state}.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public boolean enlistResource(XAResource xaRes)
- throws RollbackException, IllegalStateException, SystemException
- {
- throw new SystemException("not supported");
- }
-
- /**
- * Delist an XA resource from this transaction.
- *
- * @return <code>true</code> if the resource could be delisted from
- * this transaction, otherwise <code>false</code>.
- * @throws IllegalStateException If the transaction is in a state
- * where resources cannot be delisted. This could be because the
- * transaction is no longer active.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public boolean delistResource(XAResource xaRes, int flag)
- throws IllegalStateException, SystemException
- {
- throw new SystemException("not supported");
- }
-
- /**
- * Register a {@link Synchronization} callback with this transaction.
- *
- * @throws RollbackException If the transaction is marked for rollback
- * only.
- * @throws IllegalStateException If the transaction is in a state
- * where {@link Synchronization} callbacks cannot be registered.
- * This could be because the transaction is no longer active,
- * or because it is in the
- * {@link Status#STATUS_PREPARED prepared state}.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void registerSynchronization(Synchronization sync)
- throws RollbackException, IllegalStateException, SystemException
- {
- if (sync == null)
- throw new IllegalArgumentException("null synchronization " + this);
-
- switch (status)
- {
- case Status.STATUS_ACTIVE:
- case Status.STATUS_PREPARING:
- break;
- case Status.STATUS_PREPARED:
- throw new IllegalStateException("already prepared. " + this);
- case Status.STATUS_COMMITTING:
- throw new IllegalStateException("already started committing. " + this);
- case Status.STATUS_COMMITTED:
- throw new IllegalStateException("already committed. " + this);
- case Status.STATUS_MARKED_ROLLBACK:
- throw new RollbackException("already marked for rollback " + this);
- case Status.STATUS_ROLLING_BACK:
- throw new RollbackException("already started rolling back. " + this);
- case Status.STATUS_ROLLEDBACK:
- throw new RollbackException("already rolled back. " + this);
- case Status.STATUS_NO_TRANSACTION:
- throw new IllegalStateException("no transaction. " + this);
- case Status.STATUS_UNKNOWN:
- throw new IllegalStateException("unknown state " + this);
- default:
- throw new IllegalStateException("illegal status: " + status + " tx=" + this);
- }
-
- if (log.isDebugEnabled())
- {
- log.debug("registering synchronization handler " + sync);
- }
- participants.add(sync);
-
- }
-
- void setStatus(int new_status)
- {
- status = new_status;
- }
-
- protected boolean notifyBeforeCompletion()
- {
- boolean retval = true;
-
- for (Synchronization s : participants)
- {
- if (log.isDebugEnabled())
- {
- log.debug("processing beforeCompletion for " + s);
- }
- try
- {
- s.beforeCompletion();
- }
- catch (Throwable t)
- {
- retval = false;
- log.error("beforeCompletion() failed for " + s, t);
- }
- }
- return retval;
- }
-
- protected void notifyAfterCompletion(int status)
- {
- for (Synchronization s : participants)
- {
- if (log.isDebugEnabled())
- {
- log.debug("processing afterCompletion for " + s);
- }
- try
- {
- s.afterCompletion(status);
- }
- catch (Throwable t)
- {
- log.error("afterCompletion() failed for " + s, t);
- }
- }
- participants.clear();
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManager.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.Properties;
-
-/**
- * Simple transaction manager implementation that maintains transaction state
- * in memory only.
- *
- * @author bela
- * @version $Revision$
- * Date: May 15, 2003
- * Time: 4:11:37 PM
- */
-public class DummyTransactionManager extends DummyBaseTransactionManager
-{
- protected static DummyTransactionManager instance = null;
- protected static DummyUserTransaction utx = null;
-
- protected static Log log = LogFactory.getLog(DummyTransactionManager.class);
-
- private static final long serialVersionUID = 4396695354693176535L;
-
- public static DummyTransactionManager getInstance()
- {
- if (instance == null)
- {
- instance = new DummyTransactionManager();
- utx = new DummyUserTransaction(instance);
- try
- {
- Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
- Context ctx = new InitialContext(p);
- ctx.bind("java:/TransactionManager", instance);
- ctx.bind("UserTransaction", utx);
- }
- catch (NamingException e)
- {
- log.error("binding of DummyTransactionManager failed", e);
- }
- }
- return instance;
- }
-
- public static DummyUserTransaction getUserTransaction()
- {
- getInstance();
- return utx;
- }
-
- public static void destroy()
- {
- if (instance == null)
- return;
- try
- {
- Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
- Context ctx = new InitialContext(p);
- ctx.unbind("java:/TransactionManager");
- ctx.unbind("UserTransaction");
- }
- catch (NamingException e)
- {
- log.error("unbinding of DummyTransactionManager failed", e);
- }
- instance.setTransaction(null);
- instance = null;
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManagerLookup.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-
-
-/**
- * Returns an instance of {@link DummyTransactionManager}.
- *
- * @author Bela Ban Sept 5 2003
- * @version $Id$
- */
-public class DummyTransactionManagerLookup implements TransactionManagerLookup
-{
-
- public TransactionManager getTransactionManager() throws Exception
- {
- return DummyTransactionManager.getInstance();
- }
-
- public UserTransaction getUserTransaction()
- {
- return DummyTransactionManager.getUserTransaction();
- }
-
- public void cleanup()
- {
- DummyTransactionManager.destroy();
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyUserTransaction.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyUserTransaction.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyUserTransaction.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,155 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.UserTransaction;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author bela
- * @version $Revision$
- * Date: May 15, 2003
- * Time: 4:20:17 PM
- */
-public class DummyUserTransaction implements UserTransaction, java.io.Serializable
-{
- static final Log logger_ = LogFactory.getLog(DummyUserTransaction.class);
- DummyTransactionManager tm_;
- private static final long serialVersionUID = -6568400755677046127L;
-
- /**
- * List<Synchronization>
- */
- List<Synchronization> l = new ArrayList<Synchronization>();
-
- public DummyUserTransaction(DummyTransactionManager tm)
- {
- tm_ = tm;
- }
-
-
- /**
- * Starts a new transaction, and associate it with the calling thread.
- *
- * @throws NotSupportedException If the calling thread is already
- * associated with a transaction, and nested transactions are
- * not supported.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void begin() throws NotSupportedException, SystemException
- {
- tm_.begin();
- }
-
- /**
- * Attempt to commit this transaction.
- *
- * @throws RollbackException If the transaction was marked for rollback
- * only, the transaction is rolled back and this exception is
- * thrown.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- * @throws HeuristicMixedException If a heuristic decision was made and
- * some some parts of the transaction have been committed while
- * other parts have been rolled back.
- * @throws HeuristicRollbackException If a heuristic decision to roll
- * back the transaction was made.
- * @throws SecurityException If the caller is not allowed to commit this
- * transaction.
- */
- public void commit()
- throws RollbackException, HeuristicMixedException,
- HeuristicRollbackException, SecurityException, SystemException
- {
-
- tm_.commit();
- }
-
- /**
- * Rolls back this transaction.
- *
- * @throws IllegalStateException If the transaction is in a state
- * where it cannot be rolled back. This could be because the
- * transaction is no longer active, or because it is in the
- * {@link Status#STATUS_PREPARED prepared state}.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void rollback() throws IllegalStateException, SystemException
- {
- tm_.rollback();
- }
-
- /**
- * Mark the transaction so that the only possible outcome is a rollback.
- *
- * @throws IllegalStateException If the transaction is not in an active
- * state.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void setRollbackOnly() throws IllegalStateException, SystemException
- {
- tm_.setRollbackOnly();
- }
-
- /**
- * Get the status of the transaction.
- *
- * @return The status of the transaction. This is one of the
- * {@link Status} constants.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public int getStatus() throws SystemException
- {
- return tm_.getStatus();
- }
-
- /**
- * Change the transaction timeout for transactions started by the calling
- * thread with the {@link #begin()} method.
- *
- * @param seconds The new timeout value, in seconds. If this parameter
- * is <code>0</code>, the timeout value is reset to the default
- * value.
- * @throws SystemException If the transaction service fails in an
- * unexpected way.
- */
- public void setTransactionTimeout(int seconds) throws SystemException
- {
- throw new SystemException("not supported");
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,206 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.transaction.TransactionManager;
-import java.lang.reflect.Method;
-
-/**
- * A transaction manager lookup class that attempts to locate a TransactionManager.
- * A variety of different classes and JNDI locations are tried, for servers
- * such as:
- * <ul>
- * <li> JBoss
- * <li> JRun4
- * <li> Resin
- * <li> Orion
- * <li> JOnAS
- * <li> BEA Weblogic
- * <li> Websphere 4.0, 5.0, 5.1, 6.0
- * <li> Sun, Glassfish
- * </ul>
- * If a transaction manager is not found, returns a {@link DummyTransactionManager}.
- *
- * @author Markus Plesser
- * @version $Id$
- */
-public class GenericTransactionManagerLookup implements TransactionManagerLookup
-{
-
- private static final Log log = LogFactory.getLog(GenericTransactionManagerLookup.class);
-
- /**
- * JNDI lookups performed?
- */
- private static boolean lookupDone = false;
-
- /**
- * No JNDI available?
- */
- private static boolean lookupFailed = false;
-
- /**
- * The JVM TransactionManager found.
- */
- private static TransactionManager tm = null;
-
- /**
- * JNDI locations for TransactionManagers we know of
- */
- private static String[][] knownJNDIManagers =
- {
- {"java:/TransactionManager", "JBoss, JRun4"},
- {"java:comp/TransactionManager", "Resin 3.x"},
- {"java:appserver/TransactionManager", "Sun Glassfish"},
- {"java:pm/TransactionManager", "Borland, Sun"},
- {"javax.transaction.TransactionManager", "BEA WebLogic"},
- {"java:comp/UserTransaction", "Resin, Orion, JOnAS (JOTM)"},
- };
-
- /**
- * WebSphere 5.1 and 6.0 TransactionManagerFactory
- */
- private static final String WS_FACTORY_CLASS_5_1 = "com.ibm.ws.Transaction.TransactionManagerFactory";
-
- /**
- * WebSphere 5.0 TransactionManagerFactory
- */
- private static final String WS_FACTORY_CLASS_5_0 = "com.ibm.ejs.jts.jta.TransactionManagerFactory";
-
- /**
- * WebSphere 4.0 TransactionManagerFactory
- */
- private static final String WS_FACTORY_CLASS_4 = "com.ibm.ejs.jts.jta.JTSXA";
-
- /**
- * Get the systemwide used TransactionManager
- *
- * @return TransactionManager
- */
- public TransactionManager getTransactionManager()
- {
- if (!lookupDone)
- doLookups();
- if (tm != null)
- return tm;
- if (lookupFailed)
- {
- //fall back to a dummy from JBossCache
- tm = DummyTransactionManager.getInstance();
- log.warn("Falling back to DummyTransactionManager from JBossCache");
- }
- return tm;
- }
-
- /**
- * Try to figure out which TransactionManager to use
- */
- private static void doLookups()
- {
- if (lookupFailed)
- return;
- InitialContext ctx;
- try
- {
- ctx = new InitialContext();
- }
- catch (NamingException e)
- {
- log.error("Failed creating initial JNDI context", e);
- lookupFailed = true;
- return;
- }
- //probe jndi lookups first
- for (String[] knownJNDIManager : knownJNDIManagers)
- {
- Object jndiObject;
- try
- {
- if (log.isDebugEnabled())
- log.debug("Trying to lookup TransactionManager for " + knownJNDIManager[1]);
- jndiObject = ctx.lookup(knownJNDIManager[0]);
- }
- catch (NamingException e)
- {
- log.debug("Failed to perform a lookup for [" + knownJNDIManager[0] + " (" + knownJNDIManager[1]
- + ")]");
- continue;
- }
- if (jndiObject instanceof TransactionManager)
- {
- tm = (TransactionManager) jndiObject;
- log.debug("Found TransactionManager for " + knownJNDIManager[1]);
- return;
- }
- }
- //try to find websphere lookups since we came here
- Class clazz;
- try
- {
- log.debug("Trying WebSphere 5.1: " + WS_FACTORY_CLASS_5_1);
- clazz = Class.forName(WS_FACTORY_CLASS_5_1);
- log.debug("Found WebSphere 5.1: " + WS_FACTORY_CLASS_5_1);
- }
- catch (ClassNotFoundException ex)
- {
- try
- {
- log.debug("Trying WebSphere 5.0: " + WS_FACTORY_CLASS_5_0);
- clazz = Class.forName(WS_FACTORY_CLASS_5_0);
- log.debug("Found WebSphere 5.0: " + WS_FACTORY_CLASS_5_0);
- }
- catch (ClassNotFoundException ex2)
- {
- try
- {
- log.debug("Trying WebSphere 4: " + WS_FACTORY_CLASS_4);
- clazz = Class.forName(WS_FACTORY_CLASS_4);
- log.debug("Found WebSphere 4: " + WS_FACTORY_CLASS_4);
- }
- catch (ClassNotFoundException ex3)
- {
- log.debug("Couldn't find any WebSphere TransactionManager factory class, neither for WebSphere version 5.1 nor 5.0 nor 4");
- lookupFailed = true;
- return;
- }
- }
- }
- try
- {
- Class[] signature = null;
- Object[] args = null;
- Method method = clazz.getMethod("getTransactionManager", signature);
- tm = (TransactionManager) method.invoke(null, args);
- }
- catch (Exception ex)
- {
- log.error("Found WebSphere TransactionManager factory class [" + clazz.getName()
- + "], but couldn't invoke its static 'getTransactionManager' method", ex);
- }
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-
-import org.jgroups.Address;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-
-/**
- * Uniquely identifies a transaction that spans all nodes in a cluster. This is used when
- * replicating all modifications in a transaction; the PREPARE and COMMIT (or ROLLBACK)
- * messages have to have a unique identifier to associate the changes with<br>
- *
- * @author <a href="mailto:bela@jboss.org">Bela Ban</a> Apr 12, 2003
- * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
- * @version $Revision$
- */
-public class GlobalTransaction implements Externalizable
-{
-
- private static final long serialVersionUID = 8011434781266976149L;
-
- private static long sid = 0;
-
- private Address addr = null;
- private long id = -1;
- private transient boolean remote = false;
-
- // cache the hashcode
- private transient int hash_code = -1; // in the worst case, hashCode() returns 0, then increases, so we're safe here
-
- /**
- * empty ctor used by externalization
- */
- public GlobalTransaction()
- {
- }
-
- private GlobalTransaction(Address addr)
- {
- this.addr = addr;
- id = newId();
- }
-
- private static synchronized long newId()
- {
- return ++sid;
- }
-
- public static GlobalTransaction create(Address addr)
- {
- return new GlobalTransaction(addr);
- }
-
- public Object getAddress()
- {
- return addr;
- }
-
- public void setAddress(Address address)
- {
- addr = address;
- }
-
- public long getId()
- {
- return id;
- }
-
- @Override
- public int hashCode()
- {
- if (hash_code == -1)
- {
- hash_code = (addr != null ? addr.hashCode() : 0) + (int) id;
- }
- return hash_code;
- }
-
- @Override
- public boolean equals(Object other)
- {
- if (this == other)
- return true;
- if (!(other instanceof GlobalTransaction))
- return false;
-
- GlobalTransaction otherGtx = (GlobalTransaction) other;
- boolean aeq = (addr == null) ? (otherGtx.addr == null) : addr.equals(otherGtx.addr);
- return aeq && (id == otherGtx.id);
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("GlobalTransaction:<").append(addr).append(">:").append(id);
- return sb.toString();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeObject(addr);
- out.writeLong(id);
- // out.writeInt(hash_code);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- addr = (Address) in.readObject();
- id = in.readLong();
- hash_code = -1;
- }
-
- /**
- * @return Returns the remote.
- */
- public boolean isRemote()
- {
- return remote;
- }
-
- /**
- * @param remote The remote to set.
- */
- public void setRemote(boolean remote)
- {
- this.remote = remote;
- }
-
-
- public void setId(long id)
- {
- this.id = id;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-import java.lang.reflect.Method;
-
-/**
- * JTA standalone TM lookup.
- *
- * @author Jason T. Greene
- */
-public class JBossStandaloneJTAManagerLookup implements TransactionManagerLookup
-{
- private Method manager, user;
-
- public JBossStandaloneJTAManagerLookup()
- {
- try
- {
- manager = Class.forName("com.arjuna.ats.jta.TransactionManager").getMethod("transactionManager");
- user = Class.forName("com.arjuna.ats.jta.UserTransaction").getMethod("userTransaction");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public TransactionManager getTransactionManager() throws Exception
- {
- return (TransactionManager) manager.invoke(null);
- }
-
- public UserTransaction getUserTransaction() throws Exception
- {
- return (UserTransaction) user.invoke(null);
- }
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossTransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossTransactionManagerLookup.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import javax.naming.InitialContext;
-import javax.transaction.TransactionManager;
-
-
-/**
- * Uses JNDI to look-up the
- * {@link TransactionManager} instance from "java:/TransactionManager".
- *
- * @author Bela Ban, Aug 26 2003
- * @version $Id$
- */
-public class JBossTransactionManagerLookup implements TransactionManagerLookup
-{
-
- public TransactionManager getTransactionManager() throws Exception
- {
- return (TransactionManager) new InitialContext().lookup("java:/TransactionManager");
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.transaction;
-
-import javax.transaction.TransactionManager;
-
-/**
- * Factory interface, allows {@link org.jboss.cache.Cache_Legacy} to use different transactional systems.
- * Names of implementors of this class can be configured using
- * {@link Configuration#setTransactionManagerLookupClass}.
- *
- * @author Bela Ban, Aug 26 2003
- * @version $Id$
- */
-public interface TransactionManagerLookup
-{
-
- /**
- * Returns a new TransactionManager.
- *
- * @throws Exception if lookup failed
- */
- TransactionManager getTransactionManager() throws Exception;
-
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -29,6 +29,7 @@
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.starobrno.factories.context.ContextFactory;
+import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jgroups.Address;
import javax.transaction.Status;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,802 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.util;
-
-import org.jboss.cache.Cache_Legacy;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.starobrno.tree.Fqn;
-import org.jboss.starobrno.util.SimpleImmutableEntry;
-
-import java.util.*;
-
-/**
- * Adaptors for {@link org.jboss.cache.Cache_Legacy} classes, such as {@link Node}.
- * This is useful for integration of JBoss Cache into existing applications.
- * <p/>
- * Example use:
- * <pre>
- * Cache c = ...;
- * Map m = Caches.asMap(c);
- * m.put("a", "b"); // null
- * m.containsKey("a"); // true
- * m.remove("a"); // "b"
- * </pre>
- */
-public class Caches
-{
-
- private Caches()
- {
- }
-
- /**
- * Returns a {@link Map} from the root node.
- *
- * @param cache cache to wrap as a map
- * @return a map representation of the cache
- * @see #asMap(Node)
- */
- public static <K, V> Map<K, V> asMap(Cache_Legacy<K, V> cache)
- {
- if (cache == null) throw new NullPointerException("cache");
- return asMap(cache.getRoot());
- }
-
- /**
- * Returns a {@link Map}, where map keys are named children of the given Node,
- * and values are kept under a single key for this node.
- * The map may be safely concurrently modified through this Map or externally,
- * and its contents reflect the cache state and
- * existing data of the Node.
- * This means that {@link ConcurrentModificationException} is never thrown
- * and all methods are thread safe.
- * <p/>
- * The map is not serializable.
- * <p/>
- * Usage note: As a single node is used for every key, it is most efficient to store
- * data for a single entity (e.g. Person) in a single object.
- * <p/>
- * Also, when using a {@link CacheLoader} for storage, keys used must be valid as
- * part of the {@link Fqn} used in calls. Generally speaking, simple string values are
- * preferred.
- *
- * @param node node in a cache to wrap
- * @return a Map representation of the cache
- */
- public static <K, V> Map<K, V> asMap(Node<K, V> node)
- {
- return new MapNode<K, V>(node);
- }
-
- /**
- * Returns a {@link Map}, where map data is put and returned directly from a single Node.
- * This method is "simple" as data is kept under a single node.
- * Note that storing all data in a single Node can be inefficient when using persistence,
- * replication, or transactions.
- * The map may be safely concurrently modified through this Map or externally.
- * This means that {@link ConcurrentModificationException} is never thrown
- * and all methods are thread safe.
- * <p/>
- * The methods {@link Map#entrySet} and {@link Map#values} and {@link Map#keySet}
- * do not allow for modification of the Node.
- * Further all these methods return a collection which is a snapshot (copy)
- * of the data at time of calling. This may be very inefficient.
- * <p/>
- * The map is not serializable.
- *
- * @param node node to wrap
- * @return Map representation of the cache
- */
- public static <K, V> Map<K, V> asSimpleMap(Node<K, V> node)
- {
- return new SimpleMapNode<K, V>(node);
- }
-
- /**
- * Returns a {@link Set}, where set entries are data entries of the given Node.
- * This method is "simple" as data is kept under a single node.
- * <p/>
- * Note that storing all data in a single Node can be inefficient when using persistence,
- * replication, or transactions.
- * The set may be safely concurrently modified through this Map or externally.
- * This means that {@link ConcurrentModificationException} is never thrown
- * and all methods are thread safe.
- * <p/>
- * The set is not serializable.
- *
- * @param node node to wrap
- * @return a Set representation of the values in a node
- */
- public static <K, V> Set<V> asSimpleSet(Node<K, V> node)
- {
- return new SimpleSetNode<V>(node);
- }
-
- /**
- * Returns a {@link Map}, where map entries are partitioned into
- * children nodes, within a cache node.
- * The default child selector divides the data into 128 child nodes based on hash code.
- * Note that for large data sets, the number of child nodes should be increased.
- *
- * @param node node to cache under
- * @return a Map representation of the cache
- */
- @SuppressWarnings("unchecked")
- public static <K, V> Map<K, V> asPartitionedMap(Node<K, V> node)
- {
- return new PartitionedMapNode<K, V>(node, HashKeySelector.DEFAULT);
- }
-
- /**
- * Returns a {@link Map}, where map entries are partitioned
- * into children, within a cache node, by key hash code.
- * <p/>
- * The map is not serializable.
- * <p/>
- * Usage note: This is a performance (and size) compromise between {@link #asMap(Node)}
- * and {@link #asSimpleMap(Node)}. For applications using a {@link org.jboss.cache.loader.CacheLoader},
- * {@link #asMap(Node)} is a better choice.
- * <p/>
- *
- * @param node node to cache under
- * @param ss selector strategy that chooses a segment based on key
- * @return a Map representation of the cache
- */
- public static <K, V> Map<K, V> asPartitionedMap(Node<K, V> node, ChildSelector<K> ss)
- {
- return new PartitionedMapNode<K, V>(node, ss);
- }
-
- /**
- * Returns a {@link Map}, where map entries are partitioned into child nodes,
- * within the cache root, by key hash code.
- *
- * @param cache cache to use
- * @return a Map representation of the cache
- */
- public static <K, V> Map<K, V> asPartitionedMap(Cache_Legacy<K, V> cache)
- {
- return asPartitionedMap(cache.getRoot());
- }
-
- /**
- * Computes an improved hash code from an object's hash code.
- */
- static protected final int hashCode(int i)
- {
- i ^= i >>> 20 ^ i >>> 12;
- return i ^ i >>> 7 ^ i >>> 4;
- }
-
- /**
- * Returns a segment ({@link Node#getChild(Object) child node name})
- * to use based on the characteristics of a key.
- * <p/>
- * Here is an example class which selects a child based on a person's department:
- * <pre>
- * public static class DepartmentSelector implements ChildSelector<Person>
- * {
- * public Object childName(Person key)
- * {
- * return key.getDepartment();
- * }
- * }
- * </pre>
- */
- public interface ChildSelector<T>
- {
- /**
- * Returns a child node name for a key.
- *
- * @param key for calls to {@link Map#put}, {@link Map#get} etc.
- * @return node name
- */
- Fqn childName(T key);
- }
-
- /**
- * Class that returns a child name to use based on the hash code of a key.
- */
- public static class HashKeySelector<T> implements ChildSelector<T>
- {
-
- static ChildSelector DEFAULT = new HashKeySelector(128);
-
- protected int segments;
-
- /**
- * Constructs with N segments, where N must be a power of 2.
- *
- * @param segments Number of hash segments
- */
- public HashKeySelector(int segments)
- {
- this.segments = segments;
- if (Integer.bitCount(segments) != 1)
- throw new IllegalArgumentException();
- if (segments <= 0)
- throw new IllegalArgumentException();
- }
-
- /**
- * Returns the segment for this key, in the inclusive range 0 to {@link #segments} - 1.
- */
- protected final int segmentFor(T key)
- {
- if (key == null)
- return 0;
- int hc = key.hashCode();
- return Caches.hashCode(hc) & (segments - 1);
- }
-
- /**
- * Returns the node name for this segment.
- */
- protected final Fqn childName(int segment)
- {
- return Fqn.fromElements(Integer.toString(segment));
- }
-
- /**
- * Returns the node name for this key.
- * By default, returns a String containing the segment.
- */
- public final Fqn childName(T key)
- {
- return childName(segmentFor(key));
- }
-
- @Override
- public String toString()
- {
- return super.toString() + " segments=" + segments;
- }
-
- }
-
- static class MapNode<K, V> extends AbstractMap<K, V>
- {
-
- public static final String KEY = "K";
-
- private Node node; // purposefully un-genericized
-
- public MapNode(Node<K, V> node)
- {
- if (node == null)
- throw new NullPointerException("node");
- this.node = node;
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet()
- {
- return new AbstractSet<Map.Entry<K, V>>()
- {
-
- @Override
- public Iterator<Map.Entry<K, V>> iterator()
- {
- final Iterator<Node<K, V>> i = set().iterator();
- return new Iterator<Map.Entry<K, V>>()
- {
-
- Object name;
-
- boolean next = false;
-
- public boolean hasNext()
- {
- return i.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public Entry<K, V> next()
- {
- Node n = i.next();
- this.name = n.getFqn().getLastElement();
- this.next = true;
- Object key = n.get(KEY);
- return new SimpleImmutableEntry(name, key);
- }
-
- public void remove()
- {
- if (!next)
- throw new IllegalStateException();
- node.removeChild(name);
- }
-
- @Override
- public String toString()
- {
- return "Itr name=" + name;
- }
-
- };
- }
-
- @SuppressWarnings("unchecked")
- private Set<Node<K, V>> set()
- {
- return node.getChildren();
- }
-
- @Override
- public int size()
- {
- return set().size();
- }
-
- };
- }
-
- @Override
- public void clear()
- {
- for (Object o : node.getChildrenNames())
- node.removeChild(o);
- }
-
- @Override
- public boolean containsKey(Object arg0)
- {
- return node.getChild(arg0) != null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V get(Object arg0)
- {
- Node child = node.getChild(arg0);
- if (child == null)
- return null;
- return (V) child.get(KEY);
- }
-
- @Override
- public boolean isEmpty()
- {
- return node.getChildrenNames().isEmpty();
- }
-
- @Override
- public Set<K> keySet()
- {
-
- return new AbstractSet<K>()
- {
-
- private Set set()
- {
- return node.getChildrenNames();
- }
-
- @Override
- public Iterator<K> iterator()
- {
- final Iterator i = set().iterator();
- return new Iterator<K>()
- {
-
- K child;
-
- public boolean hasNext()
- {
- return i.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public K next()
- {
- child = (K) i.next();
- return child;
- }
-
- public void remove()
- {
- if (child == null)
- throw new IllegalStateException();
- node.removeChild(child);
- // since set is read-only, invalidate
- }
-
- };
- }
-
- @Override
- public boolean remove(Object key)
- {
- return node.removeChild(key);
- }
-
- @Override
- public int size()
- {
- return set().size();
- }
-
- };
-
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V put(K arg0, V arg1)
- {
- return (V) node.addChild(Fqn.fromElements(arg0)).put(KEY, arg1);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V remove(Object arg0)
- {
- Node child = node.getChild(arg0);
- if (child == null)
- return null;
- V o = (V) child.remove(KEY);
- node.removeChild(arg0);
- return o;
- }
-
- @Override
- public int size()
- {
- return node.getChildrenNames().size();
- }
-
- }
-
- static class SimpleMapNode<K, V> extends AbstractMap<K, V>
- {
-
- private Node<K, V> node;
-
- public SimpleMapNode(Node<K, V> node)
- {
- if (node == null)
- throw new NullPointerException("node");
- this.node = node;
- }
-
- @Override
- public void clear()
- {
- node.clearData();
- }
-
- @Override
- public boolean containsKey(Object key)
- {
- return node.getKeys().contains(key);
- }
-
- @Override
- public boolean containsValue(Object value)
- {
- return node.getData().containsValue(value);
- }
-
- /**
- * getData returns a snapshot of the data.
- */
- @Override
- public Set<Map.Entry<K, V>> entrySet()
- {
- return node.getData().entrySet();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V get(Object key)
- {
- return node.get((K) key);
- }
-
- @Override
- public Set<K> keySet()
- {
- return node.getKeys();
- }
-
- @Override
- public V put(K key, V value)
- {
- return node.put(key, value);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void putAll(Map<? extends K, ? extends V> map)
- {
- node.putAll((Map) map);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V remove(Object key)
- {
- return node.remove((K) key);
- }
-
- @Override
- public int size()
- {
- return node.dataSize();
- }
-
- }
-
- static class SimpleSetNode<K> extends AbstractSet<K> implements java.util.Set<K>
- {
-
- private Node node;
-
- private static final String VALUE = "V";
-
- public <K, V> SimpleSetNode(Node<K, V> node)
- {
- if (node == null)
- throw new NullPointerException("node");
- this.node = node;
- }
-
- @Override
- public void clear()
- {
- node.clearData();
- }
-
- @Override
- public boolean contains(Object key)
- {
- return node.getKeys().contains(key);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public boolean remove(Object key)
- {
- return node.remove(key) != null;
- }
-
- @Override
- public int size()
- {
- return node.dataSize();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public boolean add(K arg0)
- {
- return node.put(arg0, VALUE) == null;
- }
-
- @Override
- public Iterator<K> iterator()
- {
- final Iterator i = node.getKeys().iterator();
- return new Iterator<K>()
- {
- K key;
-
- boolean next = false;
-
- public boolean hasNext()
- {
- return i.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public K next()
- {
- key = (K) i.next();
- next = true;
- return key;
- }
-
- @SuppressWarnings("unchecked")
- public void remove()
- {
- if (!next)
- throw new IllegalStateException();
- node.remove(key);
- }
-
- };
- }
-
- }
-
- static class PartitionedMapNode<K, V> extends AbstractMap<K, V>
- {
-
- private NodeSPI node;
-
- private ChildSelector<K> selector;
-
- public PartitionedMapNode(Node<K, V> node, ChildSelector<K> selector)
- {
- this.node = (NodeSPI) node;
- this.selector = selector;
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet()
- {
- return new AbstractSet<Map.Entry<K, V>>()
- {
-
- Iterator<Node> ci = node.getChildren().iterator();
-
- @Override
- public Iterator<Entry<K, V>> iterator()
- {
- return new Iterator<Entry<K, V>>()
- {
-
- Iterator ni;
-
- {
- nextChild();
- findNext();
- }
-
- @SuppressWarnings("unchecked")
- private void nextChild()
- {
- ni = new SimpleMapNode(ci.next()).entrySet().iterator();
- }
-
- private void findNext()
- {
- while (!ni.hasNext())
- {
- if (!ci.hasNext())
- return;
- nextChild();
- }
- }
-
- public boolean hasNext()
- {
- return ni.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public Entry<K, V> next()
- {
- Entry<K, V> n = (Entry<K, V>) ni.next();
- findNext();
- return n;
- }
-
- public void remove()
- {
- ni.remove();
- }
-
- };
- }
-
- @Override
- public int size()
- {
- return PartitionedMapNode.this.size();
- }
-
- };
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Set keySet()
- {
- return new AbstractSet<Map.Entry<K, V>>()
- {
-
- @Override
- @SuppressWarnings("unchecked")
- public Iterator<Entry<K, V>> iterator()
- {
- return (Iterator<Entry<K, V>>) PartitionedMapNode.super.keySet().iterator();
- }
-
- @Override
- public boolean remove(Object o)
- {
- boolean key = PartitionedMapNode.this.containsKey(o);
- PartitionedMapNode.this.remove(o);
- return key;
- }
-
- @Override
- public boolean contains(Object o)
- {
- return PartitionedMapNode.this.containsKey(o);
- }
-
- @Override
- public int size()
- {
- return PartitionedMapNode.super.keySet().size();
- }
-
- };
- }
-
- @Override
- public void clear()
- {
- for (Object o : node.getChildrenNames())
- node.getChild(o).clearData();
- }
-
- @SuppressWarnings("unchecked")
- private Fqn fqnFor(Object o)
- {
- return Fqn.fromRelativeFqn(node.getFqn(), selector.childName((K) o));
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public boolean containsKey(Object o)
- {
- Fqn fqn = fqnFor(o);
- Set keys = node.getCache().getKeys(fqn);
- return keys != null && keys.contains(o);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public V get(Object key)
- {
- return (V) node.getCache().get(fqnFor(key), key);
- }
-
- @SuppressWarnings("unchecked")
- public Object put(Object key, Object value)
- {
- return node.getCache().put(fqnFor(key), key, value);
- }
-
- @SuppressWarnings("unchecked")
- public V remove(Object key)
- {
- return (V) node.getCache().remove(fqnFor(key), key);
- }
-
- public int size()
- {
- int size = 0;
- for (Object o : node.getChildrenNames())
- {
- Node child = node.getChild(o);
- size += child.dataSize();
- }
- return size;
- }
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/TransactionManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/TransactionManagerFactory.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/TransactionManagerFactory.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -21,10 +21,10 @@
*/
package org.jboss.starobrno.factories;
-import org.jboss.cache.transaction.BatchModeTransactionManager;
-import org.jboss.cache.transaction.TransactionManagerLookup;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.transaction.BatchModeTransactionManager;
+import org.jboss.starobrno.transaction.TransactionManagerLookup;
import javax.transaction.TransactionManager;
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/BatchModeTransactionManager.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManager.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/BatchModeTransactionManager.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/BatchModeTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Not really a transaction manager in the truest sense of the word. Only used to batch up operations. Proper
+ * transactional symantics of rollbacks and recovery are NOT used here. This is used by PojoCache.
+ *
+ * @author bela
+ * @version $Revision$
+ * Date: May 15, 2003
+ * Time: 4:11:37 PM
+ */
+public class BatchModeTransactionManager extends DummyBaseTransactionManager
+{
+ static BatchModeTransactionManager instance = null;
+ static Log log = LogFactory.getLog(BatchModeTransactionManager.class);
+ private static final long serialVersionUID = 5656602677430350961L;
+
+ public static BatchModeTransactionManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new BatchModeTransactionManager();
+ }
+ return instance;
+ }
+
+ public static void destroy()
+ {
+ if (instance == null) return;
+ instance.setTransaction(null);
+ instance = null;
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/BatchModeTransactionManager.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyBaseTransactionManager.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyBaseTransactionManager.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyBaseTransactionManager.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyBaseTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.*;
+
+/**
+ * @author bela
+ * @version $Revision$
+ * Date: May 15, 2003
+ * Time: 4:11:37 PM
+ */
+public class DummyBaseTransactionManager implements TransactionManager, java.io.Serializable
+{
+ static ThreadLocal<Transaction> thread_local = new ThreadLocal<Transaction>();
+ private static final long serialVersionUID = -6716097342564237376l;
+ private static final Log log = LogFactory.getLog(DummyBaseTransactionManager.class);
+ private static final boolean trace = log.isTraceEnabled();
+
+ /**
+ * Starts a new transaction, and associate it with the calling thread.
+ *
+ * @throws javax.transaction.NotSupportedException
+ * If the calling thread is already
+ * associated with a transaction, and nested transactions are
+ * not supported.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public void begin() throws NotSupportedException, SystemException
+ {
+ Transaction currentTx;
+ if ((currentTx = getTransaction()) != null)
+ throw new NotSupportedException(Thread.currentThread() +
+ " is already associated with a transaction (" + currentTx + ")");
+ DummyTransaction tx = new DummyTransaction(this);
+ setTransaction(tx);
+ }
+
+ /**
+ * Commit the transaction associated with the calling thread.
+ *
+ * @throws javax.transaction.RollbackException
+ * If the transaction was marked for rollback
+ * only, the transaction is rolled back and this exception is
+ * thrown.
+ * @throws IllegalStateException If the calling thread is not associated
+ * with a transaction.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ * @throws javax.transaction.HeuristicMixedException
+ * If a heuristic decision was made and
+ * some some parts of the transaction have been committed while
+ * other parts have been rolled back.
+ * @throws javax.transaction.HeuristicRollbackException
+ * If a heuristic decision to roll
+ * back the transaction was made.
+ * @throws SecurityException If the caller is not allowed to commit this
+ * transaction.
+ */
+ public void commit() throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, SecurityException,
+ IllegalStateException, SystemException
+ {
+ int status;
+ Transaction tx = getTransaction();
+ if (tx == null)
+ throw new IllegalStateException("thread not associated with transaction");
+ status = tx.getStatus();
+ if (status == Status.STATUS_MARKED_ROLLBACK)
+ throw new RollbackException();
+ tx.commit();
+
+ // Disassociate tx from thread.
+ setTransaction(null);
+ }
+
+ /**
+ * Rolls back the transaction associated with the calling thread.
+ *
+ * @throws IllegalStateException If the transaction is in a state
+ * where it cannot be rolled back. This could be because the
+ * calling thread is not associated with a transaction, or
+ * because it is in the
+ * {@link javax.transaction.Status#STATUS_PREPARED prepared state}.
+ * @throws SecurityException If the caller is not allowed to roll back
+ * this transaction.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public void rollback() throws IllegalStateException, SecurityException,
+ SystemException
+ {
+ Transaction tx = getTransaction();
+ if (tx == null)
+ throw new IllegalStateException("no transaction associated with thread");
+ tx.rollback();
+
+ // Disassociate tx from thread.
+ setTransaction(null);
+ }
+
+ /**
+ * Mark the transaction associated with the calling thread for rollback
+ * only.
+ *
+ * @throws IllegalStateException If the transaction is in a state
+ * where it cannot be rolled back. This could be because the
+ * calling thread is not associated with a transaction, or
+ * because it is in the
+ * {@link javax.transaction.Status#STATUS_PREPARED prepared state}.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+ Transaction tx = getTransaction();
+ if (tx == null)
+ throw new IllegalStateException("no transaction associated with calling thread");
+ tx.setRollbackOnly();
+ }
+
+ /**
+ * Get the status of the transaction associated with the calling thread.
+ *
+ * @return The status of the transaction. This is one of the
+ * {@link javax.transaction.Status} constants. If no transaction is associated
+ * with the calling thread,
+ * {@link javax.transaction.Status#STATUS_NO_TRANSACTION} is returned.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public int getStatus() throws SystemException
+ {
+ Transaction tx = getTransaction();
+ return tx != null ? tx.getStatus() : Status.STATUS_NO_TRANSACTION;
+ }
+
+ /**
+ * Get the transaction associated with the calling thread.
+ *
+ * @return The transaction associated with the calling thread, or
+ * <code>null</code> if the calling thread is not associated
+ * with a transaction.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public Transaction getTransaction() throws SystemException
+ {
+ return thread_local.get();
+ }
+
+ /**
+ * Change the transaction timeout for transactions started by the calling
+ * thread with the {@link #begin()} method.
+ *
+ * @param seconds The new timeout value, in seconds. If this parameter
+ * is <code>0</code>, the timeout value is reset to the default
+ * value.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setTransactionTimeout(int seconds) throws SystemException
+ {
+ throw new SystemException("not supported");
+ }
+
+ /**
+ * Suspend the association the calling thread has to a transaction,
+ * and return the suspended transaction.
+ * When returning from this method, the calling thread is no longer
+ * associated with a transaction.
+ *
+ * @return The transaction that the calling thread was associated with,
+ * or <code>null</code> if the calling thread was not associated
+ * with a transaction.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public Transaction suspend() throws SystemException
+ {
+ Transaction retval = getTransaction();
+ setTransaction(null);
+ if (trace) log.trace("Suspending tx " + retval);
+ return retval;
+ }
+
+ /**
+ * Resume the association of the calling thread with the given
+ * transaction.
+ *
+ * @param tx The transaction to be associated with the calling thread.
+ * @throws javax.transaction.InvalidTransactionException
+ * If the argument does not represent
+ * a valid transaction.
+ * @throws IllegalStateException If the calling thread is already
+ * associated with a transaction.
+ * @throws javax.transaction.SystemException
+ * If the transaction service fails in an
+ * unexpected way.
+ */
+ public void resume(Transaction tx) throws InvalidTransactionException, IllegalStateException, SystemException
+ {
+ if (trace) log.trace("Resuming tx " + tx);
+ setTransaction(tx);
+ }
+
+ /**
+ * Just used for unit tests
+ *
+ * @param tx
+ */
+ public void setTransaction(Transaction tx)
+ {
+ thread_local.set(tx);
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyBaseTransactionManager.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransaction.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransaction.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransaction.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransaction.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,307 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.*;
+import javax.transaction.xa.XAResource;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+/**
+ * @author bela
+ * @version $Revision$
+ * Date: May 15, 2003
+ * Time: 4:20:17 PM
+ */
+public class DummyTransaction implements Transaction
+{
+ private int status = Status.STATUS_UNKNOWN;
+ private static final Log log = LogFactory.getLog(DummyTransaction.class);
+ protected DummyBaseTransactionManager tm_;
+
+ protected final Set<Synchronization> participants = new CopyOnWriteArraySet<Synchronization>();
+
+ public DummyTransaction(DummyBaseTransactionManager tm)
+ {
+ tm_ = tm;
+ status = Status.STATUS_ACTIVE;
+ }
+
+ /**
+ * Attempt to commit this transaction.
+ *
+ * @throws RollbackException If the transaction was marked for rollback
+ * only, the transaction is rolled back and this exception is
+ * thrown.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ * @throws HeuristicMixedException If a heuristic decision was made and
+ * some some parts of the transaction have been committed while
+ * other parts have been rolled back.
+ * @throws HeuristicRollbackException If a heuristic decision to roll
+ * back the transaction was made.
+ * @throws SecurityException If the caller is not allowed to commit this
+ * transaction.
+ */
+ public void commit()
+ throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
+ SecurityException, SystemException
+ {
+ boolean doCommit;
+ status = Status.STATUS_PREPARING;
+ try
+ {
+ boolean outcome = notifyBeforeCompletion();
+ // status=Status.STATUS_PREPARED;
+ if (outcome && status != Status.STATUS_MARKED_ROLLBACK)
+ {
+ status = Status.STATUS_COMMITTING;
+ doCommit = true;
+ }
+ else
+ {
+ status = Status.STATUS_ROLLING_BACK;
+ doCommit = false;
+ }
+ notifyAfterCompletion(doCommit ? Status.STATUS_COMMITTED : Status.STATUS_MARKED_ROLLBACK);
+ status = doCommit ? Status.STATUS_COMMITTED : Status.STATUS_MARKED_ROLLBACK;
+ if (!doCommit) throw new RollbackException("outcome is " + outcome + " status: " + status);
+ }
+ finally
+ {
+ // Disassociate tx from thread.
+ tm_.setTransaction(null);
+ }
+ }
+
+ /**
+ * Rolls back this transaction.
+ *
+ * @throws IllegalStateException If the transaction is in a state
+ * where it cannot be rolled back. This could be because the
+ * transaction is no longer active, or because it is in the
+ * {@link Status#STATUS_PREPARED prepared state}.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void rollback() throws IllegalStateException, SystemException
+ {
+ try
+ {
+ // JBCACHE-360 -- to match JBossTM (and presumable the spec) a
+ // rollback transaction should have status ROLLEDBACK before
+ // calling afterCompletion().
+ //status=Status.STATUS_ROLLING_BACK;
+ status = Status.STATUS_ROLLEDBACK;
+ notifyAfterCompletion(Status.STATUS_ROLLEDBACK);
+ }
+ catch (Throwable t)
+ {
+ }
+ status = Status.STATUS_ROLLEDBACK;
+
+ // Disassociate tx from thread.
+ tm_.setTransaction(null);
+ }
+
+ /**
+ * Mark the transaction so that the only possible outcome is a rollback.
+ *
+ * @throws IllegalStateException If the transaction is not in an active
+ * state.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+ status = Status.STATUS_MARKED_ROLLBACK;
+ }
+
+ /**
+ * Get the status of the transaction.
+ *
+ * @return The status of the transaction. This is one of the
+ * {@link Status} constants.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public int getStatus() throws SystemException
+ {
+ return status;
+ }
+
+ /**
+ * Change the transaction timeout for transactions started by the calling
+ * thread with the {@link DummyTransactionManager#begin()} method.
+ *
+ * @param seconds The new timeout value, in seconds. If this parameter
+ * is <code>0</code>, the timeout value is reset to the default
+ * value.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setTransactionTimeout(int seconds) throws SystemException
+ {
+ throw new SystemException("not supported");
+ }
+
+ /**
+ * Enlist an XA resource with this transaction.
+ *
+ * @return <code>true</code> if the resource could be enlisted with
+ * this transaction, otherwise <code>false</code>.
+ * @throws RollbackException If the transaction is marked for rollback
+ * only.
+ * @throws IllegalStateException If the transaction is in a state
+ * where resources cannot be enlisted. This could be because the
+ * transaction is no longer active, or because it is in the
+ * {@link Status#STATUS_PREPARED prepared state}.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public boolean enlistResource(XAResource xaRes)
+ throws RollbackException, IllegalStateException, SystemException
+ {
+ throw new SystemException("not supported");
+ }
+
+ /**
+ * Delist an XA resource from this transaction.
+ *
+ * @return <code>true</code> if the resource could be delisted from
+ * this transaction, otherwise <code>false</code>.
+ * @throws IllegalStateException If the transaction is in a state
+ * where resources cannot be delisted. This could be because the
+ * transaction is no longer active.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public boolean delistResource(XAResource xaRes, int flag)
+ throws IllegalStateException, SystemException
+ {
+ throw new SystemException("not supported");
+ }
+
+ /**
+ * Register a {@link Synchronization} callback with this transaction.
+ *
+ * @throws RollbackException If the transaction is marked for rollback
+ * only.
+ * @throws IllegalStateException If the transaction is in a state
+ * where {@link Synchronization} callbacks cannot be registered.
+ * This could be because the transaction is no longer active,
+ * or because it is in the
+ * {@link Status#STATUS_PREPARED prepared state}.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void registerSynchronization(Synchronization sync)
+ throws RollbackException, IllegalStateException, SystemException
+ {
+ if (sync == null)
+ throw new IllegalArgumentException("null synchronization " + this);
+
+ switch (status)
+ {
+ case Status.STATUS_ACTIVE:
+ case Status.STATUS_PREPARING:
+ break;
+ case Status.STATUS_PREPARED:
+ throw new IllegalStateException("already prepared. " + this);
+ case Status.STATUS_COMMITTING:
+ throw new IllegalStateException("already started committing. " + this);
+ case Status.STATUS_COMMITTED:
+ throw new IllegalStateException("already committed. " + this);
+ case Status.STATUS_MARKED_ROLLBACK:
+ throw new RollbackException("already marked for rollback " + this);
+ case Status.STATUS_ROLLING_BACK:
+ throw new RollbackException("already started rolling back. " + this);
+ case Status.STATUS_ROLLEDBACK:
+ throw new RollbackException("already rolled back. " + this);
+ case Status.STATUS_NO_TRANSACTION:
+ throw new IllegalStateException("no transaction. " + this);
+ case Status.STATUS_UNKNOWN:
+ throw new IllegalStateException("unknown state " + this);
+ default:
+ throw new IllegalStateException("illegal status: " + status + " tx=" + this);
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("registering synchronization handler " + sync);
+ }
+ participants.add(sync);
+
+ }
+
+ void setStatus(int new_status)
+ {
+ status = new_status;
+ }
+
+ protected boolean notifyBeforeCompletion()
+ {
+ boolean retval = true;
+
+ for (Synchronization s : participants)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("processing beforeCompletion for " + s);
+ }
+ try
+ {
+ s.beforeCompletion();
+ }
+ catch (Throwable t)
+ {
+ retval = false;
+ log.error("beforeCompletion() failed for " + s, t);
+ }
+ }
+ return retval;
+ }
+
+ protected void notifyAfterCompletion(int status)
+ {
+ for (Synchronization s : participants)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("processing afterCompletion for " + s);
+ }
+ try
+ {
+ s.afterCompletion(status);
+ }
+ catch (Throwable t)
+ {
+ log.error("afterCompletion() failed for " + s, t);
+ }
+ }
+ participants.clear();
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransaction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManager.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManager.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManager.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManager.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Properties;
+
+/**
+ * Simple transaction manager implementation that maintains transaction state
+ * in memory only.
+ *
+ * @author bela
+ * @version $Revision$
+ * Date: May 15, 2003
+ * Time: 4:11:37 PM
+ */
+public class DummyTransactionManager extends DummyBaseTransactionManager
+{
+ protected static DummyTransactionManager instance = null;
+ protected static DummyUserTransaction utx = null;
+
+ protected static Log log = LogFactory.getLog(DummyTransactionManager.class);
+
+ private static final long serialVersionUID = 4396695354693176535L;
+
+ public static DummyTransactionManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new DummyTransactionManager();
+ utx = new DummyUserTransaction(instance);
+ try
+ {
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
+ Context ctx = new InitialContext(p);
+ ctx.bind("java:/TransactionManager", instance);
+ ctx.bind("UserTransaction", utx);
+ }
+ catch (NamingException e)
+ {
+ log.error("binding of DummyTransactionManager failed", e);
+ }
+ }
+ return instance;
+ }
+
+ public static DummyUserTransaction getUserTransaction()
+ {
+ getInstance();
+ return utx;
+ }
+
+ public static void destroy()
+ {
+ if (instance == null)
+ return;
+ try
+ {
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
+ Context ctx = new InitialContext(p);
+ ctx.unbind("java:/TransactionManager");
+ ctx.unbind("UserTransaction");
+ }
+ catch (NamingException e)
+ {
+ log.error("unbinding of DummyTransactionManager failed", e);
+ }
+ instance.setTransaction(null);
+ instance = null;
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManagerLookup.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyTransactionManagerLookup.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManagerLookup.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+
+/**
+ * Returns an instance of {@link org.jboss.starobrno.transaction.DummyTransactionManager}.
+ *
+ * @author Bela Ban Sept 5 2003
+ * @version $Id$
+ */
+public class DummyTransactionManagerLookup implements TransactionManagerLookup
+{
+
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return DummyTransactionManager.getInstance();
+ }
+
+ public UserTransaction getUserTransaction()
+ {
+ return DummyTransactionManager.getUserTransaction();
+ }
+
+ public void cleanup()
+ {
+ DummyTransactionManager.destroy();
+ }
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyTransactionManagerLookup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyUserTransaction.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/DummyUserTransaction.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyUserTransaction.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyUserTransaction.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author bela
+ * @version $Revision$
+ * Date: May 15, 2003
+ * Time: 4:20:17 PM
+ */
+public class DummyUserTransaction implements UserTransaction, java.io.Serializable
+{
+ static final Log logger_ = LogFactory.getLog(DummyUserTransaction.class);
+ DummyTransactionManager tm_;
+ private static final long serialVersionUID = -6568400755677046127L;
+
+ /**
+ * List<Synchronization>
+ */
+ List<Synchronization> l = new ArrayList<Synchronization>();
+
+ public DummyUserTransaction(DummyTransactionManager tm)
+ {
+ tm_ = tm;
+ }
+
+
+ /**
+ * Starts a new transaction, and associate it with the calling thread.
+ *
+ * @throws NotSupportedException If the calling thread is already
+ * associated with a transaction, and nested transactions are
+ * not supported.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void begin() throws NotSupportedException, SystemException
+ {
+ tm_.begin();
+ }
+
+ /**
+ * Attempt to commit this transaction.
+ *
+ * @throws RollbackException If the transaction was marked for rollback
+ * only, the transaction is rolled back and this exception is
+ * thrown.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ * @throws HeuristicMixedException If a heuristic decision was made and
+ * some some parts of the transaction have been committed while
+ * other parts have been rolled back.
+ * @throws HeuristicRollbackException If a heuristic decision to roll
+ * back the transaction was made.
+ * @throws SecurityException If the caller is not allowed to commit this
+ * transaction.
+ */
+ public void commit()
+ throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, SecurityException, SystemException
+ {
+
+ tm_.commit();
+ }
+
+ /**
+ * Rolls back this transaction.
+ *
+ * @throws IllegalStateException If the transaction is in a state
+ * where it cannot be rolled back. This could be because the
+ * transaction is no longer active, or because it is in the
+ * {@link Status#STATUS_PREPARED prepared state}.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void rollback() throws IllegalStateException, SystemException
+ {
+ tm_.rollback();
+ }
+
+ /**
+ * Mark the transaction so that the only possible outcome is a rollback.
+ *
+ * @throws IllegalStateException If the transaction is not in an active
+ * state.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+ tm_.setRollbackOnly();
+ }
+
+ /**
+ * Get the status of the transaction.
+ *
+ * @return The status of the transaction. This is one of the
+ * {@link Status} constants.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public int getStatus() throws SystemException
+ {
+ return tm_.getStatus();
+ }
+
+ /**
+ * Change the transaction timeout for transactions started by the calling
+ * thread with the {@link #begin()} method.
+ *
+ * @param seconds The new timeout value, in seconds. If this parameter
+ * is <code>0</code>, the timeout value is reset to the default
+ * value.
+ * @throws SystemException If the transaction service fails in an
+ * unexpected way.
+ */
+ public void setTransactionTimeout(int seconds) throws SystemException
+ {
+ throw new SystemException("not supported");
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/DummyUserTransaction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/GenericTransactionManagerLookup.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/GenericTransactionManagerLookup.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/GenericTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
+import java.lang.reflect.Method;
+
+/**
+ * A transaction manager lookup class that attempts to locate a TransactionManager.
+ * A variety of different classes and JNDI locations are tried, for servers
+ * such as:
+ * <ul>
+ * <li> JBoss
+ * <li> JRun4
+ * <li> Resin
+ * <li> Orion
+ * <li> JOnAS
+ * <li> BEA Weblogic
+ * <li> Websphere 4.0, 5.0, 5.1, 6.0
+ * <li> Sun, Glassfish
+ * </ul>
+ * If a transaction manager is not found, returns a {@link org.jboss.starobrno.transaction.DummyTransactionManager}.
+ *
+ * @author Markus Plesser
+ * @version $Id$
+ */
+public class GenericTransactionManagerLookup implements TransactionManagerLookup
+{
+
+ private static final Log log = LogFactory.getLog(GenericTransactionManagerLookup.class);
+
+ /**
+ * JNDI lookups performed?
+ */
+ private static boolean lookupDone = false;
+
+ /**
+ * No JNDI available?
+ */
+ private static boolean lookupFailed = false;
+
+ /**
+ * The JVM TransactionManager found.
+ */
+ private static TransactionManager tm = null;
+
+ /**
+ * JNDI locations for TransactionManagers we know of
+ */
+ private static String[][] knownJNDIManagers =
+ {
+ {"java:/TransactionManager", "JBoss, JRun4"},
+ {"java:comp/TransactionManager", "Resin 3.x"},
+ {"java:appserver/TransactionManager", "Sun Glassfish"},
+ {"java:pm/TransactionManager", "Borland, Sun"},
+ {"javax.transaction.TransactionManager", "BEA WebLogic"},
+ {"java:comp/UserTransaction", "Resin, Orion, JOnAS (JOTM)"},
+ };
+
+ /**
+ * WebSphere 5.1 and 6.0 TransactionManagerFactory
+ */
+ private static final String WS_FACTORY_CLASS_5_1 = "com.ibm.ws.Transaction.TransactionManagerFactory";
+
+ /**
+ * WebSphere 5.0 TransactionManagerFactory
+ */
+ private static final String WS_FACTORY_CLASS_5_0 = "com.ibm.ejs.jts.jta.TransactionManagerFactory";
+
+ /**
+ * WebSphere 4.0 TransactionManagerFactory
+ */
+ private static final String WS_FACTORY_CLASS_4 = "com.ibm.ejs.jts.jta.JTSXA";
+
+ /**
+ * Get the systemwide used TransactionManager
+ *
+ * @return TransactionManager
+ */
+ public TransactionManager getTransactionManager()
+ {
+ if (!lookupDone)
+ doLookups();
+ if (tm != null)
+ return tm;
+ if (lookupFailed)
+ {
+ //fall back to a dummy from JBossCache
+ tm = DummyTransactionManager.getInstance();
+ log.warn("Falling back to DummyTransactionManager from JBossCache");
+ }
+ return tm;
+ }
+
+ /**
+ * Try to figure out which TransactionManager to use
+ */
+ private static void doLookups()
+ {
+ if (lookupFailed)
+ return;
+ InitialContext ctx;
+ try
+ {
+ ctx = new InitialContext();
+ }
+ catch (NamingException e)
+ {
+ log.error("Failed creating initial JNDI context", e);
+ lookupFailed = true;
+ return;
+ }
+ //probe jndi lookups first
+ for (String[] knownJNDIManager : knownJNDIManagers)
+ {
+ Object jndiObject;
+ try
+ {
+ if (log.isDebugEnabled())
+ log.debug("Trying to lookup TransactionManager for " + knownJNDIManager[1]);
+ jndiObject = ctx.lookup(knownJNDIManager[0]);
+ }
+ catch (NamingException e)
+ {
+ log.debug("Failed to perform a lookup for [" + knownJNDIManager[0] + " (" + knownJNDIManager[1]
+ + ")]");
+ continue;
+ }
+ if (jndiObject instanceof TransactionManager)
+ {
+ tm = (TransactionManager) jndiObject;
+ log.debug("Found TransactionManager for " + knownJNDIManager[1]);
+ return;
+ }
+ }
+ //try to find websphere lookups since we came here
+ Class clazz;
+ try
+ {
+ log.debug("Trying WebSphere 5.1: " + WS_FACTORY_CLASS_5_1);
+ clazz = Class.forName(WS_FACTORY_CLASS_5_1);
+ log.debug("Found WebSphere 5.1: " + WS_FACTORY_CLASS_5_1);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ try
+ {
+ log.debug("Trying WebSphere 5.0: " + WS_FACTORY_CLASS_5_0);
+ clazz = Class.forName(WS_FACTORY_CLASS_5_0);
+ log.debug("Found WebSphere 5.0: " + WS_FACTORY_CLASS_5_0);
+ }
+ catch (ClassNotFoundException ex2)
+ {
+ try
+ {
+ log.debug("Trying WebSphere 4: " + WS_FACTORY_CLASS_4);
+ clazz = Class.forName(WS_FACTORY_CLASS_4);
+ log.debug("Found WebSphere 4: " + WS_FACTORY_CLASS_4);
+ }
+ catch (ClassNotFoundException ex3)
+ {
+ log.debug("Couldn't find any WebSphere TransactionManager factory class, neither for WebSphere version 5.1 nor 5.0 nor 4");
+ lookupFailed = true;
+ return;
+ }
+ }
+ }
+ try
+ {
+ Class[] signature = null;
+ Object[] args = null;
+ Method method = clazz.getMethod("getTransactionManager", signature);
+ tm = (TransactionManager) method.invoke(null, args);
+ }
+ catch (Exception ex)
+ {
+ log.error("Found WebSphere TransactionManager factory class [" + clazz.getName()
+ + "], but couldn't invoke its static 'getTransactionManager' method", ex);
+ }
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/GenericTransactionManagerLookup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossStandaloneJTAManagerLookup.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossStandaloneJTAManagerLookup.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossStandaloneJTAManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+import java.lang.reflect.Method;
+
+/**
+ * JTA standalone TM lookup.
+ *
+ * @author Jason T. Greene
+ */
+public class JBossStandaloneJTAManagerLookup implements TransactionManagerLookup
+{
+ private Method manager, user;
+
+ public JBossStandaloneJTAManagerLookup()
+ {
+ try
+ {
+ manager = Class.forName("com.arjuna.ats.jta.TransactionManager").getMethod("transactionManager");
+ user = Class.forName("com.arjuna.ats.jta.UserTransaction").getMethod("userTransaction");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return (TransactionManager) manager.invoke(null);
+ }
+
+ public UserTransaction getUserTransaction() throws Exception
+ {
+ return (UserTransaction) user.invoke(null);
+ }
+}
\ No newline at end of file
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossStandaloneJTAManagerLookup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossTransactionManagerLookup.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/JBossTransactionManagerLookup.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossTransactionManagerLookup.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossTransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+
+
+/**
+ * Uses JNDI to look-up the
+ * {@link TransactionManager} instance from "java:/TransactionManager".
+ *
+ * @author Bela Ban, Aug 26 2003
+ * @version $Id$
+ */
+public class JBossTransactionManagerLookup implements TransactionManagerLookup
+{
+
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return (TransactionManager) new InitialContext().lookup("java:/TransactionManager");
+ }
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/JBossTransactionManagerLookup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/TransactionManagerLookup.java (from rev 7261, core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/transaction/TransactionManagerLookup.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/transaction/TransactionManagerLookup.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.transaction;
+
+import javax.transaction.TransactionManager;
+
+/**
+ * Factory interface, allows {@link org.jboss.cache.Cache_Legacy} to use different transactional systems.
+ * Names of implementors of this class can be configured using
+ * {@link Configuration#setTransactionManagerLookupClass}.
+ *
+ * @author Bela Ban, Aug 26 2003
+ * @version $Id$
+ */
+public interface TransactionManagerLookup
+{
+
+ /**
+ * Returns a new TransactionManager.
+ *
+ * @throws Exception if lookup failed
+ */
+ TransactionManager getTransactionManager() throws Exception;
+
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/starobrno/transaction/TransactionManagerLookup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: core/branches/flat/src/main/resources/config-samples/all.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/all.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/all.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -18,7 +18,7 @@
Used to register a transaction manager and participate in ongoing transactions.
-->
<transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
+ transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="false"
syncCommitPhase="false"/>
Modified: core/branches/flat/src/main/resources/config-samples/buddy-replication.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/buddy-replication.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/buddy-replication.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering mode="replication">
<!--
Modified: core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<!-- Specific eviction policy configurations -->
<eviction wakeUpInterval="5000">
Modified: core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<!--
wakeUpInterval: time interval (millis) when the eviction thread kicks in.
Modified: core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering>
<async/>
Modified: core/branches/flat/src/main/resources/config-samples/invalidation-async.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/invalidation-async.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/invalidation-async.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering mode="invalidation">
<!--
Modified: core/branches/flat/src/main/resources/config-samples/local.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/local.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/local.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -4,5 +4,5 @@
<!-- By not specifying the 'clustering' element, the cache runs in LOCAL mode. -->
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
</jbosscache>
Modified: core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering>
<sync/>
Modified: core/branches/flat/src/main/resources/config-samples/total-replication.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/total-replication.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/main/resources/config-samples/total-replication.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
<!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering mode="replication">
<!-- JGroups protocol stack properties. -->
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/CacheAPITest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/CacheAPITest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/CacheAPITest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,12 +2,12 @@
import org.jboss.cache.CacheFactory;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/batch/BatchWithTM.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/batch/BatchWithTM.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/batch/BatchWithTM.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,14 +1,14 @@
package org.jboss.starobrno.api.batch;
import org.jboss.cache.CacheFactory;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.starobrno.UnitTestCacheFactory;
@Test(groups = {"functional", "transaction"})
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,12 +3,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.invocation.InvocationContextContainer;
import org.jboss.starobrno.lock.LockManager;
import org.jboss.starobrno.lock.TimeoutException;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -17,7 +18,6 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.Collections;
-import org.jboss.starobrno.UnitTestCacheFactory;
/**
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
@@ -29,14 +29,15 @@
protected boolean repeatableRead = true;
protected boolean lockParentForChildInsertRemove = false;
private Log log = LogFactory.getLog(LockTestBase.class);
-
- protected class LockTestBaseTL {
+
+ protected class LockTestBaseTL
+ {
public Cache<String, String> cache;
public TransactionManager tm;
public LockManager lockManager;
public InvocationContextContainer icc;
}
-
+
protected ThreadLocal<LockTestBaseTL> threadLocal = new ThreadLocal<LockTestBaseTL>();
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/PutForExternalReadTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/PutForExternalReadTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/PutForExternalReadTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -49,7 +49,7 @@
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache1 = (CacheSPI<String, String>) cf.createCache(c, false);
- cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.starobrno.transaction.DummyTransactionManagerLookup");
cache1.getConfiguration().setSerializationExecutorPoolSize(0);//this is very important for async tests!
cache1.start();
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/repeatable_read/WriteSkewTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/repeatable_read/WriteSkewTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,12 +1,13 @@
package org.jboss.starobrno.api.mvcc.repeatable_read;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.api.mvcc.LockAssert;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.invocation.InvocationContextContainer;
import org.jboss.starobrno.lock.LockManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -18,7 +19,6 @@
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
-import org.jboss.starobrno.UnitTestCacheFactory;
@Test(groups = {"functional", "mvcc"}, sequential = true)
public class WriteSkewTest
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeAPITest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeAPITest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeAPITest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,10 +1,10 @@
package org.jboss.starobrno.api.tree;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.Node;
import org.jboss.starobrno.tree.TreeCache;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeReplicatedMoveTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeReplicatedMoveTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/NodeReplicatedMoveTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -6,9 +6,9 @@
*/
package org.jboss.starobrno.api.tree;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.Node;
import org.jboss.starobrno.tree.TreeCache;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/SyncReplTxTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/SyncReplTxTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/SyncReplTxTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -7,11 +7,11 @@
package org.jboss.starobrno.api.tree;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.Cache;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.Node;
import org.jboss.starobrno.tree.TreeCache;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/tree/TreeCacheAPITest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,9 +1,9 @@
package org.jboss.starobrno.api.tree;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.manager.CacheManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.Node;
import org.jboss.starobrno.tree.TreeCache;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/atomic/APITest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/atomic/APITest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/atomic/APITest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -22,10 +22,10 @@
package org.jboss.starobrno.atomic;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.Configuration.CacheMode;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.Test;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/eviction/FIFOPolicyTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/eviction/FIFOPolicyTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/eviction/FIFOPolicyTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,13 +1,13 @@
package org.jboss.starobrno.eviction;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.EvictionCacheConfig;
import org.jboss.starobrno.config.EvictionConfig;
import org.jboss.starobrno.eviction.algorithms.fifo.FIFOAlgorithmConfig;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/notifications/CacheListenerTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/notifications/CacheListenerTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/notifications/CacheListenerTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,6 +2,7 @@
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.notifications.event.Event;
import static org.jboss.starobrno.notifications.event.Event.Type.*;
@@ -15,12 +16,7 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.jboss.starobrno.UnitTestCacheFactory;
+import java.util.*;
/**
* Note that this is significantly different from the old <b>TreeCacheListenerTest</b> of the JBoss Cache 1.x series, and
@@ -42,7 +38,7 @@
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.LOCAL);
c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ c.setTransactionManagerLookupClass("org.jboss.starobrno.transaction.DummyTransactionManagerLookup");
cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
eventLog.events.clear();
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/profiling/TreeProfileTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/profiling/TreeProfileTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/profiling/TreeProfileTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,12 +3,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.starobrno.Cache;
import org.jboss.starobrno.UnitTestCacheFactory;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.profiling.testinternals.Generator;
import org.jboss.starobrno.profiling.testinternals.TaskRunner;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
import org.jboss.starobrno.tree.Fqn;
import org.jboss.starobrno.tree.TreeCache;
import org.jboss.starobrno.tree.TreeCacheImpl;
@@ -60,7 +60,7 @@
cfg.setConcurrencyLevel(2000);
cfg.setLockAcquisitionTimeout(120000);
cfg.setLockParentForChildInsertRemove(true);
- cfg.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
+ cfg.setIsolationLevel(IsolationLevel.READ_COMMITTED);
Cache c = new UnitTestCacheFactory().createCache(cfg);
cache = new TreeCacheImpl(c);
}
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/replication/AsyncReplTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -8,20 +8,20 @@
package org.jboss.starobrno.replication;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.CacheSPI;
+import org.jboss.starobrno.UnitTestCacheManager;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.manager.CacheManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
+import org.jboss.starobrno.util.TestingUtil;
+import org.jboss.starobrno.util.internals.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.starobrno.CacheSPI;
-import org.jboss.starobrno.Cache;
-import org.jboss.starobrno.UnitTestCacheManager;
-import org.jboss.starobrno.manager.CacheManager;
-import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.util.internals.ReplicationListener;
-import org.jboss.starobrno.util.TestingUtil;
/**
* Unit test for replicated async CacheSPI. Use locking and multiple threads to test
@@ -31,7 +31,8 @@
public class AsyncReplTest
{
- private class AsyncReplTestTL {
+ private class AsyncReplTestTL
+ {
private Configuration configuration;
private CacheSPI<Object, Object> cache1, cache2;
private CacheManager cacheManager1, cacheManager2;
@@ -107,7 +108,7 @@
cache1.put(key, "value1");
// allow for replication
replListener2.waitForReplicationToOccur(500);
- assertEquals("value1", cache1.get( key));
+ assertEquals("value1", cache1.get(key));
assertEquals("value1", cache2.get(key));
TransactionManager mgr = cache1.getTransactionManager();
@@ -211,7 +212,7 @@
{
TransactionManager tm = cache1.getTransactionManager();
tm.begin();
- cache1.put( "age", 38);
+ cache1.put("age", 38);
tm.commit();
// value on cache2 may be 38 or not yet replicated
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/replication/ExceptionTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/replication/ExceptionTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/replication/ExceptionTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,19 +1,20 @@
package org.jboss.starobrno.replication;
+import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.UnitTestCacheManager;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.lock.TimeoutException;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
+import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import org.jboss.starobrno.Cache;
-import org.jboss.starobrno.util.TestingUtil;
-import org.jboss.starobrno.lock.TimeoutException;
-import org.jboss.starobrno.config.Configuration;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
-import org.jboss.starobrno.UnitTestCacheManager;
/**
* Tests the type of exceptions thrown for Lock Acquisition Timeouts versus Sync Repl Timeouts
+ *
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
@Test(groups = {"functional"}, sequential = true)
@@ -23,20 +24,20 @@
private Cache cache2;
private static String DELAYED_CLUSTER_CONFIG =
- "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:" +
- "DELAY(in_delay=100;out_delay=100)";
+ "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:" +
+ "DELAY(in_delay=100;out_delay=100)";
private Cache createCache(String jgroupsConfig)
{
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/replication/ReplicationExceptionTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/replication/ReplicationExceptionTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/replication/ReplicationExceptionTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -7,16 +7,17 @@
*/
package org.jboss.starobrno.replication;
+import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.starobrno.CacheSPI;
+import org.jboss.starobrno.UnitTestCacheManager;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
+import org.jboss.starobrno.util.TestingUtil;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.fail;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.jboss.starobrno.CacheSPI;
-import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.util.TestingUtil;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.lock.IsolationLevel;
import javax.naming.Context;
import javax.transaction.NotSupportedException;
@@ -25,7 +26,6 @@
import javax.transaction.TransactionManager;
import java.io.NotSerializableException;
import java.io.Serializable;
-import org.jboss.starobrno.UnitTestCacheManager;
/**
* Teting of replication exception for a Nonerislizable object
@@ -80,11 +80,11 @@
conf1.setIsolationLevel(IsolationLevel.SERIALIZABLE);
conf2.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- conf1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- conf2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ conf1.setTransactionManagerLookupClass("org.jboss.starobrno.transaction.DummyTransactionManagerLookup");
+ conf2.setTransactionManagerLookupClass("org.jboss.starobrno.transaction.DummyTransactionManagerLookup");
/*
- cache1.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
- cache2.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
+ cache1.setTransactionManagerLookupClass("org.jboss.starobrno.transaction.GenericTransactionManagerLookup");
+ cache2.setTransactionManagerLookupClass("org.jboss.starobrno.transaction.GenericTransactionManagerLookup");
*/
conf1.setLockAcquisitionTimeout(5000);
conf2.setLockAcquisitionTimeout(5000);
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/replication/SyncCacheListenerTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/replication/SyncCacheListenerTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/replication/SyncCacheListenerTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -10,16 +10,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.CacheSPI;
+import org.jboss.starobrno.UnitTestCacheManager;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.notifications.annotation.CacheEntryModified;
import org.jboss.starobrno.notifications.annotation.CacheEntryRemoved;
import org.jboss.starobrno.notifications.annotation.CacheListener;
import org.jboss.starobrno.notifications.event.Event;
import org.jboss.starobrno.notifications.event.TransactionalEvent;
+import org.jboss.starobrno.transaction.DummyTransactionManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -31,7 +32,6 @@
import javax.transaction.TransactionManager;
import java.util.Map;
import java.util.Set;
-import org.jboss.starobrno.UnitTestCacheManager;
/**
* Test out the TreeCacheListener
@@ -149,7 +149,7 @@
{
TransactionManager tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
tm.begin();
- cache1.put("key","value");
+ cache1.put("key", "value");
tm.commit();
assert cache2.get("key").equals("value");
Modified: core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/tx/LocalModeTxTest.java 2008-12-11 14:44:12 UTC (rev 7281)
@@ -21,16 +21,16 @@
*/
package org.jboss.starobrno.tx;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.CacheSPI;
+import org.jboss.starobrno.UnitTestCacheManager;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.manager.CacheManager;
+import org.jboss.starobrno.transaction.DummyTransactionManagerLookup;
import org.jboss.starobrno.util.TestingUtil;
import org.testng.annotations.Test;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import org.jboss.starobrno.UnitTestCacheManager;
@Test(groups = "functional")
public class LocalModeTxTest
Modified: core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="JBossCache-Cluster">
<sync replTimeout="15000"/>
Modified: core/branches/flat/src/test/resources/configs/clonable-config.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/clonable-config.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/clonable-config.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="SERIALIZABLE" lockAcquisitionTimeout="1"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="CloneCluster">
<stateRetrieval fetchInMemoryState="false" timeout="3"/>
<jgroupsConfig multiplexerStack="udp">
Modified: core/branches/flat/src/test/resources/configs/local-lru-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-lru-eviction.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/local-lru-eviction.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="JBossCache-Cluster">
<stateRetrieval timeout="20000"/>
</clustering>
Modified: core/branches/flat/src/test/resources/configs/local-passivation.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-passivation.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/local-passivation.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<eviction wakeUpInterval="1000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
<property name="maxNodes" value="5000"/>
Modified: core/branches/flat/src/test/resources/configs/local-tx.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-tx.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/local-tx.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="false"/>
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
Modified: core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering>
<stateRetrieval timeout="20000"/>
<jgroupsConfig configFile="udp.xml"/>
Modified: core/branches/flat/src/test/resources/configs/mux.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mux.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/mux.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering>
<stateRetrieval timeout="20000"/>
<jgroupsConfig multiplexerStack="tcp"/>
Modified: core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering>
<stateRetrieval fetchInMemoryState="false"/>
<jgroupsConfig>
Modified: core/branches/flat/src/test/resources/configs/parser-test-async.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/parser-test-async.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/parser-test-async.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -9,7 +9,7 @@
<locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
writeSkewCheck="false" concurrencyLevel="21"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="true" syncCommitPhase="true"/>
<jmxStatistics enabled="false"/>
Modified: core/branches/flat/src/test/resources/configs/parser-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/parser-test.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/parser-test.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -10,7 +10,7 @@
writeSkewCheck="false" concurrencyLevel="21"/>
<!-- perCM -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="true" syncCommitPhase="true"/>
<jmxStatistics enabled="false"/>
Modified: core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="JBossCache-Cluster123"/>
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
Modified: core/branches/flat/src/test/resources/configs/replSync.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/replSync.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/configs/replSync.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="true"/>
<clustering>
<stateRetrieval fetchInMemoryState="true" timeout="15000"/>
Modified: core/branches/flat/src/test/resources/jbc3-registry-configs.xml
===================================================================
--- core/branches/flat/src/test/resources/jbc3-registry-configs.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/jbc3-registry-configs.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,184 +2,184 @@
<registry:cache-configs xmlns="urn:jboss:jbosscache-core:config:3.0"
xmlns:registry="urn:jboss:jbosscache-core:cache-repo:3.0">
- <!--
- Various JBoss Cache configurations, suitable for different caching
- uses (e.g. entities vs. queries).
+ <!--
+ Various JBoss Cache configurations, suitable for different caching
+ uses (e.g. entities vs. queries).
- In all cases, TransactionManager configuration not required.
- Hibernate will plug in its own transaction manager integration.
- -->
+ In all cases, TransactionManager configuration not required.
+ Hibernate will plug in its own transaction manager integration.
+ -->
- <!-- A config appropriate for entity/collection caching. -->
- <registry:cache-config name="optimistic-entity">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction syncCommitPhase="true" syncRollbackPhase="true"
- transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="optimistic-entity" multiplexerStack="udp-sync"/>
- <invalidation>
- <sync replTimeout="20000"/>
- </invalidation>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <!-- A config appropriate for entity/collection caching. -->
+ <registry:cache-config name="optimistic-entity">
+ <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
+ <transaction syncCommitPhase="true" syncRollbackPhase="true"
+ transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup regionsInactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
+ <transport clusterName="optimistic-entity" multiplexerStack="udp-sync"/>
+ <invalidation>
+ <sync replTimeout="20000"/>
+ </invalidation>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- A config appropriate for entity/collection caching that
-uses pessimistic locking -->
- <registry:cache-config name="pessimistic-entity">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="pessimistic-entity" multiplexerStack="udp-sync"/>
- <invalidation>
- <sync replTimeout="20000"/>
- </invalidation>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <!-- A config appropriate for entity/collection caching that
+ uses pessimistic locking -->
+ <registry:cache-config name="pessimistic-entity">
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup regionsInactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
+ <transport clusterName="pessimistic-entity" multiplexerStack="udp-sync"/>
+ <invalidation>
+ <sync replTimeout="20000"/>
+ </invalidation>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- A config appropriate for query caching. Does not replicate
- queries. DO NOT STORE TIMESTAMPS IN THIS CACHE.
- -->
- <registry:cache-config name="local-query">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <!-- A config appropriate for query caching. Does not replicate
+ queries. DO NOT STORE TIMESTAMPS IN THIS CACHE.
+ -->
+ <registry:cache-config name="local-query">
+ <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- A query cache that replicates queries. Replication is asynchronous.
- DO NOT STORE TIMESTAMPS IN THIS CACHE.
- -->
- <registry:cache-config name="replicated-query">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="false"/>
- <startup regionsInactiveOnStartup="false"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="replicated-query" multiplexerStack="udp"/>
- <replication>
- <async/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <!-- A query cache that replicates queries. Replication is asynchronous.
+ DO NOT STORE TIMESTAMPS IN THIS CACHE.
+ -->
+ <registry:cache-config name="replicated-query">
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="false"/>
+ <startup regionsInactiveOnStartup="false"/>
+ <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
+ <transport clusterName="replicated-query" multiplexerStack="udp"/>
+ <replication>
+ <async/>
+ </replication>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- Optimized for timestamp caching. A clustered timestamp cache
- is required if query caching is used, even if the query cache
- itself is configured with CacheMode=LOCAL.
- -->
- <registry:cache-config name="timestamps-cache">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="timestamps-cache" multiplexerStack="udp"/>
- <replication>
- <async/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <!-- Optimized for timestamp caching. A clustered timestamp cache
+ is required if query caching is used, even if the query cache
+ itself is configured with CacheMode=LOCAL.
+ -->
+ <registry:cache-config name="timestamps-cache">
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup regionsInactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
+ <transport clusterName="timestamps-cache" multiplexerStack="udp"/>
+ <replication>
+ <async/>
+ </replication>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- A config appropriate for a cache that's shared for
+ <!-- A config appropriate for a cache that's shared for
entity, collection, query and timestamp caching. Not an advised
configuration, since it requires cache mode REPL_SYNC, which is the
least efficient mode. Also requires a full state transfer at startup,
which can be expensive. Uses optimistic locking. -->
- <registry:cache-config name="optimistic-shared">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction syncCommitPhase="true" syncRollbackPhase="true"
- transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="optimistic-shared" multiplexerStack="udp"/>
- <replication>
- <sync replTimeout="20000"/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <registry:cache-config name="optimistic-shared">
+ <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
+ <transaction syncCommitPhase="true" syncRollbackPhase="true"
+ transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup regionsInactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
+ <transport clusterName="optimistic-shared" multiplexerStack="udp"/>
+ <replication>
+ <sync replTimeout="20000"/>
+ </replication>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
- <!-- A config appropriate for a cache that's shared for
- entity, collection, query and timestamp caching. Not an advised
- configuration, since it requires cache mode REPL_SYNC, which is the
- least efficient mode. Also requires a full state transfer at startup,
- which can be expensive. Uses pessmistic locking.
- -->
- <registry:cache-config name="pessimistic-shared">
+ <!-- A config appropriate for a cache that's shared for
+ entity, collection, query and timestamp caching. Not an advised
+ configuration, since it requires cache mode REPL_SYNC, which is the
+ least efficient mode. Also requires a full state transfer at startup,
+ which can be expensive. Uses pessmistic locking.
+ -->
+ <registry:cache-config name="pessimistic-shared">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="pessimistic-shared" multiplexerStack="udp"/>
- <replication>
- <sync replTimeout="20000"/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup regionsInactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
+ <transport clusterName="pessimistic-shared" multiplexerStack="udp"/>
+ <replication>
+ <sync replTimeout="20000"/>
+ </replication>
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.starobrno.eviction.algorithms.lru.LRUAlgorithm">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLive">1000</attribute>
+ </default>
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLive">0</attribute>
+ </region>
+ </eviction>
+ </registry:cache-config>
</registry:cache-configs>
Modified: core/branches/flat/src/test/resources/unit-test-cache-service.xml
===================================================================
--- core/branches/flat/src/test/resources/unit-test-cache-service.xml 2008-12-11 14:19:18 UTC (rev 7280)
+++ core/branches/flat/src/test/resources/unit-test-cache-service.xml 2008-12-11 14:44:12 UTC (rev 7281)
@@ -2,7 +2,7 @@
<jbosscache xmlns="urn:jboss:starobrno-core:config:1.0">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <transaction transactionManagerLookupClass="org.jboss.starobrno.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="false"/>
<clustering>
<sync replTimeout="15000"/>
16 years, 3 months
JBoss Cache SVN: r7280 - in core/branches/flat/src/main/java/org/jboss/starobrno: util and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-12-11 09:19:18 -0500 (Thu, 11 Dec 2008)
New Revision: 7280
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/util/ObjectDuplicator.java
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/LockingInterceptor.java
core/branches/flat/src/main/java/org/jboss/starobrno/util/Immutables.java
Log:
Improved locking interceptor
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/LockingInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/LockingInterceptor.java 2008-12-11 03:12:21 UTC (rev 7279)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/LockingInterceptor.java 2008-12-11 14:19:18 UTC (rev 7280)
@@ -22,8 +22,6 @@
package org.jboss.starobrno.interceptors;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.starobrno.commands.TransactionBoundaryCommand;
-import org.jboss.starobrno.commands.VisitableCommand;
import org.jboss.starobrno.commands.read.GetKeyValueCommand;
import org.jboss.starobrno.commands.read.GravitateDataCommand;
import org.jboss.starobrno.commands.read.SizeCommand;
@@ -37,10 +35,10 @@
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
-import org.jboss.starobrno.interceptors.base.PrePostProcessingCommandInterceptor;
+import org.jboss.starobrno.interceptors.base.CommandInterceptor;
import org.jboss.starobrno.lock.LockManager;
+import org.jboss.starobrno.util.ObjectDuplicator;
-import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -52,7 +50,7 @@
* @see <a href="http://wiki.jboss.org/wiki/JBossCacheMVCC">MVCC designs</a>
* @since 3.0
*/
-public class LockingInterceptor extends PrePostProcessingCommandInterceptor
+public class LockingInterceptor extends CommandInterceptor
{
LockManager lockManager;
DataContainer dataContainer;
@@ -74,18 +72,8 @@
}
@Override
- protected boolean doBeforeCall(InvocationContext ctx, VisitableCommand command)
+ public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
{
-// if (ctx.getOptionOverrides().isSuppressLocking())
-// {
-// if (log.isWarnEnabled()) log.warn("Lock suppression not supported with MVCC!");
-// }
- return true;
- }
-
- @Override
- public Object handleCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
try
{
return invokeNextInterceptor(ctx, command);
@@ -97,7 +85,7 @@
}
@Override
- public Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
+ public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
{
try
{
@@ -110,7 +98,7 @@
}
@Override
- public Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
+ public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
{
try
{
@@ -125,79 +113,142 @@
// read commands
@Override
- public Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
+ public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
{
- entryWrapper.wrapEntryForReading(ctx, command.getKey(), true);
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ entryWrapper.wrapEntryForReading(ctx, command.getKey(), true);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handleSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable
+ public Object visitSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable
{
- if (log.isDebugEnabled()) log.debug("No locking performed for SizeCommands");
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ if (log.isDebugEnabled()) log.debug("No locking performed for SizeCommands");
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
// write commands
@Override
- public Object handleClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable
+ public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable
{
- // get a snapshot of all keys in the data container
- for (Object key : dataContainer.keySet()) entryWrapper.wrapEntryForWriting(ctx, key, false, false);
+ try
+ {
+ // get a snapshot of all keys in the data container
+ for (Object key : dataContainer.keySet()) entryWrapper.wrapEntryForWriting(ctx, key, false, false);
- return invokeNextInterceptor(ctx, command);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handleEvictCommand(InvocationContext ctx, EvictCommand command) throws Throwable
+ public Object visitEvictCommand(InvocationContext ctx, EvictCommand command) throws Throwable
{
- entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
+ public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
{
- entryWrapper.wrapEntryForWriting(ctx, command.getKey(), true, false);
- Object o = invokeNextInterceptor(ctx, command);
- return o;
+ try
+ {
+ entryWrapper.wrapEntryForWriting(ctx, command.getKey(), true, false);
+ Object o = invokeNextInterceptor(ctx, command);
+ return o;
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handlePutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
+ public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
{
- for (Object key : command.getMap().keySet())
+ try
{
- entryWrapper.wrapEntryForWriting(ctx, key, true, false);
+ for (Object key : command.getMap().keySet())
+ {
+ entryWrapper.wrapEntryForWriting(ctx, key, true, false);
+ }
+ return invokeNextInterceptor(ctx, command);
}
- return invokeNextInterceptor(ctx, command);
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handleRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
+ public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
{
- entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handleReplaceCommand(InvocationContext ctx, ReplaceCommand command) throws Throwable
+ public Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command) throws Throwable
{
- entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ entryWrapper.wrapEntryForWriting(ctx, command.getKey(), false, true);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@Override
- public Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command) throws Throwable
+ public Object visitGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command) throws Throwable
{
- entryWrapper.wrapEntryForReading(ctx, command.getKey(), true);
- return invokeNextInterceptor(ctx, command);
+ try
+ {
+ entryWrapper.wrapEntryForReading(ctx, command.getKey(), true);
+ return invokeNextInterceptor(ctx, command);
+ }
+ finally
+ {
+ doAfterCall(ctx);
+ }
}
@SuppressWarnings("unchecked")
- protected void doAfterCall(InvocationContext ctx, VisitableCommand command)
+ private void doAfterCall(InvocationContext ctx)
{
// for non-transactional stuff.
if (ctx.getTransactionContext() == null)
@@ -214,12 +265,12 @@
}
else
{
- if (useReadCommitted && !(command instanceof TransactionBoundaryCommand))
+ if (useReadCommitted)
{
Map<Object, MVCCEntry> original = ctx.getLookedUpEntries();
if (!original.isEmpty())
{
- Map<Object, MVCCEntry> defensiveCopy = new HashMap<Object, MVCCEntry>(original);
+ Map<Object, MVCCEntry> defensiveCopy = ObjectDuplicator.duplicateMap(original);
for (Map.Entry<Object, MVCCEntry> e : defensiveCopy.entrySet())
{
if (!e.getValue().isChanged()) ctx.removeLookedUpEntry(e.getKey());
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/util/Immutables.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/util/Immutables.java 2008-12-11 03:12:21 UTC (rev 7279)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/util/Immutables.java 2008-12-11 14:19:18 UTC (rev 7280)
@@ -120,10 +120,8 @@
*/
public static <T> Set<T> immutableSetCopy(Set<? extends T> set)
{
- Set<? extends T> copy = attemptKnownSetCopy(set);
+ Set<? extends T> copy = ObjectDuplicator.duplicateSet(set);
if (copy == null)
- attemptClone(set);
- if (copy == null)
// Set uses Collection copy-ctor
copy = attemptCopyConstructor(set, Collection.class);
if (copy == null)
@@ -152,11 +150,9 @@
*/
public static <K, V> Map<K, V> immutableMapCopy(Map<? extends K, ? extends V> map)
{
- Map<? extends K, ? extends V> copy = attemptKnownMapCopy(map);
+ Map<? extends K, ? extends V> copy = ObjectDuplicator.duplicateMap(map);
if (copy == null)
- attemptClone(map);
- if (copy == null)
copy = attemptCopyConstructor(map, Map.class);
if (copy == null)
copy = new HashMap<K, V>(map);
@@ -172,10 +168,8 @@
*/
public static <T> Collection<T> immutableCollectionCopy(Collection<? extends T> collection)
{
- Collection<? extends T> copy = attemptKnownSetCopy(collection);
+ Collection<? extends T> copy = ObjectDuplicator.duplicateCollection(collection);
if (copy == null)
- copy = attemptClone(collection);
- if (copy == null)
copy = attemptCopyConstructor(collection, Collection.class);
if (copy == null)
copy = new ArrayList<T>(collection);
@@ -184,51 +178,6 @@
}
@SuppressWarnings("unchecked")
- private static <T extends Map> T attemptKnownMapCopy(T map)
- {
- if (map instanceof FastCopyHashMap)
- return (T) ((FastCopyHashMap) map).clone();
- if (map instanceof HashMap)
- return (T) ((HashMap) map).clone();
- if (map instanceof LinkedHashMap)
- return (T) ((LinkedHashMap) map).clone();
- if (map instanceof TreeMap)
- return (T) ((TreeMap) map).clone();
-
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private static <T extends Collection> T attemptKnownSetCopy(T set)
- {
- if (set instanceof HashSet)
- return (T) ((HashSet) set).clone();
- if (set instanceof LinkedHashSet)
- return (T) ((LinkedHashSet) set).clone();
- if (set instanceof TreeSet)
- return (T) ((TreeSet) set).clone();
-
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private static <T> T attemptClone(T source)
- {
- if (source instanceof Cloneable)
- {
- try
- {
- return (T) source.getClass().getMethod("clone").invoke(source);
- }
- catch (Exception e)
- {
- }
- }
-
- return null;
- }
-
- @SuppressWarnings("unchecked")
private static <T> T attemptCopyConstructor(T source, Class<? super T> clazz)
{
try
Added: core/branches/flat/src/main/java/org/jboss/starobrno/util/ObjectDuplicator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/util/ObjectDuplicator.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/util/ObjectDuplicator.java 2008-12-11 14:19:18 UTC (rev 7280)
@@ -0,0 +1,60 @@
+package org.jboss.starobrno.util;
+
+import java.util.*;
+
+/**
+ * A helper that efficiently duplicates known object types.
+ */
+public class ObjectDuplicator
+{
+ @SuppressWarnings("unchecked")
+ public static <K, V> Map<K, V> duplicateMap(Map<K, V> original)
+ {
+ if (original instanceof FastCopyHashMap)
+ return (Map<K, V>) ((FastCopyHashMap) original).clone();
+ if (original instanceof HashMap)
+ return (Map<K, V>) ((HashMap) original).clone();
+ if (original instanceof TreeMap)
+ return (Map<K, V>) ((TreeMap) original).clone();
+ return attemptClone(original);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <E> Set<E> duplicateSet(Set<E> original)
+ {
+ if (original instanceof HashSet)
+ return (Set<E>) ((HashSet) original).clone();
+ if (original instanceof TreeSet)
+ return (Set<E>) ((TreeSet) original).clone();
+
+ return attemptClone(original);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <E> Collection<E> duplicateCollection(Collection<E> original)
+ {
+ if (original instanceof HashSet)
+ return (Set<E>) ((HashSet) original).clone();
+ if (original instanceof TreeSet)
+ return (Set<E>) ((TreeSet) original).clone();
+
+ return attemptClone(original);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T attemptClone(T source)
+ {
+ if (source instanceof Cloneable)
+ {
+ try
+ {
+ return (T) source.getClass().getMethod("clone").invoke(source);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ return null;
+ }
+}
16 years, 3 months