Author: jason.greene(a)jboss.com
Date: 2008-08-13 22:46:03 -0400 (Wed, 13 Aug 2008)
New Revision: 6557
Removed:
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransfer200AopTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java
Modified:
pojo/trunk/pom.xml
pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedArray.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedPrimitiveArray.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/AbstractInterceptor.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/util/AopUtil.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ArrayTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NonAspectizedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ObjectGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/TxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/demo/JBossCacheGUI.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListenerCountTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/TxObjectTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/util/ObjectUtilTest.java
Log:
Update to be compatible with core API changes
Update to commons logging 1.1.1
Drop two old out-of-date tests
Modified: pojo/trunk/pom.xml
===================================================================
--- pojo/trunk/pom.xml 2008-08-13 20:29:58 UTC (rev 6556)
+++ pojo/trunk/pom.xml 2008-08-14 02:46:03 UTC (rev 6557)
@@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-pojo-version>2.2.0-SNAPSHOT</jbosscache-pojo-version>
- <jbosscache-core-version>2.2.0.CR6</jbosscache-core-version>
- <jboss.aop.version>2.0.0.CR14</jboss.aop.version>
+ <jbosscache-pojo-version>3.0.0-SNAPSHOT</jbosscache-pojo-version>
+ <jbosscache-core-version>3.0.0.ALPHA2</jbosscache-core-version>
+ <jboss.aop.version>2.0.0.CR15</jboss.aop.version>
</properties>
<parent>
<groupId>org.jboss.cache</groupId>
@@ -40,7 +40,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
+ <version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
@@ -115,7 +115,7 @@
</systemProperties>
<groups>functional</groups>
<forkMode>always</forkMode>
-
<argLine>-Djboss.aop.path=${basedir}/src/main/resources/META-INF/pojocache-aop.xml
-javaagent:${settings.localRepository}/org/jboss/aop/jboss-aop/${jboss.aop.version}/jboss-aop-${jboss.aop.version}.jar</argLine>
+ <argLine>-Djbosscache.config.validate=false
-Djboss.aop.path=${basedir}/src/main/resources/META-INF/pojocache-aop.xml
-javaagent:${settings.localRepository}/org/jboss/aop/jboss-aop/${jboss.aop.version}/jboss-aop-${jboss.aop.version}.jar</argLine>
<!-- Warning, this does not work right on 2.4-SNAPSHOT, (see SUREFIRE-349)
-->
<!-- This seems to fail in some cases on 2.3 as well, disable for now
-->
<useSystemClassLoader>true</useSystemClassLoader>
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -83,7 +83,7 @@
* @return Existing POJO or null if there is none.
* @throws PojoCacheException Throws if there is an error related to the cache
operation.
*/
- Object attach(Fqn<?> id, Object pojo) throws PojoCacheException;
+ Object attach(Fqn id, Object pojo) throws PojoCacheException;
/**
* Remove POJO object from the cache.
@@ -102,7 +102,7 @@
* @return Original value object from this node.
* @throws PojoCacheException Throws if there is an error related to the cache
operation.
*/
- Object detach(Fqn<?> id) throws PojoCacheException;
+ Object detach(Fqn id) throws PojoCacheException;
/**
* Return the <code>Fqn</code> of the internal node containing the data of
this attached object.
@@ -116,7 +116,7 @@
* @return <code>Fqn</code> of the internal data node.
<code>null</code> if the object is
* immediate, serializable, or not in the cache.
*/
- Fqn<?> getInternalFqn(Object object);
+ Fqn getInternalFqn(Object object);
/**
* Return a list of the references from attached objects to this object. For each
reference it
@@ -147,7 +147,7 @@
* @param id the location in the cache to examine
* @return true if an attached object exists, false if not
*/
- boolean exists(Fqn<?> id);
+ boolean exists(Fqn id);
/**
* Retrieve POJO from the cache system. Return null if object does not exist in the
cache.
@@ -168,7 +168,7 @@
* @return Current content value. Null if does not exist.
* @throws PojoCacheException Throws if there is an error related to the cache
operation.
*/
- Object find(Fqn<?> id) throws PojoCacheException;
+ Object find(Fqn id) throws PojoCacheException;
/**
* Query all managed POJO objects under the id recursively. Note that this will not
return
@@ -181,7 +181,7 @@
* @return Map of all POJOs found with (id, POJO) pair. Return size of 0, if not
found.
* @throws PojoCacheException Throws if there is an error related to the cache
operation.
*/
- Map<Fqn<?>, Object> findAll(String id) throws PojoCacheException;
+ Map<Fqn, Object> findAll(String id) throws PojoCacheException;
/**
* Query all managed POJO objects under the id recursively. Note that this will not
return
@@ -195,7 +195,7 @@
* @return Map of all POJOs found with (id, POJO) pair. Return size of 0, if not
found.
* @throws PojoCacheException Throws if there is an error related to the cache
operation.
*/
- Map<Fqn<?>, Object> findAll(Fqn<?> id) throws PojoCacheException;
+ Map<Fqn, Object> findAll(Fqn id) throws PojoCacheException;
/**
* Lifecycle method to start PojoCache.
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -37,7 +37,7 @@
*
* @return <code>Fqn</code> of the referring node.
*/
- public Fqn<?> getFqn();
+ public Fqn getFqn();
/**
* Returns the name of the node key which references the attached object, or null
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedArray.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedArray.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedArray.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -37,18 +37,18 @@
{
private static final String LENGTH = "ARRAY.LENGTH";
protected PojoCacheImpl cache;
- protected Fqn<?> fqn;
+ protected Fqn fqn;
private int length = -1;
private Class<?> type;
- public static CachedArray load(Fqn<?> fqn, PojoCacheImpl cache, Class<?>
type)
+ public static CachedArray load(Fqn fqn, PojoCacheImpl cache, Class<?> type)
{
boolean primitive = CachedType.isImmediate(type.getComponentType());
CachedArray array = primitive ? new CachedPrimitiveArray(fqn, type, cache) : new
CachedObjectArray(fqn, type, cache);
return array;
}
- public static CachedArray create(Fqn<?> fqn, PojoCacheImpl cache, Object
originalArray)
+ public static CachedArray create(Fqn fqn, PojoCacheImpl cache, Object originalArray)
{
Class<?> type = originalArray.getClass();
assert type.isArray();
@@ -67,14 +67,14 @@
return array;
}
- protected CachedArray(Fqn<?> fqn, Class<?> type, PojoCacheImpl cache)
+ protected CachedArray(Fqn fqn, Class<?> type, PojoCacheImpl cache)
{
this.fqn = fqn;
this.type = type;
this.cache = cache;
}
- public Fqn<?> getFqn()
+ public Fqn getFqn()
{
return fqn;
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -54,7 +54,7 @@
throw new PojoCacheException("Non-serializable for " +
relative.getClass().getName());
}
- return new Fqn(baseFqn, relative);
+ return Fqn.fromRelativeElements(baseFqn, relative);
}
private Fqn getFqn()
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java
===================================================================
---
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -40,14 +40,14 @@
// so that multi-dimensional arrays can be handled properly
private static ArrayInterceptable arraySource = new ArrayInterceptable() {};
- protected CachedObjectArray(Fqn<?> fqn, Class<?> type, PojoCacheImpl
cache)
+ protected CachedObjectArray(Fqn fqn, Class<?> type, PojoCacheImpl cache)
{
super(fqn, type, cache);
}
public void set(int index, Object element)
{
- Fqn<?> fqn = AopUtil.constructFqn(this.fqn, IntegerCache.toString(index));
+ Fqn fqn = AopUtil.constructFqn(this.fqn, IntegerCache.toString(index));
cache.attach(fqn, Null.toNullObject(element), null, arraySource);
cache.getCache().put(fqn, InternalConstant.POJOCACHE_OPERATION, "SET");
@@ -55,7 +55,7 @@
public Object get(int index)
{
- Fqn<?> fqn = AopUtil.constructFqn(this.fqn, IntegerCache.toString(index));
+ Fqn fqn = AopUtil.constructFqn(this.fqn, IntegerCache.toString(index));
return Null.toNullValue(cache.find(fqn, null, arraySource));
}
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedPrimitiveArray.java
===================================================================
---
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedPrimitiveArray.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedPrimitiveArray.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -34,7 +34,7 @@
{
private static final String ELEMENT = "ARRAY.PELEMENT.";
- protected CachedPrimitiveArray(Fqn<?> fqn, Class<?> type, PojoCacheImpl
cache)
+ protected CachedPrimitiveArray(Fqn fqn, Class<?> type, PojoCacheImpl cache)
{
super(fqn, type, cache);
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -34,11 +34,11 @@
protected abstract boolean handles(Class<?> clazz);
- protected abstract Object remove(Fqn<?> fqn, Reference reference, Object
result);
+ protected abstract Object remove(Fqn fqn, Reference reference, Object result);
- protected abstract void put(Fqn<?> fqn, Reference reference, Object obj);
+ protected abstract void put(Fqn fqn, Reference reference, Object obj);
- protected abstract Object get(Fqn<?> fqn, Class<?> clazz, PojoInstance
pojoInstance);
+ protected abstract Object get(Fqn fqn, Class<?> clazz, PojoInstance
pojoInstance);
- protected abstract Fqn<?> getFqn(Object obj);
+ protected abstract Fqn getFqn(Object obj);
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -64,7 +64,7 @@
}
@Override
- protected Fqn<?> getFqn(Object obj)
+ protected Fqn getFqn(Object obj)
{
if (obj instanceof Advised)
{
@@ -82,7 +82,7 @@
}
@Override
- protected Object get(Fqn<?> fqn, Class<?> clazz, PojoInstance
pojoInstance) throws CacheException
+ protected Object get(Fqn fqn, Class<?> clazz, PojoInstance pojoInstance) throws
CacheException
{
CachedType type = pCache_.getCachedType(clazz);
Object obj = Instantiator.newInstance(clazz);
@@ -117,7 +117,7 @@
}
@Override
- protected void put(Fqn<?> fqn, Reference reference, Object obj) throws
CacheException
+ protected void put(Fqn fqn, Reference reference, Object obj) throws CacheException
{
CachedType type = pCache_.getCachedType(obj.getClass());
// We have a clean slate then.
@@ -202,7 +202,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object result)
throws CacheException
+ protected Object remove(Fqn fqn, Reference referencingFqn, Object result) throws
CacheException
{
CachedType type = pCache_.getCachedType(result.getClass());
InstanceAdvisor advisor = ((Advised) result)._getInstanceAdvisor();
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -41,14 +41,14 @@
this.cache = cache;
}
- protected Fqn<?> getFqn(Object array)
+ protected Fqn getFqn(Object array)
{
CachedArray cached = CachedArrayRegistry.lookup(array);
return cached != null ? cached.getFqn() : null;
}
@Override
- protected void put(Fqn<?> fqn, Reference reference, Object obj)
+ protected void put(Fqn fqn, Reference reference, Object obj)
{
// Always initialize the ref count so that we can mark this as an AopNode.
PojoInstance pojoInstance = InternalHelper.initializeAopInstance(reference);
@@ -61,7 +61,7 @@
}
@Override
- protected Object get(Fqn<?> fqn, Class<?> clazz, PojoInstance pojo)
+ protected Object get(Fqn fqn, Class<?> clazz, PojoInstance pojo)
{
CachedArray cached = CachedArray.load(fqn, cache, clazz);
Object array = cached.toArray();
@@ -71,7 +71,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object obj)
+ protected Object remove(Fqn fqn, Reference referencingFqn, Object obj)
{
CachedArray cached = CachedArrayRegistry.lookup(obj);
if (cached != null) {
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java
===================================================================
---
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -42,7 +42,7 @@
internal_ = internal;
}
- protected Fqn<?> getFqn(Object collection)
+ protected Fqn getFqn(Object collection)
{
if (! (collection instanceof ClassProxy))
return null;
@@ -266,7 +266,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object obj) throws
CacheException
+ protected Object remove(Fqn fqn, Reference referencingFqn, Object obj) throws
CacheException
{
if (!(obj instanceof ClassProxy))
{
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -21,9 +21,9 @@
public static final String SERIALIZED = "__SERIALIZED__";
public static final String JBOSS_INTERNAL_STRING = "__JBossInternal__";
public static final String JBOSS_INTERNAL_ID_SEP_STRING = "_ID_";
- public static final Fqn<String> JBOSS_INTERNAL = new
Fqn<String>(JBOSS_INTERNAL_STRING);
- public static final Fqn<String> JBOSS_INTERNAL_ID_SEP = new
Fqn<String>(JBOSS_INTERNAL_ID_SEP_STRING);
- public static final Fqn<String> JBOSS_INTERNAL_MAP = new
Fqn<String>(InternalConstant.JBOSS_INTERNAL, "__RefMap__");
+ public static final Fqn JBOSS_INTERNAL = Fqn.fromString(JBOSS_INTERNAL_STRING);
+ public static final Fqn JBOSS_INTERNAL_ID_SEP =
Fqn.fromString(JBOSS_INTERNAL_ID_SEP_STRING);
+ public static final Fqn JBOSS_INTERNAL_MAP =
Fqn.fromRelativeElements(InternalConstant.JBOSS_INTERNAL, "__RefMap__");
public static final String JBOSS_INTERNAL_STATIC = "__jboss:static__";
public static final String POJOCACHE_KEY_PREFIX = "POJOCache.";
public static final String POJOCACHE_STATUS = POJOCACHE_KEY_PREFIX +
"Status";
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -279,7 +279,7 @@
throw new IllegalStateException("InternalDelegate.getInternalFqn(). fqn is
either null or empty!");
String indirectFqn = getIndirectFqn(fqn);
- return new Fqn(InternalConstant.JBOSS_INTERNAL_MAP, indirectFqn);
+ return Fqn.fromRelativeElements(InternalConstant.JBOSS_INTERNAL_MAP, indirectFqn);
// return JBOSS_INTERNAL_MAP;
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -33,7 +33,7 @@
internal_ = internal;
}
- protected Fqn<?> getFqn(Object obj)
+ protected Fqn getFqn(Object obj)
{
return null;
}
@@ -44,7 +44,7 @@
}
@Override
- protected Object get(Fqn<?> fqn, Class<?> clazz, PojoInstance
pojoInstance) throws CacheException
+ protected Object get(Fqn fqn, Class<?> clazz, PojoInstance pojoInstance) throws
CacheException
{
// Note this is actually the aliasFqn, not the real fqn!
Object obj;
@@ -58,12 +58,12 @@
}
@Override
- protected void put(Fqn<?> fqn, Reference reference, Object obj) throws
CacheException
+ protected void put(Fqn fqn, Reference reference, Object obj) throws CacheException
{
setupRefCounting(fqn, reference);
}
- boolean isMultipleReferenced(Fqn<?> internalFqn)
+ boolean isMultipleReferenced(Fqn internalFqn)
{
// Note this is actually the aliasFqn, not the real fqn!
PojoInstance pojoInstance = null;
@@ -81,7 +81,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Reference reference, Object pojo)
+ protected Object remove(Fqn fqn, Reference reference, Object pojo)
throws CacheException
{
if (log.isDebugEnabled())
@@ -97,7 +97,7 @@
/**
* Remove the object from the the reference fqn, meaning just decrement the ref
counter.
*/
- private void removeFromReference(Fqn<?> originalFqn, Reference reference) throws
CacheException
+ private void removeFromReference(Fqn originalFqn, Reference reference) throws
CacheException
{
if (decrementRefCount(originalFqn, reference) ==
PojoInstance.INITIAL_COUNTER_VALUE)
{
@@ -114,18 +114,18 @@
* @param fqn The original fqn node
* @param refFqn The new internal fqn node
*/
- private void setupRefCounting(Fqn<?> fqn, Reference reference) throws
CacheException
+ private void setupRefCounting(Fqn fqn, Reference reference) throws CacheException
{
// increment the reference counting
incrementRefCount(fqn, reference);
}
- private int incrementRefCount(Fqn<?> originalFqn, Reference reference) throws
CacheException
+ private int incrementRefCount(Fqn originalFqn, Reference reference) throws
CacheException
{
return internal_.incrementRefCount(originalFqn, reference);
}
- private int decrementRefCount(Fqn<?> originalFqn, Reference reference) throws
CacheException
+ private int decrementRefCount(Fqn originalFqn, Reference reference) throws
CacheException
{
return internal_.decrementRefCount(originalFqn, reference);
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -120,7 +120,7 @@
return oldValue;// we are done
AbstractHandler handler = getHandler(obj.getClass(), allowArray);
- Fqn<?> internalFqn = handler.getFqn(obj);
+ Fqn internalFqn = handler.getFqn(obj);
Reference reference = new ReferenceImpl(fqn, field);
if (internalFqn != null)
@@ -232,7 +232,7 @@
return null;
}
- Fqn<?> internalFqn = pojoReference.getFqn();
+ Fqn internalFqn = pojoReference.getFqn();
@@ -285,9 +285,9 @@
return map;
}
- private Object getObjectInternal(Fqn<?> fqn, String field, Object source) throws
CacheException
+ private Object getObjectInternal(Fqn fqn, String field, Object source) throws
CacheException
{
- Fqn<?> internalFqn = fqn;
+ Fqn internalFqn = fqn;
PojoReference pojoReference = internal_.getPojoReference(fqn, field);
if (pojoReference != null)
{
@@ -347,21 +347,21 @@
}
}
- public boolean exists(Fqn<?> id)
+ public boolean exists(Fqn id)
{
return internal_.getPojoReference(id, null) != null ||
internal_.getPojoInstance(id) != null;
}
- public Fqn<?> getInternalFqn(Object object)
+ public Fqn getInternalFqn(Object object)
{
AbstractHandler handler = getHandler(object.getClass(), true);
- Fqn<?> internalFqn = handler.getFqn(object);
+ Fqn internalFqn = handler.getFqn(object);
return internalFqn;
}
public Collection<Reference> getReferences(Object object)
{
- Fqn<?> fqn = getInternalFqn(object);
+ Fqn fqn = getInternalFqn(object);
if (fqn == null)
return Collections.emptyList();
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -8,7 +8,6 @@
package org.jboss.cache.pojo.impl;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
@@ -26,7 +25,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Version;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.config.OldFileFormatException;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheException;
import org.jboss.cache.pojo.PojoCacheThreadContext;
@@ -64,6 +65,12 @@
init(expected, toStart);
}
+ catch (OldFileFormatException e)
+ {
+ log_.warn("Detected legacy configuration file format when parsing [" +
configStr + "]. Migrating to the new (3.x) file format is recommended. See FAQs for
details.");
+ XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
+ init(oldParser.parseFile(configStr), toStart);
+ }
catch (Exception e)
{
throw new PojoCacheException("Failed to start " + configStr, e);
@@ -79,7 +86,7 @@
{
try
{
- cache = (CacheSPI<Object, Object>)
DefaultCacheFactory.getInstance().createCache(config, toStart);
+ cache = (CacheSPI<Object, Object>) (new
DefaultCacheFactory()).createCache(config, toStart);
}
catch (Exception e)
{
@@ -99,12 +106,12 @@
return attach(Fqn.fromString(id), pojo);
}
- public Object attach(Fqn<?> id, Object pojo) throws PojoCacheException
+ public Object attach(Fqn id, Object pojo) throws PojoCacheException
{
return attach(id, pojo, null, null);
}
- public Object attach(Fqn<?> id, Object pojo, String field, Object source) throws
PojoCacheException
+ public Object attach(Fqn id, Object pojo, String field, Object source) throws
PojoCacheException
{
TransactionManager tm = getTransactionManager();
boolean createdTransaction = setupTransaction(tm);
@@ -125,7 +132,7 @@
}
}
- public Object detach(Fqn<?> id, String field, Object source) throws
PojoCacheException
+ public Object detach(Fqn id, String field, Object source) throws PojoCacheException
{
TransactionManager tm = getTransactionManager();
boolean createdTransaction = setupTransaction(tm);
@@ -146,7 +153,7 @@
}
}
- private void endTransaction(TransactionManager tm, Fqn<?> id)
+ private void endTransaction(TransactionManager tm, Fqn id)
{
try
{
@@ -222,12 +229,12 @@
- public Object detach(Fqn<?> id) throws PojoCacheException
+ public Object detach(Fqn id) throws PojoCacheException
{
return detach(id, null, null);
}
- public Fqn<?> getInternalFqn(Object object)
+ public Fqn getInternalFqn(Object object)
{
return delegate_.getInternalFqn(object);
}
@@ -237,7 +244,7 @@
return delegate_.getReferences(object);
}
- public boolean exists(Fqn<?> id)
+ public boolean exists(Fqn id)
{
return delegate_.exists(id);
}
@@ -247,7 +254,7 @@
return find(Fqn.fromString(id));
}
- public Object find(Fqn<?> id) throws PojoCacheException
+ public Object find(Fqn id) throws PojoCacheException
{
try
{
@@ -259,18 +266,18 @@
}
}
- public Object find(Fqn<?> id, String field, Object source) throws
CacheException
+ public Object find(Fqn id, String field, Object source) throws CacheException
{
return delegate_.getObject(id, field, source);
}
- public Map<Fqn<?>, Object> findAll(String id) throws PojoCacheException
+ public Map<Fqn, Object> findAll(String id) throws PojoCacheException
{
return findAll(Fqn.fromString(id));
}
- public Map<Fqn<?>, Object> findAll(Fqn<?> id) throws
PojoCacheException
+ public Map<Fqn, Object> findAll(Fqn id) throws PojoCacheException
{
// Should produce "/"
if (id == null) id = Fqn.ROOT;
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -40,10 +40,10 @@
{
private static final long serialVersionUID = 2647262858847953704L;
- private Fqn<?> fqn;
+ private Fqn fqn;
private String key;
- public ReferenceImpl(Fqn<?> fqn)
+ public ReferenceImpl(Fqn fqn)
{
this(fqn, null);
}
@@ -52,7 +52,7 @@
* @param fqn <code>Fqn</code> of the referring node. Cannot be
<code>null</code>.
* @param key Name of the field, index in the field or key in the collection that is
containing the reference.
*/
- public ReferenceImpl(Fqn<?> fqn, String key)
+ public ReferenceImpl(Fqn fqn, String key)
{
if (fqn == null)
throw new IllegalArgumentException("Fqn can not be null!!");
@@ -66,7 +66,7 @@
return key;
}
- public Fqn<?> getFqn()
+ public Fqn getFqn()
{
return fqn;
}
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java
===================================================================
---
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -38,7 +38,7 @@
internal_ = internal;
}
- protected Fqn<?> getFqn(Object obj)
+ protected Fqn getFqn(Object obj)
{
// Not supported
return null;
@@ -59,7 +59,7 @@
@Override
- protected void put(Fqn<?> fqn, Reference reference, Object obj) throws
CacheException
+ protected void put(Fqn fqn, Reference reference, Object obj) throws CacheException
{
// Note that JBoss Serialization can serialize any type now.
if (log_.isDebugEnabled())
@@ -87,7 +87,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Reference reference, Object result) throws
CacheException
+ protected Object remove(Fqn fqn, Reference reference, Object result) throws
CacheException
{
cache.removeNode(fqn);
return result;
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/AbstractInterceptor.java
===================================================================
---
pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/AbstractInterceptor.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/AbstractInterceptor.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -12,7 +12,7 @@
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.pojo.impl.PojoCacheImpl;
/**
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -21,6 +21,22 @@
*/
package org.jboss.cache.pojo.jmx;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.AttributeChangeNotification;
+import javax.management.JMException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
@@ -31,7 +47,10 @@
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
+import org.jboss.cache.config.parsing.element.BuddyElementParser;
+import org.jboss.cache.config.parsing.element.EvictionElementParser;
+import org.jboss.cache.config.parsing.element.LoadersElementParser;
import org.jboss.cache.jmx.CacheJmxWrapper;
import org.jboss.cache.jmx.CacheNotificationListener;
import org.jboss.cache.pojo.PojoCache;
@@ -44,21 +63,9 @@
import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Element;
-import javax.management.AttributeChangeNotification;
-import javax.management.JMException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.transaction.TransactionManager;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
+
+
public class PojoCacheJmxWrapper
implements PojoCacheJmxWrapperMBean, MBeanRegistration, NotificationEmitter
{
@@ -85,6 +92,11 @@
private Element clusterConfig;
private JChannelFactoryMBean multiplexerService;
+ private BuddyElementParser buddyElementParser = new BuddyElementParser();
+ private LoadersElementParser loadersElementParser = new LoadersElementParser();
+ private EvictionElementParser evictionElementParser = new EvictionElementParser();
+ private JGroupsStackParser stackParser = new JGroupsStackParser();
+
/**
* Default constructor.
*/
@@ -477,7 +489,7 @@
BuddyReplicationConfig brc = null;
if (config != null)
{
- brc = XmlConfigurationParser.parseBuddyReplicationConfig(config);
+ brc = buddyElementParser.parseBuddyElement(config);
}
getConfiguration().setBuddyReplicationConfig(brc);
this.buddyReplConfig = config;
@@ -488,7 +500,7 @@
CacheLoaderConfig clc = null;
if (cache_loader_config != null)
{
- clc = XmlConfigurationParser.parseCacheLoaderConfig(cache_loader_config);
+ clc = loadersElementParser.parseLoadersElement(cache_loader_config);
}
getConfiguration().setCacheLoaderConfig(clc);
this.cacheLoaderConfig = cache_loader_config;
@@ -511,7 +523,7 @@
String props = null;
if (config != null)
{
- props = XmlConfigurationParser.parseClusterConfigXml(config);
+ props = stackParser.parseClusterConfigXml(config);
}
getConfiguration().setClusterConfig(props);
this.clusterConfig = config;
@@ -538,7 +550,7 @@
EvictionConfig ec = null;
if (config != null)
{
- ec = XmlConfigurationParser.parseEvictionConfig(config);
+ ec = evictionElementParser.parseEvictionElement(config);
}
getConfiguration().setEvictionConfig(ec);
this.evictionConfig = config;
@@ -719,7 +731,7 @@
registered = false;
}
- // ---------------------------------------------------- NotificationEmitter
+ // ---------------------------------------------------- NotificationEmitter
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
@@ -849,7 +861,7 @@
CacheJmxWrapper plainCache = new CacheJmxWrapper();
plainCache.setRegisterInterceptors(getRegisterInterceptors());
plainCache.setCache(pojoCache.getCache());
- // It shouldn't send out lifecycle state change notifications for itself;
+ // It shouldn't send out lifecycle state change notifications for itself;
// we do it
plainCache.setDisableStateChangeNotifications(true);
@@ -939,7 +951,7 @@
if (plainCacheWrapper != null)
{
long now = System.currentTimeMillis();
-
+
AttributeChangeNotification stateChangeNotification = new
AttributeChangeNotification(
this,
plainCacheWrapper.getNextNotificationSequenceNumber(), now, msg,
@@ -947,7 +959,7 @@
new Integer(oldState), new Integer(newState)
);
stateChangeNotification.setUserData(t);
-
+
plainCacheWrapper.sendNotification(stateChangeNotification);
}
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/util/AopUtil.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/util/AopUtil.java 2008-08-13 20:29:58
UTC (rev 6556)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/util/AopUtil.java 2008-08-14 02:46:03
UTC (rev 6557)
@@ -134,7 +134,7 @@
// TODO Don't know why. But this will fail the CachedSetAopTest clear() method
since look up is always
// Null at the last index. But why?
// TODO also see JBCACHE-282
- return new Fqn(baseFqn, relative.toString());
+ return Fqn.fromRelativeElements(baseFqn, relative.toString());
// String tmp = baseFqn.toString() +"/" + relative.toString();
// return Fqn.fromString(tmp);
@@ -154,7 +154,7 @@
Fqn trueId = null;
if (fqn.hasElement(InternalConstant.JBOSS_INTERNAL_ID_SEP_STRING))
{
- List list = new ArrayList();
+ List<Object> list = new ArrayList<Object>();
for (int i = 0; i < fqn.size(); i++)
{
if (fqn.get(i).equals(InternalConstant.JBOSS_INTERNAL_STRING))
@@ -168,7 +168,7 @@
}
list.add(fqn.get(i));
}
- trueId = new Fqn(list);
+ trueId = Fqn.fromList(list);
}
else
{
@@ -183,9 +183,9 @@
if (region == null || region.getFqn().equals(Fqn.ROOT))
{
// Move id under JBInternal to promote concurrency
- Fqn f0 = new Fqn(InternalConstant.JBOSS_INTERNAL, trueId);
- Fqn f = new Fqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
- return new Fqn(f, Fqn.fromString(guid.toString()));
+ Fqn f0 = Fqn.fromRelativeFqn(InternalConstant.JBOSS_INTERNAL, trueId);
+ Fqn f = Fqn.fromRelativeFqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
+ return Fqn.fromRelativeElements(f, guid.toString());
}
else
{
@@ -193,10 +193,10 @@
Fqn rf = region.getFqn();
// Extract rest of fqn id
Fqn childf = trueId.getSubFqn(rf.size(), trueId.size());
- Fqn f0 = new Fqn(InternalConstant.JBOSS_INTERNAL, childf);
- Fqn f = new Fqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
- Fqn f1 = new Fqn(rf, f);
- return new Fqn(f1, Fqn.fromString(guid.toString()));
+ Fqn f0 = Fqn.fromRelativeFqn(InternalConstant.JBOSS_INTERNAL, childf);
+ Fqn f = Fqn.fromRelativeFqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
+ Fqn f1 = Fqn.fromRelativeFqn(rf, f);
+ return Fqn.fromRelativeElements(f1, guid.toString());
}
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ArrayTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/ArrayTest.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/ArrayTest.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -56,7 +56,7 @@
cache1.start();
cache2 =
PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
- //cache2.getCache().addCacheListener(new MyCacheListener(false));
+ cache2.getCache().addCacheListener(new MyCacheListener(false));
cache2.start();
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -40,7 +40,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -28,7 +28,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
@@ -82,7 +82,7 @@
log.info("testNoReferences() ....");
Person joe = createPerson("/person/joe", "Joe Black", 32,
null);
- Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
+ Fqn joesInternalFqn = cache_.getInternalFqn(joe);
assertTrue("Internal Fqn not null", joesInternalFqn != null);
Collection<Reference> addressReferences = cache_.getReferences(joe);
@@ -97,7 +97,7 @@
Address address = createAddress();
Person joe = createPerson("/person/joe", "Joe Black", 32,
address);
- Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
+ Fqn joesInternalFqn = cache_.getInternalFqn(joe);
Collection<Reference> addressReferences = cache_.getReferences(address);
assertEquals("Size", 1, addressReferences.size());
@@ -112,8 +112,8 @@
Person joe = createPerson("/person/joe", "Joe Black", 32,
address);
Person jane = createPerson("/person/jane", "Jane Black", 32,
address);
- Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
- Fqn<?> janesInternalFqn = cache_.getInternalFqn(jane);
+ Fqn joesInternalFqn = cache_.getInternalFqn(joe);
+ Fqn janesInternalFqn = cache_.getInternalFqn(jane);
HashSet<Reference> expectedReferences = new
HashSet<Reference>(Arrays.<Reference> asList(
new ReferenceImpl(joesInternalFqn, "address"), new
ReferenceImpl(janesInternalFqn, "address")));
@@ -129,7 +129,7 @@
DoubleRef doubleRef = new DoubleRef();
cache_.attach("/doubleref", doubleRef);
- Fqn<?> sourceFqn = cache_.getInternalFqn(doubleRef);
+ Fqn sourceFqn = cache_.getInternalFqn(doubleRef);
HashSet<Reference> expectedReferences = new
HashSet<Reference>(Arrays.<Reference> asList(
new ReferenceImpl(sourceFqn, "one"), new ReferenceImpl(sourceFqn,
"two")));
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -89,7 +89,7 @@
{
cachingMode_ = caching_mode;
boolean toStart = false;
- cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml",
toStart);
+ cache_ = PojoCacheFactory.createCache("configs/local-tx.xml", toStart);
cache_.start();
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -44,7 +44,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
@@ -400,7 +400,7 @@
public void testExists() throws Exception
{
- Fqn<String> fqn = Fqn.fromString("/person/test1");
+ Fqn fqn = Fqn.fromString("/person/test1");
createPerson(fqn.toString(), "Joe Black", 32);
assertTrue(cache_.exists(fqn));
assertFalse(cache_.exists(Fqn.fromString("/blah")));
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -51,7 +51,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java 2008-08-13 20:29:58
UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java 2008-08-14 02:46:03
UTC (rev 6557)
@@ -38,7 +38,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -177,7 +177,7 @@
addr.addResidents("Ben");
addr.addResidents("Joe");
// Test serialization first
- Fqn<String> fqn = Fqn.fromString("/plain");
+ Fqn fqn = Fqn.fromString("/plain");
cache_.getCache().put(fqn, "test", addr);
cache_.getCache().remove(fqn, "test");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NonAspectizedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NonAspectizedTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NonAspectizedTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -28,7 +28,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ObjectGraphTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/ObjectGraphTest.java 2008-08-13 20:29:58
UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/ObjectGraphTest.java 2008-08-14 02:46:03
UTC (rev 6557)
@@ -27,7 +27,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -13,7 +13,7 @@
@Test(groups = {"functional"})
public class RecursiveRefTest
{
- private static final String CONFIG_FILENAME = "META-INF/local-service.xml";
+ private static final String CONFIG_FILENAME = "configs/local-tx.xml";
private PojoCache cache;
Log log = LogFactory.getLog(RecursiveRefTest.class);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/TxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/TxUndoTest.java 2008-08-13 20:29:58 UTC
(rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/TxUndoTest.java 2008-08-14 02:46:03 UTC
(rev 6557)
@@ -47,7 +47,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -42,7 +42,7 @@
public void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -40,7 +40,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -48,7 +48,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -50,7 +50,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -34,7 +34,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -39,7 +39,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/demo/JBossCacheGUI.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/demo/JBossCacheGUI.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/demo/JBossCacheGUI.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -595,9 +595,9 @@
private Node getNode(Object[] path)
{
- Fqn<String> fqnToPath;
+ Fqn fqnToPath;
if (path.length == 0) fqnToPath = Fqn.ROOT;
- List<String> elements = convertMyNodeArrayToStringArray(path);
+ List<Object> elements = convertMyNodeArrayToStringArray(path);
fqnToPath = Fqn.fromList(elements);
if (root.hasChild(fqnToPath))
{
@@ -610,9 +610,9 @@
}
}
- private List<String> convertMyNodeArrayToStringArray(Object[] path)
+ private List<Object> convertMyNodeArrayToStringArray(Object[] path)
{
- List<String> list = new LinkedList<String>();
+ List<Object> list = new LinkedList<Object>();
for (Object o : path)
{
JBossCacheGUI.DisplayNode n = (JBossCacheGUI.DisplayNode) o;
@@ -741,7 +741,7 @@
}
}
- private void load(Fqn<String> fqn)
+ private void load(Fqn fqn)
{
try
{
@@ -1153,19 +1153,19 @@
* Adds a new node to the view. Intermediary nodes will be created if they
don't yet exist.
* Returns the first node that was created or null if node already existed
*/
- public JBossCacheGUI.DisplayNode add(Fqn<String> fqn)
+ public JBossCacheGUI.DisplayNode add(Fqn fqn)
{
JBossCacheGUI.DisplayNode curr, n, ret = null;
if (fqn == null) return null;
curr = this;
- for (String child_name : fqn.peekElements())
+ for (Object child_name : fqn.peekElements())
{
- n = curr.findChild(child_name);
+ n = curr.findChild(child_name.toString());
if (n == null)
{
- n = new JBossCacheGUI.DisplayNode(child_name);
+ n = new JBossCacheGUI.DisplayNode(child_name.toString());
if (ret == null) ret = n;
curr.add(n);
}
@@ -1184,16 +1184,16 @@
}
- private JBossCacheGUI.DisplayNode findNode(Fqn<String> fqn)
+ private JBossCacheGUI.DisplayNode findNode(Fqn fqn)
{
JBossCacheGUI.DisplayNode curr, n;
if (fqn == null) return null;
curr = this;
- for (String child_name : fqn.peekElements())
+ for (Object child_name : fqn.peekElements())
{
- n = curr.findChild(child_name);
+ n = curr.findChild(child_name.toString());
if (n == null)
{
return null;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -45,6 +45,7 @@
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.eviction.FIFOConfiguration;
import org.jboss.cache.eviction.FIFOPolicy;
import org.jboss.cache.eviction.LRUConfiguration;
@@ -56,7 +57,6 @@
import org.jboss.cache.loader.jdbm.JdbmCacheLoader;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.BatchModeTransactionManagerLookup;
-import org.jboss.cache.xml.XmlHelper;
import org.jgroups.ChannelFactory;
import org.jgroups.JChannelFactory;
import org.testng.annotations.Test;
@@ -239,134 +239,120 @@
protected static Element getBuddyReplicationConfig() throws Exception
{
- String xmlString =
"<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n"
+
- "
<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
- "
<buddyLocatorClass>org.jboss.cache.buddyreplication.TestBuddyLocator</buddyLocatorClass>\n"
+
- " <buddyLocatorProperties>numBuddies =
2</buddyLocatorProperties>\n" +
- "
<buddyPoolName>testpool</buddyPoolName>" +
- "
<autoDataGravitation>false</autoDataGravitation>\n" +
- "
<dataGravitationRemoveOnFind>false</dataGravitationRemoveOnFind>\n" +
- "
<dataGravitationSearchBackupTrees>false</dataGravitationSearchBackupTrees>"
+
- "</config>";
- return XmlHelper.stringToElement(xmlString);
+ String xmlStr =
+ " <buddy enabled=\"true\" poolName=\"testpool\"
communicationTimeout=\"600000\">\n" +
+ " <dataGravitation auto=\"false\"
removeOnFind=\"false\" searchBackupTrees=\"false\"/>\n" +
+ " <locator
class=\"org.jboss.cache.buddyreplication.TestBuddyLocator\">\n" +
+ " <properties>\n" +
+ " numBuddies = 2\n" +
+ " </properties>\n" +
+ " </locator>\n" +
+ " </buddy>";
+ return XmlConfigHelper.stringToElement(xmlStr);
}
protected static Element getCacheLoaderConfig() throws Exception
{
- String xml = "<config>\n" +
- "<passivation>false</passivation>\n" +
- "<preload>/foo</preload>\n" +
- "<shared>true</shared>\n" +
- "<cacheloader>\n" +
-
"<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
- "<properties>" +
- " location=/tmp\n" +
- "</properties>\n" +
- "<async>false</async>\n" +
-
"<fetchPersistentState>true</fetchPersistentState>\n" +
-
"<ignoreModifications>true</ignoreModifications>\n" +
- "<purgeOnStartup>true</purgeOnStartup>\n" +
- "<singletonStore>" +
- "<enabled>true</enabled>" +
- "</singletonStore>" +
- "</cacheloader>\n" +
- "<cacheloader>\n" +
-
"<class>org.jboss.cache.loader.jdbm.JdbmCacheLoader</class>\n" +
- "<properties>" +
- " location=/home/bstansberry\n" +
- "</properties>\n" +
- "<async>true</async>\n" +
-
"<fetchPersistentState>false</fetchPersistentState>\n" +
-
"<ignoreModifications>false</ignoreModifications>\n" +
- "<purgeOnStartup>false</purgeOnStartup>\n" +
- "<singletonStore>" +
- "<enabled>false</enabled>" +
- "</singletonStore>" +
- "</cacheloader>\n" +
- "</config>";
- return XmlHelper.stringToElement(xml);
+ String xmlStr =
+ " <loaders passivation=\"false\"
shared=\"true\">\n" +
+ " <preload>\n" +
+ " <node fqn=\"/foo\"/>\n" +
+ " </preload>\n" +
+ " <loader
class=\"org.jboss.cache.loader.FileCacheLoader\" async=\"false\"
fetchPersistentState=\"true\"\n" +
+ " ignoreModifications=\"true\"
purgeOnStartup=\"true\">\n" +
+ " <properties>\n" +
+ " location=/tmp\n " +
+ " </properties>\n" +
+ " <singletonStore enabled=\"true\" />
\n" +
+ " </loader>\n" +
+ " <loader
class=\"org.jboss.cache.loader.jdbm.JdbmCacheLoader\" async=\"true\"
fetchPersistentState=\"false\"\n" +
+ " ignoreModifications=\"false\"
purgeOnStartup=\"false\">\n" +
+ " <properties>\n" +
+ " location=/home/bstansberry\n" +
+ " </properties>\n" +
+ " <singletonStore enabled=\"false\" />
\n" +
+ " </loader>\n" +
+ " </loaders>";
+ return XmlConfigHelper.stringToElement(xmlStr);
}
protected static Element getEvictionPolicyConfig() throws Exception
{
- String xml = "<config>\n" +
- "<attribute
name=\"wakeUpIntervalSeconds\">5</attribute>\n" +
- "<attribute
name=\"eventQueueSize\">20000</attribute>\n" +
- "<attribute
name=\"policyClass\">org.jboss.cache.eviction.LRUPolicy</attribute>\n"
+
- "<region name=\"/_default_\"
eventQueueSize=\"1000\">\n" +
- " <attribute
name=\"maxNodes\">5000</attribute>\n" +
- " <attribute
name=\"timeToLiveSeconds\">1000</attribute>\n" +
- "</region>\n" +
- "<region name=\"/org/jboss/data\"
policyClass=\"org.jboss.cache.eviction.FIFOPolicy\">\n" +
- " <attribute
name=\"maxNodes\">5000</attribute>\n" +
- "</region>\n" +
- "<region name=\"/test/\"
policyClass=\"org.jboss.cache.eviction.MRUPolicy\">\n" +
- " <attribute
name=\"maxNodes\">10000</attribute>\n" +
- "</region>\n" +
- "<region name=\"/maxAgeTest/\">\n" +
- " <attribute
name=\"maxNodes\">10000</attribute>\n" +
- " <attribute
name=\"timeToLiveSeconds\">8</attribute>\n" +
- " <attribute
name=\"maxAgeSeconds\">10</attribute>\n" +
- "</region>\n" +
- " </config>\n";
- return XmlHelper.stringToElement(xml);
+ String xmlStr =
+ " <eviction wakeUpInterval=\"5000\"
defaultPolicyClass=\"org.jboss.cache.eviction.LRUPolicy\"
defaultEventQueueSize=\"20000\">\n" +
+ " <default eventQueueSize=\"1000\">\n" +
+ " <attribute
name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute
name=\"timeToLive\">1000000</attribute>\n" +
+ " </default>\n" +
+ "<region name=\"/org/jboss/data\"
policyClass=\"org.jboss.cache.eviction.FIFOPolicy\">\n" +
+ " <attribute
name=\"maxNodes\">5000</attribute>\n" +
+ "</region>\n" +
+ "<region name=\"/test/\"
policyClass=\"org.jboss.cache.eviction.MRUPolicy\">\n" +
+ " <attribute
name=\"maxNodes\">10000</attribute>\n" +
+ "</region>\n" +
+ "<region name=\"/maxAgeTest/\">\n" +
+ " <attribute
name=\"maxNodes\">10000</attribute>\n" +
+ " <attribute
name=\"timeToLiveSeconds\">8</attribute>\n" +
+ " <attribute
name=\"maxAgeSeconds\">10</attribute>\n" +
+ "</region>\n" +
+ " </eviction>";
+ return XmlConfigHelper.stringToElement(xmlStr);
}
protected static Element getClusterConfig() throws Exception
- {
- String xml =
- "<config>\n" +
- " <UDP mcast_addr=\"228.10.10.10\"\n" +
- " mcast_port=\"45588\"\n" +
- " tos=\"8\"\n" +
- " ucast_recv_buf_size=\"20000000\"\n" +
- " ucast_send_buf_size=\"640000\"\n" +
- " mcast_recv_buf_size=\"25000000\"\n" +
- " mcast_send_buf_size=\"640000\"\n" +
- " loopback=\"false\"\n" +
- " discard_incompatible_packets=\"true\"\n" +
- " max_bundle_size=\"64000\"\n" +
- " max_bundle_timeout=\"30\"\n" +
- " use_incoming_packet_handler=\"true\"\n" +
- " ip_ttl=\"2\"\n" +
- " enable_bundling=\"false\"\n" +
- " enable_diagnostics=\"true\"\n" +
- " use_concurrent_stack=\"true\"\n" +
- " thread_naming_pattern=\"pl\"\n" +
- " thread_pool.enabled=\"true\"\n" +
- " thread_pool.min_threads=\"1\"\n" +
- " thread_pool.max_threads=\"25\"\n" +
- " thread_pool.keep_alive_time=\"30000\"\n" +
- " thread_pool.queue_enabled=\"true\"\n" +
- " thread_pool.queue_max_size=\"10\"\n" +
- " thread_pool.rejection_policy=\"Run\"\n" +
- " oob_thread_pool.enabled=\"true\"\n" +
- " oob_thread_pool.min_threads=\"1\"\n" +
- " oob_thread_pool.max_threads=\"4\"\n" +
- " oob_thread_pool.keep_alive_time=\"10000\"\n"
+
- " oob_thread_pool.queue_enabled=\"true\"\n" +
- " oob_thread_pool.queue_max_size=\"10\"\n" +
- "
oob_thread_pool.rejection_policy=\"Run\"/>\n" +
- " <PING timeout=\"2000\"
num_initial_members=\"3\"/>\n" +
- " <MERGE2 max_interval=\"30000\"
min_interval=\"10000\"/>\n" +
- " <FD_SOCK/>\n" +
- " <FD timeout=\"10000\" max_tries=\"5\"
shun=\"true\"/>\n" +
- " <VERIFY_SUSPECT timeout=\"1500\"/>\n" +
- " <pbcast.NAKACK max_xmit_size=\"60000\"\n" +
- " use_mcast_xmit=\"false\"
gc_lag=\"0\"\n" +
- "
retransmit_timeout=\"300,600,1200,2400,4800\"\n" +
- "
discard_delivered_msgs=\"true\"/>\n" +
- " <UNICAST
timeout=\"300,600,1200,2400,3600\"/>\n" +
- " <pbcast.STABLE stability_delay=\"1000\"
desired_avg_gossip=\"50000\"\n" +
- " max_bytes=\"400000\"/>\n" +
- " <pbcast.GMS print_local_addr=\"true\"
join_timeout=\"5000\"\n" +
- " join_retry_timeout=\"2000\"
shun=\"false\"\n" +
- " view_bundling=\"true\"
view_ack_collection_timeout=\"5000\"/>\n" +
- " <FRAG2 frag_size=\"60000\"/>\n" +
- " <pbcast.STREAMING_STATE_TRANSFER
use_reading_thread=\"true\"/>\n" +
- " <pbcast.FLUSH timeout=\"0\"/>\n" +
- "</config>";
- return XmlHelper.stringToElement(xml);
+ {String xml =
+ "<jgroupsConfig>\n" +
+ "<UDP mcast_addr=\"228.10.10.10\"\n" +
+ " mcast_port=\"45588\"\n" +
+ " tos=\"8\"\n" +
+ " ucast_recv_buf_size=\"20000000\"\n" +
+ " ucast_send_buf_size=\"640000\"\n" +
+ " mcast_recv_buf_size=\"25000000\"\n" +
+ " mcast_send_buf_size=\"640000\"\n" +
+ " loopback=\"false\"\n" +
+ " discard_incompatible_packets=\"true\"\n" +
+ " max_bundle_size=\"64000\"\n" +
+ " max_bundle_timeout=\"30\"\n" +
+ " use_incoming_packet_handler=\"true\"\n" +
+ " ip_ttl=\"2\"\n" +
+ " enable_bundling=\"false\"\n" +
+ " enable_diagnostics=\"true\"\n" +
+ " use_concurrent_stack=\"true\"\n" +
+ " thread_naming_pattern=\"pl\"\n" +
+ " thread_pool.enabled=\"true\"\n" +
+ " thread_pool.min_threads=\"1\"\n" +
+ " thread_pool.max_threads=\"25\"\n" +
+ " thread_pool.keep_alive_time=\"30000\"\n" +
+ " thread_pool.queue_enabled=\"true\"\n" +
+ " thread_pool.queue_max_size=\"10\"\n" +
+ " thread_pool.rejection_policy=\"Run\"\n" +
+ " oob_thread_pool.enabled=\"true\"\n" +
+ " oob_thread_pool.min_threads=\"1\"\n" +
+ " oob_thread_pool.max_threads=\"4\"\n" +
+ " oob_thread_pool.keep_alive_time=\"10000\"\n" +
+ " oob_thread_pool.queue_enabled=\"true\"\n" +
+ " oob_thread_pool.queue_max_size=\"10\"\n" +
+ " oob_thread_pool.rejection_policy=\"Run\"/>\n" +
+ " <PING timeout=\"2000\"
num_initial_members=\"3\"/>\n" +
+ " <MERGE2 max_interval=\"30000\"
min_interval=\"10000\"/>\n" +
+ " <FD_SOCK/>\n" +
+ " <FD timeout=\"10000\" max_tries=\"5\"
shun=\"true\"/>\n" +
+ " <VERIFY_SUSPECT timeout=\"1500\"/>\n" +
+ " <pbcast.NAKACK max_xmit_size=\"60000\"\n" +
+ " use_mcast_xmit=\"false\"
gc_lag=\"0\"\n" +
+ "
retransmit_timeout=\"300,600,1200,2400,4800\"\n" +
+ " discard_delivered_msgs=\"true\"/>\n" +
+ " <UNICAST timeout=\"300,600,1200,2400,3600\"/>\n" +
+ " <pbcast.STABLE stability_delay=\"1000\"
desired_avg_gossip=\"50000\"\n" +
+ " max_bytes=\"400000\"/>\n" +
+ " <pbcast.GMS print_local_addr=\"true\"
join_timeout=\"5000\"\n" +
+ " join_retry_timeout=\"2000\"
shun=\"false\"\n" +
+ " view_bundling=\"true\"
view_ack_collection_timeout=\"5000\"/>\n" +
+ " <FRAG2 frag_size=\"60000\"/>\n" +
+ " <pbcast.STREAMING_STATE_TRANSFER
use_reading_thread=\"true\"/>\n" +
+ " <pbcast.FLUSH timeout=\"0\"/>\n" +
+ "</jgroupsConfig>";
+return XmlConfigHelper.stringToElement(xml);
}
class MockInvocationHandler implements InvocationHandler
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -72,13 +72,13 @@
ClassLoader cla = getClassLoader();
WeakReference<ClassLoader> refa = new WeakReference<ClassLoader>(cla);
- cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(cla);
+ cache_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(cla);
ClassLoader clb = getClassLoader();
WeakReference<ClassLoader> refb = new WeakReference<ClassLoader>(clb);
- cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clb);
+ cache_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clb);
- Fqn<String> fqn = new Fqn<String>("/aop");
- cache_.getCache().put(new Fqn<String>("/aop"), "add",
add);
+ Fqn fqn = Fqn.fromString("/aop");
+ cache_.getCache().put(Fqn.fromString("/aop"), "add", add);
TestingUtil.sleepThread(100);
try
@@ -97,8 +97,8 @@
ClassLoader clc = getClassLoader();
cla = null;
clb = null;
- cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
- cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
+ cache_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clc);
+ cache1_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clc);
System.gc(); // force gc
Thread.sleep(1000);
assertNull("Classloader should be gced ", refa.get());
@@ -140,9 +140,9 @@
ClassLoader cla = getClassLoader();
WeakReference<ClassLoader> refa = new WeakReference<ClassLoader>(cla);
- cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(cla);
+ cache_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(cla);
ClassLoader clb = getClassLoader();
- cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clb);
+ cache1_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clb);
WeakReference<ClassLoader> refb = new WeakReference<ClassLoader>(clb);
cache_.attach("/aop", p);
@@ -161,8 +161,8 @@
cache_.detach("/aop");
ClassLoader clc = getClassLoader();
- cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
- cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
+ cache_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clc);
+ cache1_.getCache().getRegion(Fqn.fromString("/aop"),
true).registerContextClassLoader(clc);
cla = null;
clb = null;
forceOutOfMemoryError();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -55,7 +55,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListenerCountTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListenerCountTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListenerCountTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -31,7 +31,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -54,7 +54,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -40,7 +40,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -55,7 +55,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/TxObjectTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/TxObjectTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/TxObjectTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -58,7 +58,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -31,11 +31,14 @@
import javax.transaction.TransactionManager;
import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.VersionedDataCommand;
+import org.jboss.cache.commands.legacy.ReversibleCommand;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -44,7 +47,6 @@
import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.xml.XmlHelper;
import org.testng.annotations.AfterMethod;
import org.w3c.dom.Element;
@@ -56,7 +58,7 @@
private int instanceNumber;
// some test data shared among all the test cases
- protected Fqn<String> fqn = Fqn.fromString("/blah");
+ protected Fqn fqn = Fqn.fromString("/blah");
protected String key = "myKey", value = "myValue";
protected String getTempDir()
@@ -119,30 +121,17 @@
return createCacheWithLoader(false);
}
- protected CacheLoaderConfig getCacheLoaderConfig(boolean shared, String filename,
boolean passivation) throws Exception
+ protected CacheLoaderConfig getCacheLoaderConfig(boolean shared, boolean passivation)
throws Exception
{
- String xml = " <config>\n" +
- " <passivation>" + passivation +
"</passivation>\n" +
- " <preload></preload>\n" +
- " <shared>" + shared +
"</shared>\n" +
- " <cacheloader>\n" +
- "
<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
- " <properties>\n" +
- " </properties>\n" +
- " <async>false</async>\n" +
- " <fetchPersistentState>" + (!shared) +
"</fetchPersistentState>\n" +
- "
<ignoreModifications>false</ignoreModifications>\n" +
- " </cacheloader>\n" +
- " </config>";
- Element element = XmlHelper.stringToElement(xml);
- return XmlConfigurationParser.parseCacheLoaderConfig(element);
+ String cacheLoaderClass = shared ? DummySharedInMemoryCacheLoader.class.getName() :
DummyInMemoryCacheLoader.class.getName();
+ return UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(passivation,
null, cacheLoaderClass, "", false, (!shared), shared, false, false);
}
protected PojoCache createCacheWithLoader(boolean passivationEnabled) throws
Exception
{
PojoCache cache = createCacheUnstarted();
Configuration c = cache.getCache().getConfiguration();
- c.setCacheLoaderConfig(getCacheLoaderConfig(true, getTempDir(),
passivationEnabled));
+ c.setCacheLoaderConfig(getCacheLoaderConfig(true, passivationEnabled));
cache.create();
cache.start();
return cache;
@@ -270,7 +259,7 @@
c.setSyncRollbackPhase(true);
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- c.setCacheLoaderConfig(getCacheLoaderConfig(shared, shared ? getTempDir(name +
"-shared") : getTempDir(name + instanceNumber++), false));
+ c.setCacheLoaderConfig(getCacheLoaderConfig(shared, false));
PojoCache cache = PojoCacheFactory.createCache(c, false);
cache.create();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -142,7 +142,7 @@
{
log.info("testFailure1() ....");
UserTransaction tx = getTransaction();
- Fqn<String> f = Fqn.fromString("/person/test2");
+ Fqn f = Fqn.fromString("/person/test2");
tx.begin();
cache.getCache().put(f, "test", "test");
tx.commit();
@@ -155,9 +155,9 @@
public void testFailure2() throws Exception
{
- Fqn<String> f0 = Fqn.fromString("/person/test");
- Fqn<String> f1 = new Fqn<String>(f0, "1");
- Fqn<String> f2 = new Fqn<String>(f0, "2");
+ Fqn f0 = Fqn.fromString("/person/test");
+ Fqn f1 = Fqn.fromRelativeElements(f0, "1");
+ Fqn f2 = Fqn.fromRelativeElements(f0, "2");
cache.getCache().put(f1, "test", "test");
cache.getCache().put(f2, "test", "test");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -47,7 +47,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/pojocache-passivation-service.xml";
+ String configFile = "configs/local-passivation.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.getCache().getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.BatchModeTransactionManagerLookup");
@@ -101,7 +101,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(Fqn.fromString(id), false));
assertEquals("age ", 20, joe.getAge());
joe.setAge(30);
@@ -118,7 +118,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(Fqn.fromString(id), false));
Address addr = new Address();
addr.setCity("Taipei");
@@ -137,7 +137,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(Fqn.fromString(id), false));
Person p = (Person) cache_.find(id);
@@ -182,7 +182,7 @@
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(Fqn.fromString(id), false));
assertEquals("City is ", "Santa Clara", add2.getCity());
@@ -268,7 +268,7 @@
@NodeActivated
public void nodeActivated(NodeEvent ne)
{
- Fqn<?> fqn = ne.getFqn();
+ Fqn fqn = ne.getFqn();
if (!ne.isPre())
{
System.out.println("nodeActivated: " + fqn);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -87,7 +87,7 @@
void initCaches() throws Exception
{
boolean toStart = false;
- cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml",
toStart);
+ cache_ = PojoCacheFactory.createCache("configs/local-tx.xml", toStart);
cache_.start();
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -52,7 +52,7 @@
protected void setUp() throws Exception
{
log.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
@@ -102,8 +102,8 @@
assertEquals((Object) "Joe Black", p.getName());
assertTrue("Region node should exist ",
- cache_.getCache().getRoot().hasChild(new Fqn<String>(REGION)));
- Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
+ cache_.getCache().getRoot().hasChild(Fqn.fromString(REGION)));
+ Fqn fqn = Fqn.fromRelativeFqn(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
assertTrue("Internal region node should exist ",
cache_.getCache().getRoot().hasChild(fqn));
//System.out.println("Cache content: "
+((org.jboss.cache.CacheImpl<Object, Object>)cache_.getCache()).printDetails());
@@ -125,7 +125,7 @@
//String str = ((CacheImpl<Object, Object>)
cache_.getCache()).printDetails();
//System.out.println("**** Details ***/n" + str);
- Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
+ Fqn fqn = Fqn.fromRelativeFqn(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
Node<Object, Object> n = cache_.getCache().getRoot().getChild(fqn);
assertTrue("Internal region node should not exist ",
n.getChildren() != null);
@@ -200,7 +200,7 @@
cache_.detach("person/test1");
- Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
+ Fqn fqn = Fqn.fromRelativeFqn(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
Node<Object, Object> n = cache_.getCache().getRoot().getChild(fqn);
assertTrue("Internal region node should not exist ",
n.getChildren() != null);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -41,7 +41,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -47,7 +47,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -64,7 +64,7 @@
public void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.getCache().getConfiguration().setLockAcquisitionTimeout(500); // timeout to
500 ms
@@ -173,11 +173,11 @@
{
try
{
- Fqn<String> f = new
Fqn<String>(InternalConstant.JBOSS_INTERNAL_STRING);
- cache_.getCache().put(new Fqn<String>(f, "123"),
"key", "test");
- cache_.getCache().put(new Fqn<String>("a"), "key",
"test");
+ Fqn f = Fqn.fromString(InternalConstant.JBOSS_INTERNAL_STRING);
+ cache_.getCache().put(Fqn.fromRelativeElements(f, "123"),
"key", "test");
+ cache_.getCache().put(Fqn.fromString("a"), "key",
"test");
tx_mgr.begin();
- cache_.getCache().put(new Fqn<String>(f, "124"),
"key", "test");
+ cache_.getCache().put(Fqn.fromRelativeElements(f, "124"),
"key", "test");
while (!isTrue)
{
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalTxUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalTxUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -45,7 +45,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -58,7 +58,7 @@
private void startTest() throws Exception
{
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();
Deleted:
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransfer200AopTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransfer200AopTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransfer200AopTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -1,27 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at
gnu.org.
- */
-
-package org.jboss.cache.pojo.statetransfer;
-
-import org.testng.annotations.Test;
-
-/**
- * Tests that PojoCache state transfer works properly if the version is 2.0.0.
- *
- * @author <a href="mailto://brian.stansberry@jboss.com">Brian
Stansberry</a>
- * @version $Revision$
- */
-@Test(groups = {"functional"})
-public class StateTransfer200AopTest extends StateTransferAopTestBase
-{
-
- protected String getReplicationVersion()
- {
- return "2.0.0.GA";
- }
-
-}
Deleted:
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java 2008-08-13
20:29:58 UTC (rev 6556)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -1,1091 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at
gnu.org.
- */
-
-package org.jboss.cache.pojo.statetransfer;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Region;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.factories.XmlConfigurationParser;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.test.Address;
-import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.xml.XmlHelper;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.w3c.dom.Element;
-
-/**
- * Tests state transfer in PojoCache.
- *
- * @author <a href="mailto://brian.stansberry@jboss.com">Brian
Stansberry</a>
- * @version $Revision$
- */
-public abstract class StateTransferAopTestBase
-{
- private Map<String, PojoCache> caches;
-
- public static final String A_B_1 = "/a/b/1";
- public static final String A_B_2 = "/a/b/2";
- public static final String A_C_1 = "/a/c/1";
- public static final String A_C_2 = "/a/c/2";
-
- public static final Fqn<String> A_B_1_f = Fqn.fromString("/a/b/1");
- public static final Fqn<String> A_B_2_f = Fqn.fromString("/a/b/2");
- public static final Fqn<String> A_C_1_f = Fqn.fromString("/a/c/1");
- public static final Fqn<String> A_C_2_f = Fqn.fromString("/a/c/2");
-
- private static final int SUBTREE_SIZE = 10;
-
- private Person joe;
- private Person bob;
- private Person jane;
- private Person jill;
- private Address addr1;
- private Address addr2;
-
- public static final Integer TWENTY = 20;
- public static final Integer TWENTYFIVE = 25;
- public static final Integer FORTY = 40;
-
- private Log log = LogFactory.getLog(StateTransferAopTestBase.class);
-
- public void testInitialStateTransfer() throws Exception
- {
- log.info("Enter testInitialStateTransfer");
-
- PojoCache cache1 = createCache("cache1", true, false, false);
-
- cache1.attach(A_B_1, joe);
- cache1.attach(A_B_2, jane);
- cache1.attach(A_C_1, bob);
- cache1.attach(A_C_2, jill);
-
- PojoCache cache2 = createCache("cache2", true, false, false);
-
- // Pause to give caches time to see each other
-// TestingUtil.blockUntilViewsReceived(new Cache[]
-// {cache1.getCache(), cache2.getCache()}, 60000);
-
- Person ab1 = (Person) cache2.find(A_B_1);
- Person ab2 = (Person) cache2.find(A_B_2);
- Person ac1 = (Person) cache2.find(A_C_1);
- Person ac2 = (Person) cache2.find(A_C_2);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab1.getAddress().getCity());
- assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/2 is Anytown", addr1.getCity(),
ab2.getAddress().getCity());
- assertTrue("Joe and Jane have same Address", ab1.getAddress() ==
ab2.getAddress());
- assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
- assertEquals("City for /a/c/1 is Fremont", addr2.getCity(),
ac1.getAddress().getCity());
- assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
- assertEquals("City for /a/c/2 is Fremont", addr2.getCity(),
ac2.getAddress().getCity());
- assertTrue("Bob and Jill have same Address", ac1.getAddress() ==
ac2.getAddress());
- }
-
- public void testInitialStateTferWithLoader() throws Exception
- {
- log.info("Enter testInitialStateTferWithLoader");
-
- PojoCache cache1 = createCache("cache1", false, false, true);
-
- cache1.attach(A_B_1, joe);
- cache1.attach(A_B_2, jane);
- cache1.attach(A_C_1, bob);
- cache1.attach(A_C_2, jill);
-
- PojoCache cache2 = createCache("cache2", false, false, true);
-
- // Pause to give caches time to see each other
- TestingUtil.blockUntilViewsReceived(new Cache[]
- {cache1.getCache(), cache2.getCache()}, 60000);
-
- Person ab1 = (Person) cache2.find(A_B_1);
- Person ab2 = (Person) cache2.find(A_B_2);
- Person ac1 = (Person) cache2.find(A_C_1);
- Person ac2 = (Person) cache2.find(A_C_2);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab1.getAddress().getCity());
- assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/2 is Anytown", addr1.getCity(),
ab2.getAddress().getCity());
- assertTrue("Joe and Jane have same Address", ab1.getAddress() ==
ab2.getAddress());
- assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
- assertEquals("City for /a/c/1 is Fremont", addr2.getCity(),
ac1.getAddress().getCity());
- assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
- assertEquals("City for /a/c/2 is Fremont", addr2.getCity(),
ac2.getAddress().getCity());
- assertTrue("Bob and Jill have same Address", ac1.getAddress() ==
ac2.getAddress());
- }
-
- private void createAndActivateRegion(Cache<Object, Object> c, Fqn<String>
f)
- {
- Region r = c.getRegion(f, true);
- r.registerContextClassLoader(getClass().getClassLoader());
- r.activate();
- }
-
- public void testPartialStateTransfer() throws Exception
- {
- log.info("Enter testPartialStateTransfer");
-
- PojoCache cache1 = createCache("cache1", false, true, false);
-
- createAndActivateRegion(cache1.getCache(), Fqn.fromString("/a"));
- createAndActivateRegion(cache1.getCache(),
Fqn.fromString("/__JBossInternal__"));
-
- cache1.attach(A_B_1, joe);
- cache1.attach(A_B_2, jane);
-
- PojoCache cache2 = createCache("cache2", false, true, false);
-
- // Pause to give caches time to see each other
- TestingUtil.blockUntilViewsReceived(new Cache[]
- {cache1.getCache(), cache2.getCache()}, 60000);
-
- assertNull("/a/b/1 not transferred per policy", cache2.find(A_B_1));
- assertNull("/a/b/2 not transferred per policy", cache2.find(A_B_2));
-
- createAndActivateRegion(cache2.getCache(), Fqn.fromString("/a"));
- createAndActivateRegion(cache2.getCache(),
Fqn.fromString("/__JBossInternal__"));
-
- Person ab1 = (Person) cache2.find(A_B_1);
- Person ab2 = (Person) cache2.find(A_B_2);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", joe.getAddress().getCity(),
ab1.getAddress().getCity());
- assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/2 is Anytown", jane.getAddress().getCity(),
ab2.getAddress().getCity());
- assertTrue("Address for Joe and Jane is the same object",
ab1.getAddress() == ab2.getAddress());
-
- cache1.attach(A_C_1, bob);
- cache1.attach(A_C_2, jill);
-
- assertNotNull("/a/c/1 should be transferred per policy",
cache2.find(A_C_1));
-
- cache1.getCache().getRegion(Fqn.fromString("/a"), true).deactivate();
-
- cache1.getCache().getRegion(Fqn.fromString("/a"), true).activate();
-
- ab1 = (Person) cache1.find(A_B_1);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab1.getAddress().getCity());
- ab2 = (Person) cache1.find(A_B_2);
- assertEquals("Name for /a/b/1 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab2.getAddress().getCity());
- assertTrue("Address for Joe and Jane is the same object",
ab1.getAddress() == ab2.getAddress());
- }
-
- public void testPartialStateTransferWithLoader() throws Exception
- {
- log.info("Enter testPartialStateTransferWithLoader");
-
- PojoCache cache1 = createCache("cache1", false, true, true);
- createAndActivateRegion(cache1.getCache(), Fqn.fromString("/a"));
- createAndActivateRegion(cache1.getCache(),
Fqn.fromString("/__JBossInternal__"));
-
- cache1.attach(A_B_1, joe);
- cache1.attach(A_B_2, jane);
-
- PojoCache cache2 = createCache("cache2", false, true, true);
-
- // Pause to give caches time to see each other
- TestingUtil.blockUntilViewsReceived(new Cache[]
- {cache1.getCache(), cache2.getCache()}, 60000);
-
- CacheLoader loader = ((CacheSPI<Object, Object>)
cache2.getCache()).getCacheLoaderManager().getCacheLoader();
-
- Map<Object, Object> map = loader.get(A_B_1_f);
- if (map != null)
- {
- assertNull("/a/b/1 name not transferred per policy",
map.get("name"));
- assertNull("/a/b/1 age not transferred per policy",
map.get("age"));
- }
- map = loader.get(A_B_2_f);
- if (map != null)
- {
- assertNull("/a/b/1 name not transferred per policy",
map.get("name"));
- assertNull("/a/b/1 age not transferred per policy",
map.get("age"));
- }
- assertNull("/a/b/1 not transferred per policy", cache2.find(A_B_1));
- assertNull("/a/b/2 not transferred per policy", cache2.find(A_B_2));
-
- createAndActivateRegion(cache2.getCache(), Fqn.fromString("/a"));
- createAndActivateRegion(cache2.getCache(),
Fqn.fromString("/__JBossInternal__"));
-
-// assertEquals("Correct name from loader for /a/b/1", joe.getName(),
loader.get(A_B_1_f).get("name"));
-// assertEquals("Correct age from loader for /a/b/1", TWENTY,
loader.get(A_B_1_f).get("age"));
-// assertEquals("Correct name from loader for /a/b/2", jane.getName(),
loader.get(A_B_2_f).get("name"));
-// assertEquals("Correct age from loader for /a/b/2", TWENTYFIVE,
loader.get(A_B_2_f).get("age"));
-
-
- Person ab1 = (Person) cache2.find(A_B_1);
- Person ab2 = (Person) cache2.find(A_B_2);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab1.getAddress().getCity());
- assertEquals("Name for /a/b/1 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab2.getAddress().getCity());
- assertTrue("Address for Joe and Jane is the same object",
ab1.getAddress() == ab2.getAddress());
-
- cache1.attach(A_C_1, bob);
- cache1.attach(A_C_2, jill);
- Thread.sleep(200);
-
- assertNotNull("/a/c/1 transferred per policy", cache2.find(A_C_1));
- assertNotNull("/a/c/1 transferred per policy", cache2.find(A_C_2));
-
- Person ac1 = (Person) cache2.find(A_C_1);
- Person ac2 = (Person) cache2.find(A_C_2);
- assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
- assertEquals("City for /a/c/1 is Fremont", addr2.getCity(),
ac1.getAddress().getCity());
- assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
- assertEquals("City for /a/c/2 is Fremont", addr2.getCity(),
ac2.getAddress().getCity());
- assertTrue("Bob and Jill have same Address", ac1.getAddress() ==
ac2.getAddress());
-
- cache1.getCache().getRegion(Fqn.fromString("/a"), true).deactivate();
-
- ab1 = (Person) cache1.find(A_B_1);
- assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab1.getAddress().getCity());
- ab2 = (Person) cache1.find(A_B_2);
- assertEquals("Name for /a/b/1 is Jane", jane.getName(), ab2.getName());
- assertEquals("City for /a/b/1 is Anytown", addr1.getCity(),
ab2.getAddress().getCity());
- assertTrue("Address for Joe and Jane is the same object",
ab1.getAddress() == ab2.getAddress());
- ac1 = (Person) cache1.find(A_C_1);
- assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
- assertEquals("City for /a/c/1 is Fremont", addr2.getCity(),
ac1.getAddress().getCity());
- ac2 = (Person) cache1.find(A_C_2);
- assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
- assertEquals("City for /a/c/2 is Fremont", addr2.getCity(),
ac2.getAddress().getCity());
- assertTrue("Address for Bob and Jill is the same object",
ac1.getAddress() == ac2.getAddress());
- }
-
-
- /**
- * Tests concurrent activation of the same subtree by multiple nodes in a
- * REPL_SYNC environment. The idea is to see what would happen with a
- * farmed deployment. See <code>concurrentActivationTest</code> for
details.
- *
- * @throws Exception
- */
- public void testConcurrentActivationSync() throws Exception
- {
- log.info("Enter testConcurrentActivationSync");
-
- concurrentActivationTest(true);
- }
-
- /**
- * Tests concurrent activation of the same subtree by multiple nodes in a
- * REPL_ASYNC environment. The idea is to see what would happen with a
- * farmed deployment. See <code>concurrentActivationTest</code> for
details.
- *
- * @throws Exception
- */
- public void testConcurrentActivationAsync() throws Exception
- {
- log.info("Enter testConcurrentActivationAsync");
-
- concurrentActivationTest(false);
- }
-
- /**
- * Starts 5 caches and then concurrently activates the same region under
- * all 5, causing each to attempt a partial state transfer from the others.
- * As soon as each cache has activated its region, it does a put to a node
- * in the region, thus complicating the lives of the other caches trying
- * to get partial state.
- * <p/>
- * Failure condition is if any node sees an exception or if the final state
- * of all caches is not consistent.
- *
- * @param sync use REPL_SYNC or REPL_ASYNC
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- private void concurrentActivationTest(boolean sync) throws Exception
- {
- String[] names = {"A", "B", "C", "D",
"E"};
- int count = names.length;
- CacheActivator[] activators = new CacheActivator[count];
-
-
- try
- {
- // Create a semaphore and take all its tickets
- Semaphore semaphore = new Semaphore(count);
- for (int i = 0; i < count; i++)
- {
- semaphore.acquire();
- }
-
- // Create activation threads that will block on the semaphore
- Cache[] caches = new Cache[count];
- for (int i = 0; i < count; i++)
- {
- activators[i] = new CacheActivator(semaphore, names[i], sync);
- caches[i] = activators[i].getCache();
- activators[i].start();
- }
-
- // Make sure everyone is in sync
- TestingUtil.blockUntilViewsReceived(caches, 60000);
-
- // Release the semaphore to allow the threads to start work
- semaphore.release(count);
-
- // Sleep to ensure the threads get all the semaphore tickets
- TestingUtil.sleepThread(1000);
-
- // Reacquire the semaphore tickets; when we have them all
- // we know the threads are done
- for (int i = 0; i < count; i++)
- {
- boolean acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
- if (!acquired)
- fail("failed to acquire semaphore " + i);
- }
-
- // Sleep to allow any async calls to clear
- if (!sync)
- TestingUtil.sleepThread(500);
-
- // Ensure the caches held by the activators see all the values
- for (int i = 0; i < count; i++)
- {
- assertNull("Activator " + names[i] + " caught an
exception",
- activators[i].getException());
-
- for (int j = 0; j < count; j++)
- {
- String fqn = "/a/b/" + names[j];
- Person p = (Person) activators[i].getCacheValue(fqn);
- assertNotNull(names[i] + ":" + fqn + " is not null",
p);
- assertEquals("Correct name for " + names[i] + ":" +
fqn,
- "Person " + names[j], p.getName());
- assertEquals("Correct street for " + names[i] + ":" +
fqn,
- names[j] + " Test Street",
p.getAddress().getStreet());
-// System.out.println(names[i] + ":" + fqn + " = " +
activators[i].getCacheValue(fqn));
- }
-
- }
- }
- catch (Exception ex)
- {
- fail(ex.getLocalizedMessage());
- }
- finally
- {
- for (int i = 0; i < count; i++)
- activators[i].cleanup();
- }
-
- }
-
- /**
- * Tests partial state transfer under heavy concurrent load and REPL_SYNC.
- * See <code>concurrentUseTest</code> for details.
- *
- * @throws Exception
- */
- public void testConcurrentUseSync() throws Exception
- {
- log.info("Enter testConcurrentUseSync");
-
-// concurrentUseTest(true);
- }
-
- /**
- * Tests partial state transfer under heavy concurrent load and REPL_ASYNC.
- * See <code>concurrentUseTest</code> for details.
- *
- * @throws Exception
- */
- public void testConcurrentUseAsync() throws Exception
- {
- log.info("Enter testConcurrentUseAsync");
-
-// concurrentUseTest(false);
- }
-
- /*
- * Initiates 5 caches, 4 with active trees and one with an inactive tree.
- * Each of the active caches begins rapidly generating puts against nodes
- * in a subtree for which it is responsible. The 5th cache activates
- * each subtree, and at the end confirms no node saw any exceptions and
- * that each node has consistent state.
- *
- * @param sync whether to use REPL_SYNC or REPL_ASYNCE
- * @throws Exception
- */
-// private void XconcurrentUseTest(boolean sync) throws Exception
-// {
-// String[] names = {"B", "C", "D", "E"};
-// int count = names.length;
-// CacheStressor[] stressors = new CacheStressor[count];
-//
-// try
-// {
-//
-// PojoCache cacheA = createCache("cacheA", sync, true, false, false);
-//
-// Cache[] caches = new Cache[count + 1];
-// caches[0] = cacheA.getCache();
-//
-// // Create a semaphore and take all its tickets
-// Semaphore semaphore = new Semaphore(count);
-// for (int i = 0; i < count; i++)
-// {
-// semaphore.acquire();
-// }
-//
-// // Create stressor threads that will block on the semaphore
-//
-// for (int i = 0; i < count; i++)
-// {
-// stressors[i] = new CacheStressor(semaphore, names[i], sync);
-// caches[i + 1] = stressors[i].getCache();
-// stressors[i].start();
-// // Give each one a chance to stabilize
-// TestingUtil.sleepThread(100);
-// }
-//
-// // Make sure everyone's views are in sync
-// TestingUtil.blockUntilViewsReceived(caches, 60000);
-//
-// // Repeat the basic test two times in order to involve inactivation
-// for (int x = 0; x < 2; x++)
-// {
-//// if (x > 0)
-//// {
-// // Reset things by inactivating the region
-// // and enabling the stressors
-// for (int i = 0; i < count; i++)
-// {
-// cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).deactivate();
-// log.info("TEST: Run " + x + "-- /" + names[i] +
" inactivated on A");
-// stressors[i].startPuts();
-// }
-//// }
-//
-// // Release the semaphore to allow the threads to start work
-// semaphore.release(count);
-//
-// // Sleep to ensure the threads get all the semaphore tickets
-// // and to ensure puts are actively in progress
-// TestingUtil.sleepThread(300);
-//
-// // Activate cacheA
-// for (int i = 0; i < count; i++)
-// {
-// log.info("TEST: Activating /" + names[i] + " on
A");
-// cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).activate();
-// // Stop the stressor so we don't pollute cacheA's state
-// // with too many messages sent after activation -- we want
-// // to compare transferred state with the sender
-// stressors[i].stopPuts();
-// log.info("TEST: Run " + x + "-- /" + names[i] +
" activated on A");
-// // Reacquire one semaphore ticket
-// boolean acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
-// if (!acquired)
-// fail("failed to acquire semaphore " + names[i]);
-// log.info("TEST: Run " + x + "-- acquired semaphore from
" + names[i]);
-//
-// // Pause to allow other work to proceed
-// TestingUtil.sleepThread(100);
-// }
-//
-// // Sleep to allow any in transit msgs to clear
-// if (!sync)
-// TestingUtil.sleepThread(2000);
-//
-// // Ensure the stressors saw no exceptions
-// for (int i = 0; i < count; i++)
-// {
-// Exception e = stressors[i].getException();
-// if (e != null)
-// {
-// log.error("Stressor " + names[i] + " caught an
exception",
-// e);
-// throw e;
-// }
-// }
-//
-//// log.info("Cache A details:\n" + cacheA.printDetails());
-//
-// // Compare cache contents
-// Person p1 = null;
-// Person p2 = null;
-// for (int i = 0; i < count; i++)
-// {
-//// log.info("Cache " + names[i] + " details:\n" +
-//// stressors[i].getTreeCache().printDetails());
-//
-// for (int j = 0; j < SUBTREE_SIZE; j++)
-// {
-//
-// String fqn = "/" + names[i] + "/" + j;
-// log.info("TEST: Getting A:" + fqn);
-// p1 = (Person) cacheA.find(fqn);
-// boolean p1Null = p1 == null;
-// log.info("TEST: Getting " + names[i] + ":" +
fqn);
-//// p2 = (Person) stressors[i].getCache().find(fqn);
-// boolean p2Null = p2 == null;
-// assertEquals("Run " + x + ": " + fqn +
-// " null status matches", p1Null, p2Null);
-// if (!p1Null)
-// {
-// assertEquals("Run " + x + ": A:" + fqn +
" age matches " + names[i] + ":" + fqn,
-// p1.getAge(), p2.getAge());
-// assertEquals("Run " + x + ": A:" + fqn +
" name matches " + names[i] + ":" + fqn,
-// p1.getName(), p2.getName());
-// assertEquals("Run " + x + ": A:" + fqn +
" address matches " + names[i] + ":" + fqn,
-// p1.getAddress().getStreet(),
-// p2.getAddress().getStreet());
-// }
-// }
-// }
-// }
-//
-// for (int i = 0; i < count; i++)
-// stressors[i].stopThread();
-//
-// }
-// finally
-// {
-// for (int i = 0; i < count; i++)
-// {
-// if (stressors[i] != null)
-// stressors[i].cleanup();
-// }
-// }
-//
-// }
-
- protected PojoCache createCache(String cacheID, boolean sync, boolean useMarshalling,
boolean useCacheLoader)
- throws Exception
- {
- return createCache(cacheID, sync, useMarshalling, useCacheLoader, true);
- }
-
- protected PojoCache createCache(String cacheID, boolean sync,
- boolean useMarshalling,
- boolean useCacheLoader,
- boolean inactiveOnStartup)
- throws Exception
- {
- if (caches.get(cacheID) != null)
- throw new IllegalStateException(cacheID + " already created");
-
- CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
- Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
- c.setClusterName("StateTransferTestBase");
- c.setReplVersionString(getReplicationVersion());
- // Use a long timeout to facilitate setting debugger breakpoints
- c.setStateRetrievalTimeout(60000);
- c.setLockParentForChildInsertRemove(true);
- if (useMarshalling)
- {
- c.setUseRegionBasedMarshalling(true);
- c.setInactiveOnStartup(inactiveOnStartup);
- }
- if (useCacheLoader)
- {
- configureCacheLoader(c, cacheID);
- }
-
- PojoCache cache = PojoCacheFactory.createCache(c, true);
- // Put the cache in the map before starting, so if it fails in
- // start it can still be destroyed later
- caches.put(cacheID, cache);
-
- return cache;
- }
-
- protected void configureCacheLoader(Configuration c, String cacheID) throws Exception
- {
- String tmp_location = getTempLocation(cacheID);
-
- // Do cleanup in case it failed before
- File file = new File(tmp_location);
- cleanFile(file);
- file.mkdir();
- tmp_location = escapeWindowsPath(tmp_location);
-
c.setCacheLoaderConfig(getCacheLoaderConfig("org.jboss.cache.loader.FileCacheLoader",
tmp_location));
- }
-
-
- protected CacheLoaderConfig getCacheLoaderConfig(String cl, String loc) throws
Exception
- {
- String xml = " <config>\n" +
- " \n" +
- "
<passivation>false</passivation>\n" +
- " <preload></preload>\n" +
- "\n" +
- " <cacheloader>\n" +
- " <class>" + cl +
"</class>\n" +
- " <properties>\n" +
- " location=" + loc + "\n"
+
- " </properties>\n" +
- " <async>false</async>\n" +
- "
<fetchPersistentState>true</fetchPersistentState>\n" +
- "
<ignoreModifications>false</ignoreModifications>\n" +
- " </cacheloader>\n" +
- " \n" +
- " </config>";
- Element element = XmlHelper.stringToElement(xml);
- return XmlConfigurationParser.parseCacheLoaderConfig(element);
- }
-
- protected String getTempLocation(String cacheID)
- {
- String tmp_location = System.getProperty("java.io.tmpdir",
"c:\\tmp");
- File file = new File(tmp_location);
- file = new File(file, cacheID);
- return file.getAbsolutePath();
- }
-
- protected String escapeWindowsPath(String path)
- {
- if ('/' == File.separatorChar)
- return path;
-
- char[] chars = path.toCharArray();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < chars.length; i++)
- {
- if (chars[i] == '\\')
- sb.append('\\');
- sb.append(chars[i]);
- }
- return sb.toString();
- }
-
- protected abstract String getReplicationVersion();
-
- @BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
- {
- caches = new HashMap<String, PojoCache>();
-
- addr1 = new Address();
- addr1.setStreet("101 Oakview Dr");
- addr1.setCity("Anytown");
- addr1.setZip(11111);
-
- addr2 = new Address();
- addr2.setStreet("222 Happy Dr");
- addr2.setCity("Fremont");
- addr2.setZip(22222);
-
- joe = new Person();
- joe.setName("Joe");
- joe.setAge(TWENTY);
- joe.setAddress(addr1);
- Set<String> skills = new HashSet<String>();
- skills.add("TENNIS");
- skills.add("CARPENTRY");
- joe.setSkills(skills);
-
- jane = new Person();
- jane.setName("Jane");
- jane.setAge(TWENTYFIVE);
- jane.setAddress(addr1);
- skills = new HashSet<String>();
- skills.add("JUJITSU");
- skills.add("MACRAME");
- jane.setSkills(skills);
-
- bob = new Person();
- bob.setName("Bob");
- bob.setAge(FORTY);
- bob.setAddress(addr2);
- skills = new HashSet<String>();
- skills.add("LANGUAGES");
- skills.add("LAWN BOWLING");
- bob.setSkills(skills);
-
- jill = new Person();
- jill.setName("Jill");
- jill.setAge(TWENTYFIVE);
- jill.setAddress(addr2);
- skills = new HashSet<String>();
- skills.add("FORTRAN");
- skills.add("COBOL");
- jane.setSkills(skills);
- }
-
- @AfterMethod(alwaysRun = true)
- protected void tearDown() throws Exception
- {
- Set<String> keys = caches.keySet();
- if (!keys.isEmpty())
- {
- String[] cacheIDs = new String[keys.size()];
- cacheIDs = keys.toArray(cacheIDs);
- PojoCache cache = caches.get(cacheIDs[0]);
- cache.getCache().removeNode(new Fqn<String>("/"));
- Thread.sleep(200);
-
- for (int i = 0; i < cacheIDs.length; i++)
- {
- stopCache(caches.get(cacheIDs[i]));
- File file = new File(getTempLocation(cacheIDs[i]));
- cleanFile(file);
- }
- }
- }
-
- protected void stopCache(PojoCache cache)
- {
- if (cache != null)
- {
- try
- {
- cache.stop();
- cache.destroy();
- }
- catch (Exception e)
- {
- log.error("Exception stopping cache " + e.getMessage(), e);
- }
- }
- }
-
- protected void cleanFile(File file)
- {
- File[] children = file.listFiles();
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- cleanFile(children[i]);
- }
- }
-
- if (file.exists())
- file.delete();
- if (file.exists())
- file.deleteOnExit();
- }
-
- private class CacheActivator extends CacheUser
- {
-
- CacheActivator(Semaphore semaphore,
- String name,
- boolean sync)
- throws Exception
- {
- super(semaphore, name, sync, false);
- }
-
- void useCache() throws Exception
- {
- Region region = cache.getCache().getRegion(Fqn.fromString("/a/b"),
true);
- region.registerContextClassLoader(getClass().getClassLoader());
- region.activate();
- log.info("TEST: " + name + " activated region" + "
" + System.currentTimeMillis());
- String childFqn = "/a/b/" + name;
-
- Person p = new Person();
- p.setName("Person " + name);
-
- Address addr = new Address();
- addr.setStreet(name + " Test Street");
- addr.setCity(name + ", CA");
- p.setAddress(addr);
-
- TestingUtil.sleepThread(1);
-
-// tm.begin();
-// try
-// {
- cache.attach(childFqn, p);
- log.info("TEST: " + name + " put fqn " + childFqn + "
" + System.currentTimeMillis());
-// }
-// catch (Exception e)
-// {
-// tm.setRollbackOnly();
-// throw e;
-// }
-// finally
-// {
-// tm.commit();
-// }
-
- }
-
- public Object getCacheValue(String fqn) throws CacheException
- {
- return cache.find(fqn);
- }
- }
-
- @SuppressWarnings("unused")
- private class CacheStressor extends CacheUser
- {
- private Random random;
- private boolean putsStopped = false;
- private boolean stopped = false;
-
- CacheStressor(Semaphore semaphore,
- String name,
- boolean sync)
- throws Exception
- {
- super(semaphore, name, sync, true);
-
- random = new Random(System.currentTimeMillis() + name.hashCode());
- }
-
- void useCache() throws Exception
- {
- // Do lots of puts into the cache. Use our own nodes,
- // as we're not testing conflicts between writer nodes,
- // just whether activation causes problems
- int factor = 0;
- int i = 0;
- String fqn = null;
-
- Address addr1 = new Address();
- addr1.setStreet("1 Test Street");
- addr1.setCity("TestOne, CA");
-
- Address addr2 = new Address();
- addr2.setStreet("2 Test Street");
- addr2.setCity("TestTwo, CA");
-
- Person[] people = new Person[SUBTREE_SIZE];
- boolean[] loaded = new boolean[SUBTREE_SIZE];
- for (int j = 0; j < SUBTREE_SIZE; j++)
- {
- Person p = new Person();
- p.setName("Person " + j);
- p.setAge(j);
- p.setAddress((j % 2 == 0) ? addr1 : addr2);
- people[j] = p;
- }
-
- boolean acquired = true;
- try
- {
- while (!stopped)
- {
- if (i > 0)
- {
- acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
- if (!acquired)
- throw new Exception(name + " cannot acquire semaphore");
- log.info("TEST: " + name + " reacquired
semaphore");
- System.out.println("TEST: " + name + " reacquired
semaphore");
- }
-
- int lastIndex = -1;
- int index = -1;
- while (!putsStopped)
- {
- // Ensure we don't operate on the same address twice in a row
- // otherwise deadlock detection sometimes causes
- // the _put for the second call to precede the commit
- // for the first, leading to deadlock. This seems like a
- // JGroups bug, but the purpose of this test isn't to expose it
- while (index % 2 == lastIndex % 2)
- {
- factor = random.nextInt(50);
- index = factor % SUBTREE_SIZE;
- }
-
- lastIndex = index;
-
- TestingUtil.sleepThread(factor);
-
- fqn = "/" + name + "/" + String.valueOf(index);
-
-// tm.begin();
-// try
-// {
- if (loaded[index] == false)
- {
- cache.attach(fqn, people[index]);
- loaded[index] = true;
- log.info("TEST: " + name + " put Person at " +
fqn);
- }
- else if (i % 2 == 0)
- {
- int newAge = factor / SUBTREE_SIZE;
- people[index].setAge(newAge);
- }
- else
- {
- people[index].getAddress().setStreet(factor + " Test
Street");
- }
-// }
-// catch (Exception e)
-// {
-// tm.setRollbackOnly();
-// throw e;
-// }
-// finally
-// {
-// tm.commit();
-// }
-
- i++;
- }
-
- log.info("TEST: " + name + ": last put [#" + i +
"] -- " + fqn + " = " + (factor / SUBTREE_SIZE));
-
- semaphore.release();
- acquired = false;
-
- // Go to sleep until directed otherwise
- while (!stopped && putsStopped)
- TestingUtil.sleepThread(100);
- }
- }
- finally
- {
- if (acquired)
- semaphore.release();
- }
- }
-
-// public void start() throws Exception
-// {
-// super.start();
-// cache.activateRegion("/" + name);
-// }
-
- public void stopPuts()
- {
- putsStopped = true;
- log.info("TEST: " + name + " putsStopped");
- }
-
- public void startPuts()
- {
- putsStopped = false;
- }
-
- public void stopThread()
- {
- stopped = true;
- if (thread.isAlive())
- thread.interrupt();
- }
-
-
- }
-
- private abstract class CacheUser implements Runnable
- {
- protected Semaphore semaphore;
- protected PojoCache cache;
- protected TransactionManager tm;
- protected String name;
- protected Exception exception;
- protected Thread thread;
-
- CacheUser(Semaphore semaphore,
- String name,
- boolean sync,
- boolean activateRoot)
- throws Exception
- {
- this.cache = createCache(name, sync, true, false, !activateRoot);
- tm = ((CacheSPI<Object, Object>)
cache.getCache()).getTransactionManager();
- if (tm == null)
- throw new IllegalStateException("TransactionManager required");
- this.semaphore = semaphore;
- this.name = name;
-
- log.info("TEST: Cache " + name + " started");
- System.out.println("TEST: Cache " + name + " started");
- }
-
- public void run()
- {
- log.info("TEST: " + name + " started");
- System.out.println("TEST: " + name + " started");
-
- boolean acquired = false;
- try
- {
- acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
- if (!acquired)
- throw new Exception(name + " cannot acquire semaphore");
- log.info("TEST: " + name + " acquired semaphore");
- System.out.println("TEST: " + name + " acquired
semaphore");
- useCache();
-
- }
- catch (Exception e)
- {
- log.error("TEST: " + name + ": " +
e.getLocalizedMessage(), e);
-
- // Save it for the test to check
- exception = e;
- }
- finally
- {
- if (acquired)
- semaphore.release();
- }
-
- }
-
- abstract void useCache() throws Exception;
-
- public Exception getException()
- {
- return exception;
- }
-
- public Cache<Object, Object> getCache()
- {
- return cache.getCache();
- }
-
- public void start() throws Exception
- {
- thread = new Thread(this);
- thread.start();
- }
-
- public void cleanup()
- {
- if (thread != null && thread.isAlive())
- thread.interrupt();
- }
- }
-}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/util/ObjectUtilTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/util/ObjectUtilTest.java 2008-08-13
20:29:58 UTC (rev 6556)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/util/ObjectUtilTest.java 2008-08-14
02:46:03 UTC (rev 6557)
@@ -32,7 +32,7 @@
protected void setUp() throws Exception
{
log_.info("setUp() ....");
- String configFile = "META-INF/local-service.xml";
+ String configFile = "configs/local-tx.xml";
boolean toStart = false;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache_.start();