JBoss Cache SVN: r6441 - core/trunk/src/test/java/org/jboss/cache/statetransfer.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 11:42:20 -0400 (Wed, 30 Jul 2008)
New Revision: 6441
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
Log:
Added better state retrieval timeout
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30 15:23:30 UTC (rev 6440)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30 15:42:20 UTC (rev 6441)
@@ -63,7 +63,6 @@
*
* @throws Exception
*/
- @Test(invocationCount = 5)
public void testConcurrentActivationAsync() throws Exception
{
concurrentActivationTest(false);
@@ -672,7 +671,7 @@
boolean sync, CacheSPI[] caches)
throws Exception
{
- super(semaphore, name, sync, false);
+ super(semaphore, name, sync, false, 120000);
this.caches = caches;
}
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-07-30 15:23:30 UTC (rev 6440)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-07-30 15:42:20 UTC (rev 6441)
@@ -446,6 +446,24 @@
}
}
+ CacheUser(Semaphore semaphore,
+ String name,
+ boolean sync,
+ boolean activateRoot, long stateRetrievalTimeout)
+ throws Exception
+ {
+ cache = createCache(name, sync, true, false, false, false, true);
+ cache.getConfiguration().setStateRetrievalTimeout(stateRetrievalTimeout);
+ cache.start();
+ this.semaphore = semaphore;
+ this.name = name;
+
+ if (activateRoot)
+ {
+ cache.getRegion(Fqn.ROOT, true).activate();
+ }
+ }
+
public void run()
{
boolean acquired = false;
16 years, 5 months
JBoss Cache SVN: r6440 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 11:23:30 -0400 (Wed, 30 Jul 2008)
New Revision: 6440
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java
Log:
Added VM and OS stats to the report
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java 2008-07-30 12:30:50 UTC (rev 6439)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java 2008-07-30 15:23:30 UTC (rev 6440)
@@ -1,5 +1,9 @@
package org.cachebench.reportgenerators;
+import org.jfree.chart.title.TextTitle;
+
+import java.util.Date;
+
public abstract class AbstractChartGen implements ChartGen
{
protected String reportDirectory;
@@ -16,4 +20,12 @@
{
this.filenamePrefix = fnPrefix;
}
+
+ protected TextTitle getSubtitle()
+ {
+ return new TextTitle("Generated on " + new Date() + " by The CacheBenchFwk\nJDK: " +
+ System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.version") + ", " +
+ System.getProperty("java.vm.vendor") + ") OS: " + System.getProperty("os.name") + " (" +
+ System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")");
+ }
}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2008-07-30 12:30:50 UTC (rev 6439)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2008-07-30 15:23:30 UTC (rev 6440)
@@ -8,7 +8,6 @@
import org.jfree.chart.labels.CategoryItemLabelGenerator;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer3D;
-import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
@@ -19,7 +18,6 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.text.NumberFormat;
-import java.util.Date;
import java.util.StringTokenizer;
/**
@@ -102,7 +100,7 @@
}
});
- chart.addSubtitle(new TextTitle("Generated on " + new Date() + " by The CacheBenchFwk"));
+ chart.addSubtitle(getSubtitle());
chart.setBorderVisible(true);
chart.setAntiAlias(true);
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java 2008-07-30 12:30:50 UTC (rev 6439)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java 2008-07-30 15:23:30 UTC (rev 6440)
@@ -5,7 +5,6 @@
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
@@ -15,7 +14,6 @@
import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException;
-import java.util.Date;
import java.util.Map;
import java.util.SortedMap;
import java.util.StringTokenizer;
@@ -61,7 +59,7 @@
private JFreeChart createChart(CategoryDataset data, String title, String yLabel)
{
JFreeChart chart = ChartFactory.createLineChart(title, "Cluster size (number of cache instances)", yLabel, data, PlotOrientation.VERTICAL, true, false, false);
- chart.addSubtitle(new TextTitle("Generated on " + new Date() + " by The CacheBenchFwk"));
+ chart.addSubtitle(getSubtitle());
chart.setBorderVisible(true);
chart.setAntiAlias(true);
chart.setTextAntiAlias(true);
16 years, 5 months
JBoss Cache SVN: r6439 - in core/trunk/src: main/java/org/jboss/cache/util and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 08:30:50 -0400 (Wed, 30 Jul 2008)
New Revision: 6439
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainer.java
core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
Log:
Fixed stuff
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -202,4 +202,9 @@
* @return true if the node exists and is marked as resident, false otherwise.
*/
boolean isResident(Fqn fqn);
+
+ /**
+ * @return a string representation of the contents of the data container
+ */
+ String printDetails();
}
Modified: core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -33,8 +33,13 @@
protected void inactivateRegion(Fqn fqn) throws CacheException
{
if (isActivatingDeactivating(fqn))
- throw new CacheException("Region " + fqn + " is already being activated/deactivated");
+ {
+// throw new CacheException("Region " + fqn + " is already being activated/deactivated");
+ log.warn("Region " + fqn + " is already being activated/deactivated");
+ return;
+ }
+
NodeSPI parent = null;
NodeSPI subtreeRoot = null;
boolean parentLocked = false;
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -331,7 +331,27 @@
}
}
+ /**
+ * Adds details of the node into a map as strings.
+ */
@Override
+ protected void printDetailsInMap(StringBuilder sb, int indent)
+ {
+ printIndent(sb, indent);
+ indent += 2;// increse it
+ sb.append(Fqn.SEPARATOR);
+ if (!fqn.isRoot()) sb.append(fqn.getLastElement());
+ sb.append(" ");
+ sb.append(data);
+ for (Node n : children().values())
+ {
+ sb.append("\n");
+ ((NodeSPI) n).printDetails(sb, indent);
+ }
+ }
+
+
+ @Override
public void setFqn(Fqn fqn)
{
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -617,6 +617,7 @@
// and roll back any tx and break any locks
List<Address> removed = new ArrayList<Address>(members);
removed.removeAll(newMembers);
+ spi.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
NodeSPI root = spi.getRoot();
if (root != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -506,7 +506,7 @@
}
}
- private void printIndent(StringBuilder sb, int indent)
+ protected final void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -550,18 +550,19 @@
/**
* Adds details of the node into a map as strings.
*/
- private void printDetailsInMap(StringBuilder sb, int indent)
+ protected void printDetailsInMap(StringBuilder sb, int indent)
{
printIndent(sb, indent);
indent += 2;// increse it
- if (!(getFqn()).isRoot())
+ sb.append(Fqn.SEPARATOR);
+ if (!fqn.isRoot()) sb.append(fqn.getLastElement());
+ sb.append(" ");
+ sb.append(data);
+ for (InternalNode n : children().values())
{
- sb.append(Fqn.SEPARATOR);
+ sb.append("\n");
+ n.printDetails(sb, indent);
}
- sb.append(fqn.getLastElement());
- sb.append(" ");
- sb.append(data);
- sb.append(children);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -2,6 +2,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.DataContainerImpl;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
@@ -23,7 +24,7 @@
public static String printCacheDetails(Cache c)
{
// internal cast
- DataContainerImpl ci = (DataContainerImpl) ((CacheInvocationDelegate) c).getDataContainer();
+ DataContainer ci = ((CacheInvocationDelegate) c).getDataContainer();
return ci.printDetails();
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -6,12 +6,13 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.CacheStarted;
import org.jboss.cache.notifications.annotation.CacheStopped;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import static org.testng.AssertJUnit.*;
@@ -366,6 +367,10 @@
String details = html ? wrapper.printCacheDetailsAsHtml() : wrapper.printCacheDetails();
+
+ System.out.println("Cache details: " + CachePrinter.printCacheDetails(cache));
+ System.out.println("Details: " + details);
+
assertTrue("Details include testing", details.contains("testing"));
assertTrue("Details include jmx", details.contains("jmx"));
assertTrue("Details include foobar", details.contains("foobar"));
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30 12:05:49 UTC (rev 6438)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30 12:30:50 UTC (rev 6439)
@@ -39,10 +39,9 @@
@Test(groups = "functional")
public class StateTransferConcurrencyTest extends StateTransferTestBase
{
-
protected String getReplicationVersion()
{
- return "2.2.0.GA";
+ return "3.0.0.GA";
}
/**
@@ -64,6 +63,7 @@
*
* @throws Exception
*/
+ @Test(invocationCount = 5)
public void testConcurrentActivationAsync() throws Exception
{
concurrentActivationTest(false);
@@ -484,7 +484,7 @@
caches.put("evict2", cache2);
Region region = cache2.getRegion(Fqn.ROOT, false);
- // We expect events for /a, /a/b and /a/b/c
+ // We expect a VISIT event for / and ADD events for /a, /a/b and /a/b/c
int nodeEventQueueSize = region.nodeEventQueueSize();
int i = 0;
while (region.nodeEventQueueSize() > 0)
@@ -492,7 +492,7 @@
System.out.println(++i + ") Queue contains : " + region.takeLastEventNode());
}
- assertEquals("Saw the expected number of node events", 3, nodeEventQueueSize);
+ assertEquals("Saw the expected number of node events", 4, nodeEventQueueSize);
}
/**
16 years, 5 months
JBoss Cache SVN: r6438 - core/branches/2.2.X/src/test/java/org/jboss/cache/eviction.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 08:05:49 -0400 (Wed, 30 Jul 2008)
New Revision: 6438
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
Log:
Better cleanup
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-07-30 12:03:28 UTC (rev 6437)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-07-30 12:05:49 UTC (rev 6438)
@@ -3,13 +3,13 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeEvicted;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -21,26 +21,26 @@
@Test(groups = {"functional"})
public class ReplicatedLRUPolicyTest
{
- CacheSPI<Object, Object> cache_, cache1_, cache2_;
+ CacheSPI<Object, Object> cache1, cache2, cache3;
int wakeupIntervalMillis_ = 0;
EvictionListener listener_ = new EvictionListener();
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache_ = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
- cache_.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache_.getConfiguration().setUseRegionBasedMarshalling(true);
- cache_.start();
- cache_.getNotifier().addCacheListener(listener_);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+ cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache1.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache1.start();
+ cache1.getNotifier().addCacheListener(listener_);
listener_.resetCounter();
- cache2_ = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2_.getConfiguration().setUseRegionBasedMarshalling(true);
- cache2_.start();
+ cache3 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache3.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache3.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache3.start();
- wakeupIntervalMillis_ = cache_.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
+ wakeupIntervalMillis_ = cache1.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
log("wakeupInterval is " + wakeupIntervalMillis_);
if (wakeupIntervalMillis_ <= 0)
{
@@ -51,8 +51,7 @@
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- cache_.stop();
- cache2_.stop();
+ TestingUtil.killCaches(cache1, cache2, cache3);
}
/**
@@ -62,13 +61,13 @@
{
String rootStr = "/org/jboss/test/data/";
String str = rootStr + "0";
- cache_.put(str, str, str);
+ cache1.put(str, str, str);
TestingUtil.sleepThread(30000);
- Object node = cache_.peek(Fqn.fromString(str), false);
+ Object node = cache1.peek(Fqn.fromString(str), false);
assertNull("DataNode should be evicted already ", node);
assertEquals("Eviction counter ", 1, listener_.getCounter());
- String val = (String) cache2_.get(str, str);
+ String val = (String) cache3.get(str, str);
assertNotNull("DataNode should not be evicted here ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
}
@@ -80,13 +79,13 @@
{
String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
- cache_.put(fqn, str, str);
+ cache1.put(fqn, str, str);
}
TestingUtil.sleepThread(2 * wakeupIntervalMillis_);
- String val = (String) cache_.get(rootStr + "3", rootStr + "3");
+ String val = (String) cache1.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be evicted already ", val);
- val = (String) cache2_.get(rootStr + "3", rootStr + "3");
+ val = (String) cache3.get(rootStr + "3", rootStr + "3");
assertNotNull("DataNode should not be evicted here ", val);
}
@@ -97,18 +96,18 @@
{
String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
- cache_.put(fqn, str, str);
+ cache1.put(fqn, str, str);
}
TestingUtil.sleepThread(wakeupIntervalMillis_ - 1000);
String str = rootStr + "7";
Fqn fqn = Fqn.fromString(str);
- cache_.get(fqn, str);
+ cache1.get(fqn, str);
TestingUtil.sleepThread(wakeupIntervalMillis_);
- String val = (String) cache_.get(rootStr + "3", rootStr + "3");
+ String val = (String) cache1.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be empty ", val);
- val = (String) cache2_.get(rootStr + "7", rootStr + "7");
+ val = (String) cache3.get(rootStr + "7", rootStr + "7");
assertNotNull("DataNode should not be null", val);
}
16 years, 5 months
JBoss Cache SVN: r6437 - core/trunk/src/test/java/org/jboss/cache/eviction.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 08:03:28 -0400 (Wed, 30 Jul 2008)
New Revision: 6437
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
Log:
proper cleanup
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-07-30 11:37:41 UTC (rev 6436)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java 2008-07-30 12:03:28 UTC (rev 6437)
@@ -21,26 +21,26 @@
@Test(groups = {"functional"})
public class ReplicatedLRUPolicyTest
{
- CacheSPI<Object, Object> cache_, cache1_, cache2_;
+ CacheSPI<Object, Object> cache1, cache2, cache3;
long wakeupIntervalMillis = 0;
EvictionListener listener_ = new EvictionListener();
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache_ = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
- cache_.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache_.getConfiguration().setUseRegionBasedMarshalling(true);
- cache_.start();
- cache_.getNotifier().addCacheListener(listener_);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+ cache1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache1.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache1.start();
+ cache1.getNotifier().addCacheListener(listener_);
listener_.resetCounter();
- cache2_ = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
- cache2_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2_.getConfiguration().setUseRegionBasedMarshalling(true);
- cache2_.start();
+ cache3 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ cache3.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache3.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache3.start();
- wakeupIntervalMillis = cache_.getConfiguration().getEvictionConfig().getWakeupInterval();
+ wakeupIntervalMillis = cache1.getConfiguration().getEvictionConfig().getWakeupInterval();
log("wakeupInterval is " + wakeupIntervalMillis);
if (wakeupIntervalMillis <= 0)
{
@@ -51,8 +51,7 @@
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- cache_.stop();
- cache2_.stop();
+ TestingUtil.killCaches(cache1, cache2, cache3);
}
/**
@@ -62,13 +61,13 @@
{
String rootStr = "/org/jboss/test/data/";
String str = rootStr + "0";
- cache_.put(str, str, str);
+ cache1.put(str, str, str);
TestingUtil.sleepThread(30000);
- Object node = cache_.peek(Fqn.fromString(str), false);
+ Object node = cache1.peek(Fqn.fromString(str), false);
assertNull("DataNode should be evicted already ", node);
assertEquals("Eviction counter ", 1, listener_.getCounter());
- String val = (String) cache2_.get(str, str);
+ String val = (String) cache3.get(str, str);
assertNotNull("DataNode should not be evicted here ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
}
@@ -80,13 +79,13 @@
{
String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
- cache_.put(fqn, str, str);
+ cache1.put(fqn, str, str);
}
TestingUtil.sleepThread(2 * wakeupIntervalMillis);
- String val = (String) cache_.get(rootStr + "3", rootStr + "3");
+ String val = (String) cache1.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be evicted already ", val);
- val = (String) cache2_.get(rootStr + "3", rootStr + "3");
+ val = (String) cache3.get(rootStr + "3", rootStr + "3");
assertNotNull("DataNode should not be evicted here ", val);
}
@@ -97,18 +96,18 @@
{
String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
- cache_.put(fqn, str, str);
+ cache1.put(fqn, str, str);
}
TestingUtil.sleepThread(wakeupIntervalMillis - 1000);
String str = rootStr + "7";
Fqn fqn = Fqn.fromString(str);
- cache_.get(fqn, str);
+ cache1.get(fqn, str);
TestingUtil.sleepThread(wakeupIntervalMillis);
- String val = (String) cache_.get(rootStr + "3", rootStr + "3");
+ String val = (String) cache1.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be empty ", val);
- val = (String) cache2_.get(rootStr + "7", rootStr + "7");
+ val = (String) cache3.get(rootStr + "7", rootStr + "7");
assertNotNull("DataNode should not be null", val);
}
16 years, 5 months
JBoss Cache SVN: r6436 - benchmarks/benchmark-fwk/trunk/src/org/cachebench.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 07:37:41 -0400 (Wed, 30 Jul 2008)
New Revision: 6436
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
Log:
stuff
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-07-30 11:10:24 UTC (rev 6435)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-07-30 11:37:41 UTC (rev 6436)
@@ -135,6 +135,7 @@
params.putAll(systemParams);
log.info("Initialising cache with params " + params);
cache.init(params);
+ cache.setUp();
}
return cache;
}
16 years, 5 months
JBoss Cache SVN: r6435 - core/trunk/src/test/java/org/jboss/cache/notifications.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 07:10:24 -0400 (Wed, 30 Jul 2008)
New Revision: 6435
Modified:
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
Log:
Disable state transfer test for OL
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java 2008-07-30 10:47:22 UTC (rev 6434)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java 2008-07-30 11:10:24 UTC (rev 6435)
@@ -15,4 +15,11 @@
{
optLocking = true;
}
+
+ @Override
+ public void testStateTransfer() throws Exception
+ {
+ // no op
+ }
+
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-07-30 10:47:22 UTC (rev 6434)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-07-30 11:10:24 UTC (rev 6435)
@@ -630,7 +630,6 @@
assertEquals(expected, eventLog2.events);
}
- @Test(enabled = true)
public void testStateTransfer() throws Exception
{
// first stop cache2
@@ -657,8 +656,6 @@
TestingUtil.blockUntilViewsReceived(5000, cache1, cache2);
List<Event> expected = new ArrayList<Event>();
- // public EventImpl(boolean pre, Cache cache, ModificationType modificationType, Map data, Fqn fqn,
- // Transaction transaction, boolean originLocal, Fqn targetFqn, boolean successful, View newView, Type type)
expected.add(new EventImpl(true, cache2, null, null, Fqn.ROOT, null, false, null, false, null, NODE_CREATED));
expected.add(new EventImpl(false, cache2, null, null, Fqn.ROOT, null, false, null, false, null, NODE_CREATED));
@@ -674,7 +671,6 @@
scrubTransactions(expected);
- if (optLocking) eventLog2.scrubImplicitTransactions();
assertEquals(expected, eventLog2.events);
}
16 years, 5 months
JBoss Cache SVN: r6434 - core/trunk/src/test/java/org/jboss/cache/lock.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 06:47:22 -0400 (Wed, 30 Jul 2008)
New Revision: 6434
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java
Log:
Fixed breakage
Modified: core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java 2008-07-30 10:41:08 UTC (rev 6433)
+++ core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java 2008-07-30 10:47:22 UTC (rev 6434)
@@ -32,6 +32,7 @@
{
PessimisticUnversionedNode un = new PessimisticUnversionedNode(fqn.getLastElement(), fqn, null, null);
un.injectDependencies(null, null, null);
+ un.injectLockStrategyFactory(new LockStrategyFactory());
return new NodeInvocationDelegate(un);
}
}
16 years, 5 months
JBoss Cache SVN: r6433 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-30 06:41:08 -0400 (Wed, 30 Jul 2008)
New Revision: 6433
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Added marshalling of FastCopyHashMaps
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-07-30 10:39:40 UTC (rev 6432)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-07-30 10:41:08 UTC (rev 6433)
@@ -15,6 +15,7 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.util.FastCopyHashMap;
import org.jboss.cache.util.ImmutableMapCopy;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
@@ -65,6 +66,7 @@
protected static final int MAGICNUMBER_SHORT = 20;
protected static final int MAGICNUMBER_IMMUTABLE_MAPCOPY = 21;
protected static final int MAGICNUMBER_MARSHALLEDVALUE = 22;
+ protected static final int MAGICNUMBER_FASTCOPY_HASHMAP = 23;
protected static final int MAGICNUMBER_NULL = 99;
protected static final int MAGICNUMBER_SERIALIZABLE = 100;
protected static final int MAGICNUMBER_REF = 101;
@@ -265,6 +267,7 @@
// --------- Marshalling methods
+ @SuppressWarnings("deprecation")
protected void marshallObject(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
if (o == null)
@@ -341,6 +344,11 @@
out.writeByte(MAGICNUMBER_TREE_MAP);
marshallMap((Map) o, out, refMap);
}
+ else if (o.getClass().equals(FastCopyHashMap.class))
+ {
+ out.writeByte(MAGICNUMBER_FASTCOPY_HASHMAP);
+ marshallMap((Map) o, out, refMap);
+ }
else if (o.getClass().equals(ImmutableMapCopy.class))
{
out.writeByte(MAGICNUMBER_IMMUTABLE_MAPCOPY);
@@ -481,6 +489,7 @@
ipAddress.writeExternal(out);
}
+ @SuppressWarnings("unchecked")
private void marshallCollection(Collection c, ObjectOutputStream out, Map refMap) throws Exception
{
writeUnsignedInt(out, c.size());
@@ -490,6 +499,7 @@
}
}
+ @SuppressWarnings("unchecked")
private void marshallMap(Map map, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
int mapSize = map.size();
@@ -586,6 +596,8 @@
return unmarshallTreeSet(in, refMap);
case MAGICNUMBER_IMMUTABLE_MAPCOPY:
return unmarshallMapCopy(in, refMap);
+ case MAGICNUMBER_FASTCOPY_HASHMAP:
+ return unmarshallFastCopyHashMap(in, refMap);
case MAGICNUMBER_BOOLEAN:
return in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
case MAGICNUMBER_INTEGER:
@@ -623,6 +635,14 @@
throw new Exception("Unknown magic number " + magicNumber);
}
+ private FastCopyHashMap unmarshallFastCopyHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
+ {
+ FastCopyHashMap map = new FastCopyHashMap();
+ populateFromStream(in, refMap, map);
+ return map;
+ }
+
+ @SuppressWarnings("unchecked")
private GravitateResult unmarshallGravitateResult(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Boolean found = (Boolean) unmarshallObject(in, refMap);
@@ -723,6 +743,7 @@
return map;
}
+ @SuppressWarnings("unchecked")
private Map unmarshallMapCopy(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
// read in as a HashMap first
@@ -751,37 +772,33 @@
return set;
}
+ @SuppressWarnings("unchecked")
private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Map mapToPopulate) throws Exception
{
int size = readUnsignedInt(in);
- for (int i = 0; i < size; i++)
- {
- mapToPopulate.put(unmarshallObject(in, refMap), unmarshallObject(in, refMap));
- }
+ for (int i = 0; i < size; i++) mapToPopulate.put(unmarshallObject(in, refMap), unmarshallObject(in, refMap));
}
+ @SuppressWarnings("unchecked")
private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Set setToPopulate) throws Exception
{
int size = readUnsignedInt(in);
- for (int i = 0; i < size; i++)
- {
- setToPopulate.add(unmarshallObject(in, refMap));
- }
+ for (int i = 0; i < size; i++) setToPopulate.add(unmarshallObject(in, refMap));
}
+ @SuppressWarnings("unchecked")
private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, List listToPopulate, int listSize) throws Exception
{
- for (int i = 0; i < listSize; i++)
- {
- listToPopulate.add(unmarshallObject(in, refMap));
- }
+ for (int i = 0; i < listSize; i++) listToPopulate.add(unmarshallObject(in, refMap));
}
+ @SuppressWarnings("deprecation")
protected void marshallDefaultDataVersion(DefaultDataVersion ddv, ObjectOutputStream out) throws Exception
{
writeUnsignedLong(out, ddv.getRawVersion());
}
+ @SuppressWarnings("deprecation")
protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
{
return new DefaultDataVersion(readUnsignedLong(in));
16 years, 5 months