[jboss-cvs] JBossCache/src/org/jboss/cache/factories ...
Vladmir Blagojevic
vladimir.blagojevic at jboss.com
Wed Jan 3 22:36:42 EST 2007
User: vblagojevic
Date: 07/01/03 22:36:42
Modified: src/org/jboss/cache/factories UnitTestCacheFactory.java
Log:
state transfer tests use UnitTestCacheFactory
Revision Changes Path
1.2 +52 -1 JBossCache/src/org/jboss/cache/factories/UnitTestCacheFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UnitTestCacheFactory.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/factories/UnitTestCacheFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- UnitTestCacheFactory.java 3 Jan 2007 20:41:36 -0000 1.1
+++ UnitTestCacheFactory.java 4 Jan 2007 03:36:42 -0000 1.2
@@ -10,8 +10,10 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.xml.XmlHelper;
import org.w3c.dom.Element;
@@ -46,8 +48,29 @@
public static Configuration createConfiguration(CacheMode mode) throws ConfigurationException
{
+ return createConfiguration(mode, false, false);
+ }
+
+ public static Configuration createConfiguration(CacheMode mode, boolean useEviction) throws ConfigurationException
+ {
+ return createConfiguration(mode, useEviction, false);
+ }
+
+ public static Configuration createConfiguration(CacheMode mode, boolean useEviction, boolean usePassivation) throws ConfigurationException
+ {
UnitTestXmlConfigurationParser parser = new UnitTestXmlConfigurationParser();
Configuration c = parser.parseFile(DEFAULT_CONFIGURATION_FILE,mode);
+
+ if(!useEviction)
+ {
+ c.setEvictionConfig(null);
+ }
+
+ if(!usePassivation)
+ {
+ c.setCacheLoaderConfig(null);
+ }
+
return c;
}
@@ -72,6 +95,34 @@
}
}
+ public static CacheLoaderConfig getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared) throws Exception
+ {
+ return getSingleCacheLoaderConfig(preload, cacheloaderClass, properties, async, fetchPersistentState, shared, false);
+ }
+
+ public static CacheLoaderConfig getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
+ {
+ return getSingleCacheLoaderConfig(false, preload, cacheloaderClass, properties, async, fetchPersistentState, shared, purgeOnStartup);
+ }
+
+ protected static CacheLoaderConfig getSingleCacheLoaderConfig(boolean passivation, String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
+ {
+ String xml = "<config>\n" +
+ "<passivation>" + passivation + "</passivation>\n" +
+ "<preload>" + preload + "</preload>\n" +
+ "<cacheloader>\n" +
+ "<class>" + cacheloaderClass + "</class>\n" +
+ "<properties>" + properties + "</properties>\n" +
+ "<async>" + async + "</async>\n" +
+ "<shared>" + shared + "</shared>\n" +
+ "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
+ "<purgeOnStartup>" + purgeOnStartup + "</purgeOnStartup>\n" +
+ "</cacheloader>\n" +
+ "</config>";
+ Element element = XmlHelper.stringToElement(xml);
+ return XmlConfigurationParser.parseCacheLoaderConfig(element);
+ }
+
private static class UnitTestXmlConfigurationParser extends XmlConfigurationParser
{
More information about the jboss-cvs-commits
mailing list