JBoss Cache SVN: r6127 - in core/trunk/src: main/java/org/jboss/cache/config and 21 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-06-30 12:44:47 -0400 (Mon, 30 Jun 2008)
New Revision: 6127
Added:
core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java
core/trunk/src/test/resources/configs/
core/trunk/src/test/resources/configs/buddy-replication-cache.xml
core/trunk/src/test/resources/configs/clonable-config.xml
core/trunk/src/test/resources/configs/conf2x/
core/trunk/src/test/resources/configs/conf2x/buddy-replication-cache.xml
core/trunk/src/test/resources/configs/conf2x/cacheloader-enabled-cache.xml
core/trunk/src/test/resources/configs/conf2x/clonable-config.xml
core/trunk/src/test/resources/configs/conf2x/default-test-config2x.xml
core/trunk/src/test/resources/configs/conf2x/eviction-enabled-cache.xml
core/trunk/src/test/resources/configs/conf2x/local-cache.xml
core/trunk/src/test/resources/configs/conf2x/multiplexer-enabled-cache.xml
core/trunk/src/test/resources/configs/conf2x/optimistically-locked-cache.xml
core/trunk/src/test/resources/configs/conf2x/policyPerRegion-eviction.xml
core/trunk/src/test/resources/configs/conf2x/total-replication-cache.xml
core/trunk/src/test/resources/configs/local-lru-eviction.xml
core/trunk/src/test/resources/configs/local-passivation.xml
core/trunk/src/test/resources/configs/local-tx.xml
core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
core/trunk/src/test/resources/configs/mux.xml
core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
core/trunk/src/test/resources/configs/replSync.xml
core/trunk/src/test/resources/configs/string-property-replaced.xml
core/trunk/src/test/resources/jbc2-registry-configs.xml
core/trunk/src/test/resources/unit-test-cache-service.xml
Removed:
core/trunk/src/main/resources/cache-config.xml
core/trunk/src/test/resources/META-INF/
Modified:
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
core/trunk/src/main/release/build.xml
core/trunk/src/main/resources/config2to3.xslt
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/DestroyedCacheAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
core/trunk/src/test/java/org/jboss/cache/config/StringPropertyReplacementTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/RegionManagerTest.java
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.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/PassivationTestsBase.java
Log:
all test configuration files were migrated to the new configuration format
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -9,6 +9,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.factories.ComponentFactory;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.invocation.CacheInvocationDelegate;
@@ -62,7 +63,7 @@
public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseFile(configFileName);
return createCache(c, start);
}
@@ -141,14 +142,14 @@
public Cache<K, V> createCache(InputStream is) throws ConfigurationException
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseStream(is);
return createCache(c);
}
public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseStream(is);
return createCache(c, start);
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -668,15 +668,6 @@
return lockParentForChildInsertRemove;
}
- /**
- * This is a deprecated configuration option. While it will be supported for the 2.x series for backward compatibility,
- * expect to see it disappear in 3.x.
- * <p/>
- * With {@link #isUseLazyDeserialization()}, which is enabled by default, custom class loaders are handled implicitly.
- * See the user guide for details on how this is handled.
- * <p/>
- */
- @Deprecated
public boolean isUseRegionBasedMarshalling()
{
return useRegionBasedMarshalling;
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -78,11 +78,16 @@
resource = getClass().getClassLoader().getResource(fileName);
if (resource == null)
throw new IllegalArgumentException("File " + fileName + " does not exist on disk or on class path");
+ System.out.println("Using xsl file: " + resource);
+ } else
+ {
+ System.out.println("Using xsl file: " + resource);
}
return ccl.getResourceAsStream(fileName);
}
else
{
+ System.out.println("Using xls file: " + xsltConvertorFile.getAbsolutePath());
return new FileInputStream(xsltConvertorFile);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -39,8 +39,11 @@
processAttributes(buffer, tag);
buffer.append(':');
}
- // Remove the trailing ':'
- buffer.setLength(buffer.length() - 1);
+ if (buffer.length() > 0)
+ {
+ //Remove the trailing ':'
+ buffer.setLength(buffer.length() - 1);
+ }
return buffer.toString();
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -22,6 +22,7 @@
/**
* todo mmarkus comment classes
+ *
* @author Mircea.Markus(a)jboss.com
* @since 3.0
*/
@@ -38,6 +39,7 @@
* the classpath. If not found, it will search for the file on the file system instead, treating the name as an
* absolute path.
*/
+ //todo mmarkus this is duplicated code from 2x parser, extract it in an FileLookup class
public Configuration parseFile(String filename)
{
InputStream is = getAsInputStreamFromClassLoader(filename);
@@ -54,8 +56,7 @@
throw new ConfigurationException("Unable to find config file " + filename + " either in classpath or on the filesystem!", e);
}
}
-
- return parse(is);
+ return parseStream(is);
}
protected InputStream getAsInputStreamFromClassLoader(String filename)
@@ -70,9 +71,21 @@
return is;
}
- public Configuration parse(InputStream configStream)
+ public Configuration parseStream(InputStream configStream)
{
readRoot(configStream);
+ return processElements();
+ }
+
+ public Configuration parseElement(Element root)
+ {
+ this.root = root;
+ this.root.normalize();
+ return processElements();
+ }
+
+ private Configuration processElements()
+ {
configureLocking(getSingleElement("locking"));
configureTransaction(getSingleElement("transaction"));
configureReplication(getSingleElement("replication"));
@@ -91,51 +104,55 @@
private void configureTransaction(Element element)
{
if (element == null) return;
- String txMngLookupClass = element.getAttribute("transactionManagerLookupClass");
- if (existsAttribute(txMngLookupClass)) config.setTransactionManagerLookupClass(txMngLookupClass);
- String syncRollbackPhase = element.getAttribute("syncRollbackPhase");
+ String attrName = "transactionManagerLookupClass";
+ String txMngLookupClass = getAttributeValue(element, attrName);
+ if (existsAttribute(txMngLookupClass)) config.setTransactionManagerLookupClass(txMngLookupClass);
+ String syncRollbackPhase = getAttributeValue(element, "syncRollbackPhase");
if (existsAttribute(syncRollbackPhase)) config.setSyncRollbackPhase(getBoolean(syncRollbackPhase));
- String syncCommitPhase = element.getAttribute("syncCommitPhase");
+ String syncCommitPhase = getAttributeValue(element, "syncCommitPhase");
if (existsAttribute(syncCommitPhase)) config.setSyncCommitPhase(getBoolean(syncCommitPhase));
}
private void configureSerialization(Element element)
{
if (element == null) return;
- String objectInputStreamPoolSize = element.getAttribute("objectInputStreamPoolSize");
- if (existsAttribute(objectInputStreamPoolSize)) config.setObjectInputStreamPoolSize(getInt(objectInputStreamPoolSize));
- String objectOutputStreamPoolSize = element.getAttribute("objectOutputStreamPoolSize");
- if (existsAttribute(objectOutputStreamPoolSize)) config.setObjectOutputStreamPoolSize(getInt(objectOutputStreamPoolSize));
- String version = element.getAttribute("version");
+ String objectInputStreamPoolSize = getAttributeValue(element, "objectInputStreamPoolSize");
+ if (existsAttribute(objectInputStreamPoolSize))
+ config.setObjectInputStreamPoolSize(getInt(objectInputStreamPoolSize));
+ String objectOutputStreamPoolSize = getAttributeValue(element, "objectOutputStreamPoolSize");
+ if (existsAttribute(objectOutputStreamPoolSize))
+ config.setObjectOutputStreamPoolSize(getInt(objectOutputStreamPoolSize));
+ String version = getAttributeValue(element, "version");
if (existsAttribute(version)) config.setReplVersionString(version);
- String marshallerClass = element.getAttribute("marshallerClass");
+ String marshallerClass = getAttributeValue(element, "marshallerClass");
if (existsAttribute(marshallerClass)) config.setMarshallerClass(marshallerClass);
- String useLazyDeserialization = element.getAttribute("useLazyDeserialization");
+ String useLazyDeserialization = getAttributeValue(element, "useLazyDeserialization");
if (existsAttribute(useLazyDeserialization)) config.setUseLazyDeserialization(getBoolean(useLazyDeserialization));
- String useRegionBasedMarshalling = element.getAttribute("useRegionBasedMarshalling");
- if (existsAttribute(useRegionBasedMarshalling)) config.setUseRegionBasedMarshalling(getBoolean(useRegionBasedMarshalling));
+ String useRegionBasedMarshalling = getAttributeValue(element, "useRegionBasedMarshalling");
+ if (existsAttribute(useRegionBasedMarshalling))
+ config.setUseRegionBasedMarshalling(getBoolean(useRegionBasedMarshalling));
}
- private void configureCustomInterceptors(Element singleElement)
+ private void configureCustomInterceptors(Element element)
{
- if (singleElement == null) return; //this element might be missing
- NodeList interceptorNodes = singleElement.getElementsByTagName("interceptor");
+ if (element == null) return; //this element might be missing
+ NodeList interceptorNodes = element.getElementsByTagName("interceptor");
List<CustomInterceptorConfig> interceptorConfigs = new ArrayList<CustomInterceptorConfig>(interceptorNodes.getLength());
for (int i = 0; i < interceptorNodes.getLength(); i++)
{
Element interceptorElement = (Element) interceptorNodes.item(i);
- String interceptorClass = interceptorElement.getAttribute("class");
+ String interceptorClass = getAttributeValue(interceptorElement, "class");
Properties props = XmlConfigHelper.readPropertiesContents(interceptorElement, "properties");
Element position = getSingleElement("position", interceptorElement);
- String firstStr = position.getAttribute("first");
+ String firstStr = getAttributeValue(position, "first");
boolean first = existsAttribute(firstStr) && getBoolean(firstStr);
- String lastStr = position.getAttribute("last");
+ String lastStr = getAttributeValue(position, "last");
boolean last = existsAttribute(lastStr) && getBoolean(lastStr);
- String indexStr = position.getAttribute("index");
+ String indexStr = getAttributeValue(position, "index");
int index = existsAttribute(indexStr) ? getInt(indexStr) : -1;
- String before = position.getAttribute("before");
+ String before = getAttributeValue(position, "before");
if (!existsAttribute(before)) before = null;
- String after = position.getAttribute("after");
+ String after = getAttributeValue(position, "after");
if (!existsAttribute(after)) after = null;
CustomInterceptorConfig customInterceptorConfig = new CustomInterceptorConfig(interceptorClass, first, last,
index, after, before, props);
@@ -160,51 +177,52 @@
config.setCacheLoaderConfig(cacheLoaderConfig);
}
- private void configureEviction(Element evictionElement)
+ private void configureEviction(Element element)
{
- if (evictionElement == null) return; //no eviction might be configured
+ if (element == null) return; //no eviction might be configured
EvictionElementParser evictionElementParser = new EvictionElementParser();
- config.setEvictionConfig(evictionElementParser.parseEvictionElement(evictionElement));
+ config.setEvictionConfig(evictionElementParser.parseEvictionElement(element));
}
private void configureJmxStatistics(Element element)
{
if (element == null) return; //might not be specified
- String enabled = element.getAttribute("enabled");
+ String enabled = getAttributeValue(element, "enabled");
if (enabled != null) config.setExposeManagementStatistics(getBoolean(enabled));
}
private void configureShutdown(Element element)
{
if (element == null) return;
- String hookBehavior = element.getAttribute("hookBehavior");
+ String hookBehavior = getAttributeValue(element, "hookBehavior");
if (hookBehavior != null) config.setShutdownHookBehavior(hookBehavior);
}
private void configureTransport(Element element)
{
if (element == null) return; //transport might be missing
- String clusterName = element.getAttribute("clusterName");
+ String clusterName = getAttributeValue(element, "clusterName");
config.setClusterName(clusterName);
- String multiplexerStack = element.getAttribute("multiplexerStack");
+ String multiplexerStack = getAttributeValue(element, "multiplexerStack");
if (existsAttribute(multiplexerStack)) config.setMultiplexerStack(multiplexerStack);
Element clusterConfig = getSingleElement("jgroupsConfig", element);
if (clusterConfig != null)
{
JGroupsStackParser stackParser = new JGroupsStackParser();
String clusterConfigStr = stackParser.parseClusterConfigXml(clusterConfig);
- config.setClusterConfig(clusterConfigStr);
+ if (clusterConfigStr != null && clusterConfigStr.trim().length() > 0)
+ config.setClusterConfig(clusterConfigStr);
}
}
private void configureStartup(Element element)
{
if (element == null) return; //we might not have this configured
- String fetchInMemoryState = element.getAttribute("fetchInMemoryState");
+ String fetchInMemoryState = getAttributeValue(element, "fetchInMemoryState");
if (existsAttribute(fetchInMemoryState)) config.setFetchInMemoryState(getBoolean(fetchInMemoryState));
- String stateRetrievalTimeout = element.getAttribute("stateRetrievalTimeout");
+ String stateRetrievalTimeout = getAttributeValue(element, "stateRetrievalTimeout");
if (existsAttribute(stateRetrievalTimeout)) config.setStateRetrievalTimeout(getLong(stateRetrievalTimeout));
- String inactiveOnStartup = element.getAttribute("inactiveOnStartup");
+ String inactiveOnStartup = getAttributeValue(element, "inactiveOnStartup");
if (existsAttribute(inactiveOnStartup)) config.setInactiveOnStartup(getBoolean(inactiveOnStartup));
}
@@ -245,29 +263,30 @@
private void configureSyncMode(Element element)
{
- String replTimeout = element.getAttribute("replTimeout");
+ String replTimeout = getAttributeValue(element, "replTimeout");
if (replTimeout != null) config.setSyncReplTimeout(getLong(replTimeout));
}
private void configureAsyncMode(Element element)
{
- String useReplQueue = element.getAttribute("useReplQueue");
+ String useReplQueue = getAttributeValue(element, "useReplQueue");
if (existsAttribute(useReplQueue)) config.setUseReplQueue(getBoolean(useReplQueue));
- String replQueueInterval = element.getAttribute("replQueueInterval");
+ String replQueueInterval = getAttributeValue(element, "replQueueInterval");
if (replQueueInterval != null) config.setReplQueueInterval(getLong(replQueueInterval));
- String replQueueMaxElements = element.getAttribute("replQueueMaxElements");
+ String replQueueMaxElements = getAttributeValue(element, "replQueueMaxElements");
if (replQueueMaxElements != null) config.setReplQueueMaxElements(getInt(replQueueMaxElements));
}
- private void configureLocking(Element locking)
+ private void configureLocking(Element element)
{
- String isolationLevel = locking.getAttribute("isolationLevel");
+ String isolationLevel = getAttributeValue(element, "isolationLevel");
if (existsAttribute(isolationLevel)) config.setIsolationLevel(IsolationLevel.valueOf(isolationLevel));
- String lockParentForChildInsertRemove = locking.getAttribute("lockParentForChildInsertRemove");
- if (existsAttribute(lockParentForChildInsertRemove)) config.setLockParentForChildInsertRemove(getBoolean(lockParentForChildInsertRemove));
- String lockAcquisitionTimeout = locking.getAttribute("lockAcquisitionTimeout");
+ String lockParentForChildInsertRemove = getAttributeValue(element, "lockParentForChildInsertRemove");
+ if (existsAttribute(lockParentForChildInsertRemove))
+ config.setLockParentForChildInsertRemove(getBoolean(lockParentForChildInsertRemove));
+ String lockAcquisitionTimeout = getAttributeValue(element, "lockAcquisitionTimeout");
if (existsAttribute(lockAcquisitionTimeout)) config.setLockAcquisitionTimeout(getLong(lockAcquisitionTimeout));
- String nodeLockingScheme = locking.getAttribute("nodeLockingScheme");
+ String nodeLockingScheme = getAttributeValue(element, "nodeLockingScheme");
if (existsAttribute(nodeLockingScheme)) config.setNodeLockingScheme(nodeLockingScheme);
}
@@ -287,7 +306,7 @@
root.normalize();
} catch (Exception e)
{
- throw new ConfigurationException("Could not parse the ");
+ throw new ConfigurationException("Could not parseStream the ");
}
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -376,8 +376,7 @@
ec.setDefaultEvictionPolicyClass(temp);
}
- temp = XmlConfigHelper.getTagContents(element,
- "wakeUpIntervalSeconds", ATTR, NAME);
+ temp = XmlConfigHelper.getTagContents(element, "wakeUpIntervalSeconds", ATTR, NAME);
int wakeupIntervalSeconds = 0;
if (temp != null)
@@ -501,7 +500,6 @@
erc.setEvictionPolicyConfig(epc);
return erc;
-
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -2,6 +2,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.jboss.util.StringPropertyReplacer;
/**
* Contains utility methods that might be useful to most of the parsers.
@@ -42,4 +43,10 @@
}
return (Element) nodeList.item(0);
}
+
+ protected String getAttributeValue(Element element, String attrName)
+ {
+ String value = element.getAttribute(attrName);
+ return value == null ? null : StringPropertyReplacer.replaceProperties(value);
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -23,11 +23,11 @@
public BuddyReplicationConfig parseBuddyElement(Element element)
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
- String enabled = element.getAttribute("enabled");
+ String enabled = getAttributeValue(element, "enabled");
if (existsAttribute(enabled)) brc.setEnabled(getBoolean(enabled));
- String buddyPoolName = element.getAttribute("poolName");
+ String buddyPoolName = getAttributeValue(element, "poolName");
if (existsAttribute(buddyPoolName)) brc.setBuddyPoolName(buddyPoolName);
- String buddyCommunicationTimeout = element.getAttribute("communicationTimeout");
+ String buddyCommunicationTimeout = getAttributeValue(element, "communicationTimeout");
if (existsAttribute(buddyCommunicationTimeout))
brc.setBuddyCommunicationTimeout(getInt(buddyCommunicationTimeout));
@@ -41,7 +41,7 @@
{
if (element == null) return defaultBuddyLocatorConfig();
BuddyReplicationConfig.BuddyLocatorConfig result = new BuddyReplicationConfig.BuddyLocatorConfig();
- String buddyLocatorClass = element.getAttribute("class");
+ String buddyLocatorClass = getAttributeValue(element, "class");
if (existsAttribute(buddyLocatorClass)) result.setBuddyLocatorClass(buddyLocatorClass);
Properties existing = new Properties();
Properties configured = XmlConfigHelper.readPropertiesContents(element, "properties");
@@ -63,11 +63,11 @@
private void parseDataGravitationElement(Element element, BuddyReplicationConfig brc)
{
if (element == null) return;
- String auto = element.getAttribute("auto");
+ String auto = getAttributeValue(element, "auto");
if (existsAttribute(auto)) brc.setAutoDataGravitation(getBoolean(auto));
- String removeOnFind = element.getAttribute("removeOnFind");
+ String removeOnFind = getAttributeValue(element, "removeOnFind");
if (existsAttribute(removeOnFind)) brc.setDataGravitationRemoveOnFind(getBoolean(removeOnFind));
- String searchBackupTrees = element.getAttribute("searchBackupTrees");
+ String searchBackupTrees = getAttributeValue(element, "searchBackupTrees");
if (existsAttribute(searchBackupTrees)) brc.setDataGravitationSearchBackupTrees(getBoolean(searchBackupTrees));
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -31,7 +31,7 @@
public EvictionConfig parseEvictionElement(Element evictionElement)
{
EvictionConfig evictionConfig = new EvictionConfig();
- String wakeUpInterval = evictionElement.getAttribute("wakeUpInterval");
+ String wakeUpInterval = getAttributeValue(evictionElement, "wakeUpInterval");
if (existsAttribute(wakeUpInterval)) evictionConfig.setWakeupInterval(getInt(wakeUpInterval));
Element element = getSingleElement("defaults", evictionElement);
@@ -62,17 +62,17 @@
private void processDefaults(EvictionConfig evictionConfig, Element element)
{
if (element == null) return;
- String policyClass = element.getAttribute("policyClass");
+ String policyClass = getAttributeValue(element, "policyClass");
if (existsAttribute(policyClass)) evictionConfig.setDefaultEvictionPolicyClass(policyClass);
- String eventQueueSize = element.getAttribute("eventQueueSize");
+ String eventQueueSize = getAttributeValue(element, "eventQueueSize");
if (existsAttribute(eventQueueSize)) evictionConfig.setDefaultEventQueueSize(getInt(eventQueueSize));
}
private EvictionRegionConfig getEvictionRegionConfig(Element element, String defaultPolicyClass, int defaultEventQueueSize)
{
EvictionRegionConfig erc = new EvictionRegionConfig();
- erc.setRegionName(element.getAttribute("name"));
- String queueSize = element.getAttribute("eventQueueSize");
+ erc.setRegionName(getAttributeValue(element, "name"));
+ String queueSize = getAttributeValue(element, "eventQueueSize");
if (existsAttribute(queueSize))
{
erc.setEventQueueSize(getInt(queueSize));
@@ -81,7 +81,7 @@
{
erc.setEventQueueSize(defaultEventQueueSize);
}
- String policyClass = element.getAttribute("policyClass");
+ String policyClass = getAttributeValue(element, "policyClass");
if (!existsAttribute(policyClass))
{
if (defaultPolicyClass == null)
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -24,9 +24,9 @@
public CacheLoaderConfig parseLoadersElement(Element element)
{
CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
- String passivation = element.getAttribute("passivation");
+ String passivation = getAttributeValue(element, "passivation");
if (existsAttribute(passivation)) cacheLoaderConfig.setPassivation(getBoolean(passivation));
- String shared = element.getAttribute("shared");
+ String shared = getAttributeValue(element, "shared");
if (existsAttribute(shared)) cacheLoaderConfig.setShared(getBoolean(shared));
String preload = getPreloadString(getSingleElement("preload", element));
if (preload != null) cacheLoaderConfig.setPreload(preload);
@@ -45,15 +45,15 @@
{
CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
- String async = indivElement.getAttribute("async");
+ String async = getAttributeValue(indivElement, "async");
if (existsAttribute(async)) iclc.setAsync(getBoolean(async));
- String fetchPersistentState = indivElement.getAttribute("fetchPersistentState");
+ String fetchPersistentState = getAttributeValue(indivElement, "fetchPersistentState");
if (existsAttribute(fetchPersistentState)) iclc.setFetchPersistentState(getBoolean(fetchPersistentState));
- String ignoreModifications = indivElement.getAttribute("ignoreModifications");
+ String ignoreModifications = getAttributeValue(indivElement, "ignoreModifications");
if (existsAttribute(ignoreModifications)) iclc.setIgnoreModifications(getBoolean(ignoreModifications));
- String purgeOnStartup = indivElement.getAttribute("purgeOnStartup");
+ String purgeOnStartup = getAttributeValue(indivElement, "purgeOnStartup");
if (existsAttribute(purgeOnStartup)) iclc.setPurgeOnStartup(getBoolean(purgeOnStartup));
- String clClass = indivElement.getAttribute("class");
+ String clClass = getAttributeValue(indivElement, "class");
if (!existsAttribute(clClass))
throw new ConfigurationException("Missing 'class' attribute for cache loader configuration");
iclc.setClassName(clClass);
@@ -74,7 +74,7 @@
for (int i = 0; i < nodesToPreload.getLength(); i++)
{
Element node = (Element) nodesToPreload.item(i);
- String fqn2preload = node.getAttribute("fqn");
+ String fqn2preload = getAttributeValue(node, "fqn");
if (!existsAttribute(fqn2preload))
throw new ConfigurationException("Missing 'fqn' attribute in 'preload\\norde' tag");
if (i > 0) result.append(",");
@@ -91,9 +91,8 @@
public CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig parseSingletonStoreConfig(Element element)
{
if (element == null) return null; //might happen, this config option is not mandatory
- String enabled = element.getAttribute("enabled");
- boolean singletonStoreEnabled = getBoolean(element.getAttribute("enabled"));
- String singletonStoreClass = element.getAttribute("class");
+ boolean singletonStoreEnabled = getBoolean(getAttributeValue(element, "enabled"));
+ String singletonStoreClass = getAttributeValue(element, "class");
CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig ssc = new CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig();
if (existsAttribute(singletonStoreClass)) ssc.setSingletonStoreClass(singletonStoreClass);
Properties singletonStoreproperties = XmlConfigHelper.readPropertiesContents(element, "properties");
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -139,7 +139,7 @@
}
/**
- * Requires a positive timeToLiveSeconds value or ConfigurationException
+ * Requires a positive timeToLive value or ConfigurationException
* is thrown.
*/
@Override
Modified: core/trunk/src/main/release/build.xml
===================================================================
--- core/trunk/src/main/release/build.xml 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/release/build.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -20,7 +20,7 @@
<property name="jvm.localhost" value="-Dbind.address=127.0.0.1"/>
<property name="jvm.ms" value="-Xms128M"/>
<property name="jvm.mx" value="-Xms1024M"/>
- <property name="demo.cfg.file" value="META-INF/total-replication-cache-service.xml"/>
+ <property name="demo.cfg.file" value="META-INF/total-replication-cache.xml"/>
<property environment="env"/>
Deleted: core/trunk/src/main/resources/cache-config.xml
===================================================================
--- core/trunk/src/main/resources/cache-config.xml 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/resources/cache-config.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-
- <mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper"
- name="jboss.cache:service=LabconnTreeCacheAop">
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
- <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
- </attribute>
- <attribute name="IsolationLevel">READ_COMMITTED</attribute>
-
- <attribute name="CacheMode">LOCAL</attribute>
-
- <attribute name="CacheLoaderConfig" replace="false">
- <config>
- <cacheloader>
- <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>
- <properties>
- location=./
- </properties>
- </cacheloader>
- </config>
- </attribute>
- </mbean>
-</server>
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/main/resources/config2to3.xslt 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,7 +11,6 @@
<xsl:call-template name="startup"/>
<xsl:call-template name="transport"/>
<xsl:apply-templates select="//attribute"/>
- <!--<xsl:call-template name="invalidation"/> -->
</xsl:element>
</xsl:template>
@@ -282,6 +281,11 @@
</xsl:if>
<xsl:if test="./config/region[@name='/_default_']">
<root>
+ <xsl:if test="./config/region[@name='/_default_' and string-length(@policyClass) > 0]">
+ <xsl:attribute name="policyClass">
+ <xsl:value-of select="./config/region[@name='/_default_' and string-length(@policyClass) > 0]/@policyClass"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:copy-of select="./config/region[@name='/_default_']/*"/>
</root>
</xsl:if>
@@ -292,13 +296,18 @@
<xsl:value-of select="@name"/>
</xsl:attribute>
</xsl:if>
+ <xsl:if test="@policyClass">
+ <xsl:attribute name="policyClass">
+ <xsl:value-of select="@policyClass"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:copy-of select="./*"/>
</region>
</xsl:for-each>
</eviction>
</xsl:template>
- <xsl:template match="//attribute[@name='CacheLoaderConfiguration']">
+ <xsl:template match="//attribute[@name='CacheLoaderConfig'] | //attribute[@name='CacheLoaderConfiguration']">
<loaders>
<xsl:if test="./config/passivation">
<xsl:attribute name="passivation">
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -7,7 +7,7 @@
package org.jboss.cache;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
@@ -25,13 +25,13 @@
public class CacheFactoryTest
{
Configuration expected;
- String configFile = "META-INF/conf-test/replSync-service.xml";
+ String configFile = "configs/replSync.xml";
private CacheSPI cache;
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
expected = parser.parseFile(configFile);
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -43,7 +43,7 @@
{
// start a single cache instance
CacheFactory<String, String> cf = new DefaultCacheFactory<String, String>();
- cache = cf.createCache("META-INF/conf-test/local-tx-service.xml", false);
+ cache = cf.createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(getNodeLockingScheme());
cache.start();
events.clear();
Modified: core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -40,7 +40,7 @@
{
// start a single cache instance
CacheFactory<String, String> cf = new DefaultCacheFactory();
- cache = cf.createCache("META-INF/conf-test/local-tx-service.xml", false);
+ cache = cf.createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
version = cache.getVersion();
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -46,7 +46,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("META-INF/conf-test/local-tx-service.xml", false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(getNodeLockingScheme());
cache.start();
rootNode = cache.getRoot();
@@ -248,7 +248,7 @@
public void testDefensiveCopyOfChildren()
{
- Fqn childFqn = Fqn.fromString("/child");
+ Fqn<String> childFqn = Fqn.fromString("/child");
rootNode.addChild(childFqn).put("k", "v");
Set<Node<Object, Object>> children = rootNode.getChildren();
Set<Object> childrenNames = rootNode.getChildrenNames();
@@ -289,7 +289,7 @@
public void testGetChildrenUnderTx() throws Exception
{
- Fqn A_B = Fqn.fromRelativeFqn(A, B);
+ Fqn<Object> A_B = Fqn.fromRelativeFqn(A, B);
Fqn A_C = Fqn.fromRelativeFqn(A, C);
tm.begin();
cache.put(A_B, "1", "1");
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -47,7 +47,7 @@
public void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache("META-INF/conf-test/local-tx-service.xml", false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
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-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,7 +11,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.interceptors.DataGravitatorInterceptor;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.config.parsing.XmlConfigHelper;
@@ -84,7 +84,7 @@
public void testXmlConfig() throws Exception
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(new XmlConfigurationParser2x().parseFile("META-INF/buddy-replication-cache-service.xml"), false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(new XmlConfigurationParser().parseFile("configs/buddy-replication-cache.xml"), false);
cache.create();
cache.start();
BuddyManager bm = cache.getBuddyManager();
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -7,25 +7,20 @@
package org.jboss.cache.config;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-import java.util.Properties;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.eviction.LRUPolicy;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
+import java.util.List;
+import java.util.Properties;
+
/**
* Tests the ability to clone Configuration elements and end up with
* independently modifiable configurations.
@@ -36,13 +31,13 @@
public class ConfigurationCloningTest
{
/** A file that includes every configuration element I could think of */
- public static final String DEFAULT_CONFIGURATION_FILE = "META-INF/conf-test/clonable-config-service.xml";
+ public static final String DEFAULT_CONFIGURATION_FILE = "/configs/clonable-config.xml";
private static final Log log = LogFactory.getLog(ConfigurationCloningTest.class);
public void testClone() throws Exception
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseFile(DEFAULT_CONFIGURATION_FILE);
try {
@@ -50,28 +45,11 @@
// Test a few simple properties
assertEquals(NodeLockingScheme.OPTIMISTIC, clone.getNodeLockingScheme());
- assertEquals(CacheMode.INVALIDATION_SYNC, clone.getCacheMode());
+ assertEquals(CacheMode.REPL_SYNC, clone.getCacheMode());
assertEquals("CloneCluster", clone.getClusterName());
assertEquals(c.getClusterConfig(), clone.getClusterConfig());
- assertEquals(3, clone.getStateRetrievalTimeout());
+ assertEquals(3, clone.getStateRetrievalTimeout());
- // Buddy replication config
- BuddyReplicationConfig brc1 = c.getBuddyReplicationConfig();
- BuddyReplicationConfig brc2 = clone.getBuddyReplicationConfig();
-
- assertFalse(brc1 == brc2);
-
- assertEquals(7, brc2.getBuddyCommunicationTimeout());
- assertEquals("cloneGroup", brc2.getBuddyPoolName());
-
- BuddyLocatorConfig blc1 = brc1.getBuddyLocatorConfig();
- BuddyLocatorConfig blc2 = brc2.getBuddyLocatorConfig();
- assertFalse(blc1 == blc2);
- Properties p1 = blc1.getBuddyLocatorProperties();
- Properties p2 = blc2.getBuddyLocatorProperties();
- assertFalse(p1 == p2);
- assertEquals(p1, p2);
-
// Eviction
EvictionConfig ec1 = c.getEvictionConfig();
EvictionConfig ec2 = clone.getEvictionConfig();
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -12,7 +12,7 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.TransactionSetup;
import org.testng.annotations.Test;
@@ -47,8 +47,8 @@
public void testMultiplexerStack() throws Exception
{
- XmlConfigurationParser2x parser = new XmlConfigurationParser2x();
- Configuration conf = parser.parseFile("META-INF/conf-test/mux-service.xml");
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ Configuration conf = parser.parseFile("configs/mux.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/config/ConfigurationTransformerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -26,7 +26,7 @@
public class ConfigurationTransformerTest
{
public static final String XSLT_FILE = "config2to3.xslt";
- private static final String BASE_DIR = "META-INF/config2.x";
+ private static final String BASE_DIR = "configs/conf2x";
ConfigFilesConvertor convertor = new ConfigFilesConvertor();
/**
@@ -34,14 +34,15 @@
*/
public void testSingleFile() throws Exception
{
- String fileName = getFileName("/optimistically-locked-cache-service.xml");
+ String fileName = getFileName("/default-test-config2x.xml");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);
+ System.out.println("result = \n" + baos);
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
- Configuration newConfig = newParser.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
Configuration oldConfig = oldParser.parseFile(fileName);
assert oldConfig.equals(newConfig);
@@ -49,9 +50,10 @@
public void testEqualityOnTransformedFiles() throws Exception
{
- String[] fileNames = {"buddy-replication-cache-service.xml", "cacheloader-enabled-cache-service.xml",
- "eviction-enabled-cache-service.xml", "local-cache-service.xml", "multiplexer-enabled-cache-service.xml",
- "optimistically-locked-cache-service.xml", "total-replication-cache-service.xml"};
+ String[] fileNames = {"buddy-replication-cache.xml", "cacheloader-enabled-cache.xml",
+ "eviction-enabled-cache.xml", "local-cache.xml", "multiplexer-enabled-cache.xml",
+ "optimistically-locked-cache.xml", "total-replication-cache.xml", "clonable-config.xml",
+ "policyPerRegion-eviction.xml" , "default-test-config2x.xml"};
for (String file : fileNames)
{
System.out.println("Processing file = " + file);
@@ -62,7 +64,7 @@
XmlConfigurationParser newParser = new XmlConfigurationParser();
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
- Configuration newConfig = newParser.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
Configuration oldConfig = oldParser.parseFile(fileName);
assert newConfig.equals(oldConfig);
Modified: core/trunk/src/test/java/org/jboss/cache/config/StringPropertyReplacementTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/StringPropertyReplacementTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/StringPropertyReplacementTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -13,11 +13,10 @@
import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.eviction.LRUConfiguration;
import org.jboss.cache.eviction.LRUPolicy;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -31,16 +30,14 @@
@Test(groups = {"functional"})
public class StringPropertyReplacementTest
{
- public static final String STRING_REPLACED_FILE = "META-INF/conf-test/string-property-replaced-service.xml";
+ public static final String STRING_REPLACED_FILE = "configs/string-property-replaced.xml";
private static final String PROP_BASE = "test.property.";
- private static final String CACHE_MODE_PROP = PROP_BASE + "CacheMode";
private static final String SYNC_COMMIT_PROP = PROP_BASE + "SyncCommitPhase";
private static final String NUM_BUDDIES_PROP = PROP_BASE + "BuddyReplicationConfig.numBuddies";
private static final String MAX_NODES_PROP = PROP_BASE + "EvictionPolicyConfig.maxNodes";
private static final String BUDDY_POOL_PROP = PROP_BASE + "BuddyReplicationConfig.buddyPoolName";
- private String cacheMode;
private String numBuddies;
private String syncCommitPhase;
private String maxNodes;
@@ -49,7 +46,6 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cacheMode = System.getProperty(CACHE_MODE_PROP);
numBuddies = System.getProperty(NUM_BUDDIES_PROP);
syncCommitPhase = System.getProperty(SYNC_COMMIT_PROP);
maxNodes = System.getProperty(MAX_NODES_PROP);
@@ -59,11 +55,6 @@
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- if (cacheMode == null)
- System.clearProperty(CACHE_MODE_PROP);
- else
- System.setProperty(CACHE_MODE_PROP, cacheMode);
-
if (numBuddies == null)
System.clearProperty(NUM_BUDDIES_PROP);
else
@@ -87,16 +78,14 @@
public void testStringPropertyReplacement() throws Exception
{
- System.setProperty(CACHE_MODE_PROP, "REPL_SYNC");
System.setProperty(NUM_BUDDIES_PROP, "3");
System.setProperty(SYNC_COMMIT_PROP, "false");
System.setProperty(MAX_NODES_PROP, "1000");
System.setProperty(BUDDY_POOL_PROP, "replaced");
- Configuration cfg = new XmlConfigurationParser2x().parseFile(STRING_REPLACED_FILE);
+ Configuration cfg = new XmlConfigurationParser().parseFile(STRING_REPLACED_FILE);
assertEquals(NodeLockingScheme.OPTIMISTIC, cfg.getNodeLockingScheme());
- assertEquals(CacheMode.REPL_SYNC, cfg.getCacheMode());
assertFalse(cfg.isSyncCommitPhase());
assertTrue(cfg.isSyncRollbackPhase());
assertEquals(15000, cfg.getLockAcquisitionTimeout());
Added: core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,206 @@
+package org.jboss.cache.config.parsing;
+
+import org.testng.annotations.Test;
+import org.jboss.cache.config.parsing.element.EvictionElementParser;
+import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.config.MissingPolicyException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.eviction.MRUConfiguration;
+import org.jboss.cache.eviction.LRUConfiguration;
+import org.w3c.dom.Element;
+
+/**
+ * Tester class for {@link org.jboss.cache.config.parsing.element.EvictionElementParser}.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 3.0
+ */
+@Test(groups = "unit")
+public class EvictionElementParserTest
+{
+ EvictionElementParser parser = new EvictionElementParser();
+
+ /**
+ * Test that when nodes are not specified the config defaults to certain values.
+ */
+ public void testDefaults()
+ {
+ String xml =
+ " <eviction wakeUpInterval=\"5\">\n" +
+ " <defaults policyClass=\"org.jboss.cache.eviction.MRUPolicy\"/>\n" +
+ " <region name=\"/org/jboss/xyz\" policyClass=\"org.jboss.cache.eviction.MRUPolicy\" eventQueueSize=\"21\">\n" +
+ " <attribute name=\"maxNodes\">2103</attribute>\n" +
+ " <attribute name=\"minTimeToLive\">22</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ EvictionConfig evictionConfig = getEvictionConfig(xml);
+ assert evictionConfig.getDefaultEventQueueSize() == EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT;
+ }
+
+ /**
+ *
+ */
+ public void testNormalConfig()
+ {
+ String xml =
+ " <eviction wakeUpInterval=\"5\">\n" +
+ " <defaults policyClass=\"org.jboss.cache.eviction.MRUPolicy\" eventQueueSize=\"123456\"/>\n" +
+ " <root>\n" +
+ " <attribute name=\"maxNodes\">6</attribute>\n" +
+ " <attribute name=\"minTimeToLive\">7</attribute>\n" +
+ " </root>\n" +
+ " <region name=\"/org/jboss/data\">\n" +
+ " <attribute name=\"minTimeToLive\">1002</attribute>\n" +
+ " <attribute name=\"maxNodes\">2021</attribute>\n" +
+ " </region>\n" +
+ " <region name=\"/org/jboss/xyz\" policyClass=\"org.jboss.cache.eviction.LRUPolicy\" eventQueueSize=\"21\">\n" +
+ " <attribute name=\"maxNodes\">2103</attribute>\n" +
+ " <attribute name=\"timeToLive\">22</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ EvictionConfig config = getEvictionConfig(xml);
+ //tests the defaults
+ assert config.getWakeupInterval() == 5;
+ assert config.getDefaultEvictionPolicyClass().equals("org.jboss.cache.eviction.MRUPolicy");
+ assert config.getDefaultEventQueueSize() == 123456;
+ assert config.getEvictionRegionConfigs().size() == 3;
+
+ //test first region config
+ EvictionRegionConfig erConfig1 = config.getEvictionRegionConfigs().get(0);
+ erConfig1.getRegionFqn().equals(Fqn.ROOT);
+ MRUConfiguration defaultPolicyonfig = (MRUConfiguration) erConfig1.getEvictionPolicyConfig();
+ assert defaultPolicyonfig.getMaxNodes() == 6;
+ assert defaultPolicyonfig.getMinTimeToLive() == 7;
+
+ //test second region config
+ EvictionRegionConfig erConfig2 = config.getEvictionRegionConfigs().get(1);
+ assert erConfig2.getEventQueueSize() == 123456;
+ assert erConfig2.getRegionFqn().equals(Fqn.fromString("/org/jboss/data"));
+ MRUConfiguration mruConfiguration = (MRUConfiguration) erConfig2.getEvictionPolicyConfig();
+ assert mruConfiguration.getMinTimeToLive() == 1002;
+ assert mruConfiguration.getMaxNodes() == 2021;
+
+ //test 3rd region config
+ EvictionRegionConfig erConfig3 = config.getEvictionRegionConfigs().get(2);
+ assert erConfig3.getEventQueueSize() == 21;
+ assert erConfig3.getRegionFqn().equals(Fqn.fromString("/org/jboss/xyz"));
+ LRUConfiguration lruConfiguration = (LRUConfiguration) erConfig3.getEvictionPolicyConfig();
+ assert lruConfiguration.getTimeToLive() == 22;
+ assert lruConfiguration.getMaxNodes() == 2103;
+ }
+
+ public void testLruConfig()
+ {
+ String xml =
+ " <eviction wakeUpInterval=\"45000\">\n" +
+ " <defaults policyClass=\"org.jboss.cache.eviction.LRUPolicy\" eventQueueSize=\"4\"/>\n" +
+ " <root>\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"timeToLiveSeconds\">1000</attribute>\n" +
+ " <attribute name=\"maxAge\">15000</attribute>\n" +
+ " </root>\n" +
+ " <region name=\"/fifo\">\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " </region>\n" +
+ " <region name=\"/mru\">\n" +
+ " <attribute name=\"maxNodes\">10000</attribute>\n" +
+ " </region>\n" +
+ " <region name=\"/lfu\">\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"minNodes\">4000</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ EvictionConfig evConfig = getEvictionConfig(xml);
+ EvictionRegionConfig evictionRegionConfig = evConfig.getEvictionRegionConfigs().get(0);
+ assert evictionRegionConfig.getRegionName().equals(RegionManager.DEFAULT_REGION.toString());
+ assert evictionRegionConfig.getRegionName().equals(RegionManager.DEFAULT_REGION.toString());
+ assert ((LRUConfiguration) evictionRegionConfig.getEvictionPolicyConfig()).getTimeToLiveSeconds() == 1000;
+ assert ((LRUConfiguration) evictionRegionConfig.getEvictionPolicyConfig()).getTimeToLive() == 1000000;
+ }
+
+ /**
+ * This is an mandatory parameter, if it is not present then an configuration exception is expected.
+ */
+ public void testMissingWakeUpInterval() throws Exception
+ {
+ String xml =
+ " <eviction defaultPolicyClass=\"org.jboss.cache.eviction.LRUPolicy\" defaultEventQueueSize=\"200000\">\n" +
+ " <default>\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000</attribute>\n" +
+ " </default>\n" +
+ " <region name=\"/org/jboss/data\">\n" +
+ " <attribute name=\"timeToLive\">1002</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ try
+ {
+ getEvictionConfig(xml);
+ assert false : "exception expected as wake up interval is not set";
+ } catch (ConfigurationException e)
+ {
+ //expected
+ }
+ }
+
+ /**
+ * If no policy is configured at region basis, and also no policy is configured at region basis,
+ * exception is expected.
+ */
+ public void testMissingPolicyOnRegion()
+ {
+ String xml =
+ " <eviction defaultPolicyClass=\"org.jboss.cache.eviction.LRUPolicy\" defaultEventQueueSize=\"200000\">\n" +
+ " <region name=\"/org/jboss/data\">\n" +
+ " <attribute name=\"timeToLive\">1002</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ try
+ {
+ getEvictionConfig(xml);
+ assert false : "missing policy in both default and region, exception expected.";
+ } catch (MissingPolicyException e)
+ {
+ //expected
+ }
+ }
+
+ private EvictionConfig getEvictionConfig(String xml)
+ {
+ Element el;
+ try
+ {
+ el = XmlConfigHelper.stringToElement(xml);
+ } catch (Exception e)
+ {
+ throw new ConfigurationException(e);
+ }
+ return parser.parseEvictionElement(el);
+ }
+
+ public void testMissingDefaultEvictionClass() throws Exception
+ {
+ String xml =
+ " <eviction wakeUpInterval=\"5000\">\n" +
+ " <root>\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"timeToLiveSeconds\">1000</attribute>\n" +
+ " </root>\n" +
+ " <region name=\"/org/jboss/data\" policyClass=\"org.jboss.cache.eviction.LFUPolicy\">\n" +
+ " <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"minNodes\">1000</attribute>\n" +
+ " </region>\n" +
+ " </eviction>";
+ try
+ {
+ getEvictionConfig(xml);
+ assert false : " excewption expectecd as root does not have a eviction policy defined";
+ } catch (MissingPolicyException e)
+ {
+ //expected
+ }
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -74,4 +74,11 @@
assert result.indexOf("num_initial_members=3") > 0;
assert result.indexOf("min_interval=10000") > 0;
}
+
+ public void testParsingEmptyConfig() throws Exception
+ {
+ String xml = "<jgroupsConfig/>";
+ Element element = XmlConfigHelper.stringToElement(xml);
+ String result = parser.parseClusterConfigXml(element);
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -22,7 +22,7 @@
public void setUp()
{
XmlConfigurationParser parser = new XmlConfigurationParser();
- config = parser.parseFile("META-INF/conf-test/parser-test-file-3.x.xml");
+ config = parser.parseFile("/configs/parser-test-file-3.x.xml");
}
public void testTransactionManagerLookupClass()
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,16 +11,12 @@
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.
*
@@ -35,7 +31,7 @@
public void testPolicyPerRegion() throws Exception
{
- this.setupCache("META-INF/conf-test/policyPerRegion-eviction-service.xml");
+ this.setupCache("configs/policyPerRegion-eviction.xml");
assertEquals(5, cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", true);
@@ -89,7 +85,7 @@
public void testMixedPolicies() throws Exception
{
- this.setupCache("META-INF/conf-test/mixedPolicy-eviction-service.xml");
+ this.setupCache("configs/mixedPolicy-eviction.xml");
assertEquals(5, cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", true);
@@ -134,7 +130,7 @@
public void testLegacyPolicyConfiguration() throws Exception
{
- this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
+ this.setupCache("configs/local-lru-eviction.xml");
assertEquals(5, cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds());
Region region = regionManager.getRegion("/org/jboss/data", false);
@@ -191,8 +187,8 @@
public void testTwoCacheInstanceConfiguration() throws Exception
{
- this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
- this.setupCache("META-INF/conf-test/local-lru-eviction-service.xml");
+ this.setupCache("configs/local-lru-eviction.xml");
+ this.setupCache("configs/local-lru-eviction.xml");
}
public void testNoEviction() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -8,7 +8,7 @@
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.interceptors.EvictionInterceptor;
import org.jboss.cache.util.TestingUtil;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -31,7 +31,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/RegionManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/RegionManagerTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/RegionManagerTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -6,7 +6,7 @@
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.BeforeMethod;
Modified: core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,8 +11,7 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
-import org.jboss.cache.config.parsing.ParsedAttributes;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
import org.jboss.cache.eviction.LRUConfiguration;
@@ -31,7 +30,7 @@
{
public static final String JGROUPS_CHANNEL;
public static final String JGROUPS_STACK_TYPE = "jgroups.stack";
- public static final String DEFAULT_CONFIGURATION_FILE = "META-INF/unit-test-cache-service.xml";
+ public static final String DEFAULT_CONFIGURATION_FILE = "unit-test-cache-service.xml";
static
{
@@ -171,7 +170,7 @@
return erc;
}
- private static class UnitTestXmlConfigurationParser extends XmlConfigurationParser2x
+ private static class UnitTestXmlConfigurationParser extends XmlConfigurationParser
{
public Configuration parseFile(String filename, CacheMode mode)
@@ -185,22 +184,9 @@
if (stream == null) throw new ConfigurationException("Input stream for configuration xml is null!");
Element root = XmlConfigHelper.getDocumentRoot(stream);
- Element mbeanElement = getMBeanElement(root);
+ XmlConfigurationParser parser = new UnitTestXmlConfigurationParser();
+ Configuration conf = parser.parseElement(root);
- ParsedAttributes attributes = XmlConfigHelper.extractAttributes(mbeanElement);
-
- // Deal with rename of the old property that controlled MBean registration
- String keepStats = attributes.stringAttribs.remove("UseMbean");
- if (keepStats != null && attributes.stringAttribs.get("ExposeManagementStatistics") == null)
- {
- attributes.stringAttribs.put("ExposeManagementStatistics", keepStats);
- }
-
- Configuration c = new Configuration();
- XmlConfigHelper.setValues(c, attributes.stringAttribs, false);
- // Special handling for XML elements -- we hard code the parsing
- setXmlValues(c, attributes.xmlAttribs);
-
Element list = (Element) root.getElementsByTagName("protocol_stacks").item(0);
NodeList stacks = list.getElementsByTagName("stack");
@@ -213,22 +199,22 @@
Element jgroupsStack = (Element) stack.getElementsByTagName("config").item(0);
if (mode == CacheMode.REPL_ASYNC && !stackName.contains("-"))
{
- c.setClusterConfig(jgroupsStack);
- c.setCacheMode(CacheMode.REPL_ASYNC);
+ conf.setClusterConfig(jgroupsStack);
+ conf.setCacheMode(CacheMode.REPL_ASYNC);
break;
}
else if (mode == CacheMode.REPL_SYNC && stackName.contains("-"))
{
- c.setClusterConfig(jgroupsStack);
- c.setCacheMode(CacheMode.REPL_SYNC);
+ conf.setClusterConfig(jgroupsStack);
+ conf.setCacheMode(CacheMode.REPL_SYNC);
break;
}
}
}
// either way, set mode in the config!!
- c.setCacheMode(mode);
- return c;
+ conf.setCacheMode(mode);
+ return conf;
}
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/integration/hibernate/UpdateTimestampsCachingTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -54,7 +54,7 @@
private Cache<String, Object> createCache(boolean optimistic)
{
CacheFactory<String, Object> cf = new DefaultCacheFactory<String, Object>();
- Cache<String, Object> cache = cf.createCache("META-INF/conf-test/local-tx-service.xml", false);
+ Cache<String, Object> cache = cf.createCache("configs/local-tx.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
caches.add(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -29,7 +29,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("META-INF/conf-test/local-tx-service.xml");
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/local-tx.xml");
tm = cache.getTransactionManager();
}
@@ -153,7 +153,7 @@
cache = null;
}
- cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("META-INF/conf-test/replSync-service.xml", false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache("configs/replSync.xml", false);
cache.getConfiguration().setCacheMode(CacheMode.REPL_ASYNC);
cache.start();
tm = cache.getTransactionManager();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -12,7 +12,7 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import static org.testng.AssertJUnit.assertEquals;
Modified: core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -13,7 +13,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.util.internals.ViewChangeListener;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -8,7 +8,7 @@
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.jmx.CacheJmxWrapper;
Modified: core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -32,7 +32,7 @@
/**
* A file that includes every configuration element I could think of
*/
- public static final String DEFAULT_CONFIGURATION_FILE = "META-INF/jbc2-configs.xml";
+ public static final String DEFAULT_CONFIGURATION_FILE = "jbc2-registry-configs.xml";
private Set<Cache<Object, Object>> caches = new HashSet<Cache<Object, Object>>();
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtTestBase.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -6,7 +6,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.config.parsing.XmlConfigHelper;
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,14 +11,14 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeActivated;
import org.jboss.cache.notifications.annotation.NodePassivated;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeEvent;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -59,7 +59,7 @@
private void initCaches()
{
CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser2x().parseFile("META-INF/conf-test/local-passivation-service.xml"), false);
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.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-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -11,7 +11,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.fail;
@@ -47,7 +47,7 @@
private void initCaches()
{
CacheFactory<Integer, String> instance = new DefaultCacheFactory();
- cache = (CacheSPI) instance.createCache(new XmlConfigurationParser2x().parseFile("META-INF/conf-test/local-passivation-service.xml"), false);
+ cache = (CacheSPI) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.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-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -13,7 +13,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
@@ -44,7 +44,7 @@
public void setUp() throws Exception
{
CacheFactory<String, String> instance = new DefaultCacheFactory();
- cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser2x().parseFile("META-INF/conf-test/local-passivation-service.xml"), false);
+ cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("configs/local-passivation.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/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-06-30 16:42:15 UTC (rev 6126)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-06-30 16:44:47 UTC (rev 6127)
@@ -10,7 +10,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.SamplePojo;
import org.jboss.cache.lock.IsolationLevel;
Added: core/trunk/src/test/resources/configs/buddy-replication-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/buddy-replication-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/buddy-replication-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster">
+ <jgroupsConfig>
+ <TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
+ max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" enable_bundling="true"
+ enable_unicast_bundling="true" enable_diagnostics="true" use_concurrent_stack="true"
+ thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="4" thread_pool.keep_alive_time="30000" thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="50000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="2" oob_thread_pool.max_threads="4" oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+ <MPING mcast_addr="232.1.2.3" 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"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" join_retry_timeout="2000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="5000000" min_threshold="0.20"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <pbcast.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <replication>
+ <sync replTimeout="15000"/>
+ <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
+ <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
+ <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
+ <properties>
+ numBuddies = 1
+ ignoreColocatedBuddies = true
+ </properties>
+ </locator>
+ </buddy>
+ </replication>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/clonable-config.xml
===================================================================
--- core/trunk/src/test/resources/configs/clonable-config.xml (rev 0)
+++ core/trunk/src/test/resources/configs/clonable-config.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="SERIALIZABLE" lockAcquisitionTimeout="1" nodeLockingScheme="OPTIMISTIC"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup fetchInMemoryState="false" stateRetrievalTimeout="3"/>
+ <transport clusterName="CloneCluster" multiplexerStack="udp">
+ <jgroupsConfig>
+ <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.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <replication>
+ <sync replTimeout="2"/>
+ <buddy enabled="true" poolName="cloneGroup" communicationTimeout="7">
+ <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
+ <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
+ <properties>
+ numBuddies = 11
+ ignoreColocatedBuddies = true
+ </properties>
+ </locator>
+ </buddy>
+ </replication>
+ <eviction wakeUpInterval="45000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="4"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ <attribute name="maxAge">15000</attribute>
+ </root>
+ <region name="/fifo" policyClass="org.jboss.cache.eviction.FIFOPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ </region>
+ <region name="/mru" policyClass="org.jboss.cache.eviction.MRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ </region>
+ <region name="/lfu" policyClass="org.jboss.cache.eviction.LFUPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="minNodes">4000</attribute>
+ </region>
+ </eviction>
+ <loaders passivation="false" shared="true">
+ <preload>
+ <node fqn="/"/>
+ </preload>
+ <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
+ ignoreModifications="false">
+ <properties>
+ location=/tmp/FileCacheLoader
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ <loader class="org.jboss.cache.loader.bdbje.BdbjeCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false">
+ <properties>
+ location=/tmp/BdbjeCacheLoader
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ <loader class="org.jboss.cache.loader.jdbm.JdbmCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false">
+ <properties>
+ location=/tmp/JdbmCacheLoader
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false">
+ <properties>
+ cache.jdbc.driver=com.foo.jdbc.Driver
+ cache.jdbc.url=foo://driver
+ cache.jdbc.user=sa
+ cache.jdbc.password=secret
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ <loader class="org.jboss.cache.loader.TcpDelegatingCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false">
+ <properties>
+ host=127.0.0.1\nport=12121
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ <loader class="org.jboss.cache.loader.ClusteredCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false">
+ <properties>
+ timeout=500
+ </properties>
+ <singletonStore enabled="false">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </loader>
+ </loaders>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/conf2x/buddy-replication-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/buddy-replication-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/buddy-replication-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- 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>
+
+ <!--
+ 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">REPL_SYNC</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>
+ <TCP recv_buf_size="20000000" use_send_queues="false"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ enable_unicast_bundling="true"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="4"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="50000"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="2"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <!--<PING timeout="2000" num_initial_members="3"/>-->
+ <MPING mcast_addr="232.1.2.3" 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="30,60,120,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"
+ join_retry_timeout="2000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="5000000"
+ min_threshold="0.20"/>
+ <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">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+
+ <!-- Buddy Replication config -->
+ <attribute name="BuddyReplicationConfig">
+ <config>
+ <buddyReplicationEnabled>true</buddyReplicationEnabled>
+ <!-- these are the default values anyway -->
+ <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>
+ <!-- numBuddies is the number of backup nodes each node maintains. ignoreColocatedBuddies means that
+ each node will *try* to select a buddy on a different physical host. If not able to do so though,
+ it will fall back to colocated nodes. -->
+ <buddyLocatorProperties>
+ numBuddies = 1
+ ignoreColocatedBuddies = true
+ </buddyLocatorProperties>
+
+ <!-- A way to specify a preferred replication group. If specified, we try and pick a buddy why shares
+ the same pool name (falling back to other buddies if not available). This allows the sysdmin to hint at
+ backup buddies are picked, so for example, nodes may be hinted topick buddies on a different physical rack
+ or power supply for added fault tolerance. -->
+ <buddyPoolName>myBuddyPoolReplicationGroup</buddyPoolName>
+ <!-- communication timeout for inter-buddy group organisation messages (such as assigning to and removing
+ from groups -->
+ <buddyCommunicationTimeout>2000</buddyCommunicationTimeout>
+
+ <!-- the following three elements, all relating to data gravitation, default to false -->
+ <!-- Should data gravitation be attempted whenever there is a cache miss on finding a node?
+If false, data will only be gravitated if an Option is set enabling it -->
+ <autoDataGravitation>false</autoDataGravitation>
+ <!-- removes data on remote caches' trees and backup subtrees when gravitated to a new data owner -->
+ <dataGravitationRemoveOnFind>true</dataGravitationRemoveOnFind>
+ <!-- search backup subtrees as well for data when gravitating. Results in backup nodes being able to
+ answer data gravitation requests. -->
+ <dataGravitationSearchBackupTrees>true</dataGravitationSearchBackupTrees>
+
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/cacheloader-enabled-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/cacheloader-enabled-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/cacheloader-enabled-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,118 @@
+<?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>
+
+ <!-- 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>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">100</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <!-- Cache Passivation for Tree Cache
+On pasivation, The objects are written to the backend store on eviction if CacheLoaderPassivation
+is true, otheriwse the objects are persisted.
+On activation, the objects are restored in the memory cache and removed from the cache loader
+if CacheLoaderPassivation is true, otherwise the objects are only loaded from the cache loader -->
+ <attribute name="CacheLoaderConfiguration">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>false</passivation>
+ <preload>/</preload>
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.JDBCCacheLoader</class>
+ <!-- same as the old CacheLoaderConfig attribute -->
+ <properties>
+ cache.jdbc.table.name=jbosscache
+ cache.jdbc.table.create=true
+ cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.driver=com.mysql.jdbc.Driver
+ cache.jdbc.url=jdbc:mysql://localhost:3306/jbossdb
+ cache.jdbc.user=root
+ cache.jdbc.password=
+ cache.jdbc.sql-concat=concat(1,2)
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>true</fetchPersistentState>
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+ <!-- if set to true, purges the contents of this cache loader when the cache starts up.
+ Defaults to false. -->
+ <purgeOnStartup>false</purgeOnStartup>
+ </cacheloader>
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/clonable-config.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/clonable-config.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/clonable-config.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Cache configuration file that attempts to utilize all known elements.
+ Intent here is not to create such a cache; rather it is to create
+ a Configuration and then see if that Configuration can be cloned.
+ Basically just for testing the clone() method of the various
+ configuration elements.
+-->
+
+<server>
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=testTreeCache">
+
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+ <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
+ <attribute name="IsolationLevel">SERIALIZABLE</attribute>
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <attribute name="ClusterName">CloneCluster</attribute>
+
+ <!-- Use both a stack name and a ClusterConfig so we can test both -->
+ <attribute name="MultiplexerStack">udp</attribute>
+ <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>
+
+ <attribute name="FetchInMemoryState">false</attribute>
+ <attribute name="StateRetrievalTimeout">3</attribute>
+ <attribute name="SyncReplTimeout">2</attribute>
+ <attribute name="LockAcquisitionTimeout">1</attribute>
+
+
+ <attribute name="BuddyReplicationConfig">
+ <config>
+ <buddyReplicationEnabled>true</buddyReplicationEnabled>
+ <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>
+ <buddyLocatorProperties>
+ numBuddies = 11
+ ignoreColocatedBuddies = true
+ </buddyLocatorProperties>
+
+ <buddyPoolName>cloneGroup</buddyPoolName>
+ <buddyCommunicationTimeout>7</buddyCommunicationTimeout>
+
+ <autoDataGravitation>false</autoDataGravitation>
+ <dataGravitationRemoveOnFind>true</dataGravitationRemoveOnFind>
+ <dataGravitationSearchBackupTrees>true</dataGravitationSearchBackupTrees>
+
+ </config>
+ </attribute>
+
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">45</attribute>
+ <attribute name="eventQueueSize">4</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>
+ <attribute name="maxAge">15000</attribute>
+ </region>
+ <region name="/fifo" policyClass="org.jboss.cache.eviction.FIFOPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ </region>
+ <region name="/mru" policyClass="org.jboss.cache.eviction.MRUPolicy">
+ <attribute name="maxNodes">10000</attribute>
+ </region>
+ <region name="/lfu" policyClass="org.jboss.cache.eviction.LFUPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="minNodes">4000</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <attribute name="CacheLoaderConfig">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>false</passivation>
+ <preload>/</preload>
+ <shared>true</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <properties>
+ location=/tmp/FileCacheLoader
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>true</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>
+ <properties>
+ location=/tmp/BdbjeCacheLoader
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.jdbm.JdbmCacheLoader</class>
+ <properties>
+ location=/tmp/JdbmCacheLoader
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.JDBCCacheLoader</class>
+ <properties>
+ cache.jdbc.driver=com.foo.jdbc.Driver
+ cache.jdbc.url=foo://driver
+ cache.jdbc.user=sa
+ cache.jdbc.password=secret
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.TcpDelegatingCacheLoader</class>
+ <properties>
+ host=127.0.0.1\nport=12121
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.ClusteredCacheLoader</class>
+ <properties>
+ timeout=500
+ </properties>
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.-->
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ <singletonStore>
+ <enabled>false</enabled>
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=5000
+ </properties>
+ </singletonStore>
+ </cacheloader>
+
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/default-test-config2x.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/default-test-config2x.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/default-test-config2x.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,130 @@
+<server>
+ <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>
+
+ <!-- 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>
+ -->
+
+ <!--
+ 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>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">2</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <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>
+
+ <!-- New 1.3.x cache loader config block -->
+ <attribute name="CacheLoaderConfiguration">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>true</passivation>
+ <preload>/</preload>
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <!-- same as the old CacheLoaderConfig attribute
+ location=/tmp this can be part of the properties.
+ -->
+ <properties>
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>true</fetchPersistentState>
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+ </cacheloader>
+
+ </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>
Added: core/trunk/src/test/resources/configs/conf2x/eviction-enabled-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/eviction-enabled-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/eviction-enabled-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!--
+Sample JBoss Cache Service Configuration that hightlights various
+eviction configurations. By default LRUPolicy is enabled, by this can be
+changed by commenting it out and uncommenting another present
+eviction policy.
+-->
+<!-- -->
+<!-- ===================================================================== -->
+
+<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>
+
+ <!-- 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.LFUPolicy">
+ <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>
+
+
+ <!--ElementSizePolicy eviction config-->
+ <!--<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.ElementSizePolicy</attribute>-->
+
+ <!-- Cache wide default -->
+ <!--<region name="/_default_">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--<attribute name="maxElementsPerNode">100</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/data">-->
+ <!--<attribute name="maxNodes">10</attribute>-->
+ <!--<attribute name="maxElementsPerNode">20</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/test/data">-->
+ <!--<attribute name="maxElementsPerNode">5</attribute>-->
+ <!--</region>-->
+ <!--<region name="/test/">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--<attribute name="maxElementsPerNode">1</attribute>-->
+ <!--</region>-->
+ <!--</config>-->
+ <!--</attribute>-->
+
+ <!-- ExpirationPolicy eviction policy configurations. -->
+ <!--<attribute name="EvictionPolicyConfig">-->
+ <!--<config>-->
+ <!-- One second is a good default -->
+ <!--<attribute name="wakeUpIntervalSeconds">1</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.ExpirationPolicy</attribute>-->
+
+ <!-- Cache wide default -->
+ <!--<region name="/_default_">-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/data">-->
+ <!-- Removes the soonest to expire nodes to reduce the region size to at most 250 nodes -->
+ <!--<attribute name="maxNodes">250</attribute>-->
+ <!--</region>-->
+ <!--</config>-->
+ <!--</attribute>-->
+
+ <!-- Specific eviction policy configurations. This is FIFOPolicy -->
+ <!--<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.FIFOPolicy</attribute>-->
+
+ <!-- Cache wide default -->
+ <!--<region name="/_default_">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/data">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/test/data">-->
+ <!--<attribute name="maxNodes">5</attribute>-->
+ <!--</region>-->
+ <!--<region name="/test/">-->
+ <!--<attribute name="maxNodes">10000</attribute>-->
+ <!--</region>-->
+ <!--</config>-->
+ <!--</attribute>-->
+
+ <!-- Specific eviction policy configurations. This is LFUPolicy -->
+ <!--<attribute name="EvictionPolicyConfig">-->
+ <!--<config>-->
+ <!--<attribute name="wakeUpIntervalSeconds">3</attribute>-->
+ <!-- This defaults to 200000 if not specified -->
+ <!--<attribute name="eventQueueSize">200000</attribute>-->
+
+ <!-- Cache wide default -->
+ <!--<region name="/_default_" policyClass="org.jboss.cache.eviction.LFUPolicy">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--<attribute name="minNodes">10</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/data" policyClass="org.jboss.cache.eviction.LFUPolicy">-->
+ <!--<attribute name="maxNodes">5000</attribute>-->
+ <!--<attribute name="minNodes">4000</attribute>-->
+ <!--</region>-->
+ <!--<region name="/org/jboss/test/data" policyClass="org.jboss.cache.eviction.LFUPolicy">-->
+ <!--<attribute name="minNodes">5</attribute>-->
+ <!--</region>-->
+ <!--</config>-->
+ <!--</attribute>-->
+
+ <!-- Specific eviction policy configurations. This is MRUPolicy -->
+ <!--<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>-->
+
+ <!-- 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/configs/conf2x/local-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/local-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/local-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,49 @@
+<?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
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ </mbean>
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/multiplexer-enabled-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/multiplexer-enabled-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/multiplexer-enabled-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- 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>
+
+ <!--
+ 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">REPL_SYNC</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>
+
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <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>
+ <TCP recv_buf_size="20000000" use_send_queues="false"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ enable_unicast_bundling="true"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="4"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="50000"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="2"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <!--<PING timeout="2000" num_initial_members="3"/>-->
+ <MPING mcast_addr="232.1.2.3" 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="30,60,120,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"
+ join_retry_timeout="2000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="5000000"
+ min_threshold="0.20"/>
+ <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">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+
+ <!-- Buddy Replication config -->
+ <attribute name="BuddyReplicationConfig">
+ <config>
+ <buddyReplicationEnabled>true</buddyReplicationEnabled>
+ <!-- these are the default values anyway -->
+ <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>
+ <!-- numBuddies is the number of backup nodes each node maintains. ignoreColocatedBuddies means that
+ each node will *try* to select a buddy on a different physical host. If not able to do so though,
+ it will fall back to colocated nodes. -->
+ <buddyLocatorProperties>
+ numBuddies = 1
+ ignoreColocatedBuddies = true
+ </buddyLocatorProperties>
+
+ <!-- A way to specify a preferred replication group. If specified, we try and pick a buddy why shares
+ the same pool name (falling back to other buddies if not available). This allows the sysdmin to hint at
+ backup buddies are picked, so for example, nodes may be hinted topick buddies on a different physical rack
+ or power supply for added fault tolerance. -->
+ <buddyPoolName>myBuddyPoolReplicationGroup</buddyPoolName>
+ <!-- communication timeout for inter-buddy group organisation messages (such as assigning to and removing
+ from groups -->
+ <buddyCommunicationTimeout>2000</buddyCommunicationTimeout>
+
+ <!-- the following three elements, all relating to data gravitation, default to false -->
+ <!-- Should data gravitation be attempted whenever there is a cache miss on finding a node?
+If false, data will only be gravitated if an Option is set enabling it -->
+ <autoDataGravitation>false</autoDataGravitation>
+ <!-- removes data on remote caches' trees and backup subtrees when gravitated to a new data owner -->
+ <dataGravitationRemoveOnFind>true</dataGravitationRemoveOnFind>
+ <!-- search backup subtrees as well for data when gravitating. Results in backup nodes being able to
+ answer data gravitation requests. -->
+ <dataGravitationSearchBackupTrees>true</dataGravitationSearchBackupTrees>
+
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/optimistically-locked-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/optimistically-locked-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/optimistically-locked-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,85 @@
+<?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>
+
+ <attribute name="FetchInMemoryState">false</attribute>
+
+ <!-- Whether each interceptor should have an mbean
+registered to capture and display its statistics. -->
+ <attribute name="UseInterceptorMbeans">true</attribute>
+
+ <!--
+ Node locking scheme:
+ OPTIMISTIC
+ PESSIMISTIC (default)
+ -->
+ <attribute name="NodeLockingScheme">Optimistic</attribute>
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">READ_COMMITTED</attribute>
+
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">1</attribute>
+ <!-- Name of the DEFAULT eviction policy class.-->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+ <region name="/_default_">
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ <attribute name="maxAgeSeconds">0</attribute>
+ </region>
+ <region name="/testingRegion">
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ <attribute name="maxAgeSeconds">0</attribute>
+ </region>
+ <region name="/timeBased">
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ <attribute name="maxAgeSeconds">1</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
Added: core/trunk/src/test/resources/configs/conf2x/policyPerRegion-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/policyPerRegion-eviction.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/policyPerRegion-eviction.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,156 @@
+<?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>
+
+ <!-- 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/configs/conf2x/total-replication-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/total-replication-cache.xml (rev 0)
+++ core/trunk/src/test/resources/configs/conf2x/total-replication-cache.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample for total replication. -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- 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>
+
+ <!--
+ 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">REPL_SYNC</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="2"/>
+ <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">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/configs/local-lru-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-lru-eviction.xml (rev 0)
+++ core/trunk/src/test/resources/configs/local-lru-eviction.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster"/>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <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>
+ </eviction>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/local-passivation.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-passivation.xml (rev 0)
+++ core/trunk/src/test/resources/configs/local-passivation.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster"/>
+ <eviction wakeUpInterval="1000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ </root>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">100</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ </region>
+ </eviction>
+ <loaders passivation="true" shared="false">
+ <preload>
+ <node fqn="/"/>
+ </preload>
+ <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
+ ignoreModifications="false">
+ <properties>
+ </properties>
+ </loader>
+ </loaders>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/local-tx.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-tx.xml (rev 0)
+++ core/trunk/src/test/resources/configs/local-tx.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="false"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster"/>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <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>
+ </eviction>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml (rev 0)
+++ core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster">
+ <jgroupsConfig>
+ <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.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <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>
+ </eviction>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/mux.xml
===================================================================
--- core/trunk/src/test/resources/configs/mux.xml (rev 0)
+++ core/trunk/src/test/resources/configs/mux.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster" multiplexerStack="tcp"/>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml (rev 0)
+++ core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster">
+ <jgroupsConfig>
+ <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.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <eviction wakeUpInterval="5000">
+ <root policyClass="org.jboss.cache.eviction.LRUPolicy">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <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>
+ </eviction>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/replSync.xml
===================================================================
--- core/trunk/src/test/resources/configs/replSync.xml (rev 0)
+++ core/trunk/src/test/resources/configs/replSync.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup fetchInMemoryState="true" stateRetrievalTimeout="15000"/>
+ <transport clusterName="JBossCache-Cluster">
+ <jgroupsConfig>
+ <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.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <replication>
+ <sync replTimeout="15000"/>
+ </replication>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/trunk/src/test/resources/configs/string-property-replaced.xml (rev 0)
+++ core/trunk/src/test/resources/configs/string-property-replaced.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"
+ nodeLockingScheme="${test.property.NodeLockingScheme:OPTIMISTIC}"/>
+ <transaction syncCommitPhase="${test.property.SyncCommitPhase:true}" syncRollbackPhase="true"/>
+ <serialization useRegionBasedMarshalling="true"/>
+ <startup fetchInMemoryState="false" stateRetrievalTimeout="20000" inactiveOnStartup="true"/>
+ <transport clusterName="optimistic-entity" multiplexerStack="udp-sync">
+ <jgroupsConfig/>
+ </transport>
+ <replication>
+ <sync replTimeout="20000"/>
+ <buddy enabled="${test.property.BuddyReplicationConfig.enabled:true}"
+ poolName="${test.property.BuddyReplicationConfig.buddyPoolName:default}" communicationTimeout="2000">
+ <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
+ <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
+ <properties>
+ ignoreColocatedBuddies = true
+ numBuddies = ${test.property.BuddyReplicationConfig.numBuddies:1}
+ </properties>
+ </locator>
+ </buddy>
+ </replication>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="${test.property.EvictionPolicyConfig.policyClass:org.jboss.cache.eviction.LRUPolicy}"/>
+ <root>
+ <attribute name="maxNodes">${test.property.EvictionPolicyConfig.maxNodes:5000}</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ </eviction>
+ <loaders passivation="true" shared="false">
+ <preload>
+ <node fqn="/"/>
+ </preload>
+ <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
+ ignoreModifications="false">
+ <properties>
+ location=${test.property.CacheLoaderConfiguration.location,java.io.tmpdir:/tmp}
+ </properties>
+ </loader>
+ </loaders>
+</jbosscache>
Copied: core/trunk/src/test/resources/jbc2-registry-configs.xml (from rev 6119, core/trunk/src/test/resources/META-INF/jbc2-configs.xml)
===================================================================
(Binary files differ)
Property changes on: core/trunk/src/test/resources/jbc2-registry-configs.xml
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: core/trunk/src/test/resources/unit-test-cache-service.xml (from rev 6119, core/trunk/src/test/resources/META-INF/unit-test-cache-service.xml)
===================================================================
--- core/trunk/src/test/resources/unit-test-cache-service.xml (rev 0)
+++ core/trunk/src/test/resources/unit-test-cache-service.xml 2008-06-30 16:44:47 UTC (rev 6127)
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<jbosscache>
+
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <serialization useRegionBasedMarshalling="false"/>
+ <startup fetchInMemoryState="true" stateRetrievalTimeout="15000"/>
+ <transport clusterName="JBossCache-Cluster"/>
+ <replication>
+ <sync replTimeout="15000"/>
+ </replication>
+ <eviction wakeUpInterval="2000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <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>
+ </eviction>
+ <loaders passivation="true" shared="false">
+ <preload>
+ <node fqn="/"/>
+ </preload>
+ <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
+ ignoreModifications="false">
+ <properties/>
+ </loader>
+ </loaders>
+
+ <protocol_stacks>
+ <stack name="udp"
+ description="Default: IP multicast based stack, with flow control and message bundling">
+ <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="true"
+ 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="false"
+ 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="false"
+ 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/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="2" shun="true"/>
+ <VERIFY_SUSPECT timeout="250"/>
+ <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
+ <!--<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"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="false" join_timeout="1000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="1000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+ <stack name="udp-sync"
+ description="IP multicast based stack, without flow control and without message bundling. This should be used
+ instead of udp if (1) synchronous calls are used and (2) the message volume (rate and size)
+ is not that large. Don't use this configuration if you send messages at a high sustained rate, or you might
+ run out of memory">
+ <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="true"
+ 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="false"
+ thread_pool.queue_max_size="100"
+ 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="false"
+ 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/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="2" shun="true"/>
+ <VERIFY_SUSPECT timeout="250"/>
+ <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
+ <!--<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,900,1200"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,900,1200"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="false" join_timeout="1000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="1000"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+
+ <stack name="tcp"
+ description="TCP based stack, with flow control and message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
+ Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
+ -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]">
+ <config>
+ <TCP start_port="7800"
+ loopback="true"
+ recv_buf_size="20000000"
+ send_buf_size="640000"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ use_send_queues="false"
+ sock_conn_timeout="300"
+ skip_suspected_members="true"
+
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="100000"
+ min_interval="20000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <BARRIER/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <VIEW_SYNC avg_send_interval="60000"/>
+ <pbcast.GMS print_local_addr="false" join_timeout="3000" shun="true"
+ view_bundling="true"/>
+ <FC max_credits="2000000"
+ min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+
+ <stack name="tcp-sync"
+ description="TCP based stack, without flow control and without message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast). This
+ configuration should be used instead of tcp when (1) synchronous calls are used and (2) the message volume
+ (rate and size) is not that large">
+ <config>
+ <TCP start_port="7800"
+ loopback="true"
+ recv_buf_size="20000000"
+ send_buf_size="640000"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ use_send_queues="false"
+ sock_conn_timeout="300"
+ skip_suspected_members="true"
+
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="100000"
+ min_interval="20000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <BARRIER/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <VIEW_SYNC avg_send_interval="60000"/>
+ <pbcast.GMS print_local_addr="false" join_timeout="3000" shun="true"
+ view_bundling="true"/>
+ <FC max_credits="2000000"
+ min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+ </protocol_stacks>
+
+</jbosscache>
16 years, 6 months
JBoss Cache SVN: r6126 - searchable/trunk/src/main/java/org/jboss/cache/search.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-30 12:42:15 -0400 (Mon, 30 Jun 2008)
New Revision: 6126
Added:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheCfgImpl.java
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
Log:
Implemented Cfg interface from org.hibernate.search.Cfg
Added: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheCfgImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheCfgImpl.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheCfgImpl.java 2008-06-30 16:42:15 UTC (rev 6126)
@@ -0,0 +1,64 @@
+package org.jboss.cache.search;
+
+import org.hibernate.search.cfg.Cfg;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Class that implements {@link org.hibernate.search.cfg.Cfg} so that within JBossCache Searchable, there is no
+ * need for a Hibernate Core configuration object.
+ *
+ * @author Navin Surtani - navin(a)surtani.org
+ */
+public class SearchableCacheCfgImpl implements Cfg
+{
+ protected Map<String, PersistentClass> classes;
+ private Properties properties;
+
+ public SearchableCacheCfgImpl(Class[] classArray, Properties properties)
+ {
+ // null chks
+ this.properties = properties;
+ if (this.properties == null) this.properties = new Properties();
+
+ classes = new HashMap<String, PersistentClass>();
+
+ // loop thru your classArray
+ // populate your Map
+ // you bog
+
+ for (int i = 0; i <= classArray.length; i++)
+ {
+ String classname = classArray[i].getName();
+ RootClass rc = new RootClass();
+ rc.setClassName(classname);
+ classes.put(classname, rc);
+ }
+ }
+
+ public Iterator getClassMappings()
+ {
+ return classes.values().iterator();
+ }
+
+ public PersistentClass getClassMapping(String name)
+ {
+ return classes.get(name);
+ }
+
+ public String getProperty(String propertyName)
+ {
+ return properties.getProperty(propertyName);
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-30 13:36:04 UTC (rev 6125)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-30 16:42:15 UTC (rev 6126)
@@ -2,8 +2,11 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.search.impl.SearchFactoryImpl;
+import org.hibernate.search.cfg.Cfg;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheStatus;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.util.Properties;
@@ -12,14 +15,13 @@
*/
public class SearchableCacheFactory
{
- private SearchFactoryImpl searchFactory;
-
+ private static final Log log = LogFactory.getLog(SearchableCacheFactory.class);
/**
* Creates a searchable cache from a cache object and a class array, without the properties object.
*
- * @param c
- * @param classes
- * @return
+ * @param c - the Cache
+ * @param classes - Class array to be added
+ * @return a SearchableCache
*/
public SearchableCache createSearchableCache(Cache<?, ?> c, Class... classes)
{
@@ -29,29 +31,33 @@
/**
* This method creates a searchable cache as well but requires the properties object.
*
- * @param c
- * @param properties
- * @param classes
- * @return
+ * @param c - the Cache
+ * @param properties - java.util.properties
+ * @param classes - a class array
+ * @return a SearchableCache
*/
public SearchableCache createSearchableCache(Cache<?, ?> c, Properties properties, Class... classes)
{
// assume cache is already created and running.
// otherwise, start the cache!!
- if (c.getCacheStatus() != CacheStatus.STARTED) c.start();
+ if (c.getCacheStatus() != CacheStatus.STARTED)
+ {
+ if (log.isInfoEnabled()) log.info("Cache not started. Starting cache first.");
+ c.start();
+ }
+ if (classes.length == 0)
+ {
+ if (log.isWarnEnabled()) log.warn("You haven't passed in any classes to index. Is this an error?");
+ }
+
// Step 1: Add cache listener to listen for events happening in the cache.
SearchableListener listener = new SearchableListener();
c.addCacheListener(listener);
// step 2: create hibernate search searchImpl
- Configuration cfg = new Configuration();
- if (properties != null) cfg.setProperties(properties);
+ Cfg cfg = new SearchableCacheCfgImpl(classes, properties);
// set classes in the cfg
- if (classes != null)
- {
- for (Class clazz : classes) cfg.addClass(clazz);
- }
SearchFactoryImpl searchImpl = new SearchFactoryImpl(cfg);
16 years, 6 months
JBoss Cache SVN: r6125 - core/trunk/src/test/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-30 09:36:04 -0400 (Mon, 30 Jun 2008)
New Revision: 6125
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
Log:
Fixed broken test
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-06-30 13:34:20 UTC (rev 6124)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-06-30 13:36:04 UTC (rev 6125)
@@ -9,7 +9,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
import org.testng.annotations.Test;
@@ -38,7 +37,7 @@
// need to test what's going on with
CacheMarshaller200 cm200 = new CacheMarshaller200();
c.setUseRegionBasedMarshalling(true);
- cm200.injectDependencies(new RegionManager(), c, getClass().getClassLoader(), new BuddyFqnTransformer());
+ cm200.injectDependencies(new RegionManager(), c, getClass().getClassLoader());
cm200.init();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
16 years, 6 months
JBoss Cache SVN: r6124 - core/trunk/src/main/java/org/jboss/cache/lock.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-30 09:34:20 -0400 (Mon, 30 Jun 2008)
New Revision: 6124
Modified:
core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
Log:
get "concurrency level" from cfg
Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-06-30 13:32:24 UTC (rev 6123)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-06-30 13:34:20 UTC (rev 6124)
@@ -51,7 +51,6 @@
private CacheSPI cache;
private TransactionManager transactionManager;
private InvocationContextContainer invocationContextContainer;
- private static final int DEFAULT_CONCURRENCY = 100;
private static final Log log = LogFactory.getLog(MVCCLockManager.class);
private static final boolean trace = log.isTraceEnabled();
@@ -291,23 +290,13 @@
private final int lockSegmentShift;
/**
- * This constructor just calls {@link #LockContainer(int)} with a default concurrency value of 20.
+ * Creates a new LockContainer which uses a certain number of shared locks across all elements that need to be locked.
*/
LockContainer()
{
- this(DEFAULT_CONCURRENCY);
- }
-
- /**
- * Creates a new LockContainer which uses a certain number of shared locks across all elements that need to be locked.
- *
- * @param concurrency number of threads expected to use this class concurrently.
- */
- LockContainer(int concurrency)
- {
int tempLockSegShift = 0;
int numLocks = 1;
- while (numLocks < concurrency)
+ while (numLocks < configuration.getConcurrencyLevel())
{
++tempLockSegShift;
numLocks <<= 1;
16 years, 6 months
JBoss Cache SVN: r6123 - core/trunk/src/main/java/org/jboss/cache/config.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-30 09:32:24 -0400 (Mon, 30 Jun 2008)
New Revision: 6123
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
Log:
Added cfg options for allowing write skew and concurrency level
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-06-30 13:29:46 UTC (rev 6122)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-06-30 13:32:24 UTC (rev 6123)
@@ -32,16 +32,6 @@
private JGroupsStackParser jGroupsStackParser = new JGroupsStackParser();
- public void setCacheMarshaller(Marshaller instance)
- {
- marshaller = instance;
- }
-
- public Marshaller getMarshaller()
- {
- return marshaller;
- }
-
/**
* Behavior of the JVM shutdown hook registered by the cache
*/
@@ -211,11 +201,45 @@
private int objectInputStreamPoolSize = 50;
private int objectOutputStreamPoolSize = 50;
private List<CustomInterceptorConfig> customInterceptors = Collections.emptyList();
+ private boolean allowWriteSkew = false;
+ private int concurrencyLevel = 50;
// ------------------------------------------------------------------------------------------------------------
// SETTERS - MAKE SURE ALL SETTERS PERFORM testImmutability()!!!
// ------------------------------------------------------------------------------------------------------------
+ public void setCacheMarshaller(Marshaller instance)
+ {
+ marshaller = instance;
+ }
+
+ public Marshaller getMarshaller()
+ {
+ return marshaller;
+ }
+
+ public boolean isAllowWriteSkew()
+ {
+ return allowWriteSkew;
+ }
+
+ public void setAllowWriteSkew(boolean allowWriteSkew)
+ {
+ testImmutability("allowWriteSkew");
+ this.allowWriteSkew = allowWriteSkew;
+ }
+
+ public int getConcurrencyLevel()
+ {
+ return concurrencyLevel;
+ }
+
+ public void setConcurrencyLevel(int concurrencyLevel)
+ {
+ testImmutability("concurrencyLevel");
+ this.concurrencyLevel = concurrencyLevel;
+ }
+
/**
* Converts a list of elements to a Java Groups property string.
*/
16 years, 6 months
JBoss Cache SVN: r6122 - in core/trunk/src/main/java/org/jboss/cache: loader and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-30 09:29:46 -0400 (Mon, 30 Jun 2008)
New Revision: 6122
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionManager.java
core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Propertransformation of Fqns when looking up regions
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2008-06-30 12:34:18 UTC (rev 6121)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2008-06-30 13:29:46 UTC (rev 6122)
@@ -12,7 +12,6 @@
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.EvictionTimerTask;
-import org.jboss.cache.eviction.RegionNameConflictException;
import org.jboss.cache.factories.annotations.Destroy;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
@@ -63,6 +62,7 @@
protected RPCManager rpcManager;
private LockManager lockManager;
private BuddyFqnTransformer buddyFqnTransformer;
+ private boolean isUsingBR;
@Inject
void injectDependencies(CacheSPI cache, Configuration configuration, RPCManager rpcManager, LockManager lockManager,
@@ -79,6 +79,7 @@
protected void start()
{
log.trace("Starting region manager");
+ isUsingBR = configuration.getBuddyReplicationConfig() != null && configuration.getBuddyReplicationConfig().isEnabled();
if (configuration.getEvictionConfig() != null
&& configuration.getEvictionConfig().isValidConfig())
{
@@ -176,6 +177,9 @@
/**
* Returns a region by {@link Fqn}, creating it optionally if absent. If the region does not exist and <tt>createIfAbsent</tt>
* is <tt>false</tt>, a parent region which may apply to the {@link Fqn} is sought.
+ * <p/>
+ * Note that this takes into account the fact that this may be a Buddy Backup Fqn. If it is, the actual Fqn is calculated
+ * and used instead.
*/
public Region getRegion(Fqn fqn, boolean createIfAbsent)
{
@@ -183,13 +187,34 @@
}
/**
+ * Retrieves a valid marshalling {@link Region} after taking into account that this may be a Buddy Backup Fqn.
+ * If the fqn passed in is null, the region has been deactivated or if a region cannot be found, this method returns a null.
+ *
+ * @param fqn of the region to locate
+ * @return a region
+ */
+ public Region getValidMarshallingRegion(Fqn fqn)
+ {
+ if (fqn == null) return null;
+ return getRegion(fqn, Region.Type.MARSHALLING, false);
+ }
+
+ /**
* An overloaded form of {@link #getRegion(Fqn,boolean)} that takes an additional {@link org.jboss.cache.Region.Type}
* parameter to force regions of a specific type.
+ * <p/>
+ * Note that this takes into account the fact that this may be a Buddy Backup Fqn. If it is, the actual Fqn is calculated
+ * and used instead.
*
* @see org.jboss.cache.Region.Type
*/
public Region getRegion(Fqn fqn, Region.Type type, boolean createIfAbsent)
{
+ if (isUsingBR && fqn != null && buddyFqnTransformer.isBackupFqn(fqn))
+ {
+ fqn = buddyFqnTransformer.getActualFqn(fqn);
+ }
+
if (log.isTraceEnabled()) log.trace("Contents of RegionsRegistry: " + regionsRegistry);
Fqn fqnToUse = fqn;
if (DEFAULT_REGION.equals(fqnToUse)) fqnToUse = Fqn.ROOT;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-30 12:34:18 UTC (rev 6121)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-30 13:29:46 UTC (rev 6122)
@@ -8,7 +8,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Modification;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.marshall.Marshaller;
@@ -51,7 +56,6 @@
*/
protected Map<Object, List<Modification>> transactions = new ConcurrentHashMap<Object, List<Modification>>();
-
public void put(Fqn fqn, Map<Object, Object> attributes, boolean erase) throws Exception
{
if (erase)
@@ -78,8 +82,6 @@
boolean moveToBuddy = subtree.isChildOf(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN) && subtree.size() > 1;
// store new state
- Fqn fqn;
- //NodeData nd = null;
Object objectFromStream = cache.getMarshaller().objectFromObjectStream(in);
if (objectFromStream instanceof NodeDataMarker)
{
@@ -167,7 +169,7 @@
protected void regionAwareMarshall(Fqn fqn, Object toMarshall) throws Exception
{
- Region r = regionManager == null ? null : regionManager.getRegion(fqn, Region.Type.MARSHALLING, false);
+ Region r = regionManager == null ? null : regionManager.getValidMarshallingRegion(fqn);
ClassLoader originalClassLoader = null;
boolean needToResetLoader = false;
Thread current = null;
@@ -193,7 +195,7 @@
protected Object regionAwareUnmarshall(Fqn fqn, Object toUnmarshall) throws Exception
{
- Region r = regionManager == null ? null : regionManager.getRegion(fqn, Region.Type.MARSHALLING, false);
+ Region r = regionManager == null ? null : regionManager.getValidMarshallingRegion(fqn);
ClassLoader originalClassLoader = null;
boolean needToResetLoader = false;
Thread current = null;
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-06-30 12:34:18 UTC (rev 6121)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-06-30 13:29:46 UTC (rev 6122)
@@ -9,9 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.WriteCommand;
@@ -57,7 +55,6 @@
protected boolean defaultInactive;
protected Log log;
protected boolean trace;
- private BuddyFqnTransformer buddyFqnTransformer;
/**
* Map<GlobalTransaction, Fqn> for prepared tx that have not committed
@@ -68,12 +65,11 @@
protected boolean useRefs = false;
@Inject
- void injectDependencies(RegionManager regionManager, Configuration configuration, ClassLoader defaultClassLoader, BuddyFqnTransformer transformer)
+ void injectDependencies(RegionManager regionManager, Configuration configuration, ClassLoader defaultClassLoader)
{
this.defaultClassLoader = defaultClassLoader;
this.regionManager = regionManager;
this.configuration = configuration;
- this.buddyFqnTransformer = transformer;
}
@Start
@@ -191,22 +187,4 @@
return fqn;
}
-
- /**
- * Retrieves the {@link Region} from the {@link RegionManager} after taking into account that this may be a Buddy Backup Fqn.
- * If the fqn passed in is null, the region has been deactivated or if a region cannot be found, this method returns a null.
- *
- * @param fqn of the region to locate
- * @return a region
- */
- protected Region getRegion(Fqn fqn)
- {
- if (fqn == null) return null;
- if (buddyFqnTransformer.isBackupFqn(fqn))
- {
- // Strip out the buddy group portion
- fqn = buddyFqnTransformer.getActualFqn(fqn);
- }
- return regionManager.getRegion(fqn, Region.Type.MARSHALLING, false);
- }
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-06-30 12:34:18 UTC (rev 6121)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-06-30 13:29:46 UTC (rev 6122)
@@ -24,7 +24,16 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
/**
* An enhanced marshaller for RPC calls between CacheImpl instances.
@@ -212,7 +221,7 @@
private Region findRegion(Fqn fqn) throws InactiveRegionException
{
- Region region = getRegion(fqn);
+ Region region = regionManager.getValidMarshallingRegion(fqn);
if (region != null)
{
@@ -250,7 +259,7 @@
{
Fqn fqn = extractFqn(cmd);
- Region r = getRegion(fqn);
+ Region r = regionManager.getValidMarshallingRegion(fqn);
return r == null ? null : r.getFqn();
}
16 years, 6 months
JBoss Cache SVN: r6121 - in searchable/trunk: src/main/java/org/jboss/cache/search and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-30 08:34:18 -0400 (Mon, 30 Jun 2008)
New Revision: 6121
Added:
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredCacheTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredPOJOCacheTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalCacheTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Removed:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchResultIterator.java
searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
Modified:
searchable/trunk/pom.xml
searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityId.java
searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityLoader.java
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
Log:
Javadocced stuff + black-box
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/pom.xml 2008-06-30 12:34:18 UTC (rev 6121)
@@ -27,10 +27,16 @@
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <version>2.2.0.CR4</version>
+ <version>2.2.0.CR5</version>
</dependency>
<dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-pojo</artifactId>
+ <version>2.2.0.CR5</version>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate.sandbox</groupId>
<artifactId>hibernate-search-gsoc</artifactId>
<version>3.1.0-SNAPSHOT</version>
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityId.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityId.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityId.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -3,6 +3,9 @@
import org.jboss.cache.Fqn;
/**
+ *
+ * This class is used to get fqns, keys and documentId's by calling methods on {@link org.jboss.cache.search.Transformer}
+ *
@author Navin Surtani - navin(a)surtani.org
*/
public class CacheEntityId
@@ -22,6 +25,12 @@
this.key = key;
}
+ /**
+ * Gets the Fqn from the instance of CacheEntityId.
+ *
+ * @return Fqn from the instance of CacheEntityId.
+ */
+
public Fqn getFqn()
{
if (fqn != null) return fqn;
@@ -33,6 +42,12 @@
throw new IllegalArgumentException("At least fqn or documentId must be set to call this method");
}
+ /**
+ * Gets the key from the instance of CacheEntityId.
+ *
+ * @return Key from the instance of CacheEntityId.
+ */
+
public String getKey()
{
if (key != null) return key;
@@ -45,6 +60,13 @@
throw new IllegalArgumentException("At least key or documentId must be set to call this method");
}
+ /**
+ * Gets a documentId String from an Fqn and key combination.
+ *
+ * @return documentId String.
+ */
+
+
public String getDocumentId()
{
if (key != null || fqn != null)
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityLoader.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheEntityLoader.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -6,6 +6,8 @@
import java.util.ArrayList;
/**
+ * Class that is used to load objects from a list of CacheEntityId ids.
+ *
* @author Navin Surtani - navin(a)surtani.org
*/
public class CacheEntityLoader
@@ -19,8 +21,9 @@
/**
* Takes a list of entity ids and gets them from the cache.
- * @param ids
- * @return
+ * @param ids list of cache entity IDs. Cannot be null.
+ * @return List of objects loaded from the cache. The list returned will be exactly the same size as the ids list passed in.
+ * @throws NullPointerException if ids is null.
*/
public List<Object> load(List<CacheEntityId> ids)
{
@@ -35,8 +38,9 @@
/**
* Takes a list of entity ids and gets them from the cache.
- * @param id
- * @return
+ * @param id cache entity id to look up in the cache.
+ * @return the object from the cache, or null if one cannot be found.
+ * @throws NullPointerException if ids is null.
*/
public Object load(CacheEntityId id)
{
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -9,20 +9,64 @@
* as list, setFirstResult,setMaxResults, setFetchSize, getResultSize and setSort.
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @see org.jboss.cache.search.SearchableCache#createQuery(org.apache.lucene.search.Query)
*/
public interface CacheQuery
{
+ /**
+ * Returns the results of a search as a list.
+ *
+ * @return list of objects that were found from the search.
+ */
+
List<Object> list();
+ /**
+ * Returns the results of a search as a {@link QueryResultIterator}.
+ *
+ * @return a QueryResultIterator which can be used to iterate through the results that were found.
+ */
+
QueryResultIterator iterator();
+ /**
+ * Sets a result with a given index to the first result.
+ *
+ * @param index of result to be set to the first.
+ * @throws IllegalArgumentException if the index given is less than zero.
+ */
+
void setFirstResult(int index);
+ /**
+ * Sets the maximum number of results to the number passed in as a parameter.
+ *
+ * @param numResults that are to be set to the maxResults.
+ */
+
void setMaxResults(int numResults);
+ /**
+ * Defines scrollable result fetch size
+ *
+ * @param size to be set
+ */
+
void setFetchSize(int size);
+ /**
+ * Gets the integer number of results.
+ *
+ * @return integer number of results.
+ */
+
int getResultSize();
+ /**
+ * Allows lucene to sort the results.
+ *
+ * @param s - lucene sort object
+ */
+
void setSort(Sort s);
}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -34,9 +34,9 @@
import java.util.Set;
/**
+ * Implementation class of the CacheQuery interface.
+ * <p />
* @author Navin Surtani - navin(a)surtani.org
- * <p/>
- * Implementation class of the FullTextQuery interface in Hibernate Search.
*/
public class CacheQueryImpl implements CacheQuery
{
@@ -138,8 +138,8 @@
/**
* Enable a given filter by its name.
*
- * @param name
- * @return
+ * @param name of filter.
+ * @return a FullTextFilter object.
*/
public FullTextFilter enableFullTextFilter(String name)
{
@@ -164,7 +164,7 @@
/**
* Disable a given filter by its name.
*
- * @param name
+ * @param name of filter.
*/
public void disableFullTextFilter(String name)
{
@@ -174,8 +174,8 @@
/**
* Sets the the result of the given integer value to the first result.
*
- * @param firstResult
- * @return
+ * @param firstResult index to be set.
+ * @throws IllegalArgumentException if the index given is less than zero.
*/
public void setFirstResult(int firstResult)
{
@@ -184,8 +184,11 @@
throw new IllegalArgumentException("'first' pagination parameter less than 0");
}
this.firstResult = firstResult;
+
+ //TODO How do we deal with this if the parameter is too high.
}
+
public QueryResultIterator iterator() throws HibernateException
{
List<CacheEntityId> ids = null;
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -3,8 +3,7 @@
import org.jboss.cache.CacheException;
/**
- *
- * Thrown when an invalid Fqn is passed into the generateId method in Transformer
+ * Thrown when an invalid Fqn is passed into {@link org.jboss.cache.search.Transformer#generateId(org.jboss.cache.Fqn, String)}
* <p />
*
* @author Navin Surtani - navin(a)surtani.org
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -7,20 +7,28 @@
import javax.transaction.Transaction;
/**
- * This class implements the TransactionContext interface in the org.hibernate.search.transaction package. It
- * retrieves transaction context information from the NodeModifiedEvent that gets passed in.
+ * This class implements the {@link org.hibernate.search.transaction.TransactionContext} interface. It
+ * retrieves transaction context information from the {@link org.jboss.cache.notifications.event.NodeModifiedEvent} that gets passed in.
* <p />
- * It is used by the SearchableListener to pass in transaction information to a Hibernate Search Work object.
+ * It is used by the {@link org.jboss.cache.search.SearchableListener} to pass transaction information to a Hibernate Search {@link org.hibernate.search.backend.Work} object.
* <p />
* @author Navin Surtani - navin(a)surtani.org
+ * @see org.jboss.cache.search.SearchableListener
*/
public class NodeModifiedTransactionContext implements TransactionContext
{
NodeModifiedEvent event;
+ /**
+ * Creates a new instance of NodeModifiedTransactionContext.
+ * <p />
+ * @param event a NodeModifiedEvent to wrap. Should not be null.
+ * @throws NullPointerException if event is null.
+ */
public NodeModifiedTransactionContext(NodeModifiedEvent event)
{
+ if (event == null) throw new NullPointerException("event cannot be null");
this.event = event;
}
@@ -46,20 +54,27 @@
}
/**
- * Registers a synchronization from one passed as a parameter.
- *
- * @param synchronization
+ * Registers the synchronization passed in as a parameter with the ongoing transaction.
+ * <p />
+ * If there is no ongoing transaction, then this method will do nothing and simply return.
+ * <p />
+ * @param synchronization synchronization to register. Must not be null.
+ * @throws NullPointerException if the synchronization is null.
*/
public void registerSynchronization(Synchronization synchronization)
{
Transaction transaction = event.getTransaction();
- try
+ if (transaction != null)
{
- transaction.registerSynchronization(synchronization);
+ if (synchronization == null) throw new NullPointerException("Synchronization passed in is null!");
+ try
+ {
+ transaction.registerSynchronization(synchronization);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
}
}
Deleted: searchable/trunk/src/main/java/org/jboss/cache/search/SearchResultIterator.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchResultIterator.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchResultIterator.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -1,61 +0,0 @@
-package org.jboss.cache.search;
-
-import org.hibernate.search.engine.EntityInfo;
-import org.hibernate.search.engine.Loader;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-/**
- * @author Navin Surtani - navin(a)surtani.org
- */
-public class SearchResultIterator implements Iterator
-{
- protected final List<CacheEntityId> entityIds;
- protected int index = 0;
- protected final int size;
- protected Object next;
- protected int nextObjectIndex = -1;
- protected final CacheEntityLoader loader;
-
- public SearchResultIterator(List<CacheEntityId> entityIds, CacheEntityLoader loader) {
- this.entityIds = entityIds;
- this.size = entityIds.size();
- this.loader = loader;
- }
-
- //side effect is to set up next
- public boolean hasNext() {
- if ( nextObjectIndex == index ) return next != null;
- next = null;
- nextObjectIndex = -1;
- do {
- if ( index >= size ) {
- nextObjectIndex = index;
- next = null;
- return false;
- }
- next = loader.load( entityIds.get( index ) );
- if ( next == null ) {
- index++;
- }
- else {
- nextObjectIndex = index;
- }
- }
- while ( next == null );
- return true;
- }
-
- public Object next() {
- //hasNext() has side effect
- if ( !hasNext() ) throw new NoSuchElementException( "Out of boundaries" );
- index++;
- return next;
- }
-
- public void remove() {
- throw new UnsupportedOperationException( "Cannot remove from a lucene query iterator" );
- }
-}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -17,17 +17,17 @@
/**
* Creates a CacheQuery object from a luceneQuery.
*
- * @param luceneQuery
- * @return
+ * @param luceneQuery - from {@link org.apache.lucene.search.Query}
+ * @return a CacheQuery instance from which the user can get a list/iterator object.
*/
public CacheQuery createQuery(Query luceneQuery);
/**
* Creates a CacheQuery from a lucene query and a class array.
*
- * @param luceneQuery
- * @param classes
- * @return
+ * @param classes - array of classes to be searched from.
+ * @param luceneQuery - from {@link org.apache.lucene.search.Query}
+ * @return a CacheQuery instance from which the user can get a list/iterator object.
*/
public CacheQuery createQuery(Query luceneQuery, Class... classes);
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -34,6 +34,8 @@
//TODO: javadoc!!
public SearchableCacheImpl(Cache<K, V> cache, SearchFactoryImpl searchFactory)
{
+ if (cache == null) throw new NullPointerException("Blah");
+ if (searchFactory == null) throw new NullPointerException("Blah");
this.cache = cache;
this.searchFactory = searchFactory;
}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -25,7 +25,7 @@
* Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
*
*
- * @param event
+ * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
*/
@@ -51,7 +51,7 @@
* If the modification type is PUT_MAP or PUT_DATA then this method will be called.
* Takes in the event as a parameter
*
- * @param event
+ * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
*/
void handlePutData(NodeModifiedEvent event)
{
@@ -73,7 +73,7 @@
* If the modification type is DELETE_DATA then this method will be called.
* Takes in the event as a parameter
*
- * @param event
+ * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
*/
void handleDeleteData(NodeModifiedEvent event)
{
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -18,8 +18,8 @@
* Takes in the documentId string from the user and will return the key from the Fqn, key combination.
*
*
- * @param docId
- * @return
+ * @param docId - for the keystring to be obtained
+ * @return keystring.
*/
public static String getKey(String docId)
@@ -45,8 +45,8 @@
/**
* Takes in the documentId string from the user and will return the Fqn from the Fqn, key combination.
*
- * @param docId
- * @return
+ * @param docId - for the Fqn to be obtained
+ * @return Fqn from the documentId.
*/
@@ -74,7 +74,7 @@
*
* @param fqn
* @param key
- * @return
+ * @return documentId String to be given to Lucene.
* @throws InvalidFqnException
*/
Deleted: searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-30 11:58:59 UTC (rev 6120)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -1,129 +0,0 @@
-package org.jboss.cache.search;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.jboss.cache.Cache;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.search.test.Person;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * @author Navin Surtani - navin(a)surtani.org
- */
-@Test
-public class BlackBoxTest
-{
- public void doTest() throws ParseException
- {
- Cache cache = new DefaultCacheFactory().createCache();
- SearchableCache sc = new SearchableCacheFactory().createSearchableCache(cache, Person.class);
-
- Person p1 = new Person();
- p1.setName("Navin Surtani");
- p1.setBlurb("Likes playing WoW");
-
- Person p2 = new Person();
- p2.setName("BigGoat");
- p2.setName("Eats grass");
-
- Person p3 = new Person();
- p3.setName("MiniGoat");
- p3.setBlurb("Makes cheese");
-
- //Put the 3 created objects in the cache.
-
- sc.put(Fqn.fromString("/a/b/c"), "Navin", p1);
- sc.put(Fqn.fromString("/a/b/d"), "BigGoat", p2);
- sc.put(Fqn.fromString("/a/b/c"), "MiniGoat", p3);
-
-
- QueryParser qp = new QueryParser("field", new StandardAnalyzer());
- Query luceneQuery = qp.parse("playing");
- CacheQuery query = sc.createQuery(luceneQuery);
-
- List found = query.list();
-
- assert found.size() == 1;
- assert found.get(0).equals(p1);
-
- sc.remove("/a/b/c", "Navin");
-
- query = sc.createQuery(luceneQuery);
-
- found = query.list();
-
- assert found.size() == 0;
-
- sc.put(Fqn.fromString("/a/b/c"), "Navin", p1);
-
- luceneQuery = qp.parse("Goat");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert found.size() == 2;
- assert !found.get(1).equals(p2);
- assert !found.get(0).equals(p3);
-
- luceneQuery = qp.parse("/a/b/c");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert found.size() == 2;
-
- for (int i = 0; i < found.size(); i++)
- {
- assert !found.get(i).equals(p2);
- }
-
- p1.setBlurb("Likes pizza");
-
- luceneQuery = qp.parse("pizza");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert found.size() == 1;
- assert found.get(0).equals(p1);
-
- Cache cache2 = new DefaultCacheFactory().createCache();
- SearchableCache sc2 = new SearchableCacheFactory().createSearchableCache(cache2, Person.class);
-
- Person p4 = new Person();
-
- p4.setName("Ralph Nader");
- p4.setBlurb("Runs for president");
-
- sc2.put(Fqn.fromString("/u/s/a"), "Ralph", p4);
-
- luceneQuery = qp.parse("president");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert found.size() == 1;
-
- p4.setBlurb("Makes cheese");
-
- sc2.put(Fqn.fromString("/u/s/a"), "Ralph", p4);
-
- luceneQuery = qp.parse("Makes cheese");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert found.size() == 2;
-
- sc2.remove("/u/s/a", "Ralph");
-
- luceneQuery = qp.parse("Makes cheese");
- query = sc.createQuery(luceneQuery);
- found = query.list();
-
- assert !found.contains(p4);
-
- // TODO: Test stuff with PojoCache. Put stuff in PojoCache (using cache.attach()) and see if you can find stuff.
-
- }
-}
Added: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredCacheTest.java (rev 0)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredCacheTest.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -0,0 +1,167 @@
+package org.jboss.cache.search.blackbox;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.search.SearchableCache;
+import org.jboss.cache.search.CacheQuery;
+import org.jboss.cache.search.SearchableCacheFactory;
+import org.jboss.cache.search.test.Person;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterMethod;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+
+import java.util.List;
+
+/**
+ * @author Navin Surtani - navin(a)surtani.org
+ */
+@Test
+public class ClusteredCacheTest
+{
+ Cache cache1, cache2;
+ SearchableCache searchableCache1, searchableCache2;
+ Person person1;
+ Person person2;
+ Person person3;
+ Person person4;
+ QueryParser queryParser;
+ Query luceneQuery;
+ CacheQuery cacheQuery;
+ List found;
+
+
+ @BeforeMethod
+ public void setUp()
+ {
+ cache1 = new DefaultCacheFactory().createCache();
+ searchableCache1 = new SearchableCacheFactory().createSearchableCache(cache1, Person.class);
+
+ cache2 = new DefaultCacheFactory().createCache();
+ searchableCache2 = new SearchableCacheFactory().createSearchableCache(cache2, Person.class);
+
+ person1 = new Person();
+ person1.setName("Navin Surtani");
+ person1.setBlurb("Likes playing WoW");
+
+ person2 = new Person();
+ person2.setName("BigGoat");
+ person2.setName("Eats grass");
+
+ person3 = new Person();
+ person3.setName("MiniGoat");
+ person3.setBlurb("Makes cheese");
+
+ //Put the 3 created objects in the searchableCache1.
+
+ searchableCache1.put(Fqn.fromString("/a/b/c"), "Navin", person1);
+ searchableCache1.put(Fqn.fromString("/a/b/d"), "BigGoat", person2);
+ searchableCache1.put(Fqn.fromString("/a/b/c"), "MiniGoat", person3);
+
+
+ }
+
+ @AfterMethod
+ public void tearDown()
+ {
+ if (searchableCache1 != null) searchableCache1.stop();
+ if (searchableCache2 != null) searchableCache2.stop();
+
+ }
+
+ public void testSimple() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+
+ }
+
+ public void testModified() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+
+ person1.setBlurb("Likes pizza");
+ searchableCache1.put(Fqn.fromString("/a/b/c/"), "Navin", person1);
+
+
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+ }
+
+ public void testAdded() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2 : "Size of list should be 2";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert !found.contains(person4) : "This should not contain object person4";
+
+ person4.setName("MightyGoat");
+ person4.setBlurb("Also eats grass");
+
+ searchableCache1.put(Fqn.fromString("/r/a/m/"), "Ram", person4);
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 3 : "Size of list should be 3";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert found.contains(person4) : "This should now contain object person4";
+ }
+
+ public void testRemoved() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2;
+ assert found.contains(person2);
+ assert found.contains(person3) : "This should still contain object person3";
+
+ searchableCache1.remove(Fqn.fromString("/a/b/c/"), person3);
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache2.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.contains(person2);
+ assert !found.contains(person3) : "The search should not return person3";
+
+
+ }
+
+
+}
+
+
Added: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredPOJOCacheTest.java (rev 0)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/ClusteredPOJOCacheTest.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -0,0 +1,8 @@
+package org.jboss.cache.search.blackbox;
+
+/**
+ * @author Navin Surtani - navin(a)surtani.org
+ */
+public class ClusteredPOJOCacheTest
+{
+}
Added: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalCacheTest.java (rev 0)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalCacheTest.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -0,0 +1,166 @@
+package org.jboss.cache.search.blackbox;
+
+import org.jboss.cache.search.SearchableCache;
+import org.jboss.cache.search.SearchableCacheFactory;
+import org.jboss.cache.search.CacheQuery;
+import org.jboss.cache.search.test.Person;
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.search.Query;
+
+import java.util.List;
+
+/**
+ * @author Navin Surtani - navin(a)surtani.org
+ */
+
+@Test
+public class LocalCacheTest
+{
+ SearchableCache searchableCache;
+ Person person1;
+ Person person2;
+ Person person3;
+ Person person4;
+ QueryParser queryParser;
+ Query luceneQuery;
+ CacheQuery cacheQuery;
+ List found;
+
+ @BeforeMethod
+ public void setUp()
+ {
+ Cache coreCache = new DefaultCacheFactory().createCache();
+ searchableCache = new SearchableCacheFactory().createSearchableCache(coreCache, Person.class);
+
+ person1 = new Person();
+ person1.setName("Navin Surtani");
+ person1.setBlurb("Likes playing WoW");
+
+ person2 = new Person();
+ person2.setName("BigGoat");
+ person2.setName("Eats grass");
+
+ person3 = new Person();
+ person3.setName("MiniGoat");
+ person3.setBlurb("Makes cheese");
+
+ //Put the 3 created objects in the searchableCache.
+
+ searchableCache.put(Fqn.fromString("/a/b/c"), "Navin", person1);
+ searchableCache.put(Fqn.fromString("/a/b/d"), "BigGoat", person2);
+ searchableCache.put(Fqn.fromString("/a/b/c"), "MiniGoat", person3);
+
+ }
+
+ @AfterMethod
+ public void tearDown()
+ {
+ if (searchableCache != null) searchableCache.stop();
+ }
+
+ public void testSimple() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+ }
+
+ public void testMultipleResults() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2;
+ assert !found.get(1).equals(person2);
+ assert !found.get(0).equals(person3);
+
+ }
+
+ public void testModified() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+
+ person1.setBlurb("Likes pizza");
+ searchableCache.put(Fqn.fromString("/a/b/c/"), "Navin", person1);
+
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("pizza");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+ }
+
+ public void testAdded() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2: "Size of list should be 2";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert !found.contains(person4) : "This should not contain object person4";
+
+ person4.setName("MightyGoat");
+ person4.setBlurb("Also eats grass");
+
+ searchableCache.put(Fqn.fromString("/r/a/m/"), "Ram", person4);
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 3: "Size of list should be 3";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert found.contains(person4) : "This should now contain object person4";
+ }
+
+ public void testRemoved() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2;
+ assert found.contains(person2);
+ assert found.contains(person3): "This should still contain object person3";
+
+ searchableCache.remove(Fqn.fromString("/a/b/c/"), person3);
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.contains(person2);
+ assert !found.contains(person3): "The search should not return person3";
+
+
+ }
+
+}
Added: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java (rev 0)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2008-06-30 12:34:18 UTC (rev 6121)
@@ -0,0 +1,181 @@
+package org.jboss.cache.search.blackbox;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterMethod;
+import org.jboss.cache.search.SearchableCache;
+import org.jboss.cache.search.CacheQuery;
+import org.jboss.cache.search.SearchableCacheFactory;
+import org.jboss.cache.search.test.Person;
+import org.jboss.cache.pojo.PojoCache;
+import org.jboss.cache.pojo.PojoCacheFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import java.util.List;
+
+/**
+ * Same as LocalCacheTest except that you will use a POJO Cache instead and use pojoCache.attach() ad pojoCache.detach()
+ * instead of cache.put() and cache.remove().
+ * <p />
+ * @author Navin Surtani - navin(a)surtani.org
+ */
+
+@Test
+public class LocalPOJOCacheTest
+{
+ SearchableCache searchableCache;
+ PojoCache pojo;
+ Person person1;
+ Person person2;
+ Person person3;
+ Person person4;
+ QueryParser queryParser;
+ Query luceneQuery;
+ CacheQuery cacheQuery;
+ List found;
+
+
+ @BeforeMethod
+ public void setUp()
+ {
+ Configuration config = new Configuration();
+ PojoCache pojo = PojoCacheFactory.createCache(config, true);
+ Cache coreCache = new DefaultCacheFactory().createCache();
+ searchableCache = new SearchableCacheFactory().createSearchableCache(coreCache, Person.class);
+
+ person1 = new Person();
+ person1.setName("Navin Surtani");
+ person1.setBlurb("Likes playing WoW");
+
+ person2 = new Person();
+ person2.setName("BigGoat");
+ person2.setName("Eats grass");
+
+ person3 = new Person();
+ person3.setName("MiniGoat");
+ person3.setBlurb("Makes cheese");
+
+ pojo.attach(Fqn.fromString("/a/b/c"), person1);
+ pojo.attach(Fqn.fromString("/a/b/d"), person2);
+ pojo.attach(Fqn.fromString("/a/b/c"), person3);
+
+
+ }
+
+ @AfterMethod
+ public void tearDown()
+ {
+
+ if(pojo != null) pojo.stop();
+ if(searchableCache != null) searchableCache.stop();
+ }
+
+ public void testSimple() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+ }
+
+ public void testMultipleResults() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2;
+ assert !found.get(1).equals(person2);
+ assert !found.get(0).equals(person3);
+
+ }
+
+ public void testModified() throws ParseException
+ {
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("playing");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+
+ person1.setBlurb("Likes pizza");
+
+ pojo.attach(Fqn.fromString("/a/b/c/"), person1);
+
+ queryParser = new QueryParser("field", new StandardAnalyzer());
+ luceneQuery = queryParser.parse("pizza");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(person1);
+ }
+
+ public void testAdded() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2: "Size of list should be 2";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert !found.contains(person4) : "This should not contain object person4";
+
+ person4.setName("MightyGoat");
+ person4.setBlurb("Also eats grass");
+
+ pojo.attach(Fqn.fromString("/r/a/m/"), person4);
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 3: "Size of list should be 3";
+ assert found.contains(person2);
+ assert found.contains(person3);
+ assert found.contains(person4) : "This should now contain object person4";
+ }
+
+ public void testRemoved() throws ParseException
+ {
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 2;
+ assert found.contains(person2);
+ assert found.contains(person3): "This should still contain object person3";
+
+ pojo.detach(Fqn.fromString("/a/b/c/"));
+
+ luceneQuery = queryParser.parse("Goat");
+ cacheQuery = searchableCache.createQuery(luceneQuery);
+ found = cacheQuery.list();
+
+ assert found.size() == 1;
+ assert found.contains(person2);
+ assert !found.contains(person3): "The search should not return person3";
+
+
+ }
+
+}
+
+
+}
16 years, 6 months
JBoss Cache SVN: r6120 - in core/branches/2.2.X/src: main/java/org/jboss/cache/cluster and 21 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-30 07:58:59 -0400 (Mon, 30 Jun 2008)
New Revision: 6120
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java
core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
Log:
PMD fixes
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -393,10 +393,9 @@
if (trace)
log.trace("callRemoteMethods(): valid members are " + recipients + " methods: " + command + " Using OOB? " + useOutOfBandMessage);
- if (channel.flushSupported())
+ if (channel.flushSupported() && !flushBlockGate.await(configuration.getStateRetrievalTimeout()))
{
- if (!flushBlockGate.await(configuration.getStateRetrievalTimeout()))
- throw new TimeoutException("State retrieval timed out waiting for flush unblock.");
+ throw new TimeoutException("State retrieval timed out waiting for flush unblock.");
}
useOutOfBandMessage = false;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -12,7 +12,6 @@
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.EvictionTimerTask;
-import org.jboss.cache.eviction.RegionNameConflictException;
import org.jboss.cache.factories.annotations.Destroy;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -36,10 +36,4 @@
{
super(msg, cause);
}
-
- @Override
- public String toString()
- {
- return super.toString();
- }
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -84,19 +84,16 @@
this.max_elements = configuration.getReplQueueMaxElements();
// check again
enabled = configuration.isUseReplQueue() && (configuration.getBuddyReplicationConfig() == null || !configuration.getBuddyReplicationConfig().isEnabled());
- if (enabled)
+ if (enabled && interval > 0)
{
- if (interval > 0)
+ if (task == null)
+ task = new ReplicationQueue.MyTask();
+ if (timer == null)
{
- if (task == null)
- task = new ReplicationQueue.MyTask();
- if (timer == null)
- {
- timer = new Timer(true);
- timer.schedule(task,
- 500, // delay before initial flush
- interval); // interval between flushes
- }
+ timer = new Timer(true);
+ timer.schedule(task,
+ 500, // delay before initial flush
+ interval); // interval between flushes
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -12,7 +12,16 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.ClearDataCommand;
+import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import java.util.Collection;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -12,7 +12,16 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.ClearDataCommand;
+import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
/**
* This interface is the core of JBoss Cache, where each {@link VisitableCommand} can be visited by a Visitor implementation.
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,7 +2,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
import org.jboss.cache.commands.Visitor;
/**
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -5,9 +5,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* Implements functionality defined by {@link org.jboss.cache.Cache#getKeys(org.jboss.cache.Fqn)}
* <p/>
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,7 +2,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -83,24 +83,22 @@
{
// only attempt to clean up the backup if the primary did not exist - a waste of a call otherwise.
Object result = executeRemove(gtx, backup);
- if (wasNodeRemoved(result))
+ if (wasNodeRemoved(result) &&
+ buddyFqnTransformer.isDeadBackupFqn(backup) && buddyFqnTransformer.isDeadBackupRoot(backup.getParent().getParent()))
{
// if this is a DIRECT child of a DEAD buddy backup region, then remove the empty dead region structural node.
- if (buddyFqnTransformer.isDeadBackupFqn(backup) && buddyFqnTransformer.isDeadBackupRoot(backup.getParent().getParent()))
+ NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(), false);
+ if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
- NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(), false);
+ if (trace) log.trace("Removing dead backup region " + deadBackupRoot.getFqn());
+ executeRemove(gtx, deadBackupRoot.getFqn());
+
+ // now check the grand parent and see if we are free of versions
+ deadBackupRoot = dataContainer.peek(deadBackupRoot.getFqn().getParent(), false);
if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
if (trace) log.trace("Removing dead backup region " + deadBackupRoot.getFqn());
executeRemove(gtx, deadBackupRoot.getFqn());
-
- // now check the grand parent and see if we are free of versions
- deadBackupRoot = dataContainer.peek(deadBackupRoot.getFqn().getParent(), false);
- if (deadBackupRoot.getChildrenMapDirect().isEmpty())
- {
- if (trace) log.trace("Removing dead backup region " + deadBackupRoot.getFqn());
- executeRemove(gtx, deadBackupRoot.getFqn());
- }
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jgroups.Address;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,21 +2,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.notifications.Notifier;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.Collections;
-import java.util.Map;
-
/**
* Removes a node's content from memory - never removes the node.
- * It also clenups data for resident nodes - which are not being touched by eviction.
+ * It also clenups data for resident nodes - which are not being touched by eviction.
*
* @author Mircea.Markus(a)jboss.com
* @since 2.2
@@ -82,7 +79,7 @@
/**
* //TODO: 2.2.0: rather than using CacheSPI this should use peek(). The other interceptors should obtain locks and load nodes if necessary for this InvalidateCommand.
- //Even better - this can be handles in the interceptors before call interceptor
+ * //Even better - this can be handles in the interceptors before call interceptor
*/
protected NodeSPI enforceNodeLoading()
{
@@ -91,8 +88,8 @@
/**
- * mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
- be aware that it is no longer valid.
+ * mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
+ * be aware that it is no longer valid.
*/
protected void invalidateNode(NodeSPI node)
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,7 +2,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -14,7 +14,6 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.Collections;
-import java.util.Map;
/**
* Behaves like {@link org.jboss.cache.commands.write.InvalidateCommand}. Also, potentially throws a cache exception if
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -5,7 +5,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.optimistic.DataVersion;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -28,12 +28,6 @@
private static final boolean trace = log.isTraceEnabled();
@Override
- public void process(Region region) throws EvictionException
- {
- super.process(region);
- }
-
- @Override
protected void processQueues(Region region) throws EvictionException
{
boolean evictionNodesModified = false;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -89,7 +89,7 @@
{
if (this == obj)
return true;
- if (obj instanceof ElementSizeConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
return this.maxElementsPerNode == ((ElementSizeConfiguration) obj).maxElementsPerNode;
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -8,7 +8,16 @@
import org.jboss.cache.Fqn;
-import java.util.*;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
/**
* @author Daniel Huang
@@ -57,10 +66,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -78,10 +78,10 @@
@Override
public boolean equals(Object obj)
{
+ if (obj == null) return false;
if (this == obj)
return true;
-
- if (obj instanceof EvictionPolicyConfigBase)
+ if (getClass().equals(obj.getClass()))
{
EvictionPolicyConfigBase other = (EvictionPolicyConfigBase) obj;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -61,12 +61,6 @@
}
@Override
- public boolean equals(Object obj)
- {
- return (obj instanceof FIFOConfiguration && super.equals(obj));
- }
-
- @Override
protected void setEvictionPolicyClassName()
{
setEvictionPolicyClass(FIFOPolicy.class.getName());
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -61,7 +61,7 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof LFUConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
return (this.minNodes == ((LFUConfiguration) obj).minNodes);
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -8,7 +8,16 @@
import org.jboss.cache.Fqn;
-import java.util.*;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
/**
* LFUQueue EvictionQueue implementation for LFU Policy.
@@ -61,10 +70,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -89,19 +89,16 @@
@Override
protected void evict(NodeEntry ne)
{
- if (ne != null)
+ if (ne != null && !this.evictCacheNode(ne.getFqn()))
{
- if (!this.evictCacheNode(ne.getFqn()))
+ try
{
- try
- {
- recycleQueue.put(ne.getFqn());
- }
- catch (InterruptedException e)
- {
- log.debug("InterruptedException", e);
- }
+ recycleQueue.put(ne.getFqn());
}
+ catch (InterruptedException e)
+ {
+ log.debug("InterruptedException", e);
+ }
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -99,7 +99,7 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof LRUConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
LRUConfiguration other = (LRUConfiguration) obj;
return maxAgeSeconds == other.maxAgeSeconds
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -66,12 +66,6 @@
}
@Override
- public boolean equals(Object obj)
- {
- return (obj instanceof MRUConfiguration && super.equals(obj));
- }
-
- @Override
public void reset()
{
setMaxNodes(-1);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -72,10 +72,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -189,15 +189,12 @@
String name = type.getName();
Component old = componentLookup.get(name);
- if (old != null)
+ if (old != null && old.instance.equals(component))
{
// if they are equal don't bother
- if (old.instance.equals(component))
- {
- if (trace)
- log.trace("Attempting to register a component equal to one that already exists under the same name (" + name + "). Not doing anything.");
- return;
- }
+ if (trace)
+ log.trace("Attempting to register a component equal to one that already exists under the same name (" + name + "). Not doing anything.");
+ return;
}
Component c;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -253,8 +253,8 @@
catch (NoSuchMethodException me)
{
// this is ok, but certainly log this as a warning
- // this is hugely noisy!
- //if (log.isWarnEnabled()) log.warn("Unrecognised attribute " + propName + ". Please check your configuration. Ignoring!!");
+ if (log.isDebugEnabled())
+ log.debug("Unrecognised attribute " + propName + ". Please check your configuration. Ignoring!!");
}
catch (Exception e)
{
@@ -347,6 +347,7 @@
}
catch (Exception e)
{
+ throw new ConfigurationException("Bad buddyCommunicationTimeout [" + strBuddyCommunicationTimeout + "]");
}
finally
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -95,7 +95,7 @@
public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
{
Object returnValue = super.visitGetChildrenNamesCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -103,7 +103,7 @@
public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
{
Object returnValue = super.visitGetKeysCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -111,7 +111,7 @@
public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
{
Object returnValue = super.visitGetNodeCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -119,7 +119,7 @@
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
{
Object returnValue = super.visitGetKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -133,7 +133,7 @@
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
{
Object returnValue = super.visitPutKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -141,7 +141,7 @@
public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
{
Object returnValue = super.visitPutDataMapCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -149,7 +149,7 @@
public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
{
Object returnValue = super.visitRemoveKeyCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -160,8 +160,8 @@
if (trace)
log.trace("This is a move operation; removing the FROM node from the loader, no activation processing needed.");
loader.remove(command.getFqn());
- removeNodeFromCacheLoader(ctx, command.getFqn().getParent());
- removeNodeFromCacheLoader(ctx, command.getTo());
+ removeNodeFromCacheLoader(command.getFqn().getParent());
+ removeNodeFromCacheLoader(command.getTo());
return returnValue;
}
@@ -172,7 +172,7 @@
* AND it was found in the cache loader (nodeLoaded = true).
* Then notify the listeners that the node has been activated.
*/
- private void removeNodeFromCacheLoader(InvocationContext ctx, Fqn fqn) throws Throwable
+ private void removeNodeFromCacheLoader(Fqn fqn) throws Throwable
{
NodeSPI n;
if (((n = dataContainer.peek(fqn, true, false)) != null) && n.isDataLoaded() && loader.exists(fqn))
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -249,10 +249,9 @@
boolean mustLoad = false;
try
{
- if (needLock)
+ if (needLock && !lockManager.lock(n, LockType.READ, lockOwner))
{
- if (!lockManager.lock(n, LockType.READ, lockOwner))
- throw new TimeoutException("Unable to acquire lock on " + fqn + ". Lock info: " + lockManager.printLockInfo(n));
+ throw new TimeoutException("Unable to acquire lock on " + fqn + ". Lock info: " + lockManager.printLockInfo(n));
}
mustLoad = mustLoad(n, key, allKeys || isMove);
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -8,18 +8,15 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import javax.transaction.Transaction;
@@ -36,22 +33,6 @@
*/
public class CallInterceptor extends CommandInterceptor
{
- private TransactionTable transactionTable;
- private boolean cacheLoadingEnabled;
-
- @Inject
- public void injectDependencies(TransactionTable transactionTable)
- {
- this.transactionTable = transactionTable;
- }
-
- @Start
- public void startInterceptor()
- {
- cacheLoadingEnabled = configuration.getCacheLoaderConfig() != null &&
- configuration.getCacheLoaderConfig().getFirstCacheLoaderConfig() != null;
- }
-
@Override
public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -203,12 +203,9 @@
private boolean isGravitationEnabled(InvocationContext ctx)
{
boolean enabled = ctx.isOriginLocal();
- if (enabled)
+ if (enabled && !buddyManager.isAutoDataGravitation())
{
- if (!buddyManager.isAutoDataGravitation())
- {
- enabled = ctx.getOptionOverrides().getForceDataGravitation();
- }
+ enabled = ctx.getOptionOverrides().getForceDataGravitation();
}
return enabled;
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -155,10 +155,10 @@
public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
{
Object retVal = invokeNextInterceptor(ctx, command);
- return handleGetNodeOrDataCommands(ctx, retVal, command.getFqn());
+ return handleGetNodeOrDataCommands(retVal, command.getFqn());
}
- private Object handleGetNodeOrDataCommands(InvocationContext ctx, Object retVal, Fqn fqn)
+ private Object handleGetNodeOrDataCommands(Object retVal, Fqn fqn)
{
if (retVal == null)
{
@@ -182,7 +182,7 @@
public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
{
Object retVal = invokeNextInterceptor(ctx, command);
- return handleGetNodeOrDataCommands(ctx, retVal, command.getFqn());
+ return handleGetNodeOrDataCommands(retVal, command.getFqn());
}
@Override
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -13,10 +13,10 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Option;
@@ -132,24 +132,21 @@
setTransactionalContext(null, null, null, ctx);
}
- if (optionOverride != null)
+ if (optionOverride != null && optionOverride.isFailSilently())
{
- if (optionOverride.isFailSilently())
+ log.debug("FAIL_SILENTLY Option is present - suspending any ongoing transaction.");
+ suppressExceptions = true;
+ if (ctx.getTransaction() != null)
{
- log.debug("FAIL_SILENTLY Option is present - suspending any ongoing transaction.");
- suppressExceptions = true;
- if (ctx.getTransaction() != null)
- {
- suspendedTransaction = txManager.suspend();
- setTransactionalContext(null, null, null, ctx);
- if (trace) log.trace("Suspending transaction " + suspendedTransaction);
- resumeSuspended = true;
- }
- else
- {
- if (trace) log.trace("No ongoing transaction to suspend");
- }
+ suspendedTransaction = txManager.suspend();
+ setTransactionalContext(null, null, null, ctx);
+ if (trace) log.trace("Suspending transaction " + suspendedTransaction);
+ resumeSuspended = true;
}
+ else
+ {
+ if (trace) log.trace("No ongoing transaction to suspend");
+ }
}
Object retval;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,14 +1,16 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.marshall.MarshalledValueHelper;
@@ -45,7 +47,7 @@
Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
command.setData(wrapMap(command.getData(), marshalledValues, ctx));
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -82,7 +84,7 @@
command.setValue(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -109,7 +111,7 @@
command.setKey(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -136,10 +138,10 @@
command.setKey(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
- private Object compactAndProcessRetVal(ReplicableCommand command, Set<MarshalledValue> marshalledValues, Object retVal)
+ private Object compactAndProcessRetVal(Set<MarshalledValue> marshalledValues, Object retVal)
throws IOException, ClassNotFoundException
{
if (trace) log.trace("Compacting MarshalledValues created");
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -259,17 +259,14 @@
}
}
- if (!suppressNotification)
+ if (!suppressNotification && nodesCreated.size() > 0)
{
- if (nodesCreated.size() > 0)
+ Notifier n = cache.getNotifier();
+ for (Fqn temp : nodesCreated)
{
- Notifier n = cache.getNotifier();
- for (Fqn temp : nodesCreated)
- {
- n.notifyNodeCreated(temp, true, ctx);
- n.notifyNodeCreated(temp, false, ctx);
- if (trace) log.trace("Notifying cache of node created in workspace " + temp);
- }
+ n.notifyNodeCreated(temp, true, ctx);
+ n.notifyNodeCreated(temp, false, ctx);
+ if (trace) log.trace("Notifying cache of node created in workspace " + temp);
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -30,14 +30,11 @@
*/
public class OptimisticLockingInterceptor extends OptimisticInterceptor
{
- private long lockAcquisitionTimeout;
-
@Start
private void init()
{
if (txManager == null)
log.fatal("No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used! Expect errors!!");
- lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
}
@Override
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -27,7 +27,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.notifications.Notifier;
@@ -345,7 +344,6 @@
*/
private void addToModificationList(ReversibleCommand command, InvocationContext ctx)
{
- Option opt = ctx.getOptionOverrides();
ctx.getTransactionEntry().addModification(command);
if (log.isDebugEnabled()) log.debug("Adding command " + command + " to modification list");
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -14,7 +14,14 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
/**
* This interceptor will call {@link #skipInterception(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} before invoking each visit method
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,6 +1,17 @@
package org.jboss.cache.invocation;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.Version;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -568,12 +579,9 @@
protected void cacheStatusCheck(InvocationContext ctx)
{
assertIsConstructed();
- if (!ctx.getOptionOverrides().isSkipCacheStatusCheck())
+ if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() && !componentRegistry.invocationsAllowed(true))
{
- if (!componentRegistry.invocationsAllowed(true))
- {
- throw new IllegalStateException("Cache not in STARTED state!");
- }
+ throw new IllegalStateException("Cache not in STARTED state!");
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -99,16 +99,10 @@
String serviceName = cacheObjectName + INTERCEPTOR_KEY + className.substring(className.lastIndexOf('.') + 1);
ObjectName objName = new ObjectName(serviceName);
- if (!server.isRegistered(objName))
+ if (mbeanExists && !server.isRegistered(objName))
{
- if (mbeanExists)
// register associated interceptor mbean
- {
- server.registerMBean(interceptor, objName);
- }
- //else
- // register dummy interceptor mbean
- // server.registerMBean(new BaseInterceptor(), objName);
+ server.registerMBean(interceptor, objName);
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -56,7 +56,6 @@
*/
protected Map<Object, List<Modification>> transactions = new ConcurrentHashMap<Object, List<Modification>>();
-
public void put(Fqn fqn, Map<Object, Object> attributes, boolean erase) throws Exception
{
if (erase)
@@ -83,8 +82,6 @@
boolean moveToBuddy = subtree.isChildOf(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN) && subtree.size() > 1;
// store new state
- Fqn fqn;
- //NodeData nd = null;
Object objectFromStream = cache.getMarshaller().objectFromObjectStream(in);
if (objectFromStream instanceof NodeDataMarker)
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,6 +2,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -49,6 +50,7 @@
protected String driverName;
private AdjListJDBCCacheLoaderConfig config;
protected StripedLock lock = new StripedLock();
+ protected static Log log = LogFactory.getLog(AdjListJDBCCacheLoader.class);
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
{
@@ -60,14 +62,14 @@
{
/* Instantiate an standalone connection factory as per configuration, either explicitly
defined or the default one */
- getLogger().debug("Initialising with a connection factory since data source is not provided.");
- if (getLogger().isDebugEnabled())
- getLogger().debug("Using connection factory " + config.getConnectionFactoryClass());
+ log.debug("Initialising with a connection factory since data source is not provided.");
+ if (log.isDebugEnabled())
+ log.debug("Using connection factory " + config.getConnectionFactoryClass());
cf = (ConnectionFactory) Util.loadClass(config.getConnectionFactoryClass()).newInstance();
}
catch (Exception e)
{
- getLogger().error("Connection factory class could not be loaded", e);
+ log.error("Connection factory class could not be loaded", e);
throw new IllegalStateException("Connection factory class could not be loaded", e);
}
}
@@ -118,9 +120,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getSelectChildNamesSql() + " (" + fqn + ")");
+ log.debug("executing sql: " + config.getSelectChildNamesSql() + " (" + fqn + ")");
}
con = cf.getConnection();
@@ -226,17 +228,14 @@
{
con = cf.getConnection();
driverName = getDriverName(con);
- if (config.getCreateTable())
+ if (config.getCreateTable() && !tableExists(config.getTable(), con))
{
- if (!tableExists(config.getTable(), con))
+ if (log.isDebugEnabled())
{
- if (getLogger().isDebugEnabled())
- {
- getLogger().debug("executing ddl: " + config.getCreateTableDDL());
- }
- st = con.createStatement();
- st.executeUpdate(config.getCreateTableDDL());
+ log.debug("executing ddl: " + config.getCreateTableDDL());
}
+ st = con.createStatement();
+ st.executeUpdate(config.getCreateTableDDL());
}
}
finally
@@ -255,9 +254,9 @@
Statement st = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing ddl: " + config.getDropTableDDL());
+ log.debug("executing ddl: " + config.getDropTableDDL());
}
con = cf.getConnection();
@@ -267,7 +266,7 @@
}
catch (SQLException e)
{
- getLogger().error("Failed to drop table: " + e.getMessage(), e);
+ log.error("Failed to drop table: " + e.getMessage(), e);
}
finally
{
@@ -352,9 +351,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getSelectNodeSql() + " (" + name + ")");
+ log.debug("executing sql: " + config.getSelectNodeSql() + " (" + name + ")");
}
con = cf.getConnection();
@@ -412,9 +411,9 @@
PreparedStatement ps = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getInsertNodeSql() + " (" + name + ")");
+ log.debug("executing sql: " + config.getInsertNodeSql() + " (" + name + ")");
}
con = cf.getConnection();
@@ -468,7 +467,7 @@
}
catch (Exception e)
{
- getLogger().error("Failed to insert node :" + e.getMessage());
+ log.error("Failed to insert node :" + e.getMessage());
throw new IllegalStateException("Failed to insert node: " + e.getMessage(), e);
}
finally
@@ -491,9 +490,9 @@
PreparedStatement ps = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getUpdateNodeSql());
+ log.debug("executing sql: " + config.getUpdateNodeSql());
}
con = cf.getConnection();
@@ -624,14 +623,11 @@
}
}
-
- protected abstract Log getLogger();
-
protected abstract AdjListJDBCCacheLoaderConfig processConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base);
protected void reportAndRethrowError(String message, Exception cause) throws IllegalStateException
{
- getLogger().error(message, cause);
+ log.error(message, cause);
throw new IllegalStateException(message, cause);
}
@@ -645,7 +641,7 @@
}
catch (IOException e)
{
- getLogger().warn("Failed to close input stream: " + e.getMessage());
+ log.warn("Failed to close input stream: " + e.getMessage());
}
}
}
@@ -660,7 +656,7 @@
}
catch (SQLException e)
{
- getLogger().warn("Failed to close statement: " + e.getMessage());
+ log.warn("Failed to close statement: " + e.getMessage());
}
}
}
@@ -675,7 +671,7 @@
}
catch (SQLException e)
{
- getLogger().warn("Failed to close result set: " + e.getMessage());
+ log.warn("Failed to close result set: " + e.getMessage());
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -53,7 +53,7 @@
{
File root = null;
String rootPath = null;
- Log log = LogFactory.getLog(getClass());
+ private static final Log log = LogFactory.getLog(FileCacheLoader.class);
protected final StripedLock lock = new StripedLock();
@@ -82,14 +82,14 @@
static
{
- float osVersion = -1;
+ float osVersion;
try
{
osVersion = Float.parseFloat(System.getProperty("os.version").trim());
}
catch (Exception e)
{
- // ignore
+ osVersion = -1;
}
// 4.x is windows NT/2000 and 5.x is XP.
isOldWindows = System.getProperty("os.name").toLowerCase().startsWith("windows") && osVersion < 4;
@@ -390,16 +390,13 @@
}
}
- if (include_start_dir)
+ if (include_start_dir && !dir.equals(root))
{
- if (!dir.equals(root))
+ if (dir.delete())
{
- if (dir.delete())
- {
- return success;
- }
- success = false;
+ return success;
}
+ success = false;
}
return success;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,7 +1,6 @@
package org.jboss.cache.loader;
import net.jcip.annotations.ThreadSafe;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -37,8 +36,6 @@
@ThreadSafe
public class JDBCCacheLoader extends AdjListJDBCCacheLoader
{
- private static final Log log = LogFactory.getLog(JDBCCacheLoader.class);
-
private JDBCCacheLoaderConfig config;
/**
@@ -123,9 +120,9 @@
ps.setString(1, fqn.isRoot() ? fqn.toString() : fqn + Fqn.SEPARATOR);
lock.acquireLock(fqn, true);
ps.executeUpdate();
- if (getLogger().isTraceEnabled())
+ if (log.isTraceEnabled())
{
- getLogger().trace("Deleting all the children of " + fqn + ". Used sql is'" + config.getDeleteNodeSql() + '\'');
+ log.trace("Deleting all the children of " + fqn + ". Used sql is'" + config.getDeleteNodeSql() + '\'');
}
}
catch (SQLException e)
@@ -260,14 +257,6 @@
while (!exists(currentNode));
}
-
- @Override
- protected Log getLogger()
- {
- return log;
- }
-
-
/**
* Start is overwritten for the sake of backward compatibility only.
* Here is the issue: old implementation does not create a Fqn.ROOT if not specifically told so.
@@ -279,6 +268,7 @@
@Override
public void start() throws Exception
{
+ log = LogFactory.getLog(getClass());
super.start();
if (!exists(Fqn.ROOT) && getNodeCount() > 0)
{
@@ -296,9 +286,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getNodeCountSql());
+ log.debug("executing sql: " + config.getNodeCountSql());
}
conn = cf.getConnection();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.loader;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
@@ -68,10 +67,12 @@
@SuppressWarnings("deprecation")
public class JDBCCacheLoaderOld extends AdjListJDBCCacheLoader
{
- private static final Log log = LogFactory.getLog(JDBCCacheLoaderOld.class);
-
private JDBCCacheLoaderOldConfig config;
+ public JDBCCacheLoaderOld()
+ {
+ log = LogFactory.getLog(getClass());
+ }
@Override
public AdjListJDBCCacheLoaderConfig processConfig(IndividualCacheLoaderConfig base)
@@ -323,12 +324,4 @@
insertNode(name, attrs);
}
}
-
-
- @Override
- protected Log getLogger()
- {
- return log;
- }
-
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -3,8 +3,6 @@
import org.jboss.cache.Cache;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import java.util.Properties;
-
public class LocalDelegatingCacheLoaderConfig extends IndividualCacheLoaderConfig
{
private static final long serialVersionUID = 4626734068542420865L;
@@ -28,12 +26,6 @@
}
@Override
- public void setProperties(Properties props)
- {
- super.setProperties(props);
- }
-
- @Override
public boolean equals(Object obj)
{
return obj instanceof LocalDelegatingCacheLoaderConfig && equalsExcludingProperties(obj) && delegate == ((LocalDelegatingCacheLoaderConfig) obj).delegate;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -2,7 +2,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
@@ -130,23 +129,11 @@
}
}
- /**
- * Sets the cache loader's CacheSPI reference and also adds a listener to the cache that reacts to cluster topology
- * changes.
- *
- * @param c instance of CacheSPI
- */
@Override
- public void setCache(CacheSPI c)
- {
- super.setCache(c);
- }
-
- @Override
public void create() throws Exception
{
super.create();
-
+
cache.addCacheListener(new SingletonStoreListener());
}
@@ -357,13 +344,10 @@
if (newView != null && localAddress != null)
{
Vector mbrs = newView.getMembers();
- if (mbrs != null)
+ if (mbrs != null && mbrs.size() > 0 && localAddress.equals(mbrs.firstElement()))
{
- if (mbrs.size() > 0 && localAddress.equals(mbrs.firstElement()))
- {
- /* This node is the coordinator */
- return true;
- }
+ /* This node is the coordinator */
+ return true;
}
return false;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -137,7 +137,8 @@
throw new CacheException("Problems invoking method call!", e);
}
}
- } while (System.currentTimeMillis() < endTime);
+ }
+ while (System.currentTimeMillis() < endTime);
throw new CacheException("Unable to communicate with TCPCacheServer(" + config.getHost() + ":" + config.getPort() + ") after " + config.getTimeout() + " millis, with reconnects every " + config.getReconnectWaitTime() + " millis.");
}
@@ -384,6 +385,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream.", e);
}
try
{
@@ -391,6 +393,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream.", e);
}
try
{
@@ -398,6 +401,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close socket.", e);
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -490,13 +490,11 @@
{
TupleBrowser browser = tree.browse(name);
Tuple t = new Tuple();
- if (browser.getNext(t))
+ if (browser.getNext(t) && self)
{
- if (self)
- {
- tree.remove(t.getKey());
- }
+ tree.remove(t.getKey());
}
+
while (browser.getNext(t))
{
Fqn fqn = (Fqn) t.getKey();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -198,7 +198,7 @@
}
catch (IOException e)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close server socket", e);
}
}
}
@@ -265,7 +265,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream", th);
}
try
{
@@ -273,7 +273,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream", th);
}
try
{
@@ -281,7 +281,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close socket", th);
}
// remove self from connections list
@@ -296,7 +296,7 @@
NodeSPI n;
boolean flag;
- while (t != null && Thread.currentThread().equals(t))
+ while (t != null && t.equals(Thread.currentThread()))
{
try
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -3,6 +3,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import java.util.List;
@@ -104,7 +105,7 @@
}
catch (IllegalMonitorStateException imse)
{
- // perhaps the RL was already released earlier?
+ throw new CacheException("Lock is held by a different thread! Cannot be unlocked by current thread.", imse);
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -45,10 +45,4 @@
{
super(msg, cause);
}
-
- @Override
- public String toString()
- {
- return super.toString();
- }
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -17,7 +17,6 @@
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.LinkedList;
import java.util.List;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -369,13 +369,10 @@
Object name = internalFqn.get(parent.getFqn().size());
cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
Node result = parent.getChild(name);
- if (result != null)
+ if (result != null && internalFqn.size() < result.getFqn().size())
{
- if (internalFqn.size() < result.getFqn().size())
- {
- // need to recursively walk down the tree
- result = getInternalNode(result, internalFqn);
- }
+ // need to recursively walk down the tree
+ result = getInternalNode(result, internalFqn);
}
return result;
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -6,6 +6,8 @@
*/
package org.jboss.cache.statetransfer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Version;
@@ -23,6 +25,7 @@
public abstract class StateTransferFactory
{
private static final short RV_200 = Version.getVersionShort("2.0.0");
+ private static final Log log = LogFactory.getLog(StateTransferFactory.class);
/**
* Gets the StateTransferGenerator able to handle the given cache instance.
@@ -58,8 +61,9 @@
{
in.close();
}
- catch (IOException ignored)
+ catch (IOException e)
{
+ if (log.isWarnEnabled()) log.warn("Unable to close stream!", e);
}
throw new IllegalStateException("Stream corrupted ", io);
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,21 +1,12 @@
package org.jboss.cache.transaction;
import javax.naming.Binding;
-import javax.naming.CompoundName;
import javax.naming.Context;
-import javax.naming.ContextNotEmptyException;
import javax.naming.Name;
-import javax.naming.NameAlreadyBoundException;
import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InvalidAttributesException;
import java.util.HashMap;
import java.util.Hashtable;
@@ -73,7 +64,7 @@
* @see #bind(String,Object)
* @see #rebind(Name,Object)
* @see DirContext#bind(Name,Object,
- *Attributes)
+ * Attributes)
*/
public void bind(Name name, Object obj) throws NamingException
{
@@ -111,7 +102,7 @@
* @see #rebind(String,Object)
* @see #bind(Name,Object)
* @see DirContext#rebind(Name,Object,
- *Attributes)
+ * Attributes)
* @see DirContext
*/
public void rebind(Name name, Object obj) throws NamingException
@@ -480,7 +471,7 @@
* @throws NamingException if a naming exception is encountered
*/
public String composeName(String name, String prefix)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -499,7 +490,7 @@
* @see #removeFromEnvironment(String)
*/
public Object addToEnvironment(String propName, Object propVal)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -517,7 +508,7 @@
* @see #addToEnvironment(String,Object)
*/
public Object removeFromEnvironment(String propName)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -536,7 +527,7 @@
* @see #addToEnvironment(String,Object)
* @see #removeFromEnvironment(String)
*/
- public Hashtable<?,?> getEnvironment() throws NamingException
+ public Hashtable<?, ?> getEnvironment() throws NamingException
{
return null;
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -51,8 +51,8 @@
* transaction.
*/
public void commit()
- throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
- SecurityException, SystemException
+ throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
+ SecurityException, SystemException
{
boolean doCommit;
status = Status.STATUS_PREPARING;
@@ -104,6 +104,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
status = Status.STATUS_ROLLEDBACK;
@@ -167,7 +168,7 @@
* unexpected way.
*/
public boolean enlistResource(XAResource xaRes)
- throws RollbackException, IllegalStateException, SystemException
+ throws RollbackException, IllegalStateException, SystemException
{
throw new SystemException("not supported");
}
@@ -184,7 +185,7 @@
* unexpected way.
*/
public boolean delistResource(XAResource xaRes, int flag)
- throws IllegalStateException, SystemException
+ throws IllegalStateException, SystemException
{
throw new SystemException("not supported");
}
@@ -203,7 +204,7 @@
* unexpected way.
*/
public void registerSynchronization(Synchronization sync)
- throws RollbackException, IllegalStateException, SystemException
+ throws RollbackException, IllegalStateException, SystemException
{
if (sync == null)
throw new IllegalArgumentException("null synchronization " + this);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -269,6 +269,7 @@
}
catch (SystemException e)
{
+ // do nothing
}
// JBCACHE-982 -- don't complain if COMMITTED
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -404,14 +404,11 @@
public static boolean readBooleanAttribute(Element elem, String elementName, String attributeName, boolean defaultValue)
{
String val = getAttributeValue(elem, elementName, attributeName);
- if (val != null)
+ if (val != null && (val.equalsIgnoreCase("true") || val.equalsIgnoreCase("false")))
{
- if (val.equalsIgnoreCase("true") || val.equalsIgnoreCase("false"))
- {
- //return Boolean.parseBoolean(val);
- // needs to be done this way because of JBBUILD-351
- return Boolean.valueOf(val);
- }
+ //return Boolean.parseBoolean(val);
+ // needs to be done this way because of JBBUILD-351
+ return Boolean.valueOf(val);
}
return defaultValue;
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,16 +1,14 @@
package org.jboss.cache.commands;
-import org.testng.annotations.Test;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
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.factories.UnitTestCacheConfigurationFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import java.util.HashMap;
/**
* @author Mircea.Markus(a)jboss.com
@@ -64,7 +62,7 @@
public void testRemoveKeyCommand() throws Exception
{
txMgr.begin();
- cache.remove("/blah/blah","key");
+ cache.remove("/blah/blah", "key");
txMgr.rollback();
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,13 +1,12 @@
package org.jboss.cache.commands;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
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.factories.UnitTestCacheConfigurationFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
import java.util.HashMap;
@@ -43,23 +42,23 @@
public void testPutDataMap() throws Exception
{
HashMap map = new HashMap();
- map.put("k","v");
+ map.put("k", "v");
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
txMgr.begin();
cache.put("/a/b/c", map);
- assert cache.exists("/a/b");
+ assert cache.exists("/a/b");
txMgr.rollback();
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
}
-
+
public void testPutKeyValueCommand() throws Exception
{
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
txMgr.begin();
cache.put("/a/b/c", "key", "value");
- assert cache.exists("/a/b");
+ assert cache.exists("/a/b");
txMgr.rollback();
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
}
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,10 +1,10 @@
package org.jboss.cache.commands.read;
-import static org.easymock.EasyMock.*;
-
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.mock.NodeSpiMock;
import org.testng.annotations.Test;
-import org.jboss.cache.mock.NodeSpiMock;
-import org.jboss.cache.mock.MockNodesFixture;
import java.util.Set;
@@ -14,7 +14,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test (groups="unit")
+@Test(groups = "unit")
public class GetChildrenNamesCommandTest extends AbstractDataCommandTest
{
private GetChildrenNamesCommand command;
@@ -35,7 +35,7 @@
Set result = (Set) command.perform(null);
assert result.isEmpty() : "empty result expected";
}
-
+
public void testPerformInexistingNode()
{
expect(container.peek(testFqn)).andReturn(null);
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,8 +1,9 @@
package org.jboss.cache.commands.read;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import org.jboss.cache.mock.NodeSpiMock;
import org.testng.annotations.Test;
-import static org.easymock.EasyMock.*;
-import org.jboss.cache.mock.NodeSpiMock;
import java.util.Map;
@@ -33,8 +34,8 @@
public void testForExistingNode()
{
NodeSpiMock node = new NodeSpiMock(testFqn);
- node.putDirect("k1","v1");
- node.putDirect("k2","v2");
+ node.putDirect("k1", "v1");
+ node.putDirect("k2", "v2");
expect(container.peek(testFqn)).andReturn(node);
replay(container);
Map result = (Map) command.perform(null);
@@ -46,7 +47,8 @@
{
result.put("k3", "v3");
assert false : "map should be immutable";
- } catch (RuntimeException ex)
+ }
+ catch (RuntimeException ex)
{
//expected
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,13 +1,14 @@
package org.jboss.cache.commands.read;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import static org.easymock.EasyMock.*;
-import org.easymock.*;
-import org.jboss.cache.notifications.Notifier;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.mock.NodeSpiMock;
+import org.jboss.cache.notifications.Notifier;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
/**
* Tester class for {@link GetKeyValueCommand}.
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.read;
-import org.testng.annotations.Test;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import org.jboss.cache.mock.NodeSpiMock;
+import org.testng.annotations.Test;
import java.util.Set;
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,11 +1,16 @@
package org.jboss.cache.commands.read;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.mock.NodeSpiMock;
import org.jgroups.stack.IpAddress;
@@ -21,7 +26,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test(groups="unit")
+@Test(groups = "unit")
public class GravitateDataCommandTest
{
GravitateDataCommand command;
@@ -81,7 +86,7 @@
control.replay();
GravitateResult result = (GravitateResult) command.perform(ctx);
- assert result.getNodeData()== listReference;
+ assert result.getNodeData() == listReference;
control.verify();
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.testng.annotations.Test;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import java.util.Collections;
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test (groups = "unit")
+@Test(groups = "unit")
public class ClearDataCommandTest extends AbstractVersionedDataCommandTest
{
@@ -63,9 +63,10 @@
try
{
command.rollback();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
- assert false : "should not fail but expect this scenarion";
+ assert false : "should not fail but expect this scenarion";
}
}
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,10 +1,9 @@
package org.jboss.cache.commands.write;
import static org.easymock.EasyMock.*;
-
-import org.testng.annotations.Test;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
import org.jboss.cache.mock.MockNodesFixture;
+import org.testng.annotations.Test;
import java.util.ArrayList;
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,15 +1,15 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
-import org.easymock.IMocksControl;
-import static org.easymock.EasyMock.createStrictControl;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.notifications.Notifier;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
@@ -67,7 +67,7 @@
public void testRootNodeInvalidation()
{
command.setFqn(Fqn.ROOT);
- nodes.adfgNode.put("key","value");
+ nodes.adfgNode.put("key", "value");
expect(spiMock.getNode(Fqn.ROOT)).andReturn(nodes.root);
notifier.notifyNodeEvicted(Fqn.ROOT, true, ctx);
expect(container.evict(Fqn.ROOT)).andReturn(Boolean.TRUE);
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,14 +1,14 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
-import org.jboss.cache.commands.read.AbstractDataCommandTest;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeNotExistsException;
-import org.easymock.IMocksControl;
-import static org.easymock.EasyMock.createStrictControl;
+import org.jboss.cache.commands.read.AbstractDataCommandTest;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.notifications.Notifier;
import org.testng.annotations.Test;
/**
@@ -48,7 +48,8 @@
{
command.perform(ctx);
assert false : "should have thrown an exception as the source is null";
- } catch (NodeNotExistsException e)
+ }
+ catch (NodeNotExistsException e)
{
//expected
}
@@ -64,7 +65,8 @@
{
command.perform(ctx);
assert false : "should have thrown an exception as the source is null";
- } catch (NodeNotExistsException e)
+ }
+ catch (NodeNotExistsException e)
{
//expected
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,18 +1,19 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.optimistic.DefaultDataVersion;
import org.testng.annotations.Test;
+import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import javax.transaction.Transaction;
import java.util.Collections;
/**
@@ -82,7 +83,8 @@
{
command.perform(ctx);
assert false : "exception expected";
- } catch (Exception e)
+ }
+ catch (Exception e)
{
//expected as there is a version mismatch
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,18 +1,19 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.mock.NodeSpiMock;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.mock.NodeSpiMock;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* Tester class for {@link PutDataMapCommand}
@@ -45,7 +46,7 @@
container = control.createMock(DataContainer.class);
command.initialize(notifier, container);
node = new NodeSpiMock(testFqn);
- node.put("k","v");
+ node.put("k", "v");
}
public void testAddDataNoErase()
@@ -58,15 +59,15 @@
notifier.notifyNodeModified(testFqn, true, NodeModifiedEvent.ModificationType.PUT_MAP, node.getData(), null);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(testFqn, false, NodeModifiedEvent.ModificationType.PUT_MAP, expected, null);
-
+
control.replay();
assert null == command.perform(null) : "null result is always expected";
assert command.getOldData().size() == 1;
assert command.getOldData().get("k").equals("v");
control.verify();
}
-
+
public void testRollbackNonexistentNode()
{
expect(container.peek(testFqn, false, true)).andReturn(null);
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,12 +1,12 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
+import static org.easymock.EasyMock.expect;
import org.jboss.cache.CacheException;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.testng.annotations.Test;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* tester class for {@link PutKeyValueCommand}.
@@ -33,7 +33,8 @@
{
command.perform(ctx);
assert false : "exception should have been thrown as data does not exists.";
- } catch (Exception e)
+ }
+ catch (Exception e)
{
//expected
}
@@ -88,6 +89,6 @@
command.rollback();
assert nodes.adfNode.getData().size() == 1;
assert "oldValue".equals(nodes.adfNode.getData().get("k"));
- control.verify();
+ control.verify();
}
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,12 +1,11 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.testng.annotations.Test;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* tester class for {@link RemoveKeyCommand}.
@@ -14,7 +13,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test(groups="unit")
+@Test(groups = "unit")
public class RemoveKeyCommandTest extends AbstractVersionedDataCommandTest
{
RemoveKeyCommand command;
@@ -38,13 +37,13 @@
public void testRemoveNonexistentPair()
{
Map expected = new HashMap();
- expected.put("newKey","newValue");
+ expected.put("newKey", "newValue");
nodes.adfgNode.putAll(expected);
expect(container.peek(fqn, false, false)).andReturn(nodes.adfgNode);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(fqn, true, NodeModifiedEvent.ModificationType.REMOVE_DATA, expected, ctx);
expected = new HashMap();
- expected.put(key,null);
+ expected.put(key, null);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(fqn, false, NodeModifiedEvent.ModificationType.REMOVE_DATA, expected, ctx);
control.replay();
@@ -65,7 +64,7 @@
public void testRemoveExistentPair()
{
Map expected = new HashMap();
- expected.put(key,"newValue");
+ expected.put(key, "newValue");
nodes.adfgNode.putAll(expected);
expect(container.peek(fqn, false, false)).andReturn(nodes.adfgNode);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
@@ -97,7 +96,8 @@
try
{
command.rollback();
- } catch (Exception ex)
+ }
+ catch (Exception ex)
{
assert false : "No exception should be thrown here.";
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-29 23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-30 11:58:59 UTC (rev 6120)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.transaction.GlobalTransaction;
import org.testng.annotations.Test;
-import org.jboss.cache.transaction.GlobalTransaction;
/**
* tester for {@link RemoveNodeCommand}.
@@ -33,7 +33,7 @@
{
//aditional setup
command.setSkipSendingNodeEvents(true); //no notification
- nodes.adfNode.put("akey","avalue");
+ nodes.adfNode.put("akey", "avalue");
ctx.setGlobalTransaction(new GlobalTransaction());
//check perform
@@ -53,11 +53,12 @@
command.rollback();
assert nodes.adNode.hasChild("f");
}
+
public void testRemovalNoNotificationsInvalidNode()
{
command.setSkipSendingNodeEvents(true); //no notification
nodes.adfNode.setValid(false, false); //invalid node
-
+
expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(nodes.adfNode);
control.replay();
assert Boolean.FALSE == command.perform(ctx);
@@ -65,7 +66,7 @@
assert nodes.adfhNode.isDeleted();
control.verify();
}
-
+
public void testRemovalWithNotificationsInvalidNode()
{
nodes.adfNode.setValid(false, false); //invalid node
16 years, 6 months
JBoss Cache SVN: r6119 - in searchable/trunk/src: test/java/org/jboss/cache/search and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-29 19:29:19 -0400 (Sun, 29 Jun 2008)
New Revision: 6119
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java
Log:
Javadocced stuff
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-29 22:32:02 UTC (rev 6118)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-29 23:29:19 UTC (rev 6119)
@@ -99,7 +99,6 @@
{
return index == idList.size() - 1;
- //TODO: Why does this method work but " return idList.get(index) == idList.size() -1); " doesn't ?
}
/**
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-29 22:32:02 UTC (rev 6118)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-29 23:29:19 UTC (rev 6119)
@@ -26,6 +26,9 @@
{
// this is the ACTUAL cache. that does all the work.
private Cache<K, V> cache;
+
+ //TODO: Will this barf because of searchFactory being null or does it not matter to us?
+
private SearchFactoryImpl searchFactory;
//TODO: javadoc!!
@@ -35,222 +38,487 @@
this.searchFactory = searchFactory;
}
+ /**
+ * Creates a CacheQuery object from a given Lucene Query.
+ *
+ * @param luceneQuery
+ * @return CacheQuery object
+ */
+
public CacheQuery createQuery(Query luceneQuery)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache);
}
+ /**
+ * Creates a CacheQuery object from a Lucene Query and a class array.
+ *
+ * @param luceneQuery
+ * @param classes
+ * @return CacheQuery object.
+ */
+
+
public CacheQuery createQuery(Query luceneQuery, Class... classes)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache, classes);
}
+ /**
+ * Returns an org.jboss.cache.config.Configuration instance.
+ *
+ * @return org.jboss.cache.config.Configuration
+ */
+
public Configuration getConfiguration()
{
return cache.getConfiguration();
}
+ /**
+ * Returns an org.jboss.cache.Node instance.
+ *
+ * @return org.jboss.cache.Node<K,V>
+ */
+
public Node getRoot()
{
return cache.getRoot();
}
+ /**
+ * Adds a listener to the cache.
+ *
+ * @param listener
+ */
+
+ //TODO: Does this have to be a CacheListener?
public void addCacheListener(Object listener)
{
cache.addCacheListener(listener);
}
- public void addCacheListener(Fqn<?> fqn, Object o)
- {
- cache.addCacheListener(fqn, o);
- }
+ /**
+ * Removes a listener from the cache.
+ *
+ * @param listener
+ */
+
public void removeCacheListener(Object listener)
{
cache.removeCacheListener(listener);
}
- public void removeCacheListener(Fqn<?> fqn, Object o)
- {
- cache.removeCacheListener(fqn, o);
- }
+ /**
+ * Returns a set of listeners that the cache has.
+ *
+ * @return A set of listeners.
+ */
public Set getCacheListeners()
{
return cache.getCacheListeners();
}
- public Set<Object> getCacheListeners(Fqn<?> fqn)
- {
- return cache.getCacheListeners(fqn);
- }
+ /**
+ * Puts something into the cache with a given Fqn, key and value.
+ *
+ * @param fqn
+ * @param key
+ * @param value
+ * @return
+ */
+
public V put(String fqn, K key, V value)
{
return cache.put(fqn, key, value);
}
+ /**
+ * Puts something into the cache with a given Fqn and Map instance.
+ *
+ * @param fqn
+ * @param data
+ */
+
+
public void put(String fqn, Map<K, V> data)
{
cache.put(fqn, data);
}
+ /**
+ * Removes something from the cache with a given Fqn and key.
+ *
+ * @param fqn
+ * @param key
+ * @return
+ */
+
+
public V remove(String fqn, K key)
{
return cache.remove(fqn, key);
}
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to removeNode(Fqn)
+ *
+ * @param fqn
+ * @return True if the node was removed, false if the node wasn't
+ */
+
public boolean removeNode(String fqn)
{
return cache.removeNode(fqn);
}
+ /**
+ * Gets a node from a String representation of a Fqn
+ *
+ * @param fqn
+ * @return
+ */
+
public Node getNode(String fqn)
{
return cache.getNode(fqn);
}
+ /**
+ * Convenience method that allows for direct access to the data in a Node.
+ *
+ * @param fqn
+ * @param key
+ * @return
+ */
public V get(String fqn, K key)
{
return cache.get(fqn, key);
}
+ /**
+ * Lifecycle method that initializes configuration state, the root node, etc.
+ *
+ * @throws CacheException
+ */
+
public void create() throws CacheException
{
cache.create();
}
+ /**
+ * Lifecycle method that starts the cache loader, starts cache replication,
+ * starts the region manager, etc., and (if configured) warms the cache using a
+ * state transfer or cache loader preload.
+ *
+ * @throws CacheException
+ */
+
public void start() throws CacheException
{
cache.start();
}
+ /**
+ * Lifecycle method that stops the cache, including replication, clustering, cache loading, notifications, etc.,
+ * and clears all cache in-memory state.
+ */
+
public void stop()
{
cache.stop();
}
+ /**
+ * Lifecycle method that destroys the cache and removes any interceptors/configuration elements.
+ */
+
public void destroy()
{
cache.destroy();
}
+ /**
+ * Gets where the cache currently is its lifecycle transitions.
+ * @return the CacheStatus. Will not return null.
+ */
+
public CacheStatus getCacheStatus()
{
return cache.getCacheStatus();
}
+ /**
+ * The current invocation context for the current invocation and cache instance.
+ *
+ * @return the current invocation context for the current invocation and cache instance
+ */
public InvocationContext getInvocationContext()
{
return cache.getInvocationContext();
}
+ /**
+ * Sets the passed in InvocationContext as current.
+ *
+ * @param ctx
+ */
+
public void setInvocationContext(InvocationContext ctx)
{
cache.setInvocationContext(ctx);
}
+ /**
+ * Returns the local address of this cache in a cluster, or null if running in local mode.
+ *
+ * @return Returns the local address of this cache in a cluster, or null if running in local mode.
+ */
public Address getLocalAddress()
{
return cache.getLocalAddress();
}
+ /**
+ * Returns a list of members in the cluster, or null if running in local mode.
+ *
+ * @return Returns a list of members in the cluster, or null if running in local mode.
+ */
+
+
public List getMembers()
{
return cache.getMembers();
}
+ /**
+ * Moves a part of the cache to a different subtree. Takes Strings for convenience.
+ *
+ * @param nodeToMove
+ * @param newParent
+ * @throws NodeNotExistsException
+ */
public void move(String nodeToMove, String newParent) throws NodeNotExistsException
{
cache.move(nodeToMove, newParent);
}
+ /**
+ * Returns the version of the cache as a string.
+ *
+ * @return Returns the version of the cache as a string.
+ */
public String getVersion()
{
return cache.getVersion();
}
+ /**
+ * Returns a set of attribute keys for the Fqn. Takes Strings for convenience.
+ *
+ * @param fqn
+ * @return Returns a set of attribute keys for the Fqn.
+ */
+
public Set<K> getKeys(String fqn)
{
return cache.getKeys(fqn);
}
+ /**
+ * Removes the keys and properties from a named node. Takes Strings for convenience.
+ *
+ * @param fqn
+ */
+
public void clearData(String fqn)
{
cache.clearData(fqn);
}
+ /**
+ * Removes the keys and properties from a named node.
+ * @param fqn
+ */
+
public void clearData(Fqn<?> fqn)
{
cache.clearData(fqn);
}
+ /**
+ * Returns a set of attribute keys for the Fqn.
+ *
+ * @param fqn
+ * @return
+ */
public Set getKeys(Fqn<?> fqn)
{
return cache.getKeys(fqn);
}
+ /**
+ * Retrieves a defensively copied data map of the underlying node.
+ *
+ * @param fqn
+ * @return a defensively copied data map of the underlying node.
+ */
public Map getData(Fqn<?> fqn)
{
return cache.getData(fqn);
}
+ /**
+ * Moves a part of the cache to a different subtree.
+ *
+ * @param nodeToMove
+ * @param newParent
+ * @throws NodeNotExistsException
+ */
public void move(Fqn<?> nodeToMove, Fqn<?> newParent) throws NodeNotExistsException
{
cache.move(nodeToMove, newParent);
}
+ /**
+ * Removes a region denoted by the Fqn passed in.
+ *
+ * @param fqn
+ * @return True if the region did exist and was removed, false otherwise.
+ */
+
public boolean removeRegion(Fqn<?> fqn)
{
return cache.removeRegion(fqn);
}
+ /**
+ * Retrieves a Region for a given Fqn.
+ *
+ * @param fqn
+ * @param createIfAbsent
+ * @return a MarshRegion. Null if none is found.
+ */
public Region getRegion(Fqn<?> fqn, boolean createIfAbsent)
{
return cache.getRegion(fqn, createIfAbsent);
}
+ /**
+ * Eviction call that evicts the specified Node from memory.
+ *
+ * @param fqn
+ */
+
public void evict(Fqn<?> fqn)
{
cache.evict(fqn);
}
+ /**
+ * Eviction call that evicts the specified Node from memory.
+ *
+ * @param fqn
+ * @param recursive
+ */
+
+
public void evict(Fqn<?> fqn, boolean recursive)
{
cache.evict(fqn, recursive);
}
+ /**
+ * Convenience method that allows for direct access to the data in a Node.
+ *
+ * @param fqn
+ * @param key
+ * @return
+ */
+
+
public V get(Fqn<?> fqn, K key)
{
return cache.get(fqn, key);
}
+ /**
+ * A convenience method to retrieve a node directly from the cache.
+ *
+ * @param fqn
+ * @return
+ */
+
public Node getNode(Fqn<?> fqn)
{
return cache.getNode(fqn);
}
+ /**
+ * Removes a Node indicated by absolute Fqn.
+ *
+ * @param fqn
+ * @return True if the node was removed, false if the node was not found.
+ */
public boolean removeNode(Fqn<?> fqn)
{
return cache.removeNode(fqn);
}
+ /**
+ * Moves a part of the cache to a different subtree.
+ *
+ * @param fqn
+ * @param key
+ * @return
+ */
public V remove(Fqn<?> fqn, K key)
{
return cache.remove(fqn, key);
}
+ /**
+ * Copies all of the mappings from the specified map to a Node.
+ *
+ * @param fqn
+ * @param data
+ */
+
+
public void put(Fqn<?> fqn, Map<K, V> data)
{
cache.put(fqn, data);
}
+ /**
+ * Under special operating behavior, associates the value with the specified key for a node identified
+ * by the Fqn passed in.
+ * @param fqn
+ * @param key
+ * @param value
+ */
+
public void putForExternalRead(Fqn<?> fqn, K key, V value)
{
cache.putForExternalRead(fqn, key, value);
}
+ /**
+ * Associates the specified value with the specified key for a Node in this cache.
+ *
+ *
+ * @param fqn
+ * @param key
+ * @param value
+ * @return
+ */
+
+
public V put(Fqn<?> fqn, K key, V value)
{
return cache.put(fqn, key, value);
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-29 22:32:02 UTC (rev 6118)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-29 23:29:19 UTC (rev 6119)
@@ -89,10 +89,40 @@
assert found.size() == 1;
assert found.get(0).equals(p1);
- // TODO: Test more complex object graphs. Put a person Object which has an address which has a City class with a name and description about that city. Then try finding stuff by searching on the city.
+ Cache cache2 = new DefaultCacheFactory().createCache();
+ SearchableCache sc2 = new SearchableCacheFactory().createSearchableCache(cache2, Person.class);
- // TODO: test removal of stuff. Remove stuff and see if you can still search for it. You should not be able to.
- // TODO: Create more black box tests - use a replicated cache, put stuff in one instance and perform searches on anotehr instance.
+ Person p4 = new Person();
+
+ p4.setName("Ralph Nader");
+ p4.setBlurb("Runs for president");
+
+ sc2.put(Fqn.fromString("/u/s/a"), "Ralph", p4);
+
+ luceneQuery = qp.parse("president");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert found.size() == 1;
+
+ p4.setBlurb("Makes cheese");
+
+ sc2.put(Fqn.fromString("/u/s/a"), "Ralph", p4);
+
+ luceneQuery = qp.parse("Makes cheese");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert found.size() == 2;
+
+ sc2.remove("/u/s/a", "Ralph");
+
+ luceneQuery = qp.parse("Makes cheese");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert !found.contains(p4);
+
// TODO: Test stuff with PojoCache. Put stuff in PojoCache (using cache.attach()) and see if you can find stuff.
}
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java 2008-06-29 22:32:02 UTC (rev 6118)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java 2008-06-29 23:29:19 UTC (rev 6119)
@@ -11,7 +11,6 @@
@Test
public class TransformerTest
- //TODO: How best to javadoc the exception methods?
{
/**
16 years, 6 months
JBoss Cache SVN: r6118 - in searchable/trunk/src: test/java/org/jboss/cache/search and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-29 18:32:02 -0400 (Sun, 29 Jun 2008)
New Revision: 6118
Removed:
searchable/trunk/src/test/java/org/jboss/cache/search/NodeModifiedTransactionContextTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/SearchableCacheFactoryTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/SearchableListenerTest.java
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
searchable/trunk/src/test/java/org/jboss/cache/search/QueryResultIteratorImplTest.java
Log:
BlackBox testing and javadoccing in progress.
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -32,13 +32,11 @@
/**
* Jumps to a given index in the list of results.
- *
*
* @param index to jump to
* @throws IndexOutOfBoundsException
*/
-
public void jumpToResult(int index) throws IndexOutOfBoundsException
{
if (index > idList.size() || index < 0)
@@ -52,7 +50,6 @@
* Jumps to first element in the list.
*/
-
public void first()
{
index = 0;
@@ -62,7 +59,6 @@
* Jumps to last element in the list.
*/
-
public void last()
{
index = idList.size() - 1;
@@ -72,7 +68,6 @@
* Jumps to second element in the list.
*/
-
public void afterFirst()
{
index = 1;
@@ -82,40 +77,35 @@
* Jumps to penultimate element in the list.
*/
-
public void beforeLast()
{
index = idList.size() - 2;
}
/**
- *
* @return true if the current element is the first in the list.
*/
-
public boolean isFirst()
{
return idList.get(index) == idList.get(0);
}
/**
- *
* @return true if the current result is the last one.
*/
-
public boolean isLast()
{
- return idList.get(index) == idList.get(idList.size() - 1);
+ return index == idList.size() - 1;
+
+ //TODO: Why does this method work but " return idList.get(index) == idList.size() -1); " doesn't ?
}
/**
- *
* @return true if the current result is one after the first.
*/
-
public boolean isAfterFirst()
{
return idList.get(index) == idList.get(1);
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -35,7 +35,6 @@
this.searchFactory = searchFactory;
}
-
public CacheQuery createQuery(Query luceneQuery)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache);
@@ -62,16 +61,31 @@
cache.addCacheListener(listener);
}
+ public void addCacheListener(Fqn<?> fqn, Object o)
+ {
+ cache.addCacheListener(fqn, o);
+ }
+
public void removeCacheListener(Object listener)
{
cache.removeCacheListener(listener);
}
+ public void removeCacheListener(Fqn<?> fqn, Object o)
+ {
+ cache.removeCacheListener(fqn, o);
+ }
+
public Set getCacheListeners()
{
return cache.getCacheListeners();
}
+ public Set<Object> getCacheListeners(Fqn<?> fqn)
+ {
+ return cache.getCacheListeners(fqn);
+ }
+
public V put(String fqn, K key, V value)
{
return cache.put(fqn, key, value);
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/BlackBoxTest.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -18,29 +18,77 @@
@Test
public class BlackBoxTest
{
- public void doTest() throws ParseException {
+ public void doTest() throws ParseException
+ {
Cache cache = new DefaultCacheFactory().createCache();
SearchableCache sc = new SearchableCacheFactory().createSearchableCache(cache, Person.class);
+
Person p1 = new Person();
p1.setName("Navin Surtani");
p1.setBlurb("Likes playing WoW");
+
+ Person p2 = new Person();
+ p2.setName("BigGoat");
+ p2.setName("Eats grass");
+
+ Person p3 = new Person();
+ p3.setName("MiniGoat");
+ p3.setBlurb("Makes cheese");
+
+ //Put the 3 created objects in the cache.
+
sc.put(Fqn.fromString("/a/b/c"), "Navin", p1);
- QueryParser qp = new QueryParser("field", new StandardAnalyzer());
- Query luceneQuery = qp.parse("playing");
- CacheQuery query = sc.createQuery(luceneQuery);
+ sc.put(Fqn.fromString("/a/b/d"), "BigGoat", p2);
+ sc.put(Fqn.fromString("/a/b/c"), "MiniGoat", p3);
- List found = query.list();
- assert found.size() == 1;
- assert found.get(0).equals(p1);
+ QueryParser qp = new QueryParser("field", new StandardAnalyzer());
+ Query luceneQuery = qp.parse("playing");
+ CacheQuery query = sc.createQuery(luceneQuery);
- // try and search for navin
- // TODO: Create a dummy lucene query
- //sc.createQuery(new Query);
- // TODO: Test should search on name, as well as blurb. Try both cases.
- // TODO: Also test with stuff in different Fqns.
- // TODO; test if the indexes get updated. Try changing the values of a Person object and put it back in the cache.
+ List found = query.list();
+ assert found.size() == 1;
+ assert found.get(0).equals(p1);
+
+ sc.remove("/a/b/c", "Navin");
+
+ query = sc.createQuery(luceneQuery);
+
+ found = query.list();
+
+ assert found.size() == 0;
+
+ sc.put(Fqn.fromString("/a/b/c"), "Navin", p1);
+
+ luceneQuery = qp.parse("Goat");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert found.size() == 2;
+ assert !found.get(1).equals(p2);
+ assert !found.get(0).equals(p3);
+
+ luceneQuery = qp.parse("/a/b/c");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert found.size() == 2;
+
+ for (int i = 0; i < found.size(); i++)
+ {
+ assert !found.get(i).equals(p2);
+ }
+
+ p1.setBlurb("Likes pizza");
+
+ luceneQuery = qp.parse("pizza");
+ query = sc.createQuery(luceneQuery);
+ found = query.list();
+
+ assert found.size() == 1;
+ assert found.get(0).equals(p1);
+
// TODO: Test more complex object graphs. Put a person Object which has an address which has a City class with a name and description about that city. Then try finding stuff by searching on the city.
// TODO: test removal of stuff. Remove stuff and see if you can still search for it. You should not be able to.
Deleted: searchable/trunk/src/test/java/org/jboss/cache/search/NodeModifiedTransactionContextTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/NodeModifiedTransactionContextTest.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/NodeModifiedTransactionContextTest.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -1,8 +0,0 @@
-package org.jboss.cache.search;
-
-/**
- * @author Navin Surtani - navin(a)surtani.org
- */
-public class NodeModifiedTransactionContextTest
-{
-}
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/QueryResultIteratorImplTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/QueryResultIteratorImplTest.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/QueryResultIteratorImplTest.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -126,7 +126,7 @@
Object previous = iterator.previous();
//Check that previous is the first element.
- assert previous == dummyResults.get(ids.get(0));
+ assert previous == dummyResults.get(ids.get(1));
//Make sure that the iterator isn't pointing at the second element.
assert !iterator.isAfterFirst();
@@ -200,11 +200,11 @@
public void testPreviousAndHasPrevious()
{
iterator.last();
- for (int i = ids.size(); i > 0; i--)
+ for (int i = ids.size() - 1; i >= 0; i--)
{
Object expectedValue = dummyResults.get(ids.get(i));
- assert iterator.hasPrevious(); // should have next as long as we are less than the number of elements.
- assert expectedValue == iterator.previous(); // tests next()
+ assert iterator.hasPrevious(); // should have previous as long as we are more than the number of elements.
+ assert expectedValue == iterator.previous(); // tests previous()
}
assert !iterator.hasPrevious(); // this should now NOT be true.
@@ -226,19 +226,19 @@
assert iterator.previousIndex() == -1;
iterator.last();
- assert iterator.previousIndex() == (ids.size() - 1);
+ assert iterator.previousIndex() == (ids.size() - 2);
}
- public void testPreviousAndNext()
- {
- iterator.jumpToResult(5);
- for (int i=0; i<10; i++) // repeat 10 times
- {
- assert iterator.next() == iterator.previous();
- }
+// public void testPreviousAndNext()
+// {
+// iterator.jumpToResult(5);
+// for (int i = 0; i < 10; i++) // repeat 10 times
+// {
+// assert iterator.next() == iterator.previous();
+// }
+//
+// }
- }
-
public static class DummyEntityLoader extends CacheEntityLoader
{
private List<CacheEntityId> allKnownIds;
Deleted: searchable/trunk/src/test/java/org/jboss/cache/search/SearchableCacheFactoryTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/SearchableCacheFactoryTest.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/SearchableCacheFactoryTest.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -1,28 +0,0 @@
-package org.jboss.cache.search;
-
-import org.jboss.cache.Cache;
-import org.testng.annotations.Test;
-
-import java.util.Properties;
-
-/**
- * @author Navin Surtani - navin(a)surtani.org
- */
-
-@Test
-public class SearchableCacheFactoryTest
-{
-
- private Cache cache;
- private Properties properties;
- private Class[] classes;
- private SearchableCacheFactory scf = new SearchableCacheFactory();
-
- public void testCreateSearchableCache()
- {
- cache.start();
- SearchableCache sc = scf.createSearchableCache(cache, properties, classes);
-
- }
-
-}
Deleted: searchable/trunk/src/test/java/org/jboss/cache/search/SearchableListenerTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/SearchableListenerTest.java 2008-06-28 11:25:55 UTC (rev 6117)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/SearchableListenerTest.java 2008-06-29 22:32:02 UTC (rev 6118)
@@ -1,14 +0,0 @@
-package org.jboss.cache.search;
-
-import org.testng.annotations.Test;
-
-/**
- * @author Navin Surtani - navin(a)surtani.org
- */
-
-@Test
-public class SearchableListenerTest
-{
-
-
-}
16 years, 6 months