diff --git a/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TransactionalAccessDelegate.java b/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TransactionalAccessDelegate.java
index f48d77acf8..2b4868fbdc 100755
--- a/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TransactionalAccessDelegate.java
+++ b/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TransactionalAccessDelegate.java
@@ -102,10 +102,6 @@ public class TransactionalAccessDelegate {
cache.clear();
}
-// public void evict(Object key) throws CacheException {
-// cache.evict(key);
-// }
-
public void evictAll() throws CacheException {
evictOrRemoveAll();
}
diff --git a/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java b/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java
index 2c8b7ff08f..41a00deaf5 100644
--- a/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java
+++ b/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/CollectionRegionImpl.java
@@ -17,7 +17,7 @@ import org.infinispan.Cache;
*/
public class CollectionRegionImpl extends BaseTransactionalDataRegion implements CollectionRegion {
- public CollectionRegionImpl(Cache
*
- * This class can also be configured to raise a ClassNotFoundException if
- * asked to load certain classes, thus allowing classes on the classpath
- * to be hidden from a test environment.
+ * This class can also be configured to raise a ClassNotFoundException if asked to load certain
+ * classes, thus allowing classes on the classpath to be hidden from a test environment.
*
- *
+ *
* @author Brian Stansberry
*/
-public class SelectedClassnameClassLoader extends ClassLoader
-{
+public class SelectedClassnameClassLoader extends ClassLoader {
private Logger log = LoggerFactory.getLogger(SelectedClassnameClassLoader.class);
-
+
private String[] includedClasses = null;
private String[] excludedClasses = null;
private String[] notFoundClasses = null;
@@ -66,115 +61,82 @@ public class SelectedClassnameClassLoader extends ClassLoader
/**
* Creates a new classloader that loads the given classes.
- *
- * @param includedClasses array of class or package names that should be
- * directly loaded by this loader. Classes
- * whose name starts with any of the strings
- * in this array will be loaded by this class,
- * unless their name appears in
- * excludedClasses.
- * Can be null
- * @param excludedClasses array of class or package names that should NOT
- * be directly loaded by this loader. Loading of
- * classes whose name starts with any of the
- * strings in this array will be delegated to
- * parent, even if the classes
- * package or classname appears in
- * includedClasses. Typically this
- * parameter is used to exclude loading one or
- * more classes in a package whose other classes
- * are loaded by this object.
- * @param parent ClassLoader to which loading of classes should
- * be delegated if necessary
+ *
+ * @param includedClasses
+ * array of class or package names that should be directly loaded by this loader.
+ * Classes whose name starts with any of the strings in this array will be loaded by
+ * this class, unless their name appears in excludedClasses. Can be
+ * null
+ * @param excludedClasses
+ * array of class or package names that should NOT be directly loaded by this loader.
+ * Loading of classes whose name starts with any of the strings in this array will be
+ * delegated to parent, even if the classes package or classname appears
+ * in includedClasses. Typically this parameter is used to exclude loading
+ * one or more classes in a package whose other classes are loaded by this object.
+ * @param parent
+ * ClassLoader to which loading of classes should be delegated if necessary
*/
- public SelectedClassnameClassLoader(String[] includedClasses,
- String[] excludedClasses,
- ClassLoader parent)
- {
+ public SelectedClassnameClassLoader(String[] includedClasses, String[] excludedClasses, ClassLoader parent) {
this(includedClasses, excludedClasses, null, parent);
}
/**
* Creates a new classloader that loads the given classes.
- *
- * @param includedClasses array of class or package names that should be
- * directly loaded by this loader. Classes
- * whose name starts with any of the strings
- * in this array will be loaded by this class,
- * unless their name appears in
- * excludedClasses.
- * Can be null
- * @param excludedClasses array of class or package names that should NOT
- * be directly loaded by this loader. Loading of
- * classes whose name starts with any of the
- * strings in this array will be delegated to
- * parent, even if the classes
- * package or classname appears in
- * includedClasses. Typically this
- * parameter is used to exclude loading one or
- * more classes in a package whose other classes
- * are loaded by this object.
- * @param notFoundClasses array of class or package names for which this
- * should raise a ClassNotFoundException
- * @param parent ClassLoader to which loading of classes should
- * be delegated if necessary
+ *
+ * @param includedClasses
+ * array of class or package names that should be directly loaded by this loader.
+ * Classes whose name starts with any of the strings in this array will be loaded by
+ * this class, unless their name appears in excludedClasses. Can be
+ * null
+ * @param excludedClasses
+ * array of class or package names that should NOT be directly loaded by this loader.
+ * Loading of classes whose name starts with any of the strings in this array will be
+ * delegated to parent, even if the classes package or classname appears
+ * in includedClasses. Typically this parameter is used to exclude loading
+ * one or more classes in a package whose other classes are loaded by this object.
+ * @param notFoundClasses
+ * array of class or package names for which this should raise a ClassNotFoundException
+ * @param parent
+ * ClassLoader to which loading of classes should be delegated if necessary
*/
- public SelectedClassnameClassLoader(String[] includedClasses,
- String[] excludedClasses,
- String[] notFoundClasses,
- ClassLoader parent)
- {
+ public SelectedClassnameClassLoader(String[] includedClasses, String[] excludedClasses, String[] notFoundClasses,
+ ClassLoader parent) {
super(parent);
this.includedClasses = includedClasses;
this.excludedClasses = excludedClasses;
this.notFoundClasses = notFoundClasses;
-
+
log.debug("created " + this);
}
- protected synchronized Class> loadClass(String name, boolean resolve)
- throws ClassNotFoundException
- {
+ protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
log.trace("loadClass(" + name + "," + resolve + ")");
- if (isIncluded(name) && (isExcluded(name) == false))
- {
+ if (isIncluded(name) && (isExcluded(name) == false)) {
Class c = findClass(name);
- if (resolve)
- {
+ if (resolve) {
resolveClass(c);
}
return c;
- }
- else if (isNotFound(name))
- {
+ } else if (isNotFound(name)) {
throw new ClassNotFoundException(name + " is discarded");
- }
- else
- {
+ } else {
return super.loadClass(name, resolve);
}
}
- protected Class> findClass(String name) throws ClassNotFoundException
- {
+ protected Class> findClass(String name) throws ClassNotFoundException {
log.trace("findClass(" + name + ")");
Class result = classes.get(name);
- if (result != null)
- {
+ if (result != null) {
return result;
}
- if (isIncluded(name) && (isExcluded(name) == false))
- {
+ if (isIncluded(name) && (isExcluded(name) == false)) {
result = createClass(name);
- }
- else if (isNotFound(name))
- {
+ } else if (isNotFound(name)) {
throw new ClassNotFoundException(name + " is discarded");
- }
- else
- {
+ } else {
result = super.findClass(name);
}
@@ -183,41 +145,30 @@ public class SelectedClassnameClassLoader extends ClassLoader
return result;
}
- protected Class createClass(String name) throws ClassFormatError, ClassNotFoundException
- {
+ protected Class createClass(String name) throws ClassFormatError, ClassNotFoundException {
log.info("createClass(" + name + ")");
- try
- {
+ try {
InputStream is = getResourceAsStream(name.replace('.', '/').concat(".class"));
byte[] bytes = new byte[1024];
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
int read;
- while ((read = is.read(bytes)) > -1)
- {
+ while ((read = is.read(bytes)) > -1) {
baos.write(bytes, 0, read);
}
bytes = baos.toByteArray();
return this.defineClass(name, bytes, 0, bytes.length);
- }
- catch (FileNotFoundException e)
- {
+ } catch (FileNotFoundException e) {
throw new ClassNotFoundException("cannot find " + name, e);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
throw new ClassNotFoundException("cannot read " + name, e);
}
}
- protected boolean isIncluded(String className)
- {
+ protected boolean isIncluded(String className) {
- if (includedClasses != null)
- {
- for (int i = 0; i < includedClasses.length; i++)
- {
- if (className.startsWith(includedClasses[i]))
- {
+ if (includedClasses != null) {
+ for (int i = 0; i < includedClasses.length; i++) {
+ if (className.startsWith(includedClasses[i])) {
return true;
}
}
@@ -226,15 +177,11 @@ public class SelectedClassnameClassLoader extends ClassLoader
return false;
}
- protected boolean isExcluded(String className)
- {
+ protected boolean isExcluded(String className) {
- if (excludedClasses != null)
- {
- for (int i = 0; i < excludedClasses.length; i++)
- {
- if (className.startsWith(excludedClasses[i]))
- {
+ if (excludedClasses != null) {
+ for (int i = 0; i < excludedClasses.length; i++) {
+ if (className.startsWith(excludedClasses[i])) {
return true;
}
}
@@ -243,15 +190,11 @@ public class SelectedClassnameClassLoader extends ClassLoader
return false;
}
- protected boolean isNotFound(String className)
- {
+ protected boolean isNotFound(String className) {
- if (notFoundClasses != null)
- {
- for (int i = 0; i < notFoundClasses.length; i++)
- {
- if (className.startsWith(notFoundClasses[i]))
- {
+ if (notFoundClasses != null) {
+ for (int i = 0; i < notFoundClasses.length; i++) {
+ if (className.startsWith(notFoundClasses[i])) {
return true;
}
}
@@ -259,8 +202,8 @@ public class SelectedClassnameClassLoader extends ClassLoader
return false;
}
-
- public String toString() {
+
+ public String toString() {
String s = getClass().getName();
s += "[includedClasses=";
s += listClasses(includedClasses);
@@ -273,9 +216,10 @@ public class SelectedClassnameClassLoader extends ClassLoader
s += "]";
return s;
}
-
+
private static String listClasses(String[] classes) {
- if (classes == null) return null;
+ if (classes == null)
+ return null;
String s = "";
for (int i = 0; i < classes.length; i++) {
if (i > 0)
@@ -284,5 +228,5 @@ public class SelectedClassnameClassLoader extends ClassLoader
}
return s;
}
-
+
}
diff --git a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/SelectedClassnameClassLoaderTestSetup.java b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/SelectedClassnameClassLoaderTestSetup.java
index 74c12ec4ca..9b011b2b73 100644
--- a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/SelectedClassnameClassLoaderTestSetup.java
+++ b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/SelectedClassnameClassLoaderTestSetup.java
@@ -20,30 +20,24 @@ import junit.extensions.TestSetup;
import junit.framework.Test;
/**
- * A TestSetup that makes SelectedClassnameClassLoader the thread
- * context classloader for the duration of the test.
+ * A TestSetup that makes SelectedClassnameClassLoader the thread context classloader for the
+ * duration of the test.
*
* @author Brian Stansberry
* @version $Revision: 1 $
*/
-public class SelectedClassnameClassLoaderTestSetup extends TestSetup
-{
+public class SelectedClassnameClassLoaderTestSetup extends TestSetup {
private ClassLoader originalTCCL;
private String[] includedClasses;
private String[] excludedClasses;
private String[] notFoundClasses;
-
-
+
/**
* Create a new SelectedClassnameClassLoaderTestSetup.
*
* @param test
*/
- public SelectedClassnameClassLoaderTestSetup(Test test,
- String[] includedClasses,
- String[] excludedClasses,
- String[] notFoundClasses)
- {
+ public SelectedClassnameClassLoaderTestSetup(Test test, String[] includedClasses, String[] excludedClasses, String[] notFoundClasses) {
super(test);
this.includedClasses = includedClasses;
this.excludedClasses = excludedClasses;
@@ -51,10 +45,9 @@ public class SelectedClassnameClassLoaderTestSetup extends TestSetup
}
@Override
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
-
+
originalTCCL = Thread.currentThread().getContextClassLoader();
ClassLoader parent = originalTCCL == null ? getClass().getClassLoader() : originalTCCL;
ClassLoader selectedTCCL = new SelectedClassnameClassLoader(includedClasses, excludedClasses, notFoundClasses, parent);
@@ -62,12 +55,9 @@ public class SelectedClassnameClassLoaderTestSetup extends TestSetup
}
@Override
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
Thread.currentThread().setContextClassLoader(originalTCCL);
super.tearDown();
}
-
-
}
diff --git a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/EntityCollectionInvalidationTestCase.java b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/EntityCollectionInvalidationTestCase.java
index 5522418939..edf1107669 100644
--- a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/EntityCollectionInvalidationTestCase.java
+++ b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/EntityCollectionInvalidationTestCase.java
@@ -244,17 +244,6 @@ public class EntityCollectionInvalidationTestCase extends AbstractDualNodeTestCa
Customer customer = doGetCustomer(id, session, tm);
customer.setName("NewJBoss");
ids.customerId = customer.getId();
-
-// Set contacts = customer.getContacts();
-// for (Contact c : contacts) {
-// if (c.getName().equals("Kabir")) {
-// contacts.remove(c);
-// } else {
-// contactIds.add(c.getId());
-// }
-// }
-// ids.contactIds = contactIds;
-// customer.setContacts(contacts);
Set contacts = customer.getContacts();
for (Contact c : contacts) {
contactIds.add(c.getId());
@@ -356,27 +345,6 @@ public class EntityCollectionInvalidationTestCase extends AbstractDualNodeTestCa
}
}
}
-
-// @CacheEntryModified
-// public void nodeModified(CacheEntryModifiedEvent event) {
-// log.debug(event.toString());
-// if (!event.isPre()) {
-// MarshalledValue mv = (MarshalledValue) event.getKey();
-// CacheKey cacheKey = (CacheKey) mv.get();
-// Integer primKey = (Integer) cacheKey.getKey();
-// String key = (String) cacheKey.getEntityOrRoleName() + '#' + primKey;
-// log.debug("MyListener[" + name +"] - Modified key " + key);
-// // String name = fqn.toString();
-// String token = ".functional.";
-// int index = key.indexOf(token);
-// if (index > -1) {
-// index += token.length();
-// key = key.substring(index);
-// log.debug("MyListener[" + name +"] - recording modification of " + key);
-// visited.add(key);
-// }
-// }
-// }
}
private class IdContainer {
diff --git a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/query/QueryRegionImplTestCase.java b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/query/QueryRegionImplTestCase.java
index 7ac9231c8b..103ade40db 100644
--- a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/query/QueryRegionImplTestCase.java
+++ b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/query/QueryRegionImplTestCase.java
@@ -172,10 +172,6 @@ public class QueryRegionImplTestCase extends AbstractGeneralDataRegionTestCase {
getDoesNotBlockPutTest();
}
- // public void testGetDoesNotBlockPutPessimisticRepeatableRead() throws Exception {
- // getDoesNotBlockPutTest();
- // }
-
private void getDoesNotBlockPutTest() throws Exception {
Configuration cfg = createConfiguration();
InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
diff --git a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaTransactionImpl.java b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaTransactionImpl.java
index c01a2b4ea1..b68e75de6c 100644
--- a/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaTransactionImpl.java
+++ b/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaTransactionImpl.java
@@ -81,12 +81,6 @@ public class XaTransactionImpl implements Transaction {
s.beforeCompletion();
}
-// if (!runXaResourcePrepare()) {
-// status = Status.STATUS_ROLLING_BACK;
-// } else {
-// status = Status.STATUS_PREPARED;
-// }
-
status = Status.STATUS_COMMITTING;
if (connection != null) {
@@ -99,8 +93,6 @@ public class XaTransactionImpl implements Transaction {
}
}
-// runXaResourceCommitTx();
-
status = Status.STATUS_COMMITTED;
for (int i = 0; i < synchronizations.size(); i++) {
@@ -114,8 +106,6 @@ public class XaTransactionImpl implements Transaction {
}
public void rollback() throws IllegalStateException, SystemException {
-// status = Status.STATUS_ROLLING_BACK;
-// runXaResourceRollback();
status = Status.STATUS_ROLLEDBACK;
if (connection != null) {