Author: mircea.markus
Date: 2008-01-25 07:47:36 -0500 (Fri, 25 Jan 2008)
New Revision: 5238
Added:
core/trunk/src/test-perf/resources/
core/trunk/src/test-perf/resources/local-mru-eviction-service.xml
core/trunk/src/test-perf/resources/local-service.xml
core/trunk/src/test/resources/META-INF/conf-test/
core/trunk/src/test/resources/META-INF/conf-test/local-lru-eviction-service.xml
core/trunk/src/test/resources/META-INF/conf-test/local-null-eviction-service.xml
core/trunk/src/test/resources/META-INF/conf-test/mixedPolicy-eviction-service.xml
core/trunk/src/test/resources/META-INF/conf-test/mux-service.xml
core/trunk/src/test/resources/META-INF/conf-test/policyPerRegion-eviction-service.xml
core/trunk/src/test/resources/META-INF/conf-test/replSync-service.xml
Modified:
core/trunk/src/test-perf/java/org/jboss/cache/ConcurrentEvictAndRemoveTest.java
core/trunk/src/test-perf/java/org/jboss/cache/LocalMapPerfTest.java
core/trunk/src/test-perf/java/org/jboss/cache/LocalPerfTest.java
core/trunk/src/test-scripts/resources/TcpCacheServer/startTcpCacheServer.sh
core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.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/buddyreplication/BuddyReplicationConfigTest.java
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.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/factories/UnitTestCacheConfigurationFactory.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
core/trunk/src/test/java/org/jboss/cache/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/ReplicatedPassivationIntegrationTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
core/trunk/src/test/resources/log4j.xml
Log:
http://jira.jboss.com/jira/browse/JBCACHE-1269
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-01-25 11:50:20 UTC
(rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-01-25 12:47:36 UTC
(rev 5238)
@@ -25,7 +25,7 @@
public class CacheFactoryTest
{
Configuration expected;
- String configFile = "META-INF/replSync-service.xml";
+ String configFile = "META-INF/conf-test/replSync-service.xml";
private CacheSPI cache;
@BeforeMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-01-25 11:50:20 UTC
(rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-01-25 12:47:36 UTC
(rev 5238)
@@ -43,7 +43,7 @@
{
// start a single cache instance
CacheFactory<String, String> cf = new DefaultCacheFactory();
- cache = cf.createCache("META-INF/local-tx-service.xml", false);
+ cache = cf.createCache("/META-INF/news/local-cache-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
events.clear();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-01-25 11:50:20 UTC
(rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-01-25 12:47:36 UTC
(rev 5238)
@@ -46,7 +46,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml", false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("/META-INF/news/local-cache-service.xml",
false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
rootNode = cache.getRoot();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-01-25 11:50:20
UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-01-25 12:47:36
UTC (rev 5238)
@@ -46,7 +46,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml", false);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("/META-INF/news/local-cache-service.xml",
false);
cache.getConfiguration().setNodeLockingScheme(optimistic ?
Configuration.NodeLockingScheme.OPTIMISTIC :
Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
rootNode = cache.getRoot();
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -75,7 +75,7 @@
public void testXmlConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(new
XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"),
false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(new
XmlConfigurationParser().parseFile("META-INF/buddy-replication-cache-service.xml"),
false);
cache.create();
cache.start();
BuddyManager bm = cache.getBuddyManager();
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -48,7 +48,7 @@
public void testMultiplexerStack() throws Exception
{
XmlConfigurationParser parser = new XmlConfigurationParser();
- Configuration conf = parser.parseFile("META-INF/mux-service.xml");
+ Configuration conf =
parser.parseFile("META-INF/conf-test/mux-service.xml");
// test that multiplexer settings have been read in properly.
//assertEquals("MultiplexerService",
"jgroups.mux:name=Multiplexer", conf.getMultiplexerService());
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -11,6 +11,8 @@
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.config.*;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.fail;
@@ -19,6 +21,9 @@
import org.testng.annotations.Test;
import java.util.Properties;
+import java.util.List;
+import java.util.ArrayList;
+import java.io.IOException;
/**
* Tests cache behavior in the presence of concurrent passivation.
@@ -50,14 +55,45 @@
{
TestingUtil.recursiveFileRemove(tmpDir + cacheLoaderDir);
CacheFactory<Integer, String> factory = new DefaultCacheFactory();
- cache_ =
factory.createCache("META-INF/local-eviction-cacheloader-service.xml", false);//
read in generic local xml
-
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ conf.setEvictionConfig(buildEvictionConfig());
+ conf.setCacheLoaderConfig(buildCacheLoaderConfig());
+
conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache_ = factory.createCache(conf, true);// read in generic local xml
+ }
+
+ private CacheLoaderConfig buildCacheLoaderConfig()
+ throws IOException
+ {
+ CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
+ cacheLoaderConfig.setPassivation(false);
+ cacheLoaderConfig.setPreload("/");
+ cacheLoaderConfig.setShared(false);
+ CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new
CacheLoaderConfig.IndividualCacheLoaderConfig();
+ iclc.setClassName("org.jboss.cache.loader.FileCacheLoader");
Properties p = new Properties();
- p.put("location", tmpDir + cacheLoaderDir);
-
cache_.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setProperties(p);
- cache_.start();
+ p.put("location", tmpDir + cacheLoaderDir);
+ iclc.setProperties(p);
+ iclc.setAsync(false);
+ iclc.setFetchPersistentState(true);
+ iclc.setIgnoreModifications(false);
+ cacheLoaderConfig.addIndividualCacheLoaderConfig(iclc);
+ return cacheLoaderConfig;
}
+ private EvictionConfig buildEvictionConfig()
+ {
+ EvictionConfig ec = new
EvictionConfig("org.jboss.cache.eviction.LRUPolicy");
+ ec.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.LRUPolicy");
+ ec.setWakeupIntervalSeconds(5);
+
+ EvictionRegionConfig erc =
UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("_default_",
5000, 1000);
+ List<EvictionRegionConfig> erConfigs = new
ArrayList<EvictionRegionConfig>();
+ erConfigs.add(erc);
+ ec.setEvictionRegionConfigs(erConfigs);
+ return ec;
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -11,12 +11,19 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* @author Daniel Huang
* @version $Revison: $
@@ -48,12 +55,37 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-elementsize-eviction-service.xml",
false);// read in generic local xml
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ EvictionConfig evConfig = conf.getEvictionConfig();
+
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.ElementSizePolicy");
+ evConfig.setWakeupIntervalSeconds(3);
+ evConfig.setDefaultEventQueueSize(200000);
+
+ List<EvictionRegionConfig> regionConfigs = new
ArrayList<EvictionRegionConfig>();
+ regionConfigs.add(createEvictionRegionConfig("_default_", 5000, 100));
+ regionConfigs.add(createEvictionRegionConfig("/org/jboss/data", 10,
20));
+ regionConfigs.add(createEvictionRegionConfig("/org/jboss/test/data", -1,
5));
+ regionConfigs.add(createEvictionRegionConfig("/test/", 5000, 1));
+
+ evConfig.setEvictionRegionConfigs(regionConfigs);
+
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(conf, false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache.start();
}
+ private EvictionRegionConfig createEvictionRegionConfig(String regionName, int
maxNodes, int maxElementsPerNode)
+ {
+ EvictionRegionConfig ercDefault = new EvictionRegionConfig();
+ ercDefault.setRegionName(regionName);
+ ElementSizeConfiguration esConfig = new ElementSizeConfiguration();
+ if (maxNodes >= 0) esConfig.setMaxNodes(maxNodes);
+ if (maxElementsPerNode >= 0)
esConfig.setMaxElementsPerNode(maxElementsPerNode);
+ ercDefault.setEvictionPolicyConfig(esConfig);
+ return ercDefault;
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -11,12 +11,16 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.EvictionPolicyConfig;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.Test;
+import java.net.URL;
+
/**
* Unit test to test Eviction configuration types.
*
@@ -31,7 +35,7 @@
public void testPolicyPerRegion() throws Exception
{
- this.setupCache("META-INF/policyPerRegion-eviction-service.xml");
+
this.setupCache("META-INF/conf-test/policyPerRegion-eviction-service.xml");
assertEquals(5,
cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", true);
@@ -85,7 +89,7 @@
public void testMixedPolicies() throws Exception
{
- this.setupCache("META-INF/mixedPolicy-eviction-service.xml");
+ this.setupCache("META-INF/conf-test/mixedPolicy-eviction-service.xml");
assertEquals(5,
cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", true);
@@ -130,7 +134,7 @@
public void testLegacyPolicyConfiguration() throws Exception
{
- this.setupCache("META-INF/local-lru-eviction-service.xml");
+ this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
assertEquals(5,
cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", false);
@@ -187,8 +191,8 @@
public void testTwoCacheInstanceConfiguration() throws Exception
{
- this.setupCache("META-INF/local-lru-eviction-service.xml");
- this.setupCache("META-INF/local-lru-eviction-service.xml");
+ this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
+ this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
}
public void testNoEviction() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -9,6 +9,10 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
@@ -16,6 +20,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* Unit tests for FIFOPolicy.
*
@@ -49,12 +56,32 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-fifo-eviction-service.xml",
false);// read in generic local xml
-
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache.start();
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ EvictionConfig evConfig = config.getEvictionConfig();
+ evConfig.setWakeupIntervalSeconds(3);
+ evConfig.setDefaultEventQueueSize(20000);
+
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.FIFOPolicy");
+ List<EvictionRegionConfig> erConfigs = new
ArrayList<EvictionRegionConfig>();
+ erConfigs.add(createEvictionRegionConfig("/_default_",5000));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data",5));
+ evConfig.setEvictionRegionConfigs(erConfigs);
+
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(config, true);// read in generic local xml
}
+
+ private EvictionRegionConfig createEvictionRegionConfig(String regionName, int
maxNodes)
+ {
+ EvictionRegionConfig ercDefault = new EvictionRegionConfig();
+ ercDefault.setRegionName(regionName);
+ FIFOConfiguration esConfig = new FIFOConfiguration();
+ if (maxNodes >= 0) esConfig.setMaxNodes(maxNodes);
+ ercDefault.setEvictionPolicyConfig(esConfig);
+ return ercDefault;
+ }
+
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -9,6 +9,10 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
@@ -16,6 +20,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* Unit tests for LFU Policy.
*
@@ -49,12 +56,32 @@
void initCaches() throws Exception
{
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lfu-eviction-service.xml",
false);
-
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache.start();
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ EvictionConfig evConfig = config.getEvictionConfig();
+ evConfig.setWakeupIntervalSeconds(3);
+ evConfig.setDefaultEventQueueSize(200000);
+ List<EvictionRegionConfig> erConfigs = new
ArrayList<EvictionRegionConfig>();
+ erConfigs.add(createEvictionRegionConfig("/_default_",500,10));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/data",5000,4000));
+ erConfigs.add(createEvictionRegionConfig("/org/jboss/test/data",-1,5));
+ evConfig.setEvictionRegionConfigs(erConfigs);
+
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(config, true);
}
+ private EvictionRegionConfig createEvictionRegionConfig(String regionName, int
maxNodes, int minNodes)
+ {
+ EvictionRegionConfig ercDefault = new EvictionRegionConfig();
+ ercDefault.setRegionName(regionName);
+ LFUConfiguration esConfig = new LFUConfiguration();
+ if (maxNodes >= 0) esConfig.setMaxNodes(maxNodes);
+ if (minNodes >= 0) esConfig.setMinNodes(minNodes);
+ ercDefault.setEvictionPolicyConfig(esConfig);
+ esConfig.setEvictionPolicyClassName();
+ return ercDefault;
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -4,6 +4,10 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
@@ -11,6 +15,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* Unit tests for LRU Policy.
*
@@ -45,12 +52,33 @@
public void initCaches() throws Exception
{
- cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
-
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache_.start();
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,true);
+ EvictionConfig evConfig = conf.getEvictionConfig();
+ evConfig.setWakeupIntervalSeconds(5);
+ List<EvictionRegionConfig> regionConfigs = new
ArrayList<EvictionRegionConfig>();
+
regionConfigs.add(UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("/org/jboss/test/data",
5, 4));
+
regionConfigs.add(UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("/test",
10000, 4));
+ evConfig.setEvictionRegionConfigs(regionConfigs);
+
conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ conf.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache_ = (CacheSPI) new DefaultCacheFactory().createCache(conf);
}
+
+ private EvictionRegionConfig buildEvictionRegionConfig(String regionName, int
timeToLive, int maxNodes)
+ {
+ EvictionRegionConfig erc = new EvictionRegionConfig();
+ erc.setRegionName(regionName);
+ LRUConfiguration lruConfig = new LRUConfiguration();
+ lruConfig.setMaxNodes(5000);
+ lruConfig.setTimeToLiveSeconds(1000);
+ erc.setEvictionPolicyConfig(lruConfig);
+ List<EvictionRegionConfig> erConfigs = new
ArrayList<EvictionRegionConfig>();
+ erConfigs.add(erc);
+ return null;
+
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -8,6 +8,10 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
@@ -15,6 +19,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* Unit tests for MRUPolicy.
*
@@ -54,12 +61,31 @@
private void initCaches()
{
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-mru-eviction-service.xml",
false);// read in generic local xml
-
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache.start();
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ EvictionConfig evConfig = config.getEvictionConfig();
+ evConfig.setWakeupIntervalSeconds(3);
+ evConfig.setDefaultEventQueueSize(200000);
+
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.MRUPolicy");
+ List<EvictionRegionConfig> evictionRegionConfigs = new
ArrayList<EvictionRegionConfig>();
+ evictionRegionConfigs.add(buildEvictionRegionConfig("_default_",100));
+
evictionRegionConfigs.add(buildEvictionRegionConfig("/org/jboss/test/data",6));
+ evConfig.setEvictionRegionConfigs(evictionRegionConfigs);
+
+
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache = (CacheSPI)new DefaultCacheFactory().createCache(config);
}
+ private EvictionRegionConfig buildEvictionRegionConfig(String regionName, int
maxNodes)
+ {
+ EvictionRegionConfig erc = new EvictionRegionConfig();
+ erc.setRegionName(regionName);
+ MRUConfiguration mruConfiguration = new MRUConfiguration();
+ mruConfiguration.setMaxNodes(maxNodes);
+ erc.setEvictionPolicyConfig(mruConfiguration);
+ return erc;
+ }
+
public void testEviction() throws Exception
{
cache.put("/org/jboss/test/data/a", "/org/jboss/test/data/a",
"/org/jboss/test/data/a");
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/NullEvictionPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -4,13 +4,22 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* Unit tests for LRU Policy.
*
@@ -39,6 +48,10 @@
}
}
+
+
+
+
/**
* Builds a cache was null eviction by default and in "/test" region,
* LRU in "/lru" region. Does a mix of puts/reads/removes, wakes for
@@ -47,67 +60,53 @@
*/
public void testEviction()
{
- cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-null-eviction-service.xml",
false);// read in generic local xml
-
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache_.start();
-
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ EvictionConfig evConfig = config.getEvictionConfig();
+ evConfig.setWakeupIntervalSeconds(1);
+ evConfig.setDefaultEventQueueSize(200000);
+
evConfig.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.NullEvictionPolicy");
+ List<EvictionRegionConfig> regionConfigs = new
ArrayList<EvictionRegionConfig>();
+ regionConfigs.add(buildEvictionRegionConfig("/_default_"));
+ regionConfigs.add(buildEvictionRegionConfig("/test"));
+
regionConfigs.add(UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("/lru",
10000,1));
+ evConfig.setEvictionRegionConfigs(regionConfigs);
+
config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache_ = (CacheSPI)new DefaultCacheFactory().createCache(config);
+
String dfltRootStr = "/a/";
String testRootStr = "/test/";
String lruRootStr = "/lru/";
for (int i = 0; i < 20; i++)
{
- if (i % 1 == 0 || i % 3 == 0)
- {
Fqn dflt = Fqn.fromString(dfltRootStr + i);
Fqn test = Fqn.fromString(testRootStr + i);
Fqn lru = Fqn.fromString(lruRootStr + i);
cache_.put(dflt, "key", "value");
cache_.put(test, "key", "value");
cache_.put(lru, "key", "value");
- }
- else
- {
- Fqn dflt = Fqn.fromString(dfltRootStr + (i - 1));
- Fqn test = Fqn.fromString(testRootStr + (i - 1));
- Fqn lru = Fqn.fromString(lruRootStr + (i - 1));
- if (i % 2 == 0)
- {
- assertEquals("value", cache_.get(dflt, "key"));
- assertEquals("value", cache_.get(test, "key"));
- assertEquals("value", cache_.get(lru, "key"));
- }
- else
- {
- cache_.removeNode(dflt);
- cache_.removeNode(test);
- cache_.removeNode(lru);
- }
- }
}
-
- TestingUtil.sleepThread(2500);
-
+ TestingUtil.sleepThread(3500);
for (int i = 0; i < 20; i++)
{
Fqn dflt = Fqn.fromString(dfltRootStr + i);
Fqn test = Fqn.fromString(testRootStr + i);
Fqn lru = Fqn.fromString(lruRootStr + i);
-
- if (i % 1 == 0)
- {
+
assertEquals("value", cache_.get(dflt, "key"));
assertEquals("value", cache_.get(test, "key"));
assertNull(cache_.get(lru, "key"));
- }
- else if (i % 3 == 0)
- {
- assertNull(cache_.get(dflt, "key"));
- assertNull(cache_.get(test, "key"));
- assertNull(cache_.get(lru, "key"));
- }
}
}
+ private EvictionRegionConfig buildEvictionRegionConfig(String regionName)
+ {
+ EvictionRegionConfig evRegConfig = new EvictionRegionConfig();
+ evRegConfig.setRegionName(regionName);
+ NullEvictionPolicyConfig nullEvictionPolicyConfig = new
NullEvictionPolicyConfig();
+ evRegConfig.setEvictionPolicyConfig(nullEvictionPolicyConfig);
+ return evRegConfig;
+ }
+
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -3,6 +3,11 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.xml.XmlHelper;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.interceptors.EvictionInterceptor;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
@@ -11,6 +16,7 @@
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import org.w3c.dom.Element;
import javax.transaction.TransactionManager;
import java.util.Iterator;
@@ -41,9 +47,40 @@
public void setUp() throws Exception
{
txManager = new DummyTransactionManagerLookup().getTransactionManager();
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/optimistic-eviction.xml");
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ config.setNodeLockingOptimistic(true);
+ config.setEvictionConfig(buildEvictionConfig());
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(config);
}
+ private EvictionConfig buildEvictionConfig() throws Exception
+ {
+ String xml = " <attribute
name=\"EvictionPolicyConfig\">\n" +
+ " <config>\n" +
+ " <attribute
name=\"wakeUpIntervalSeconds\">1</attribute>\n" +
+ " <!-- Name of the DEFAULT eviction policy
class.-->\n" +
+ " <attribute
name=\"policyClass\">org.jboss.cache.eviction.LRUPolicy</attribute>\n"
+
+ " <region name=\"/_default_\">\n" +
+ " <attribute
name=\"maxNodes\">10</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">0</attribute>\n" +
+ " <attribute
name=\"maxAgeSeconds\">0</attribute>\n" +
+ " </region>\n" +
+ " <region name=\"/testingRegion\">\n" +
+ " <attribute
name=\"maxNodes\">10</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">0</attribute>\n" +
+ " <attribute
name=\"maxAgeSeconds\">0</attribute>\n" +
+ " </region>\n" +
+ " <region name=\"/timeBased\">\n" +
+ " <attribute
name=\"maxNodes\">10</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">1</attribute>\n" +
+ " <attribute
name=\"maxAgeSeconds\">1</attribute>\n" +
+ " </region>\n" +
+ " </config>\n" +
+ " </attribute>";
+ Element element = XmlHelper.stringToElement(xml);
+ return XmlConfigurationParser.parseEvictionConfig(element);
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() 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-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -23,13 +23,12 @@
package org.jboss.cache.eviction;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.RegionManager;
+import org.jboss.cache.*;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.xml.XmlHelper;
@@ -66,7 +65,10 @@
private void initCaches()
{
- cache_ = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-lru-eviction-service.xml",
false);// read in generic local xml
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
+ cache_ = (CacheSPI)instance.createCache(conf, false);
+ conf.getEvictionConfig().setWakeupIntervalSeconds(5);
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
Modified:
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -10,8 +10,10 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.transaction.TransactionSetup;
import org.jboss.cache.xml.XmlHelper;
+import org.jboss.cache.eviction.LRUConfiguration;
import org.jgroups.conf.XmlConfigurator;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -132,6 +134,18 @@
return jgroupsConfigString.substring(0, jgroupsConfigString.indexOf(":"))
+ delay + jgroupsConfigString.substring(jgroupsConfigString.indexOf(":"));
}
+ public static EvictionRegionConfig buildLruEvictionRegionConfig(String regionNaame,
int maxNodes, int timeToLive)
+ {
+ EvictionRegionConfig erc = new EvictionRegionConfig();
+ erc.setRegionName(regionNaame);
+ LRUConfiguration lruConfig = new LRUConfiguration();
+ lruConfig.setEvictionPolicyClass("org.jboss.cache.eviction.LRUPolicy");
+ if (maxNodes >= 0) lruConfig.setMaxNodes(maxNodes);
+ if (timeToLive >= 0) lruConfig.setTimeToLiveSeconds(timeToLive);
+ erc.setEvictionPolicyConfig(lruConfig);
+ return erc;
+ }
+
private static class UnitTestXmlConfigurationParser extends XmlConfigurationParser
{
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -25,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("META-INF/local-tx-service.xml");
+ cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache("/META-INF/news/local-cache-service.xml");
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheLoaderTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -1,6 +1,10 @@
package org.jboss.cache.loader;
import org.jboss.cache.CacheException;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
import org.jboss.cache.loader.tcp.TcpCacheServer;
import org.jboss.cache.misc.TestingUtil;
@@ -43,7 +47,9 @@
cache_server = new TcpCacheServer();
cache_server.setBindAddress("127.0.0.1");
cache_server.setPort(12121);
- cache_server.setConfig("META-INF/local-service.xml"); // must be
in classpath
+ Configuration config =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ CacheSPI cache = (CacheSPI) new
DefaultCacheFactory().createCache(config);
+ cache_server.setCache(cache);
cache_server.create();
cache_server.start();
START_COUNT++;
@@ -53,6 +59,7 @@
ex.printStackTrace();
}
}
+
};
t.setDaemon(true);
t.start();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -7,6 +7,7 @@
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.jmx.CacheJmxWrapper;
import org.jboss.cache.loader.tcp.TcpCacheServer;
import org.jboss.cache.misc.TestingUtil;
@@ -27,8 +28,6 @@
@Test(groups = {"functional"})
public class TcpCacheServerTest
{
- private static final String CONFIG_FILE = "META-INF/local-service.xml";
-
static TcpCacheServer cache_server = null;
private CacheSPI<Object, Object> cache;
@@ -134,7 +133,9 @@
public void testInjectConfigFilePath() throws Exception
{
createTcpCacheServer();
- cache_server.setConfig(CONFIG_FILE);
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
cacheCheck();
@@ -144,9 +145,9 @@
public void testInjectCache() throws Exception
{
createTcpCacheServer();
- CacheSPI cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(CONFIG_FILE, false);
- cache.start();
- cache_server.setCache(cache);
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ cache_server.setCache(cacheSPI);
startTcpCacheServer();
createCacheAndLoader();
cacheCheck();
@@ -156,8 +157,9 @@
public void testInjectCacheJmxWrapper() throws Exception
{
createTcpCacheServer();
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new
DefaultCacheFactory().createCache(CONFIG_FILE, false);
- CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cache);
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
+ CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
wrapper.start();
cache_server.setCacheJmxWrapper(wrapper);
startTcpCacheServer();
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -59,7 +59,7 @@
private void initCaches()
{
CacheFactory<String, String> instance = new DefaultCacheFactory();
- cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
+ cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/jdbCacheLoader-passivation-service.xml"),
false);
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-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -47,7 +47,7 @@
private void initCaches()
{
CacheFactory<Integer, String> instance = new DefaultCacheFactory();
- cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
+ cache = (CacheSPI) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/jdbCacheLoader-passivation-service.xml"),
false);
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-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -44,7 +44,7 @@
public void setUp() throws Exception
{
CacheFactory<String, String> instance = new DefaultCacheFactory();
- cache = (CacheSPI<String, String>) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"),
false);
+ cache = (CacheSPI<String, String>) instance.createCache(new
XmlConfigurationParser().parseFile("META-INF/jdbCacheLoader-passivation-service.xml"),
false);
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/ReplicatedPassivationIntegrationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -29,8 +29,12 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import org.jboss.cache.xml.XmlHelper;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
@@ -43,6 +47,7 @@
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import org.w3c.dom.Element;
/**
* @author Ben Wang, Feb 11, 2004
@@ -86,12 +91,58 @@
Configuration getCfg() throws Exception
{
- Configuration cfg = new
XmlConfigurationParser().parseFile("META-INF/replSync-passivation-service.xml");//
read in generic local xml
+ Configuration cfg =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
+ cfg.setEvictionConfig(buildEvictionConfig());
+ cfg.setCacheLoaderConfig(buildCacheLoaderConfig());
cfg.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cfg.getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
return cfg;
}
+ private CacheLoaderConfig buildCacheLoaderConfig() throws Exception
+ {
+ String xml = " <attribute
name=\"CacheLoaderConfiguration\">\n" +
+ " <config>\n" +
+ " <passivation>true</passivation>\n" +
+ " <preload>/</preload>\n" +
+ " <shared>false</shared>\n" +
+ " <cacheloader>\n" +
+ "
<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
+ " <properties>\n" +
+ " </properties>\n" +
+ " <async>false</async>\n" +
+ "
<fetchPersistentState>true</fetchPersistentState>\n" +
+ "
<ignoreModifications>false</ignoreModifications>\n" +
+ " </cacheloader>\n" +
+ " </config>\n" +
+ " </attribute>";
+ Element element = XmlHelper.stringToElement(xml);
+ return XmlConfigurationParser.parseCacheLoaderConfig(element);
+
+ }
+
+ private EvictionConfig buildEvictionConfig() throws Exception
+ {
+ String xml = " <attribute
name=\"EvictionPolicyConfig\">\n" +
+ " <config>\n" +
+ " <attribute
name=\"wakeUpIntervalSeconds\">5</attribute>\n" +
+ " <attribute
name=\"eventQueueSize\">200000</attribute>\n" +
+ " <attribute
name=\"policyClass\">org.jboss.cache.eviction.LRUPolicy</attribute>\n"
+
+ " <region name=\"/_default_\">\n" +
+ " <attribute
name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">3</attribute>\n" +
+ " </region>\n" +
+ " <region
name=\"/org/jboss/test/data\">\n" +
+ " <attribute
name=\"maxNodes\">100</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">3</attribute>\n" +
+ " </region>\n" +
+ " </config>\n" +
+ " </attribute>";
+ Element element = XmlHelper.stringToElement(xml);
+ return XmlConfigurationParser.parseEvictionConfig(element);
+
+ }
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -7,6 +7,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.misc.TestingUtil;
@@ -30,7 +32,7 @@
* @author Ben Wang
* @version $Revision$
*/
-@Test(groups = {"functional", "transaction"}, enabled = false)
+@Test(groups = {"functional", "transaction"}, enabled = true)
public class ConcurrentBankTest
{
private CacheSPI<Object, Integer> cache;
@@ -50,14 +52,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
- cache = (CacheSPI<Object, Integer>)
instance.createCache("META-INF/local-lru-eviction-service.xml", false);
-
- // XML file above only sets REPEATABLE-READ
+ cache = (CacheSPI<Object, Integer>) instance.createCache(conf, false);
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
-
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
-
cache.create();
cache.start();
}
Modified:
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -15,6 +15,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.fail;
@@ -50,12 +51,11 @@
private void createCache(IsolationLevel level)
{
CacheFactory<Integer, String> factory = new DefaultCacheFactory();
- cache = (CacheSPI<Integer, String>) factory.createCache(new
XmlConfigurationParser().parseFile("META-INF/local-service.xml"), false);
-
- cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
- cache.getConfiguration().setIsolationLevel(level);
-
cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
- cache.start();
+ Configuration conf =
UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true);
+ conf.setCacheMode(Configuration.CacheMode.LOCAL);
+ conf.setIsolationLevel(level);
+ conf.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(conf);
cache.put("/a/b/c", null);
}
Added: core/trunk/src/test/resources/META-INF/conf-test/local-lru-eviction-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/local-lru-eviction-service.xml
(rev 0)
+++
core/trunk/src/test/resources/META-INF/conf-test/local-lru-eviction-service.xml 2008-01-25
12:47:36 UTC (rev 5238)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample JBoss Cache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines JBoss Cache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=Cache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+ This configuration is dependent on the JGroups multiplexer being
+ registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties NOT NEEDED since CacheMode is LOCAL
-->
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/data">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">5</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ <region name="/test">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ <region name="/maxAgeTest">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">8</attribute>
+ <attribute name="maxAgeSeconds">10</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/META-INF/conf-test/local-null-eviction-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/local-null-eviction-service.xml
(rev 0)
+++
core/trunk/src/test/resources/META-INF/conf-test/local-null-eviction-service.xml 2008-01-25
12:47:36 UTC (rev 5238)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample JBoss Cache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines JBoss Cache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=Cache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+ This configuration is dependent on the JGroups multiplexer being
+ registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties NOT NEEDED since CacheMode is LOCAL
-->
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">1</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <attribute
name="policyClass">org.jboss.cache.eviction.NullEvictionPolicy</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ </region>
+ <region name="/test"
policyClass="org.jboss.cache.eviction.NullEvictionPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ </region>
+ <region name="/lru"
policyClass="org.jboss.cache.eviction.LRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/META-INF/conf-test/mixedPolicy-eviction-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/mixedPolicy-eviction-service.xml
(rev 0)
+++
core/trunk/src/test/resources/META-INF/conf-test/mixedPolicy-eviction-service.xml 2008-01-25
12:47:36 UTC (rev 5238)
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties.
+ ClusterConfig isn't used if the multiplexer is enabled and successfully
initialized.
+ -->
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="false"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5"
shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK
+ use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE stability_delay="1000"
desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true"
join_timeout="5000" shun="false"
+ view_bundling="true"
view_ack_collection_timeout="5000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </attribute>
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/data"
policyClass="org.jboss.cache.eviction.FIFOPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ </region>
+ <region name="/test/"
policyClass="org.jboss.cache.eviction.MRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ </region>
+ <region name="/maxAgeTest/">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">8</attribute>
+ <attribute name="maxAgeSeconds">10</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/META-INF/conf-test/mux-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/mux-service.xml
(rev 0)
+++ core/trunk/src/test/resources/META-INF/conf-test/mux-service.xml 2008-01-25 12:47:36
UTC (rev 5238)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--
-->
+<!-- Sample TreeCache Service Configuration using Multiplexer
-->
+<!--
-->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=testTreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <depends optional-attribute-name="MultiplexerService"
+ proxy-type="attribute">jgroups.mux:name=Multiplexer
+ </depends>
+ <attribute name="MultiplexerStack">tcp</attribute>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all nodes in a clusters, in
order
+ to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+ </mbean>
+
+
+</server>
Added:
core/trunk/src/test/resources/META-INF/conf-test/policyPerRegion-eviction-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/policyPerRegion-eviction-service.xml
(rev 0)
+++
core/trunk/src/test/resources/META-INF/conf-test/policyPerRegion-eviction-service.xml 2008-01-25
12:47:36 UTC (rev 5238)
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties.
+ ClusterConfig isn't used if the multiplexer is enabled and successfully
initialized.
+ -->
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="false"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5"
shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE stability_delay="1000"
desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true"
join_timeout="5000" shun="false"
+ view_bundling="true"
view_ack_collection_timeout="5000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </attribute>
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_"
policyClass="org.jboss.cache.eviction.LRUPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/data"
policyClass="org.jboss.cache.eviction.LFUPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="minNodes">1000</attribute>
+ </region>
+ <region name="/org/jboss/test/data"
policyClass="org.jboss.cache.eviction.FIFOPolicy">
+ <attribute name="maxNodes">5</attribute>
+ </region>
+ <region name="/test/"
policyClass="org.jboss.cache.eviction.MRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ </region>
+ <region name="/maxAgeTest/"
policyClass="org.jboss.cache.eviction.LRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">8</attribute>
+ <attribute name="maxAgeSeconds">10</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/META-INF/conf-test/replSync-service.xml
===================================================================
--- core/trunk/src/test/resources/META-INF/conf-test/replSync-service.xml
(rev 0)
+++ core/trunk/src/test/resources/META-INF/conf-test/replSync-service.xml 2008-01-25
12:47:36 UTC (rev 5238)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+ <!--
+ Isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!--
+ Just used for async repl: use a replication queue
+ -->
+ <attribute name="UseReplQueue">false</attribute>
+
+ <!--
+ Replication interval for replication queue (in ms)
+ -->
+ <attribute name="ReplQueueInterval">0</attribute>
+
+ <!--
+ Max number of elements which trigger replication
+ -->
+ <attribute name="ReplQueueMaxElements">0</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties.
+ ClusterConfig isn't used if the multiplexer is enabled and successfully
initialized.
+ -->
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="false"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5"
shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE stability_delay="1000"
desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true"
join_timeout="5000" shun="false"
+ view_bundling="true"
view_ack_collection_timeout="5000"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </attribute>
+
+
+ <!--
+ Whether or not to fetch state on joining a cluster
+ NOTE this used to be called FetchStateOnStartup and has been renamed to be more
descriptive.
+ -->
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">15000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+ <!--
+ Indicate whether to use region based marshalling or not. Set this to true if you
are running under a scoped
+ class loader, e.g., inside an application server. Default is "false".
+ -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ </mbean>
+
+
+ <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
+ <!-- <mbean code="org.jboss.cache.TreeCacheView"
name="jboss.cache:service=TreeCacheView">-->
+ <!-- <depends>jboss.cache:service=TreeCache</depends>-->
+ <!-- <attribute
name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+ <!-- </mbean>-->
+
+
+</server>
Modified: core/trunk/src/test/resources/log4j.xml
===================================================================
--- core/trunk/src/test/resources/log4j.xml 2008-01-25 11:50:20 UTC (rev 5237)
+++ core/trunk/src/test/resources/log4j.xml 2008-01-25 12:47:36 UTC (rev 5238)
@@ -23,7 +23,7 @@
<!-- A time/date based rolling appender -->
<appender name="FILE"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="output/jbosscache.log"/>
- <param name="Append" value="true"/>
+ <param name="Append" value="false"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern"
value="'.'yyyy-MM-dd"/>
@@ -31,7 +31,7 @@
<!-- Rollover at the top of each hour
<param name="DatePattern"
value="'.'yyyy-MM-dd-HH"/>
-->
- <param name="Threshold" value="DEBUG"/>
+ <param name="Threshold" value="TRACE"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
@@ -63,9 +63,21 @@
<!-- ================ -->
<category name="org.jboss.cache">
- <priority value="WARN"/>
+ <priority value="ERROR"/>
</category>
+
+ <!--<category
name="org.jboss.cache.interceptors.PessimisticLockInterceptor">-->
+ <!--<priority value="TRACE"/>-->
+ <!--</category>-->
+ <!--<category
name="org.jboss.cache.interceptors.UnlockInterceptor">-->
+ <!--<priority value="TRACE"/>-->
+ <!--</category>-->
+
+ <category name="org.jboss.cache.eviction">
+ <priority value="TRACE"/>
+ </category>
+
<category name="org.jboss.tm">
<priority value="WARN"/>
</category>
Modified: core/trunk/src/test-perf/java/org/jboss/cache/ConcurrentEvictAndRemoveTest.java
===================================================================
---
core/trunk/src/test-perf/java/org/jboss/cache/ConcurrentEvictAndRemoveTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++
core/trunk/src/test-perf/java/org/jboss/cache/ConcurrentEvictAndRemoveTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -51,7 +51,7 @@
public void setUp() throws Exception
{
super.setUp();
- Configuration c = new
XmlConfigurationParser().parseFile("META-INF/local-mru-eviction-service.xml");
+ Configuration c = new
XmlConfigurationParser().parseFile("resources/local-mru-eviction-service.xml");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(c);
}
Modified: core/trunk/src/test-perf/java/org/jboss/cache/LocalMapPerfTest.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/LocalMapPerfTest.java 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test-perf/java/org/jboss/cache/LocalMapPerfTest.java 2008-01-25
12:47:36 UTC (rev 5238)
@@ -121,7 +121,7 @@
void initCaches(Configuration.CacheMode caching_mode) throws Exception
{
cachingMode_ = caching_mode;
- cache_ = (CacheImpl)
DefaultCacheFactory.getInstance().createCache("META-INF/local-service.xml",
false);
+ cache_ = (CacheImpl)
DefaultCacheFactory.getInstance().createCache("resources/local-service.xml",
false);
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache_.start();
}
Modified: core/trunk/src/test-perf/java/org/jboss/cache/LocalPerfTest.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/LocalPerfTest.java 2008-01-25 11:50:20
UTC (rev 5237)
+++ core/trunk/src/test-perf/java/org/jboss/cache/LocalPerfTest.java 2008-01-25 12:47:36
UTC (rev 5238)
@@ -88,7 +88,7 @@
void initCaches(Configuration.CacheMode caching_mode) throws Exception
{
cachingMode_ = caching_mode;
- cache_ = (CacheImpl)
DefaultCacheFactory.getInstance().createCache("META-INF/local-service.xml",
false);
+ cache_ = (CacheImpl)
DefaultCacheFactory.getInstance().createCache("resources/local-service.xml",
false);
cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache_.start();
}
Added: core/trunk/src/test-perf/resources/local-mru-eviction-service.xml
===================================================================
--- core/trunk/src/test-perf/resources/local-mru-eviction-service.xml
(rev 0)
+++ core/trunk/src/test-perf/resources/local-mru-eviction-service.xml 2008-01-25 12:47:36
UTC (rev 5238)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties NOT NEEDED since CacheMode is LOCAL
-->
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute
name="policyClass">org.jboss.cache.eviction.MRUPolicy</attribute>
+
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">100</attribute>
+ </region>
+ <region name="/org/jboss/data">
+ <attribute name="maxNodes">250</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">6</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test-perf/resources/local-service.xml
===================================================================
--- core/trunk/src/test-perf/resources/local-service.xml (rev 0)
+++ core/trunk/src/test-perf/resources/local-service.xml 2008-01-25 12:47:36 UTC (rev
5238)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+
+ <!-- Configure the TransactionManager -->
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.BatchModeTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute
name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute
name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties NOT NEEDED since CacheMode is LOCAL
-->
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/data">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute
name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">5</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <!--
+ Indicate whether to use region based marshalling or not. Set this to true if you
are running under a scoped
+ class loader, e.g., inside an application server. Default is "false".
+ -->
+ <attribute
name="UseRegionBasedMarshalling">false</attribute>
+ </mbean>
+
+
+</server>
Modified: core/trunk/src/test-scripts/resources/TcpCacheServer/startTcpCacheServer.sh
===================================================================
--- core/trunk/src/test-scripts/resources/TcpCacheServer/startTcpCacheServer.sh 2008-01-25
11:50:20 UTC (rev 5237)
+++ core/trunk/src/test-scripts/resources/TcpCacheServer/startTcpCacheServer.sh 2008-01-25
12:47:36 UTC (rev 5238)
@@ -2,7 +2,7 @@
address=127.0.0.1
port=7500
-config=META-INF/local-service.xml
+config=resources/local-service.xml
echo Starting TCP Cache Server on port $port, address $address and cache config $config