JBoss Cache SVN: r6080 - core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 20:17:00 -0400 (Thu, 26 Jun 2008)
New Revision: 6080
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
Log:
Null chk
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 00:00:18 UTC (rev 6079)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
@@ -1,12 +1,12 @@
package org.jboss.cache.commands.write;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.notifications.Notifier;
import java.util.List;
@@ -51,11 +51,15 @@
public Object perform(InvocationContext ctx)
{
NodeSPI node = dataContainer.peek(fqn, false, false);
- if (node != null && node.isResident())
+ if (node == null)
{
+ return false;
+ }
+ else if (node.isResident())
+ {
return true;
}
- if (recursive)
+ else if (recursive)
{
List<Fqn> nodesToEvict = dataContainer.getNodesForEviction(fqn, true);
for (Fqn aFqn : nodesToEvict)
16 years, 6 months
JBoss Cache SVN: r6078 - core/trunk/src/test/java/org/jboss/cache/optimistic.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 19:24:20 -0400 (Thu, 26 Jun 2008)
New Revision: 6078
Modified:
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
Log:
Should be using an optimistically locked cache
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2008-06-26 23:24:00 UTC (rev 6077)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2008-06-26 23:24:20 UTC (rev 6078)
@@ -31,7 +31,7 @@
private CacheSPI createLocalCache() throws Exception
{
- CacheSPI cache = createCacheUnstarted(false);
+ CacheSPI cache = createCacheUnstarted(true);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig());
cache.create();
16 years, 6 months
JBoss Cache SVN: r6077 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 19:24:00 -0400 (Thu, 26 Jun 2008)
New Revision: 6077
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
Log:
Registered 30 as a valid version id
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-06-26 23:09:12 UTC (rev 6076)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-06-26 23:24:00 UTC (rev 6077)
@@ -39,6 +39,7 @@
private static final int VERSION_200 = 20;
private static final int VERSION_210 = 21;
private static final int VERSION_220 = 22;
+ private static final int VERSION_300 = 30;
private static final int CUSTOM_MARSHALLER = 999;
private ComponentRegistry componentRegistry;
@@ -281,10 +282,11 @@
break;
case VERSION_220:
case VERSION_210:
+ case VERSION_300:
knownVersion = true;
default:
if (!knownVersion && log.isWarnEnabled())
- log.warn("Unknown replication version String. Falling back to the default marshaller installed.");
+ log.warn("Unknown replication version [" + versionId + "]. Falling back to the default marshaller installed.");
marshaller = marshallers.get(VERSION_210);
if (marshaller == null)
{
16 years, 6 months
JBoss Cache SVN: r6076 - in core/trunk/src: main/java/org/jboss/cache/config and 12 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 19:09:12 -0400 (Thu, 26 Jun 2008)
New Revision: 6076
Modified:
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java
core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
core/trunk/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
core/trunk/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
core/trunk/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java
core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java
core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java
core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
Log:
Replaced StringBuffer with StringBuilder
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- StringBuffer b = new StringBuffer("BuddyGroup: (");
+ StringBuilder b = new StringBuilder("BuddyGroup: (");
b.append("dataOwner: ").append(dataOwner).append(", ");
b.append("groupName: ").append(groupName).append(", ");
b.append("buddies: ").append(buddies).append(",");
Modified: core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- return new StringBuffer().append("CacheLoaderConfig{").append("shared=").append(shared).append(", passivation=").append(passivation).append(", preload='").append(preload).append('\'').append(", cacheLoaderConfigs.size()=").append(cacheLoaderConfigs.size()).append('}').toString();
+ return new StringBuilder().append("CacheLoaderConfig{").append("shared=").append(shared).append(", passivation=").append(passivation).append(", preload='").append(preload).append('\'').append(", cacheLoaderConfigs.size()=").append(cacheLoaderConfigs.size()).append('}').toString();
}
public void setShared(boolean shared)
@@ -319,7 +319,7 @@
@Override
public String toString()
{
- return new StringBuffer().append("IndividualCacheLoaderConfig{").append("className='").append(className).append('\'')
+ return new StringBuilder().append("IndividualCacheLoaderConfig{").append("className='").append(className).append('\'')
.append(", async=").append(async)
.append(", ignoreModifications=").append(ignoreModifications)
.append(", fetchPersistentState=").append(fetchPersistentState)
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-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -1,14 +1,14 @@
package org.jboss.cache.config.parsing;
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Attr;
/**
* The purpose of this class is to parse the jgroups configuration from the config file into an compact string
* that can be passed as a config to the channel.
- *
+ *
* @author Mircea.Markus(a)jboss.com
* @since 3.0
*/
@@ -21,7 +21,7 @@
*/
public String parseClusterConfigXml(Element config)
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
NodeList stack = config.getChildNodes();
int length = stack.getLength();
@@ -44,7 +44,7 @@
return buffer.toString();
}
- private void processAttributes(StringBuffer buffer, Element tag)
+ private void processAttributes(StringBuilder buffer, Element tag)
{
NamedNodeMap attrs = tag.getAttributes();
int attrLength = attrs.getLength();
@@ -67,7 +67,7 @@
}
}
- private void processSingleAttribute(StringBuffer buffer, Attr attr)
+ private void processSingleAttribute(StringBuilder buffer, Attr attr)
{
String name = attr.getName();
String value = attr.getValue();
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -8,9 +8,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.util.BeanUtils;
import org.jboss.util.StringPropertyReplacer;
-import org.jboss.cache.util.BeanUtils;
-import org.jboss.cache.config.ConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -22,15 +22,15 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Properties;
-import java.util.Map;
-import java.util.HashMap;
-import java.lang.reflect.Method;
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
/**
* A simple XML utility class for reading configuration elements
@@ -257,7 +257,7 @@
*/
public static String escapeBackslashes(String value)
{
- StringBuffer buf = new StringBuffer(value);
+ StringBuilder buf = new StringBuilder(value);
for (int looper = 0; looper < buf.length(); looper++)
{
char curr = buf.charAt(looper);
@@ -318,10 +318,11 @@
properties = new Properties();
properties.load(is);
is.close();
- } catch (IOException e)
+ }
+ catch (IOException e)
{
- log.warn("Unexpected",e);
- throw new ConfigurationException("Exception occured while reading properties from XML document",e);
+ log.warn("Unexpected", e);
+ throw new ConfigurationException("Exception occured while reading properties from XML document", e);
}
return properties;
}
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-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -19,10 +19,9 @@
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.config.MissingPolicyException;
+import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.eviction.EvictionPolicy;
import org.jboss.cache.util.Util;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
-import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -440,8 +439,8 @@
}
private static EvictionRegionConfig parseEvictionRegionConfig(Element element,
- String defaultEvictionClass,
- int defaultQueueCapacity)
+ String defaultEvictionClass,
+ int defaultQueueCapacity)
{
EvictionRegionConfig erc = new EvictionRegionConfig();
@@ -512,7 +511,7 @@
*/
public static String parseClusterConfigXml(Element config)
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
NodeList stack = config.getChildNodes();
int length = stack.getLength();
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-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -2,10 +2,9 @@
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.parsing.XmlParserBase;
import org.jboss.cache.config.parsing.XmlConfigHelper;
+import org.jboss.cache.config.parsing.XmlParserBase;
import org.w3c.dom.Element;
-import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.Properties;
@@ -71,7 +70,7 @@
{
if (preloadElement == null) return null; //might be no preload
NodeList nodesToPreload = preloadElement.getElementsByTagName("node");
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
for (int i = 0; i < nodesToPreload.getLength(); i++)
{
Element node = (Element) nodesToPreload.item(i);
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -78,7 +78,7 @@
@Override
public String toString()
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
str.append("ElementSizeConfiguration: maxElementsPerNode =");
str.append(getMaxElementsPerNode()).append(" maxNodes =").append(getMaxNodes());
return str.toString();
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -55,7 +55,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("LFUConfiguration: maxNodes = ").append(getMaxNodes());
return ret.toString();
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -53,7 +53,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("LFUConfiguration: maxNodes = ").append(getMaxNodes()).append(" minNodes = ").append(getMinNodes());
return ret.toString();
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -59,7 +59,7 @@
@Override
public String toString()
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
str.append("MRUConfiguration: ").
append(" maxNodes =").append(getMaxNodes());
return str.toString();
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -150,7 +150,7 @@
@Override
public String toString()
{
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
output.append("Fqn: ");
if (fqn != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -439,7 +439,7 @@
@Override
public String toString()
{
- StringBuffer buf = new StringBuffer("ChainingCacheLoader{");
+ StringBuilder buf = new StringBuilder("ChainingCacheLoader{");
Iterator<CacheLoader> i = cacheLoaders.iterator();
Iterator<CacheLoaderConfig.IndividualCacheLoaderConfig> c = cacheLoaderConfigs.iterator();
int count = 0;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -79,7 +79,7 @@
*/
public static final Pattern FQN_PATTERN = Pattern.compile("[\\\\\\/:*<>|\"?]");
private static boolean isOldWindows;
-
+
static
{
float osVersion = -1;
@@ -407,7 +407,7 @@
String getFullPath(Fqn fqn)
{
- StringBuffer sb = new StringBuffer(rootPath);
+ StringBuilder sb = new StringBuilder(rootPath);
for (int i = 0; i < fqn.size(); i++)
{
Object tmp = fqn.get(i);
Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -188,7 +188,7 @@
}
else
{
- StringBuffer sql = new StringBuffer(300);
+ StringBuilder sql = new StringBuilder(300);
sql.append("delete from ").append(config.getTable()).append(" where fqn in (");
//sql2.append("delete from " + table + " where fqn=? or parent in (");
List fqns = new ArrayList();
@@ -244,7 +244,7 @@
// Private
- private void addChildrenToDeleteSql(String name, StringBuffer sql, List fqns)
+ private void addChildrenToDeleteSql(String name, StringBuilder sql, List fqns)
throws SQLException
{
// for now have to use connection per method, i.e. can't pass the same connection to recursive
Modified: core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -208,7 +208,7 @@
{
synchronized (conns)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(conns.size()).append(" connections:\n");
for (Connection c : conns)
{
@@ -450,7 +450,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (sock != null)
{
sb.append(sock.getRemoteSocketAddress());
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("MethodName: ");
ret.append(method_name);
ret.append("; MethodIdInteger: ");
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -115,5 +115,5 @@
void addChild(Object nodeName, Node<K, V> nodeToAdd);
- void printDetails(StringBuffer sb, int indent);
+ void printDetails(StringBuilder sb, int indent);
}
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -277,7 +277,7 @@
delegate.addChild(nodeName, nodeToAdd);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
delegate.printDetails(sb, indent);
}
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -331,7 +331,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (isDeleted()) sb.append("del ");
if (isModified()) sb.append("modified ");
if (isCreated()) sb.append("new ");
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -59,7 +59,7 @@
public static String printInterceptorChain(CommandInterceptor i)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (i != null)
{
if (i.getNext() != null)
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -19,13 +19,13 @@
* @param clazz the Class
* @param results the buffer to write the info to
*/
- public static void displayClassInfo(Class clazz, StringBuffer results)
+ public static void displayClassInfo(Class clazz, StringBuilder results)
{
displayClassInfo(clazz, results, true);
}
@SuppressWarnings("null")
- public static void displayClassInfo(Class clazz, StringBuffer results,
+ public static void displayClassInfo(Class clazz, StringBuilder results,
boolean showParentClassLoaders)
{
@@ -37,7 +37,7 @@
results.append("\n.." + parent);
URL[] urls = getClassLoaderURLs(parent);
int length = urls != null ? urls.length : 0;
- for (int u = 0; u < length; u ++)
+ for (int u = 0; u < length; u++)
{
results.append("\n...." + urls[u]);
}
@@ -59,7 +59,7 @@
results.append("\nImplemented Interfaces:");
Class[] ifaces = clazz.getInterfaces();
- for (int i = 0; i < ifaces.length; i ++)
+ for (int i = 0; i < ifaces.length; i++)
{
Class iface = ifaces[i];
results.append("\n++" + iface + "(" + Integer.toHexString(iface.hashCode()) + ")");
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -43,7 +43,7 @@
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("name=").append(getName()).append(" Address= ").append(address);
return sb.toString();
}
Modified: core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -1,14 +1,17 @@
package org.jboss.cache.mock;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
/**
* @author Mircea.Markus(a)jboss.com
@@ -117,12 +120,12 @@
((NodeSpiMock) nodeToAdd).fqn = Fqn.fromRelativeElements(fqn, nodeName);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
//skip
}
- public void print(StringBuffer sb, int indent)
+ public void print(StringBuilder sb, int indent)
{
//skip
}
@@ -169,7 +172,7 @@
Object directChildName = childName.get(0);
NodeSpiMock directChild = children.get(directChildName);
Fqn subFqn = childName.getSubFqn(1, childName.size());
- if(directChild == null)
+ if (directChild == null)
{
directChild = newChild(directChildName);
}
@@ -356,7 +359,8 @@
{
data.put(key, newValue);
return true;
- } else
+ }
+ else
return false;
}
@@ -367,7 +371,7 @@
public void replaceAll(Map map)
{
- data = map;
+ data = map;
}
public Object get(Object key)
Modified: core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-06-26 23:08:29 UTC (rev 6075)
+++ core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-06-26 23:09:12 UTC (rev 6076)
@@ -11,7 +11,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
-import org.jboss.cache.lock.LockManager;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.ComponentRegistry;
@@ -20,7 +19,7 @@
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.lock.LockManager;
import org.jgroups.JChannel;
import java.io.File;
@@ -293,7 +292,7 @@
else if (memberCount < members.size())
{
// This is an exceptional condition
- StringBuffer sb = new StringBuffer("Cache at address ");
+ StringBuilder sb = new StringBuilder("Cache at address ");
sb.append(cache.getRPCManager().getLocalAddress());
sb.append(" had ");
sb.append(members.size());
@@ -338,7 +337,7 @@
if (barfIfTooManyMembers)
{
// This is an exceptional condition
- StringBuffer sb = new StringBuffer("Cache at address ");
+ StringBuilder sb = new StringBuilder("Cache at address ");
sb.append(cache.getLocalAddress());
sb.append(" had ");
sb.append(members.size());
16 years, 6 months
JBoss Cache SVN: r6075 - in core/trunk/src: main/java/org/jboss/cache/commands/read and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 19:08:29 -0400 (Thu, 26 Jun 2008)
New Revision: 6075
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
core/trunk/src/main/java/org/jboss/cache/Modification.java
core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/Version.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java
core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java
core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/NodeLock.java
core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java
core/trunk/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
Log:
Replaced StringBuffer with StringBuilder
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -299,7 +299,7 @@
@SuppressWarnings("deprecation")
public String toString(boolean details)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int indent = 0;
if (!details)
@@ -369,7 +369,7 @@
*/
public String printDetails()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
root.printDetails(sb, 0);
sb.append("\n");
return sb.toString();
Modified: core/trunk/src/main/java/org/jboss/cache/Modification.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Modification.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/Modification.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -266,7 +266,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(type.toString()).append(": ").append(fqn);
if (key != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -151,21 +151,21 @@
void addChild(Object nodeName, Node<K, V> nodeToAdd);
/**
- * Prints details of this node to the StringBuffer passed in.
+ * Prints details of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending spaces.
*/
- void printDetails(StringBuffer sb, int indent);
+ void printDetails(StringBuilder sb, int indent);
/**
- * Prints basic information of this node to the StringBuffer passed in.
+ * Prints basic information of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending spaces.
*/
@Deprecated
- void print(StringBuffer sb, int indent);
+ void print(StringBuilder sb, int indent);
// versioning
/**
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -313,7 +313,7 @@
return data.remove(key);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
printDetailsInMap(sb, indent);
}
@@ -562,7 +562,7 @@
throw new UnsupportedOperationException("Versioning not supported");
}
- private void printIndent(StringBuffer sb, int indent)
+ private void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -666,7 +666,7 @@
/**
* Adds details of the node into a map as strings.
*/
- private void printDetailsInMap(StringBuffer sb, int indent)
+ private void printDetailsInMap(StringBuilder sb, int indent)
{
printIndent(sb, indent);
indent += 2;// increse it
Modified: core/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Version.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/Version.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -46,7 +46,7 @@
public static String printVersionId(byte[] v, int len)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
if (len <= 0)
@@ -59,7 +59,7 @@
public static String printVersionId(byte[] v)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
for (byte aV : v) sb.append((char) aV);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -54,7 +54,7 @@
{
if (trace)
{
- log.trace(new StringBuffer("get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
+ log.trace(new StringBuilder("get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
append(sendNodeEvent).append("\")"));
}
NodeSPI n = ctx.lookUpNode(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -110,12 +110,12 @@
node.addChild(nodeName, nodeToAdd);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
node.printDetails(sb, indent);
}
- public void print(StringBuffer sb, int indent)
+ public void print(StringBuilder sb, int indent)
{
throw new CacheException("This method is deprecated!");
}
Modified: core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -155,13 +155,13 @@
{
if (trace)
{
- log.trace(new StringBuffer("acquiring WL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquiring WL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
boolean flag = acquireWriteLock0(caller, timeout);
if (trace)
{
- log.trace(new StringBuffer("acquired WL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquired WL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
return flag;
@@ -255,13 +255,13 @@
{
if (trace)
{
- log.trace(new StringBuffer("acquiring RL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquiring RL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
boolean flag = acquireReadLock0(caller, timeout);
if (trace)
{
- log.trace(new StringBuffer("acquired RL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquired RL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
return flag;
@@ -296,7 +296,7 @@
{
if (trace)
{
- StringBuffer sb = new StringBuffer(64);
+ StringBuilder sb = new StringBuilder(64);
sb.append("acquireReadLock(): caller ").append(caller).append(" already owns lock for ").append(getFqn());
log.trace(sb.toString());
}
@@ -308,7 +308,7 @@
// we don't need to synchronize from here on because we own the semaphore
if (!rc)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("read lock for ").append(getFqn()).append(" could not be acquired by ").append(caller);
sb.append(" after ").append(timeout).append(" ms. " + "Locks: ").append(map.printInfo());
sb.append(", lock info: ").append(toString(true));
@@ -421,17 +421,17 @@
public String toString(boolean print_lock_details)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
toString(sb, print_lock_details);
return sb.toString();
}
- public void toString(StringBuffer sb)
+ public void toString(StringBuilder sb)
{
toString(sb, false);
}
- public void toString(StringBuffer sb, boolean print_lock_details)
+ public void toString(StringBuilder sb, boolean print_lock_details)
{
boolean printed_read_owners = false;
Collection<Object> read_owners = lock != null ? getReaderOwners() : null;
@@ -490,7 +490,7 @@
}
catch (UpgradeException e)
{
- StringBuffer buf = new StringBuffer("failure upgrading lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure upgrading lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -500,7 +500,7 @@
}
catch (LockingException e)
{
- StringBuffer buf = new StringBuffer("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -510,7 +510,7 @@
}
catch (TimeoutException e)
{
- StringBuffer buf = new StringBuffer("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -559,7 +559,7 @@
release(owner);
}
- private void printIndent(StringBuffer sb, int indent)
+ private void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -570,7 +570,7 @@
}
}
- public void printLockInfo(StringBuffer sb, int indent)
+ public void printLockInfo(StringBuilder sb, int indent)
{
boolean locked = isLocked();
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -187,7 +187,7 @@
*/
public String printInfo()
{
- StringBuffer buf = new StringBuffer(64);
+ StringBuilder buf = new StringBuilder(64);
buf.append("Read lock owners: ").append(readOwners).append('\n');
buf.append("Write lock owner: ").append(writeOwner_).append('\n');
return buf.toString();
Modified: core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -293,7 +293,7 @@
public String printLockInfo(NodeSPI node)
{
- StringBuffer sb = new StringBuffer("\n");
+ StringBuilder sb = new StringBuilder("\n");
int indent = 0;
for (Object n : node.getChildrenDirect())
Modified: core/trunk/src/main/java/org/jboss/cache/lock/NodeLock.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -124,6 +124,6 @@
Set<NodeLock> acquireAll(Object caller, long timeout, LockType lock_type, boolean excludeInternalFqns) throws LockingException, TimeoutException,
InterruptedException;
- void printLockInfo(StringBuffer sb, int indent);
+ void printLockInfo(StringBuilder sb, int indent);
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -193,7 +193,7 @@
}
if (!fqn.isChildOrEquals(currentNode.getFqn())) // Does this ever happen? Perhaps with a move(), I suppose? - MS
{
- String message = new StringBuffer("currentNode instance changed the FQN(").append(currentNode.getFqn())
+ String message = new StringBuilder("currentNode instance changed the FQN(").append(currentNode.getFqn())
.append(") and do not match the FQN on which we want to acquire lock(").append(fqn).append(")").toString();
log.trace(message);
throw new LockingException(message);
Modified: core/trunk/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -70,7 +70,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("activeReaders=").append(activeReaders_).append(", activeWriter=").append(activeWriter_);
sb.append(", waitingReaders=").append(waitingReaders_).append(", waitingWriters=").append(waitingWriters_);
sb.append(", waitingUpgrader=").append(waitingUpgrader_);
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -102,7 +102,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("GlobalTransaction:<").append(addr).append(">:").append(id);
return sb.toString();
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -33,7 +33,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer(super.toString());
+ StringBuilder sb = new StringBuilder(super.toString());
sb.append("\nworkspace: ").append(transactionWorkSpace);
return sb.toString();
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -195,7 +195,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(tx2gtxMap.size()).append(" mappings, ");
sb.append(gtx2ContextMap.size()).append(" transactions");
return sb.toString();
@@ -208,7 +208,7 @@
{
if (!printDetails)
return toString();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("LocalTransactions: ").append(tx2gtxMap.size()).append("\n");
sb.append("GlobalTransactions: ").append(gtx2ContextMap.size()).append("\n");
sb.append("tx2gtxMap:\n");
Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -92,7 +92,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -6,18 +6,12 @@
*/
package org.jboss.cache.loader;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
+import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
-import org.testng.annotations.AfterMethod;
import java.util.Properties;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-
/**
* This test runs cache loader tests using Database as the cache loader store.
* The default test is configured using Derby embedded framework.
@@ -60,7 +54,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
@@ -79,7 +73,8 @@
retVal = loader.put(FQN, key, updatedValue);
assertEquals(initialValue, (String) retVal);
assertEquals(updatedValue, (String) loader.get(FQN).get(key));
- } catch (Exception e)
+ }
+ catch (Exception e)
{
fail(e.toString());
}
@@ -99,9 +94,9 @@
}
}
- public void testRootIsCreated() throws Exception
- {
- loader.put(Fqn.fromString("/a/b/c"), "a", "b");
- assertTrue(loader.exists(Fqn.ROOT));
- }
+ public void testRootIsCreated() throws Exception
+ {
+ loader.put(Fqn.fromString("/a/b/c"), "a", "b");
+ assertTrue(loader.exists(Fqn.ROOT));
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -10,8 +10,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.transaction.GlobalTransaction;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -567,7 +567,7 @@
}
try
{
- iLock.toString(new StringBuffer(), false);
+ iLock.toString(new StringBuilder(), false);
}
catch (Exception e)
{
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-06-26 22:59:25 UTC (rev 6074)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-06-26 23:08:29 UTC (rev 6075)
@@ -27,13 +27,13 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.SelectedClassnameClassLoader;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import org.testng.annotations.AfterMethod;
@@ -307,7 +307,7 @@
}
char[] chars = path.toCharArray();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (char aChar : chars)
{
if (aChar == '\\')
@@ -394,7 +394,7 @@
protected ClassLoader getClassLoader() throws Exception
{
String[] includesClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
String[] excludesClasses = {};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(includesClasses, excludesClasses, cl);
@@ -403,7 +403,7 @@
protected ClassLoader getNotFoundClassLoader() throws Exception
{
String[] notFoundClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(null, null, notFoundClasses, cl);
}
16 years, 6 months
JBoss Cache SVN: r6074 - in core/branches/2.2.X/src/main/docbook: tutorial/en and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 18:59:25 -0400 (Thu, 26 Jun 2008)
New Revision: 6074
Modified:
core/branches/2.2.X/src/main/docbook/faq/en/master.xml
core/branches/2.2.X/src/main/docbook/tutorial/en/master.xml
core/branches/2.2.X/src/main/docbook/userguide/en/master.xml
Log:
Updated publish date on docs.
Modified: core/branches/2.2.X/src/main/docbook/faq/en/master.xml
===================================================================
--- core/branches/2.2.X/src/main/docbook/faq/en/master.xml 2008-06-26 22:58:07 UTC (rev 6073)
+++ core/branches/2.2.X/src/main/docbook/faq/en/master.xml 2008-06-26 22:59:25 UTC (rev 6074)
@@ -7,7 +7,7 @@
<title>Frequently Asked Questions about JBoss Cache</title>
<!-- Release version and date -->
<releaseinfo>Release 2.2.0 Poblano</releaseinfo>
- <pubdate>May 2008</pubdate>
+ <pubdate>July 2008</pubdate>
<author>
<firstname>Manik</firstname>
Modified: core/branches/2.2.X/src/main/docbook/tutorial/en/master.xml
===================================================================
--- core/branches/2.2.X/src/main/docbook/tutorial/en/master.xml 2008-06-26 22:58:07 UTC (rev 6073)
+++ core/branches/2.2.X/src/main/docbook/tutorial/en/master.xml 2008-06-26 22:59:25 UTC (rev 6074)
@@ -4,7 +4,7 @@
<title>JBoss Cache Core Edition Tutorial</title>
<!-- Release version and date -->
<releaseinfo>Release 2.2.0 Poblano</releaseinfo>
- <pubdate>May 2008</pubdate>
+ <pubdate>July 2008</pubdate>
<author>
<firstname>Manik</firstname>
Modified: core/branches/2.2.X/src/main/docbook/userguide/en/master.xml
===================================================================
--- core/branches/2.2.X/src/main/docbook/userguide/en/master.xml 2008-06-26 22:58:07 UTC (rev 6073)
+++ core/branches/2.2.X/src/main/docbook/userguide/en/master.xml 2008-06-26 22:59:25 UTC (rev 6074)
@@ -22,7 +22,7 @@
<!-- Release version and date -->
<releaseinfo>Release 2.2.0 Poblano</releaseinfo>
- <pubdate>May 2008</pubdate>
+ <pubdate>July 2008</pubdate>
<!-- Authors/contributors -->
<author>
16 years, 6 months
JBoss Cache SVN: r6073 - in core/branches/2.2.X/src: main/java/org/jboss/cache/commands/read and 15 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 18:58:07 -0400 (Thu, 26 Jun 2008)
New Revision: 6073
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/config/CacheLoaderConfig.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/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/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/NodeEntry.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/invocation/NodeInvocationDelegate.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/IdentityLock.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/LockMap.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeLock.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java
core/branches/2.2.X/src/main/java/org/jboss/cache/marshall/MethodCall.java
core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.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/lock/IdentityLockTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Debug.java
core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Person.java
core/branches/2.2.X/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
core/branches/2.2.X/src/test/java/org/jboss/cache/util/TestingUtil.java
Log:
Converted StringBuffers to StringBuilders.
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- StringBuffer b = new StringBuffer("BuddyGroup: (");
+ StringBuilder b = new StringBuilder("BuddyGroup: (");
b.append("dataOwner: ").append(dataOwner).append(", ");
b.append("groupName: ").append(groupName).append(", ");
b.append("buddies: ").append(buddies).append(",");
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -2,7 +2,10 @@
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.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.Notifier;
@@ -51,7 +54,7 @@
{
if (trace)
{
- log.trace(new StringBuffer("get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
+ log.trace(new StringBuilder("get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
append(sendNodeEvent).append("\")"));
}
NodeSPI n = dataContainer.peek(fqn);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -55,7 +55,7 @@
{
if (trace)
{
- log.trace(new StringBuffer("perform(").append(globalTransaction).append(", \"").
+ log.trace(new StringBuilder("perform(").append(globalTransaction).append(", \"").
append(fqn).append("\", k=").append(key).append(", v=").append(value).append(")"));
}
NodeSPI n = dataContainer.peekStrict(globalTransaction, fqn, false);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- return new StringBuffer().append("CacheLoaderConfig{").append("shared=").append(shared).append(", passivation=").append(passivation).append(", preload='").append(preload).append('\'').append(", cacheLoaderConfigs.size()=").append(cacheLoaderConfigs.size()).append('}').toString();
+ return new StringBuilder().append("CacheLoaderConfig{").append("shared=").append(shared).append(", passivation=").append(passivation).append(", preload='").append(preload).append('\'').append(", cacheLoaderConfigs.size()=").append(cacheLoaderConfigs.size()).append('}').toString();
}
public void setShared(boolean shared)
@@ -319,7 +319,7 @@
@Override
public String toString()
{
- return new StringBuffer().append("IndividualCacheLoaderConfig{").append("className='").append(className).append('\'')
+ return new StringBuilder().append("IndividualCacheLoaderConfig{").append("className='").append(className).append('\'')
.append(", async=").append(async)
.append(", ignoreModifications=").append(ignoreModifications)
.append(", fetchPersistentState=").append(fetchPersistentState)
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -78,7 +78,7 @@
@Override
public String toString()
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
str.append("ElementSizeConfiguration: maxElementsPerNode =");
str.append(getMaxElementsPerNode()).append(" maxNodes =").append(getMaxNodes());
return str.toString();
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -55,7 +55,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("LFUConfiguration: maxNodes = ").append(getMaxNodes());
return ret.toString();
}
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -53,7 +53,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("LFUConfiguration: maxNodes = ").append(getMaxNodes()).append(" minNodes = ").append(getMinNodes());
return ret.toString();
}
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -90,7 +90,7 @@
@Override
public String toString()
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
str.append("LRUConfiguration: timeToLiveSeconds = ").append(getTimeToLiveSeconds()).append(" maxAgeSeconds =");
str.append(getMaxAgeSeconds()).append(" maxNodes =").append(getMaxNodes());
return str.toString();
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -59,7 +59,7 @@
@Override
public String toString()
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
str.append("MRUConfiguration: ").
append(" maxNodes =").append(getMaxNodes());
return str.toString();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/NodeEntry.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -150,7 +150,7 @@
@Override
public String toString()
{
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
output.append("Fqn: ");
if (fqn != null)
{
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -619,7 +619,7 @@
*/
public static String parseClusterConfigXml(Element config)
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
NodeList stack = config.getChildNodes();
int length = stack.getLength();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -110,12 +110,12 @@
node.addChild(nodeName, nodeToAdd);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
node.printDetails(sb, indent);
}
- public void print(StringBuffer sb, int indent)
+ public void print(StringBuilder sb, int indent)
{
throw new CacheException("This method is deprecated!");
}
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -208,7 +208,7 @@
{
synchronized (conns)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(conns.size()).append(" connections:\n");
for (Connection c : conns)
{
@@ -450,7 +450,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (sock != null)
{
sb.append(sock.getRemoteSocketAddress());
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/IdentityLock.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -154,13 +154,13 @@
{
if (trace)
{
- log.trace(new StringBuffer("acquiring WL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquiring WL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
boolean flag = acquireWriteLock0(caller, timeout);
if (trace)
{
- log.trace(new StringBuffer("acquired WL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquired WL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
return flag;
@@ -254,13 +254,13 @@
{
if (trace)
{
- log.trace(new StringBuffer("acquiring RL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquiring RL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
boolean flag = acquireReadLock0(caller, timeout);
if (trace)
{
- log.trace(new StringBuffer("acquired RL: fqn=").append(getFqn()).append(", caller=").append(caller).
+ log.trace(new StringBuilder("acquired RL: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(PRINT_LOCK_DETAILS)));
}
return flag;
@@ -295,7 +295,7 @@
{
if (trace)
{
- StringBuffer sb = new StringBuffer(64);
+ StringBuilder sb = new StringBuilder(64);
sb.append("acquireReadLock(): caller ").append(caller).append(" already owns lock for ").append(getFqn());
log.trace(sb.toString());
}
@@ -307,7 +307,7 @@
// we don't need to synchronize from here on because we own the semaphore
if (!rc)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("read lock for ").append(getFqn()).append(" could not be acquired by ").append(caller);
sb.append(" after ").append(timeout).append(" ms. " + "Locks: ").append(map.printInfo());
sb.append(", lock info: ").append(toString(true));
@@ -420,17 +420,17 @@
public String toString(boolean print_lock_details)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
toString(sb, print_lock_details);
return sb.toString();
}
- public void toString(StringBuffer sb)
+ public void toString(StringBuilder sb)
{
toString(sb, false);
}
- public void toString(StringBuffer sb, boolean print_lock_details)
+ public void toString(StringBuilder sb, boolean print_lock_details)
{
boolean printed_read_owners = false;
Collection<Object> read_owners = lock != null ? getReaderOwners() : null;
@@ -489,7 +489,7 @@
}
catch (UpgradeException e)
{
- StringBuffer buf = new StringBuffer("failure upgrading lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure upgrading lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -499,7 +499,7 @@
}
catch (LockingException e)
{
- StringBuffer buf = new StringBuffer("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -509,7 +509,7 @@
}
catch (TimeoutException e)
{
- StringBuffer buf = new StringBuffer("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
+ StringBuilder buf = new StringBuilder("failure acquiring lock: fqn=").append(getFqn()).append(", caller=").append(caller).
append(", lock=").append(toString(true));
if (trace)
{
@@ -558,7 +558,7 @@
release(owner);
}
- private void printIndent(StringBuffer sb, int indent)
+ private void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -569,7 +569,7 @@
}
}
- public void printLockInfo(StringBuffer sb, int indent)
+ public void printLockInfo(StringBuilder sb, int indent)
{
boolean locked = isLocked();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/LockMap.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/LockMap.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/LockMap.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -187,7 +187,7 @@
*/
public String printInfo()
{
- StringBuffer buf = new StringBuffer(64);
+ StringBuilder buf = new StringBuilder(64);
buf.append("Read lock owners: ").append(readOwners).append('\n');
buf.append("Write lock owner: ").append(writeOwner_).append('\n');
return buf.toString();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -311,7 +311,7 @@
public String printLockInfo(NodeSPI node)
{
- StringBuffer sb = new StringBuffer("\n");
+ StringBuilder sb = new StringBuilder("\n");
int indent = 0;
for (Object n : node.getChildrenDirect())
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeLock.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -120,6 +120,6 @@
Set<NodeLock> acquireAll(Object caller, long timeout, LockType lock_type, boolean excludeInternalFqns) throws LockingException, TimeoutException,
InterruptedException;
- void printLockInfo(StringBuffer sb, int indent);
+ void printLockInfo(StringBuilder sb, int indent);
}
\ No newline at end of file
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -193,7 +193,7 @@
}
if (!fqn.isChildOrEquals(currentNode.getFqn())) // Does this ever happen? Perhaps with a move(), I suppose? - MS
{
- String message = new StringBuffer("currentNode instance changed the FQN(").append(currentNode.getFqn())
+ String message = new StringBuilder("currentNode instance changed the FQN(").append(currentNode.getFqn())
.append(") and do not match the FQN on which we want to acquire lock(").append(fqn).append(")").toString();
log.trace(message);
throw new LockingException(message);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/ReadWriteLockWithUpgrade.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -70,7 +70,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("activeReaders=").append(activeReaders_).append(", activeWriter=").append(activeWriter_);
sb.append(", waitingReaders=").append(waitingReaders_).append(", waitingWriters=").append(waitingWriters_);
sb.append(", waitingUpgrader=").append(waitingUpgrader_);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -89,7 +89,7 @@
@Override
public String toString()
{
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("MethodName: ");
ret.append(method_name);
ret.append("; MethodIdInteger: ");
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -331,7 +331,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (isDeleted()) sb.append("del ");
if (isModified()) sb.append("modified ");
if (isCreated()) sb.append("new ");
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -59,7 +59,7 @@
public static String printInterceptorChain(CommandInterceptor i)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (i != null)
{
if (i.getNext() != null)
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-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -250,7 +250,7 @@
*/
public static String escapeBackslashes(String value)
{
- StringBuffer buf = new StringBuffer(value);
+ StringBuilder buf = new StringBuilder(value);
for (int looper = 0; looper < buf.length(); looper++)
{
char curr = buf.charAt(looper);
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/lock/IdentityLockTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -10,8 +10,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.transaction.GlobalTransaction;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -567,7 +567,7 @@
}
try
{
- iLock.toString(new StringBuffer(), false);
+ iLock.toString(new StringBuilder(), false);
}
catch (Exception e)
{
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Debug.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Debug.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Debug.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -19,13 +19,13 @@
* @param clazz the Class
* @param results the buffer to write the info to
*/
- public static void displayClassInfo(Class clazz, StringBuffer results)
+ public static void displayClassInfo(Class clazz, StringBuilder results)
{
displayClassInfo(clazz, results, true);
}
@SuppressWarnings("null")
- public static void displayClassInfo(Class clazz, StringBuffer results,
+ public static void displayClassInfo(Class clazz, StringBuilder results,
boolean showParentClassLoaders)
{
@@ -37,7 +37,7 @@
results.append("\n.." + parent);
URL[] urls = getClassLoaderURLs(parent);
int length = urls != null ? urls.length : 0;
- for (int u = 0; u < length; u ++)
+ for (int u = 0; u < length; u++)
{
results.append("\n...." + urls[u]);
}
@@ -59,7 +59,7 @@
results.append("\nImplemented Interfaces:");
Class[] ifaces = clazz.getInterfaces();
- for (int i = 0; i < ifaces.length; i ++)
+ for (int i = 0; i < ifaces.length; i++)
{
Class iface = ifaces[i];
results.append("\n++" + iface + "(" + Integer.toHexString(iface.hashCode()) + ")");
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Person.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Person.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/data/Person.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -43,7 +43,7 @@
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("name=").append(getName()).append(" Address= ").append(address);
return sb.toString();
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -27,13 +27,13 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.SelectedClassnameClassLoader;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import org.testng.annotations.AfterMethod;
@@ -307,7 +307,7 @@
}
char[] chars = path.toCharArray();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (char aChar : chars)
{
if (aChar == '\\')
@@ -394,7 +394,7 @@
protected ClassLoader getClassLoader() throws Exception
{
String[] includesClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
String[] excludesClasses = {};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(includesClasses, excludesClasses, cl);
@@ -403,7 +403,7 @@
protected ClassLoader getNotFoundClassLoader() throws Exception
{
String[] notFoundClasses = {"org.jboss.cache.marshall.Person",
- "org.jboss.cache.marshall.Address"};
+ "org.jboss.cache.marshall.Address"};
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new SelectedClassnameClassLoader(null, null, notFoundClasses, cl);
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/util/TestingUtil.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-06-26 22:56:53 UTC (rev 6072)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-06-26 22:58:07 UTC (rev 6073)
@@ -11,7 +11,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
-import org.jboss.cache.lock.LockManager;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.ComponentRegistry;
@@ -20,7 +19,7 @@
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.lock.LockManager;
import org.jgroups.JChannel;
import java.io.File;
@@ -293,7 +292,7 @@
else if (memberCount < members.size())
{
// This is an exceptional condition
- StringBuffer sb = new StringBuffer("Cache at address ");
+ StringBuilder sb = new StringBuilder("Cache at address ");
sb.append(cache.getRPCManager().getLocalAddress());
sb.append(" had ");
sb.append(members.size());
@@ -338,7 +337,7 @@
if (barfIfTooManyMembers)
{
// This is an exceptional condition
- StringBuffer sb = new StringBuffer("Cache at address ");
+ StringBuilder sb = new StringBuilder("Cache at address ");
sb.append(cache.getLocalAddress());
sb.append(" had ");
sb.append(members.size());
16 years, 6 months
JBoss Cache SVN: r6072 - in core/branches/2.2.X/src: main/java/org/jboss/cache/loader and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 18:56:53 -0400 (Thu, 26 Jun 2008)
New Revision: 6072
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java
core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java
core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.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/JDBCCacheLoaderOld.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
Log:
Converted StringBuffers to StringBuilders.
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -14,7 +14,12 @@
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* A container for the root node in the cache, which also provides helpers for efficiently accessing nodes, walking trees, etc.
@@ -293,7 +298,7 @@
@SuppressWarnings("deprecation")
public String toString(boolean details)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int indent = 0;
if (!details)
@@ -363,7 +368,7 @@
*/
public String printDetails()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
root.printDetails(sb, 0);
sb.append("\n");
return sb.toString();
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/Modification.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -266,7 +266,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(type.toString()).append(": ").append(fqn);
if (key != null)
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/NodeSPI.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -151,21 +151,21 @@
void addChild(Object nodeName, Node<K, V> nodeToAdd);
/**
- * Prints details of this node to the StringBuffer passed in.
+ * Prints details of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending spaces.
*/
- void printDetails(StringBuffer sb, int indent);
+ void printDetails(StringBuilder sb, int indent);
/**
- * Prints basic information of this node to the StringBuffer passed in.
+ * Prints basic information of this node to the StringBuilder passed in.
*
- * @param sb StringBuffer to print to
+ * @param sb StringBuilder to print to
* @param indent depth of this node in the tree. Used to indent details by prepending spaces.
*/
@Deprecated
- void print(StringBuffer sb, int indent);
+ void print(StringBuilder sb, int indent);
// versioning
/**
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -306,7 +306,7 @@
return data.remove(key);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
printDetailsInMap(sb, indent);
}
@@ -555,7 +555,7 @@
throw new UnsupportedOperationException("Versioning not supported");
}
- private void printIndent(StringBuffer sb, int indent)
+ private void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -659,7 +659,7 @@
/**
* Adds details of the node into a map as strings.
*/
- private void printDetailsInMap(StringBuffer sb, int indent)
+ private void printDetailsInMap(StringBuilder sb, int indent)
{
printIndent(sb, indent);
indent += 2;// increse it
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/Version.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -46,7 +46,7 @@
public static String printVersionId(byte[] v, int len)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
if (len <= 0)
@@ -59,7 +59,7 @@
public static String printVersionId(byte[] v)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (v != null)
{
for (byte aV : v) sb.append((char) aV);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -439,7 +439,7 @@
@Override
public String toString()
{
- StringBuffer buf = new StringBuffer("ChainingCacheLoader{");
+ StringBuilder buf = new StringBuilder("ChainingCacheLoader{");
Iterator<CacheLoader> i = cacheLoaders.iterator();
Iterator<CacheLoaderConfig.IndividualCacheLoaderConfig> c = cacheLoaderConfigs.iterator();
int count = 0;
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-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -79,7 +79,7 @@
*/
public static final Pattern FQN_PATTERN = Pattern.compile("[\\\\\\/:*<>|\"?]");
private static boolean isOldWindows;
-
+
static
{
float osVersion = -1;
@@ -407,7 +407,7 @@
String getFullPath(Fqn fqn)
{
- StringBuffer sb = new StringBuffer(rootPath);
+ StringBuilder sb = new StringBuilder(rootPath);
for (int i = 0; i < fqn.size(); i++)
{
Object tmp = fqn.get(i);
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-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -188,7 +188,7 @@
}
else
{
- StringBuffer sql = new StringBuffer(300);
+ StringBuilder sql = new StringBuilder(300);
sql.append("delete from ").append(config.getTable()).append(" where fqn in (");
//sql2.append("delete from " + table + " where fqn=? or parent in (");
List fqns = new ArrayList();
@@ -244,7 +244,7 @@
// Private
- private void addChildrenToDeleteSql(String name, StringBuffer sql, List fqns)
+ private void addChildrenToDeleteSql(String name, StringBuilder sql, List fqns)
throws SQLException
{
// for now have to use connection per method, i.e. can't pass the same connection to recursive
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/GlobalTransaction.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -102,7 +102,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("GlobalTransaction:<").append(addr).append(">:").append(id);
return sb.toString();
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/OptimisticTransactionEntry.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -33,7 +33,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer(super.toString());
+ StringBuilder sb = new StringBuilder(super.toString());
sb.append("\nworkspace: ").append(transactionWorkSpace);
return sb.toString();
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -305,7 +305,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("TransactionEntry\nmodificationList: ").append(modificationList);
synchronized (locks)
{
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-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -203,7 +203,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(tx2gtxMap.size()).append(" mappings, ");
sb.append(gtx2EntryMap.size()).append(" transactions");
return sb.toString();
@@ -216,7 +216,7 @@
{
if (!printDetails)
return toString();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("LocalTransactions: ").append(tx2gtxMap.size()).append("\n");
sb.append("GlobalTransactions: ").append(gtx2EntryMap.size()).append("\n");
sb.append("tx2gtxMap:\n");
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -92,7 +92,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderTest.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -6,18 +6,12 @@
*/
package org.jboss.cache.loader;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
+import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
-import org.testng.annotations.AfterMethod;
import java.util.Properties;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-
/**
* This test runs cache loader tests using Database as the cache loader store.
* The default test is configured using Derby embedded framework.
@@ -60,7 +54,7 @@
{
String key = "LargeObj";
// create an object with size bigger than 4k (k=1024 bytes)
- StringBuffer text = new StringBuffer("LargeObject");
+ StringBuilder text = new StringBuilder("LargeObject");
while (text.toString().getBytes().length < (1024 * 100))
{
text.append(text);
@@ -79,7 +73,8 @@
retVal = loader.put(FQN, key, updatedValue);
assertEquals(initialValue, (String) retVal);
assertEquals(updatedValue, (String) loader.get(FQN).get(key));
- } catch (Exception e)
+ }
+ catch (Exception e)
{
fail(e.toString());
}
@@ -99,9 +94,9 @@
}
}
- public void testRootIsCreated() throws Exception
- {
- loader.put(Fqn.fromString("/a/b/c"), "a", "b");
- assertTrue(loader.exists(Fqn.ROOT));
- }
+ public void testRootIsCreated() throws Exception
+ {
+ loader.put(Fqn.fromString("/a/b/c"), "a", "b");
+ assertTrue(loader.exists(Fqn.ROOT));
+ }
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26 21:43:56 UTC (rev 6071)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/mock/NodeSpiMock.java 2008-06-26 22:56:53 UTC (rev 6072)
@@ -1,14 +1,17 @@
package org.jboss.cache.mock;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
/**
* @author Mircea.Markus(a)jboss.com
@@ -117,12 +120,12 @@
((NodeSpiMock) nodeToAdd).fqn = Fqn.fromRelativeElements(fqn, nodeName);
}
- public void printDetails(StringBuffer sb, int indent)
+ public void printDetails(StringBuilder sb, int indent)
{
//skip
}
- public void print(StringBuffer sb, int indent)
+ public void print(StringBuilder sb, int indent)
{
//skip
}
@@ -169,7 +172,7 @@
Object directChildName = childName.get(0);
NodeSpiMock directChild = children.get(directChildName);
Fqn subFqn = childName.getSubFqn(1, childName.size());
- if(directChild == null)
+ if (directChild == null)
{
directChild = newChild(directChildName);
}
@@ -356,7 +359,8 @@
{
data.put(key, newValue);
return true;
- } else
+ }
+ else
return false;
}
@@ -367,7 +371,7 @@
public void replaceAll(Map map)
{
- data = map;
+ data = map;
}
public Object get(Object key)
16 years, 6 months
JBoss Cache SVN: r6071 - in core/trunk/src/test/java/org/jboss/cache: api and 5 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 17:43:56 -0400 (Thu, 26 Jun 2008)
New Revision: 6071
Added:
core/trunk/src/test/java/org/jboss/cache/ComparatorTest.java
Removed:
core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
Modified:
core/trunk/src/test/java/org/jboss/cache/api/CacheAPIOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeAPIOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeMoveOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/LockParentVersionTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ParentVersionTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
Log:
Refactored optimistic locking tests
Copied: core/trunk/src/test/java/org/jboss/cache/ComparatorTest.java (from rev 6055, core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/ComparatorTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/ComparatorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -0,0 +1,174 @@
+package org.jboss.cache;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tests {@link FqnComparator}.
+ *
+ * @author xenephon
+ */
+@Test(groups = "unit")
+public class ComparatorTest
+{
+ FqnComparator comp = new FqnComparator();
+
+ public void testSingleCompare()
+ {
+ Fqn fqn1 = Fqn.fromString("one");
+ Fqn fqn2 = Fqn.fromString("two");
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+ }
+
+ public void testNullCompare()
+ {
+ Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
+ Fqn<String> fqn2 = Fqn.fromList(new ArrayList<String>());
+
+ assertTrue(comp.compare(fqn1, fqn2) == 0);
+ assertTrue(comp.compare(fqn2, fqn1) == 0);
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+ }
+
+ public void testOneNullCompare()
+ {
+ Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
+ List<String> temp = new ArrayList<String>();
+ temp.add("one");
+ Fqn<String> fqn2 = Fqn.fromList(temp);
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+ }
+
+ public void testNotComparableCompare()
+ {
+ Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
+
+ List<String> temp = new ArrayList<String>();
+ temp.add("one");
+ Fqn fqn2 = Fqn.fromList(temp);
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+ }
+
+ public void testMultiChildCompare()
+ {
+
+ Fqn fqn1 = Fqn.fromString("/one/two");
+
+ Fqn fqn2 = Fqn.fromString("/one/two/three");
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ }
+
+ public void testMultiNotChildCompare()
+ {
+
+ Fqn fqn1 = Fqn.fromString("/one/two");
+
+ Fqn fqn2 = Fqn.fromString("/three/four");
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ }
+
+ public void testPartialMultiNotChildCompare()
+ {
+
+ Fqn fqn1 = Fqn.fromString("/one/two");
+
+ Fqn fqn2 = Fqn.fromString("/three");
+
+ assertTrue(comp.compare(fqn1, fqn2) < 0);
+ assertTrue(comp.compare(fqn2, fqn1) > 0);
+
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ }
+
+ public void testEqualsMultidCompare()
+ {
+
+ Fqn fqn1 = Fqn.fromString("/one/two");
+
+ Fqn fqn2 = Fqn.fromString("/one/two");
+
+ assertTrue(comp.compare(fqn1, fqn2) == 0);
+ assertTrue(comp.compare(fqn2, fqn1) == 0);
+
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ }
+
+ public void testStringIntMultidCompare()
+ {
+ Fqn<String> fqn1 = Fqn.fromString("/one/two");
+
+ List<Object> temp = new ArrayList<Object>();
+ temp.add(1234);
+ Fqn<Object> fqn2 = Fqn.fromList(temp);
+
+ assertTrue(comp.compare(fqn1, fqn2) > 0);
+ assertTrue(comp.compare(fqn2, fqn1) < 0);
+
+ assertTrue(comp.compare(fqn2, fqn2) == 0);
+
+ assertTrue(comp.compare(fqn1, fqn1) == 0);
+ }
+
+ public void testOrdinaryObjectCompare()
+ {
+ Fqn<Object> fqn1 = Fqn.fromElements(new XYZ(), new ABC());
+ Fqn fqn2 = Fqn.fromElements("XYZ", "ABC");
+ Fqn<Object> fqn3 = Fqn.fromElements("XYZ", new ABC());
+
+ Fqn<Object> fqn4 = Fqn.fromElements("XYZ", new XYZ());
+
+ assertEquals(0, comp.compare(fqn1, fqn2));
+ assertEquals(0, comp.compare(fqn1, fqn3));
+ assertEquals(0, comp.compare(fqn2, fqn3));
+ assertEquals(true, comp.compare(fqn1, fqn4) < 0);
+ assertEquals(true, comp.compare(fqn4, fqn1) > 0);
+ }
+
+ private static class XYZ
+ {
+ @Override
+ public String toString()
+ {
+ return "XYZ";
+ }
+ }
+
+ private static class ABC
+ {
+ @Override
+ public String toString()
+ {
+ return "ABC";
+ }
+ }
+
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/ComparatorTest.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPIOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPIOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPIOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -7,7 +7,7 @@
/**
* Optimistically locked version of {@link org.jboss.cache.api.CacheAPITest}
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class CacheAPIOptimisticTest extends CacheAPITest
{
@Override
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPIOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPIOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPIOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -9,7 +9,7 @@
/**
* An optimistic version of {@link org.jboss.cache.api.NodeAPITest}
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeAPIOptimisticTest extends NodeAPITest
{
protected NodeLockingScheme getNodeLockingScheme()
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,7 +8,7 @@
import org.testng.annotations.Test;
-
+@Test(groups = {"functional", "optimistic"})
public class NodeMoveOptimisticTest extends NodeMoveAPITest
{
public NodeMoveOptimisticTest()
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,7 +8,7 @@
import org.testng.annotations.Test;
-@Test(groups = {"functional", "jgroups"})
+@Test(groups = {"functional", "optimistic"})
public class NodeReplicatedMoveOptimisticTest extends NodeReplicatedMoveTest
{
public NodeReplicatedMoveOptimisticTest()
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -11,7 +11,7 @@
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = {"functional", "jgroups"})
+@Test(groups = {"functional", "jgroups", "optimistic"})
public class BuddyReplicationWithOptimisticLockingTest extends BuddyReplicationFailoverTest
{
public BuddyReplicationWithOptimisticLockingTest()
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -1,19 +1,19 @@
package org.jboss.cache.invalidation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.FIFOConfiguration;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +24,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class TombstoneEvictionTest
{
private CacheSPI c1, c2;
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -1,10 +1,14 @@
package org.jboss.cache.invalidation;
-import org.jboss.cache.*;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -18,7 +22,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test(groups = {"functional", "jgroups"})
+@Test(groups = {"functional", "optimistic"})
public class VersionInconsistencyTest
{
private Cache cache1, cache2;
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,7 +8,7 @@
import org.testng.annotations.Test;
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class CacheListenerOptimisticTest extends CacheListenerTest
{
public CacheListenerOptimisticTest()
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerOptimisticTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,7 +8,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class RemoteCacheListenerOptimisticTest extends RemoteCacheListenerTest
{
public RemoteCacheListenerOptimisticTest()
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -12,7 +12,12 @@
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.interceptors.*;
+import org.jboss.cache.interceptors.CacheMgmtInterceptor;
+import org.jboss.cache.interceptors.CallInterceptor;
+import org.jboss.cache.interceptors.NotificationInterceptor;
+import org.jboss.cache.interceptors.OptimisticLockingInterceptor;
+import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
+import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.DummyInMemoryCacheLoader;
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
@@ -21,10 +26,10 @@
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionSetup;
+import org.jboss.cache.util.TestingUtil;
import org.jgroups.Address;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
-import org.jboss.cache.util.TestingUtil;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
@@ -40,7 +45,7 @@
/**
* @author manik
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class AbstractOptimisticTestCase
{
// some test data shared among all the test cases
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,8 +8,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.transaction.TransactionSetup;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.transaction.TransactionSetup;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -18,7 +18,7 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-@Test(groups = {"functional", "transaction"})
+@Test(groups = {"functional", "transaction", "optimistic"})
public class AsyncCacheTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache, cache2;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -21,7 +21,7 @@
/**
* @author xenephon
*/
-@Test(groups = {"functional", "transaction"})
+@Test(groups = {"functional", "transaction", "optimistic"})
public class AsyncFullStackInterceptorTest extends AbstractOptimisticTestCase
{
/**
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -33,7 +33,7 @@
import java.util.concurrent.CountDownLatch;
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class CacheTest extends AbstractOptimisticTestCase
{
Log log = LogFactory.getLog(CacheTest.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -22,7 +22,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class ChildMapLazyLoadingTest
{
private CacheSPI<Object, Object> cache;
Deleted: core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -1,176 +0,0 @@
-package org.jboss.cache.optimistic;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.FqnComparator;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tests {@link FqnComparator}.
- *
- * @author xenephon
- */
-@Test(groups = {"functional"})
-public class ComparatorTest
-{
- FqnComparator comp = new FqnComparator();
-
- public void testSingleCompare()
- {
- Fqn fqn1 = Fqn.fromString("one");
- Fqn fqn2 = Fqn.fromString("two");
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- assertTrue(comp.compare(fqn2, fqn2) == 0);
- }
-
- public void testNullCompare()
- {
- Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
- Fqn<String> fqn2 = Fqn.fromList(new ArrayList<String>());
-
- assertTrue(comp.compare(fqn1, fqn2) == 0);
- assertTrue(comp.compare(fqn2, fqn1) == 0);
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- assertTrue(comp.compare(fqn2, fqn2) == 0);
- }
-
- public void testOneNullCompare()
- {
- Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
- List<String> temp = new ArrayList<String>();
- temp.add("one");
- Fqn<String> fqn2 = Fqn.fromList(temp);
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
- }
-
- public void testNotComparableCompare()
- {
- Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
-
- List<String> temp = new ArrayList<String>();
- temp.add("one");
- Fqn fqn2 = Fqn.fromList(temp);
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
- }
-
- public void testMultiChildCompare()
- {
-
- Fqn fqn1 = Fqn.fromString("/one/two");
-
- Fqn fqn2 = Fqn.fromString("/one/two/three");
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
-
- assertTrue(comp.compare(fqn2, fqn2) == 0);
-
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- }
-
- public void testMultiNotChildCompare()
- {
-
- Fqn fqn1 = Fqn.fromString("/one/two");
-
- Fqn fqn2 = Fqn.fromString("/three/four");
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
-
- assertTrue(comp.compare(fqn2, fqn2) == 0);
-
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- }
-
- public void testPartialMultiNotChildCompare()
- {
-
- Fqn fqn1 = Fqn.fromString("/one/two");
-
- Fqn fqn2 = Fqn.fromString("/three");
-
- assertTrue(comp.compare(fqn1, fqn2) < 0);
- assertTrue(comp.compare(fqn2, fqn1) > 0);
-
- assertTrue(comp.compare(fqn2, fqn2) == 0);
-
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- }
-
- public void testEqualsMultidCompare()
- {
-
- Fqn fqn1 = Fqn.fromString("/one/two");
-
- Fqn fqn2 = Fqn.fromString("/one/two");
-
- assertTrue(comp.compare(fqn1, fqn2) == 0);
- assertTrue(comp.compare(fqn2, fqn1) == 0);
-
- assertTrue(comp.compare(fqn2, fqn2) == 0);
-
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- }
-
- public void testStringIntMultidCompare()
- {
- Fqn<String> fqn1 = Fqn.fromString("/one/two");
-
- List<Object> temp = new ArrayList<Object>();
- temp.add(1234);
- Fqn<Object> fqn2 = Fqn.fromList(temp);
-
- assertTrue(comp.compare(fqn1, fqn2) > 0);
- assertTrue(comp.compare(fqn2, fqn1) < 0);
-
- assertTrue(comp.compare(fqn2, fqn2) == 0);
-
- assertTrue(comp.compare(fqn1, fqn1) == 0);
- }
-
- public void testOrdinaryObjectCompare()
- {
- Fqn<Object> fqn1 = Fqn.fromElements(new XYZ(), new ABC());
- Fqn fqn2 = Fqn.fromElements("XYZ", "ABC");
- Fqn<Object> fqn3 = Fqn.fromElements("XYZ", new ABC());
-
- Fqn<Object> fqn4 = Fqn.fromElements("XYZ", new XYZ());
-
- assertEquals(0, comp.compare(fqn1, fqn2));
- assertEquals(0, comp.compare(fqn1, fqn3));
- assertEquals(0, comp.compare(fqn2, fqn3));
- assertEquals(true, comp.compare(fqn1, fqn4) < 0);
- assertEquals(true, comp.compare(fqn4, fqn1) > 0);
- }
-
- private static class XYZ
- {
- @Override
- public String toString()
- {
- return "XYZ";
- }
- }
-
- private static class ABC
- {
- @Override
- public String toString()
- {
- return "ABC";
- }
- }
-
-}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -31,7 +31,7 @@
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class ConcurrentTransactionTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -22,7 +22,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class DataVersionPersistenceTest
{
private Cache cache;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -4,9 +4,9 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -20,7 +20,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.1.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class DataVersionTransferTest
{
private List<Cache<Object, Object>> caches = new ArrayList<Cache<Object, Object>>(2);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -22,7 +22,7 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class FullStackInterceptorTest extends AbstractOptimisticTestCase
{
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -17,7 +17,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class HasChildTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/LockParentVersionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/LockParentVersionTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/LockParentVersionTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -6,7 +6,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class LockParentVersionTest extends ParentVersionTest
{
public LockParentVersionTest()
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -23,7 +23,7 @@
/**
* @author xenephon
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorGetChildrenNamesTest extends AbstractOptimisticTestCase
{
TestListener listener;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -21,19 +21,17 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorGetKeyValTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
- private TestListener listener;
private MockInterceptor dummy;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -21,10 +21,9 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorGetKeysTest extends AbstractOptimisticTestCase
{
- private TestListener listener;
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
private MockInterceptor dummy;
@@ -32,8 +31,7 @@
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -21,19 +21,17 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorKeyValTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
- private TestListener listener;
private MockInterceptor dummy;
private TransactionManager mgr;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -24,19 +24,17 @@
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorPutEraseTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
- private TestListener listener;
private MockInterceptor dummy;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -24,19 +24,17 @@
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorPutMapTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
- private TestListener listener;
private MockInterceptor dummy;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -24,19 +24,17 @@
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorRemoveDataTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
- private TestListener listener;
private MockInterceptor dummy;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -30,19 +30,17 @@
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorRemoveKeyValTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
private TransactionManager mgr;
- private TestListener listener;
private MockInterceptor dummy;
@BeforeMethod
public void setUp() throws Exception
{
- listener = new TestListener();
- cache = createCacheWithListener(listener);
+ cache = createCache();
CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -30,7 +30,7 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
@SuppressWarnings("unchecked")
public class NodeInterceptorRemoveNodeTest extends AbstractOptimisticTestCase
{
@@ -46,7 +46,6 @@
cache = createCacheWithListener(listener);
dummy = new MockInterceptor();
-// dummy.setCache(cache);
cache.addInterceptor(dummy, CallInterceptor.class);
cache.removeInterceptor(CallInterceptor.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -7,35 +7,48 @@
package org.jboss.cache.optimistic;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class NodeInterceptorTransactionTest extends AbstractOptimisticTestCase
{
- public void testNoTransactionCRUDMethod() throws Exception
- {
+ CacheSPI cache;
+ MockInterceptor dummy;
- TestListener listener = new TestListener();
- final CacheSPI cache = createCacheWithListener(listener);
-
+ @BeforeMethod
+ public void setUp() throws Exception
+ {
+ cache = createCache();
CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
CommandInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
- MockInterceptor dummy = new MockInterceptor();
+ dummy = new MockInterceptor();
interceptor.setNext(nodeInterceptor);
nodeInterceptor.setNext(dummy);
TestingUtil.replaceInterceptorChain(cache, interceptor);
+ }
+ @AfterMethod
+ public void tearDown()
+ {
+ TestingUtil.killCaches(cache);
+ }
+
+ public void testNoTransactionCRUDMethod() throws Exception
+ {
+
try
{
cache.put("/one/two", "key1", new Object());
@@ -47,24 +60,10 @@
assertTrue(true);
}
assertEquals(null, dummy.getCalledCommand());
- cache.stop();
}
public void testNoTransactionGetMethod() throws Exception
{
-
- TestListener listener = new TestListener();
- final CacheSPI cache = createCacheWithListener(listener);
-
- CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
- CommandInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
- MockInterceptor dummy = new MockInterceptor();
-
- interceptor.setNext(nodeInterceptor);
- nodeInterceptor.setNext(dummy);
-
- TestingUtil.replaceInterceptorChain(cache, interceptor);
-
boolean fail = false;
try
{
@@ -76,7 +75,6 @@
}
assertTrue(fail);
assertEquals(null, dummy.getCalledCommand());
- cache.stop();
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -18,6 +18,8 @@
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.transaction.Transaction;
@@ -27,17 +29,41 @@
* @author xenephon
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class OptimisticCreateIfNotExistsInterceptorTest extends AbstractOptimisticTestCase
{
-
protected TransactionManager txManager;
protected Transaction tx;
protected GlobalTransaction gtx;
protected TransactionTable table;
protected OptimisticTransactionContext entry;
protected TransactionWorkspace workspace;
+ CacheSPI cache;
+ MockInterceptor dummy;
+ SamplePojo pojo;
+ @BeforeMethod
+ public void setUp() throws Exception
+ {
+ pojo = new SamplePojo(21, "test");
+ cache = createCache();
+ CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+ dummy = new MockInterceptor();
+
+ interceptor.setNext(dummy);
+
+ TestingUtil.replaceInterceptorChain(cache, interceptor);
+
+ setupTransactionsInInvocationCtx(cache);
+ }
+
+ @AfterMethod
+ public void tearDown()
+ {
+ TestingUtil.killCaches(cache);
+ }
+
+
protected void setupTransactionsInInvocationCtx(CacheSPI cache) throws Exception
{
txManager = DummyTransactionManager.getInstance();
@@ -58,20 +84,6 @@
public void testNodeCreation() throws Exception
{
-
- TestListener listener = new TestListener();
- final CacheSPI cache = createCacheWithListener(listener);
-
- CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
- MockInterceptor dummy = new MockInterceptor();
-
- interceptor.setNext(dummy);
-
- TestingUtil.replaceInterceptorChain(cache, interceptor);
-
- setupTransactionsInInvocationCtx(cache);
-
- final SamplePojo pojo = new SamplePojo(21, "test");
cache.put("/one/two", "key1", pojo);
assertEquals(3, workspace.getNodes().size());
@@ -83,25 +95,10 @@
assertTrue(!cache.exists("/one/two"));
assertEquals(PutKeyValueCommand.class, dummy.getCalledCommandClass());
txManager.commit();
-
- cache.stop();
-
}
public void testInvalidTransaction() throws Exception
{
-
- TestListener listener = new TestListener();
- final CacheSPI cache = createCacheWithListener(listener);
-
- CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
- MockInterceptor dummy = new MockInterceptor();
-
- interceptor.setNext(dummy);
- TestingUtil.replaceInterceptorChain(cache, interceptor);
-
- setupTransactionsInInvocationCtx(cache);
- final SamplePojo pojo = new SamplePojo(21, "test");
cache.put("/one/two", "key1", pojo);
assertEquals(3, workspace.getNodes().size());
@@ -128,24 +125,10 @@
{
assertTrue(true);
}
- cache.stop();
-
}
public void testMultiplePut() throws Exception
{
-
- TestListener listener = new TestListener();
- final CacheSPI cache = createCacheWithListener(listener);
-
- CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
- MockInterceptor dummy = new MockInterceptor();
- interceptor.setNext(dummy);
- TestingUtil.replaceInterceptorChain(cache, interceptor);
- SamplePojo pojo = new SamplePojo(21, "test");
-
- setupTransactionsInInvocationCtx(cache);
-
cache.put("/one/two", "key1", pojo);
cache.put("/one/two", "key2", pojo);
@@ -159,10 +142,5 @@
assertEquals(PutKeyValueCommand.class, dummy.getCalledCommandClass());
txManager.commit();
-
- cache.stop();
-
}
-
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -27,7 +27,7 @@
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class OptimisticLockInterceptorTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
Deleted: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -1,662 +0,0 @@
-/*
- * Created on 17-Feb-2005
- *
- *
- *
- */
-package org.jboss.cache.optimistic;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.commands.ReversibleCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.loader.SamplePojo;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionTable;
-import org.jboss.cache.util.TestingUtil;
-import org.jgroups.Address;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author xenephon
- */
-@SuppressWarnings("unchecked")
-@Test(groups = "functional", enabled = false)
-// disabling since this needs to be rewritten to cope with the new OptimisticReplicationInterceptor. This really doesn't test very much right now.
-public class OptimisticReplicationInterceptorTest extends AbstractOptimisticTestCase
-{
- private CacheSPI cache;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
- {
- cache = createCache();
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- TestingUtil.killCaches(cache);
- }
-
- public void testLocalTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
- assertNull(mgr.getTransaction());
-
- mgr.begin();
-
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- mgr.commit();
-
- assertNull(mgr.getTransaction());
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- //make sure all calls were done in right order
-
- List calls = dummy.getAllCalledIds();
-
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
- assertEquals(CommitCommand.METHOD_ID, calls.get(1));
- }
-
- public void testRollbackTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
- assertNull(mgr.getTransaction());
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- SamplePojo pojo = new SamplePojo(21, "test");
- mgr.begin();
- cache.put("/one/two", "key1", pojo);
- mgr.rollback();
- assertNull(mgr.getTransaction());
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- //make sure all calls were done in right order
-
- List calls = dummy.getAllCalledIds();
-
- assertEquals(1, calls.size());
- assertEquals(RollbackCommand.METHOD_ID, calls.get(0));
- }
-
- public void testRemotePrepareTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
- TransactionTable table = cache.getTransactionTable();
- OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
-
- GlobalTransaction remoteGtx = new GlobalTransaction();
-
- remoteGtx.setAddress(new TestAddress());
- //hack the method call to make it have the remote globalTransaction
- ReversibleCommand command = (ReversibleCommand) entry.getModifications().get(0);
- command.setGlobalTransaction(remoteGtx);
-
- //call our remote method
- OptimisticPrepareCommand optimisticPrepareCommand = new OptimisticPrepareCommand(remoteGtx, null, (Address) remoteGtx.getAddress(), false);
- try
- {
- TestingUtil.replicateCommand(cache, optimisticPrepareCommand); //getInvocationDelegate(cache)._replicate(prepareMethod);
- }
- catch (Throwable t)
- {
- fail();
- }
-
- //our thread should be null
- assertNull(mgr.getTransaction());
-
- // there should be a registration for the remote globalTransaction
- assertNotNull(table.get(remoteGtx));
- assertNotNull(table.getLocalTransaction(remoteGtx));
- //assert that this is populated
- assertEquals(1, table.get(remoteGtx).getModifications().size());
-
- //assert that the remote prepare has populated the local workspace
- assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
- assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalledIds();
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
-
-
- assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
-
- }
-
-
- public void testRemoteRollbackTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
- TransactionTable table = cache.getTransactionTable();
- OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
-
- GlobalTransaction remoteGtx = new GlobalTransaction();
-
- remoteGtx.setAddress(new TestAddress());
- //hack the method call to make it have the remote globalTransaction
- ReversibleCommand command = entry.getModifications().get(0);
- command.setGlobalTransaction(remoteGtx);
- //call our remote method
- OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, null, (Address) remoteGtx.getAddress(), false);
- try
- {
- TestingUtil.replicateCommand(cache, prepareCommand);
- }
- catch (Throwable t)
- {
- fail();
- }
-
- //our thread should be null
- assertNull(mgr.getTransaction());
-
- // there should be a registration for the remote globalTransaction
- assertNotNull(table.get(remoteGtx));
- assertNotNull(table.getLocalTransaction(remoteGtx));
- //assert that this is populated
- assertEquals(1, table.get(remoteGtx).getModifications().size());
-
- assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
- assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalledIds();
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
-
-
- assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
-
- // call our remote method
- RollbackCommand cacheCommand = new RollbackCommand(null);
- try
- {
- TestingUtil.replicateCommand(cache, cacheCommand);
- }
- catch (Throwable t)
- {
- fail();
- }
- //we should have the commit as well now
- assertNull(mgr.getTransaction());
- assertEquals(RollbackCommand.METHOD_ID, calls.get(3));
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
- }
-
-
- public void testRemoteCommitNoPrepareTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
- TransactionTable table = cache.getTransactionTable();
- OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
-
- GlobalTransaction remoteGtx = new GlobalTransaction();
-
- remoteGtx.setAddress(new TestAddress());
- //hack the method call to make it have the remote globalTransaction
- ReversibleCommand command = entry.getModifications().get(0);
- command.setGlobalTransaction(remoteGtx);
-
- List calls = dummy.getAllCalledIds();
- assertEquals(2, calls.size());
-
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- // call our remote method
- CommitCommand cacheCommand = new CommitCommand(gtx);
-
- try
- {
- TestingUtil.replicateCommand(cache, cacheCommand);
- fail();
- }
- catch (Throwable t)
- {
- assertTrue(t instanceof RuntimeException);
- //t.printStackTrace();
- }
- //we should have the commit as well now
- assertNull(mgr.getTransaction());
- assertEquals(2, calls.size());
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
- }
-
-
- public void testRemoteRollbackNoPrepareTransaction() throws Throwable
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
- TransactionTable table = cache.getTransactionTable();
- OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
-
- GlobalTransaction remoteGtx = new GlobalTransaction();
-
- remoteGtx.setAddress(new TestAddress());
- //hack the method call to make it have the remote globalTransaction
- ReversibleCommand command = entry.getModifications().get(0);
-
- command.setGlobalTransaction(remoteGtx);
-
- List calls = dummy.getAllCalledIds();
- assertEquals(2, calls.size());
-
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
- // call our remote method
- RollbackCommand cacheCommand = new RollbackCommand(remoteGtx);
-
- TestingUtil.replicateCommand(cache, cacheCommand);
- assertTrue("Should be handled on the remote end without barfing, in the event of a rollback without a prepare", true);
-
- //we should have the commit as well now
- assertNull(mgr.getTransaction());
- assertEquals(2, calls.size());
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
- }
-
-
- public void testRemoteCommitTransaction() throws Exception
- {
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
- TransactionTable table = cache.getTransactionTable();
- OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
-
- GlobalTransaction remoteGtx = new GlobalTransaction();
-
- remoteGtx.setAddress(new TestAddress());
- //hack the method call to make it have the remote globalTransaction
- ReversibleCommand command = entry.getModifications().get(0);
- command.setGlobalTransaction(remoteGtx);
- OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, null, (Address) remoteGtx.getAddress(), false);
- try
- {
- TestingUtil.replicateCommand(cache, prepareCommand);
- }
- catch (Throwable t)
- {
- fail();
- }
-
- //our thread should be null
- assertNull(mgr.getTransaction());
-
- // there should be a registration for the remote globalTransaction
- assertNotNull(table.get(remoteGtx));
- assertNotNull(table.getLocalTransaction(remoteGtx));
- //assert that this is populated
- assertEquals(1, table.get(remoteGtx).getModifications().size());
-
- //assert that the remote prepare has populated the local workspace
- assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
- assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalledIds();
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
-
-
- assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
-
- // call our remote method
- CommitCommand commitCommand = new CommitCommand(remoteGtx);
- try
- {
- TestingUtil.replicateCommand(cache, commitCommand);
- }
- catch (Throwable t)
- {
- fail();
- }
- //we should have the commit as well now
- assertNull(mgr.getTransaction());
- assertEquals(CommitCommand.METHOD_ID, calls.get(3));
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
- }
-
-
- public void testTwoWayRemoteCacheBroadcast() throws Exception
- {
- destroyCache(cache);
- cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
-
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
- MockInterceptor dummy2 = new MockInterceptor();
- setAlteredInterceptorChain(dummy2, cache2);
-
-
- TransactionManager mgr = cache.getTransactionManager();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- assertNotNull(mgr.getTransaction());
- mgr.commit();
-
- assertNull(mgr.getTransaction());
-
- //assert that the local cache is in the right state
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
-
- assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
-
-
- List calls = dummy.getAllCalledIds();
-
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
- assertEquals(CommitCommand.METHOD_ID, calls.get(1));
-
- List calls2 = dummy2.getAllCalledIds();
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls2.get(0));
- assertEquals(CommitCommand.METHOD_ID, calls2.get(1));
-
- destroyCache(cache2);
- }
-
-
- public void testFailurePrepareRemoteCacheBroadcast() throws Exception
- {
- destroyCache(cache);
- cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
-
- MockInterceptor dummy = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
- MockFailureInterceptor dummy2 = new MockFailureInterceptor();
- List failures = new ArrayList();
- failures.add(OptimisticPrepareCommand.class);
- dummy2.setFailurelist(failures);
- setAlteredInterceptorChain(dummy2, cache2);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- assertNotNull(mgr.getTransaction());
- try
- {
- mgr.commit();
- }
- catch (Exception e)
- {
- assertTrue(e instanceof RollbackException);
- }
-
-
- assertNull(mgr.getTransaction());
-
- //assert that the local cache is in the right state
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
-
- assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
-
-
- List calls = dummy.getAllCalledIds();
- assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
- assertEquals(RollbackCommand.METHOD_ID, calls.get(1));
-
- //we have no prepare - as it failed - but we have a commit
- List calls2 = dummy2.getAllCalledIds();
- assertEquals(RollbackCommand.METHOD_ID, calls2.get(0));
-
- destroyCache(cache2);
- }
-
-
- public void testFailurePrepareLocalCacheBroadcast() throws Exception
- {
-
- destroyCache(cache);
- cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
-
- MockFailureInterceptor dummy = new MockFailureInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
- MockInterceptor dummy2 = new MockInterceptor();
- setAlteredInterceptorChain(dummy, cache);
-
- List failures = new ArrayList();
- failures.add(OptimisticPrepareCommand.class);
- dummy.setFailurelist(failures);
-
- DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-
- //start local transaction
- mgr.begin();
- Transaction tx = mgr.getTransaction();
-
- //this sets
- cache.getCurrentTransaction(tx, true);
-
- SamplePojo pojo = new SamplePojo(21, "test");
-
- cache.put("/one/two", "key1", pojo);
-
- assertNotNull(mgr.getTransaction());
- try
- {
- mgr.commit();
- }
- catch (Exception e)
- {
- assertTrue(e instanceof RollbackException);
- }
-
-
- assertNull(mgr.getTransaction());
-
- //assert that the local cache is in the right state
- assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
-
-
- assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
- assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
-
-
- List calls = dummy.getAllCalledIds();
- assertEquals(RollbackCommand.METHOD_ID, calls.get(0));
-
- //we have no prepare - as it failed - but we have a commit
- List calls2 = dummy2.getAllCalledIds();
- assertEquals(0, calls2.size());
-
- destroyCache(cache2);
- }
-
- static class TestAddress implements Address
- {
- private static final long serialVersionUID = -8525272532201600656L;
-
- public boolean isMulticastAddress()
- {
- return false;
- }
-
- public void readExternal(ObjectInput arg0)
- {
- }
-
- public int size()
- {
- return 0;
- }
-
- public void writeExternal(ObjectOutput arg0)
- {
- }
-
- public void writeTo(DataOutputStream arg0)
- {
- }
-
- public void readFrom(DataInputStream arg0)
- {
- }
-
- public int compareTo(Object arg0)
- {
- return 0;
- }
- }
-
-}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -12,7 +12,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
@@ -30,7 +29,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
@SuppressWarnings("unchecked")
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class OptimisticVersioningTest extends AbstractOptimisticTestCase
{
private static final Log log = LogFactory.getLog(OptimisticVersioningTest.class);
@@ -61,8 +60,8 @@
cache1.put(fqn, key, "value");
- DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
- DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
+ DataVersion v1 = cache1.getNode(fqn).getVersion();
+ DataVersion v2 = cache2.getNode(fqn).getVersion();
assertEquals("value", cache1.get(fqn, key));
assertEquals("value", cache2.get(fqn, key));
@@ -124,8 +123,8 @@
}
// data versions should be in sync.
- v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
- v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
+ v1 = cache1.getNode(fqn).getVersion();
+ v2 = cache2.getNode(fqn).getVersion();
assertEquals("Version info should have propagated", v1, v2);
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -20,7 +20,7 @@
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
*/
-@Test(groups = {"functional", "transaction"})
+@Test(groups = {"functional", "transaction", "optimistic"})
public class OptimisticWithCacheLoaderTest extends AbstractOptimisticTestCase
{
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -8,22 +8,19 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import static org.jboss.cache.factories.UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
-import static org.jboss.cache.factories.UnitTestCacheConfigurationFactory.*;
import org.testng.annotations.Test;
-import org.w3c.dom.Element;
/**
* Tests optimistic locking with pasivation
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class OptimisticWithPassivationTest extends AbstractOptimisticTestCase
{
protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ParentVersionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ParentVersionTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ParentVersionTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -16,7 +16,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class ParentVersionTest extends AbstractOptimisticTestCase
{
private Cache<Object, Object> cache;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -3,8 +3,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.config.Configuration;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.AfterMethod;
@@ -16,7 +16,7 @@
/**
* Tests removal of a node before the node is even created.
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class RemoveBeforeCreateTest extends AbstractOptimisticTestCase
{
CacheSPI<Object, Object>[] c = null;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -19,7 +19,7 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class ThreadedCacheAccessTest extends AbstractOptimisticTestCase
{
private static final Log log = LogFactory.getLog(ThreadedCacheAccessTest.class);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -24,7 +24,7 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class ThreadedOptimisticCreateIfNotExistsInterceptorTest extends AbstractOptimisticTestCase
{
protected synchronized void setTransactionsInInvocationCtx(TransactionManager mgr, CacheSPI cache) throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -25,7 +25,7 @@
import javax.transaction.TransactionManager;
import java.util.List;
-@Test(groups = {"functional", "transaction"})
+@Test(groups = {"functional", "transaction", "optimistic"})
public class TxInterceptorTest extends AbstractOptimisticTestCase
{
@Override
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -19,7 +19,7 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class ValidationFailureTest extends AbstractOptimisticTestCase
{
public void testValidationFailureLockRelease() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -40,7 +40,7 @@
/**
* @author xenephon
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class ValidatorInterceptorTest extends AbstractOptimisticTestCase
{
private CacheSPI<Object, Object> cache;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -14,7 +14,7 @@
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "optimistic"})
public class VersioningOnReadTest extends AbstractOptimisticTestCase
{
CacheSPI cache;
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -5,9 +5,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
+import org.jboss.cache.util.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
@SuppressWarnings("unchecked")
public class ExplicitVersionsReplTest
{
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-06-26 21:42:58 UTC (rev 6070)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2008-06-26 21:43:56 UTC (rev 6071)
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-@Test(groups = {"functional"})
+@Test(groups = {"functional", "optimistic"})
public class ExplicitVersionsTest
{
private CacheSPI<String, String> cache;
16 years, 6 months
JBoss Cache SVN: r6070 - in core/trunk/src/main/java/org/jboss/cache: transaction and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 17:42:58 -0400 (Thu, 26 Jun 2008)
New Revision: 6070
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
Log:
Moved pessimistic lock specific rollback code to the PLI and away from the TransactionContext
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-06-26 21:42:34 UTC (rev 6069)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-06-26 21:42:58 UTC (rev 6070)
@@ -10,6 +10,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
@@ -39,8 +40,10 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
/*
@@ -160,7 +163,8 @@
dataContainer.removeFromDataStructure(fqn, false);
}
// 1. Revert the modifications by running the undo-op list in reverse. This *cannot* throw any exceptions !
- transactionContext.undoOperations();
+
+ undoOperations(transactionContext);
}
if (trace)
{
@@ -171,6 +175,38 @@
return retVal;
}
+ private void undoOperations(TransactionContext transactionContext)
+ {
+ List<ReversibleCommand> modificationList = transactionContext.getModifications();
+
+ if (modificationList.isEmpty())
+ {
+ if (trace) log.trace("Modification list is null, no modifications in this transaction!");
+ return;
+ }
+
+ if (trace) log.trace("undoOperations " + modificationList);
+
+ ArrayList<ReversibleCommand> copy;
+ copy = new ArrayList<ReversibleCommand>(modificationList);
+ RuntimeException exc = null;
+ for (ListIterator i = copy.listIterator(copy.size()); i.hasPrevious();)
+ {
+ Object undoOp = i.previous();
+ ReversibleCommand txCommand = (ReversibleCommand) undoOp;
+ if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
+ try
+ {
+ txCommand.rollback();
+ }
+ catch (RuntimeException re)
+ {
+ exc = re;
+ }
+ }
+ if (exc != null) throw exc;
+ }
+
@Override
protected Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
{
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-06-26 21:42:34 UTC (rev 6069)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-06-26 21:42:58 UTC (rev 6070)
@@ -22,7 +22,6 @@
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
/**
* Information associated with a {@link GlobalTransaction} about the transaction state.
@@ -204,32 +203,6 @@
}
}
-
- public void undoOperations()
- {
- if (modificationList == null)
- {
- if (trace) log.trace("Modification list is null, no modifications in this transaction!");
- return;
- }
-
- if (trace) log.trace("undoOperations " + modificationList);
-
- ArrayList<ReversibleCommand> copy;
-// synchronized (modificationList)
-// {
- // no need to sync? Only one thread would access a transaction at any given time?
- copy = new ArrayList<ReversibleCommand>(modificationList);
-// }
- for (ListIterator i = copy.listIterator(copy.size()); i.hasPrevious();)
- {
- Object undoOp = i.previous();
- ReversibleCommand txCommand = (ReversibleCommand) undoOp;
- if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
- txCommand.rollback();
- }
- }
-
/**
* Returns debug information about this transaction.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-06-26 21:42:34 UTC (rev 6069)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-06-26 21:42:58 UTC (rev 6070)
@@ -194,11 +194,6 @@
void setForceSyncReplication(boolean forceSyncReplication);
/**
- * Calls a rollback on all modifications in reverse order.
- */
- void undoOperations();
-
- /**
* Adds an Fqn to the list of uninitialized nodes created by the cache loader.
*
* @param fqn fqn to add. Must not be null.
16 years, 6 months