JBoss Cache SVN: r4918 - in core/trunk/src: main/docbook/userguide/en/modules and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-27 15:19:38 -0500 (Thu, 27 Dec 2007)
New Revision: 4918
Modified:
core/trunk/src/examples/resources/META-INF/replSync-service.xml
core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
core/trunk/src/main/resources/META-INF/buddyreplication-service.xml
core/trunk/src/main/resources/META-INF/clonable-config-service.xml
core/trunk/src/main/resources/META-INF/hibernate-recommended-config.xml
core/trunk/src/main/resources/META-INF/jdbcCacheLoader-service.xml
core/trunk/src/main/resources/META-INF/mixedPolicy-eviction-service.xml
core/trunk/src/main/resources/META-INF/pojocache-passivation-service.xml
core/trunk/src/main/resources/META-INF/pojocache-passivation-service2.xml
core/trunk/src/main/resources/META-INF/policyPerRegion-eviction-service.xml
core/trunk/src/main/resources/META-INF/replAsync-service.xml
core/trunk/src/main/resources/META-INF/replSync-passivation-service.xml
core/trunk/src/main/resources/META-INF/replSync-service-test.xml
core/trunk/src/main/resources/META-INF/replSync-service.xml
core/trunk/src/main/resources/META-INF/tree-service.xml
core/trunk/src/test-scripts/resources/bench.xml
Log:
Removed deprecated JGroups element
Modified: core/trunk/src/examples/resources/META-INF/replSync-service.xml
===================================================================
--- core/trunk/src/examples/resources/META-INF/replSync-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/examples/resources/META-INF/replSync-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -124,8 +124,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -95,8 +95,7 @@
<pbcast.STABLE desired_avg_gossip="400000"/>
<FC max_credits="2000000" min_threshold="0.10"/>
<FRAG2 frag_size="8192"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
- shun="true" print_local_addr="true"/>
+ <pbcast.GMS join_timeout="5000" shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER/>
</config>
</attribute>
Modified: core/trunk/src/main/resources/META-INF/buddyreplication-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/buddyreplication-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/buddyreplication-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -113,8 +113,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/resources/META-INF/clonable-config-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/clonable-config-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/clonable-config-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -74,8 +74,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/resources/META-INF/hibernate-recommended-config.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/hibernate-recommended-config.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/hibernate-recommended-config.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -108,7 +108,7 @@
<UNICAST timeout="600,1200,2400"/>
<pbcast.STABLE desired_avg_gossip="20000"/>
<FRAG frag_size="8192"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+ <pbcast.GMS join_timeout="5000"
shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER/>
</config>
Modified: core/trunk/src/main/resources/META-INF/jdbcCacheLoader-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/jdbcCacheLoader-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/jdbcCacheLoader-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -94,7 +94,7 @@
<UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"/>
<pbcast.STABLE desired_avg_gossip="20000"/>
<FRAG frag_size="8192"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+ <pbcast.GMS join_timeout="5000"
shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER/>
</config>
Modified: core/trunk/src/main/resources/META-INF/mixedPolicy-eviction-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/mixedPolicy-eviction-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/mixedPolicy-eviction-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -108,8 +108,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FC max_credits="20000000" min_threshold="0.10"/>
<FRAG2 frag_size="60000"/>
Modified: core/trunk/src/main/resources/META-INF/pojocache-passivation-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/pojocache-passivation-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/pojocache-passivation-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -107,8 +107,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FC max_credits="20000000" min_threshold="0.10"/>
<FRAG2 frag_size="60000"/>
Modified: core/trunk/src/main/resources/META-INF/pojocache-passivation-service2.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/pojocache-passivation-service2.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/pojocache-passivation-service2.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -107,8 +107,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FC max_credits="20000000" min_threshold="0.10"/>
<FRAG2 frag_size="60000"/>
Modified: core/trunk/src/main/resources/META-INF/policyPerRegion-eviction-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/policyPerRegion-eviction-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/policyPerRegion-eviction-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -107,8 +107,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FC max_credits="20000000" min_threshold="0.10"/>
<FRAG2 frag_size="60000"/>
Modified: core/trunk/src/main/resources/META-INF/replAsync-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/replAsync-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/replAsync-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -123,8 +123,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FC max_credits="20000000" min_threshold="0.10"/>
<FRAG2 frag_size="60000"/>
Modified: core/trunk/src/main/resources/META-INF/replSync-passivation-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/replSync-passivation-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/replSync-passivation-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -107,8 +107,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/resources/META-INF/replSync-service-test.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/replSync-service-test.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/replSync-service-test.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -123,8 +123,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/resources/META-INF/replSync-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/replSync-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/replSync-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -123,8 +123,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
Modified: core/trunk/src/main/resources/META-INF/tree-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/tree-service.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/main/resources/META-INF/tree-service.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -107,7 +107,7 @@
<UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"/>
<pbcast.STABLE desired_avg_gossip="20000"/>
<FRAG frag_size="8192"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+ <pbcast.GMS join_timeout="5000"
shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER/>
</config>
Modified: core/trunk/src/test-scripts/resources/bench.xml
===================================================================
--- core/trunk/src/test-scripts/resources/bench.xml 2007-12-23 13:16:29 UTC (rev 4917)
+++ core/trunk/src/test-scripts/resources/bench.xml 2007-12-27 20:19:38 UTC (rev 4918)
@@ -75,8 +75,7 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="true"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="true"/>
<!-- Comment it out when we use repl_sync. We don't need fc when it is sync mode. -->
<!--FC max_credits="2000000"
min_threshold="0.20" max_block_time="5000"/-->
17 years
JBoss Cache SVN: r4917 - in core/trunk/src: main/java/org/jboss/cache/factories and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-23 08:16:29 -0500 (Sun, 23 Dec 2007)
New Revision: 4917
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManager.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
Log:
Fixed failing unit tests
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -25,8 +25,6 @@
public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception;
- public void setCache(CacheSPI c);
-
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -77,11 +77,6 @@
return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
}
- public void setCache(CacheSPI c)
- {
- this.c = (CacheImpl) c;
- }
-
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -116,12 +116,26 @@
public void registerComponent(String name, Object component)
{
// this will make sure all dependent components are stopped or set to CONSTRUCTED so they can be re-wired later.
- unregisterComponent(name);
+ Component c = new Component(name, component);
+ Component old = componentLookup.get(name);
+ if (old != null)
+ {
+ // unregister the old component so that components that depend on it can be stopped if necessary
+ unregisterComponent(name);
+ // components that depended on the old component should now depend on the new one.
+ c.dependencyFor.addAll(old.dependencyFor);
+ }
+ addComponentDependencies(c);
- Component c = new Component(name, component);
componentLookup.put(name, c);
- addComponentDependencies(c);
- c.changeState(overallState == null ? CONSTRUCTED : overallState);
+ State stateToMoveTo = overallState == null ? CONSTRUCTED : overallState;
+ c.changeState(stateToMoveTo);
+
+ // make sure any other omponents that have inadvertently been stopped are now restarted.
+ for (Component comp : componentLookup.values())
+ {
+ if (comp.state != stateToMoveTo) comp.changeState(stateToMoveTo);
+ }
}
protected void addComponentDependencies(Component c)
@@ -130,6 +144,8 @@
for (Dependency d : c.dependencies)
{
getOrCreateComponent(d.name, d.type);
+ Component dependencyComponent = componentLookup.get(d.name);
+ if (dependencyComponent != null) dependencyComponent.dependencyFor.add(c.asDependency());
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -5,9 +5,11 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.RPCManager;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -26,16 +28,22 @@
*/
public abstract class BaseRpcInterceptor extends MethodDispacherInterceptor
{
-
private BuddyManager buddyManager;
+ private RPCManager rpcManager;
private boolean usingBuddyReplication;
protected boolean defaultSynchronous;
+ @Inject
+ private void injectComponents(RPCManager rpcManager, BuddyManager buddyManager)
+ {
+ this.rpcManager = rpcManager;
+ this.buddyManager = buddyManager;
+ usingBuddyReplication = buddyManager != null && buddyManager.isEnabled();
+ }
+
public void setCache(CacheSPI cache)
{
super.setCache(cache);
- buddyManager = cache.getBuddyManager();
- usingBuddyReplication = buddyManager != null;
CacheMode mode = cache.getConfiguration().getCacheMode();
defaultSynchronous = (mode == CacheMode.REPL_SYNC || mode == CacheMode.INVALIDATION_SYNC);
}
@@ -81,7 +89,7 @@
else if (te.isForceSyncReplication()) sync = true;
}
}
- if (!sync && cache.getRPCManager().getReplicationQueue() != null && !usingBuddyReplication)
+ if (!sync && rpcManager.getReplicationQueue() != null && !usingBuddyReplication)
{
putCallOnAsyncReplicationQueue(call);
}
@@ -100,7 +108,7 @@
long syncReplTimeout = o.getSyncReplTimeout();
if (syncReplTimeout < 0) syncReplTimeout = configuration.getSyncReplTimeout();
- List rsps = cache.getRPCManager().callRemoteMethods(callRecipients,
+ List rsps = rpcManager.callRemoteMethods(callRecipients,
MethodDeclarations.replicateMethod,
new Object[]{call},
sync, // is synchronised?
@@ -118,7 +126,7 @@
protected void putCallOnAsyncReplicationQueue(MethodCall call)
{
if (log.isDebugEnabled()) log.debug("Putting call " + call + " on the replication queue.");
- cache.getRPCManager().getReplicationQueue().add(MethodCallFactory.create(MethodDeclarations.replicateMethod, call));
+ rpcManager.getReplicationQueue().add(MethodCallFactory.create(MethodDeclarations.replicateMethod, call));
}
//todo info expt for this is InvocationContext, move method there
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -6,6 +6,7 @@
*/
package org.jboss.cache.interceptors;
+import org.apache.commons.logging.Log;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -21,13 +22,12 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.OptimisticTransactionEntry;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
-import org.apache.commons.logging.Log;
import org.jgroups.Address;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
/**
* Replication interceptor for the optimistically locked interceptor chain. Responsible for replicating
@@ -53,6 +53,7 @@
return log;
}
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
// bypass for buddy group org metod calls.
@@ -68,6 +69,7 @@
return false;
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
// pass up the chain.
@@ -82,6 +84,7 @@
return retval;
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction gtx) throws Throwable
{
//lets broadcast the commit first
@@ -109,6 +112,7 @@
return retval;
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction gtx) throws Throwable
{
// lets broadcast the rollback first
@@ -136,13 +140,21 @@
return retval;
}
+ @Override
protected Object handlePutForExternalReadVersionedMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, DataVersion dv) throws Throwable
{
+ return handlePutForExternalReadMethod(ctx, gtx, fqn, key, value);
+ }
+
+ @Override
+ protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value) throws Throwable
+ {
gtx = getGlobalTransaction(ctx);
cache.getTransactionTable().get(gtx).setForceAsyncReplication(true);
return nextInterceptor(ctx);
}
+
private GlobalTransaction getGlobalTransaction(InvocationContext ctx)
{
// get the current gtx
@@ -174,8 +186,8 @@
if (log.isDebugEnabled())
{
log.debug("(" + cache.getLocalAddress()
- + "): broadcasting prepare for " + gtx
- + " (" + num_mods + " modifications");
+ + "): broadcasting prepare for " + gtx
+ + " (" + num_mods + " modifications");
}
replicateCall(toBroadcast, remoteCallSync, ctx.getOptionOverrides());
@@ -186,7 +198,7 @@
if (log.isDebugEnabled())
{
log.debug("(" + cache.getLocalAddress()
- + "):not broadcasting prepare as members are " + cache.getMembers());
+ + "):not broadcasting prepare as members are " + cache.getMembers());
}
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-22 17:04:39 UTC (rev 4916)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-23 13:16:29 UTC (rev 4917)
@@ -170,7 +170,8 @@
RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
// inject a mock RPC manager so that we can test whether calls made are sync or async.
- cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);
+ //cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(RPCManager.class.getName(), rpcManager);
// invalidations will not trigger any rpc call sfor PFER
if (!isUsingInvalidation())
@@ -186,8 +187,9 @@
// now try a simple replication. Since the RPCManager is a mock object it will not actually replicate anything.
cache1.putForExternalRead(fqn, key, value);
verify(rpcManager);
+
// cleanup
- cache1.getConfiguration().getRuntimeConfig().setRPCManager(originalRpcManager);
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(RPCManager.class.getName(), originalRpcManager);
cache1.removeNode(fqn);
}
@@ -241,7 +243,7 @@
}
};
- barfingRpcManager.setCache((CacheSPI<String, String>) cache1);
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(RPCManager.class.getName(), barfingRpcManager);
cache1.getConfiguration().getRuntimeConfig().setRPCManager(barfingRpcManager);
try
17 years
JBoss Cache SVN: r4916 - core/trunk/src/test/java/org/jboss/cache/invalidation.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-22 12:04:39 -0500 (Sat, 22 Dec 2007)
New Revision: 4916
Modified:
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
Log:
[JBCACHE-1251] Test showing the issue
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-21 17:11:56 UTC (rev 4915)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-22 17:04:39 UTC (rev 4916)
@@ -459,6 +459,81 @@
assertEquals(null, cache1.get(fqn, "key"));
}
+ /**
+ * Test for JBCACHE-1251.
+ *
+ * @throws Exception
+ */
+ public void testPessimisticNodeResurrection2() throws Exception
+ {
+ nodeResurrectionTest2(false);
+ }
+
+ /**
+ * OPTIMISTIC locking verion of test for JBCACHE-1251. JBCACHE-1251
+ * did not effect optimistic, but we add the test to guard against
+ * regressions.
+ *
+ * @throws Exception
+ */
+ public void testOptimisticNodeResurrection2() throws Exception
+ {
+ nodeResurrectionTest2(true);
+ }
+
+ /**
+ * Here we model a scenario where a parent node represents
+ * a structural node, and then child nodes represent different
+ * data elements.
+ *
+ * Such data structures are set up on both caches, and then the parent node
+ * is removed (globally) and re-added (locally) on one cache. This
+ * represents an attempt to clear the region -- removing a node and
+ * re-adding is one of the only ways to do this.
+ *
+ * On the second cache, the fact that the structural node is missing is
+ * detected, and an attempt is made to re-add it locally.
+ *
+ * @param optimistic should the cache be configured for optimistic locking
+ * @throws Exception
+ */
+ private void nodeResurrectionTest2(boolean optimistic) throws Exception
+ {
+ cache1 = createCache(optimistic);
+ cache2 = createCache(optimistic);
+
+ Node root1 = cache1.getRoot();
+ Node root2 = cache2.getRoot();
+
+ // this fqn is relative, but since it is from the root it may as well be absolute
+ Fqn<String> fqn = Fqn.fromString("/test/fqn");
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ root1.addChild(fqn);
+ assertEquals(true, root1.hasChild(fqn));
+ cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ root1.addChild(fqn);
+ assertEquals(true, root1.hasChild(fqn));
+
+ Fqn<String> child = new Fqn(fqn, "child");
+ cache1.putForExternalRead(child, "key", "value");
+ cache2.putForExternalRead(child, "key", "value");
+ assertEquals("value", cache1.get(child, "key"));
+ assertEquals("value", cache2.get(child, "key"));
+
+ assertEquals(true, cache1.removeNode(fqn));
+ assertFalse(root1.hasChild(fqn));
+
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ root1.addChild(fqn);
+ assertEquals(true, root1.hasChild(fqn));
+
+ Node remoteNode = root2.getChild(fqn);
+ checkRemoteNodeIsRemoved(remoteNode);
+ cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ root2.addChild(fqn);
+ assertEquals(true, root2.hasChild(fqn));
+ }
+
private void dumpVersionInfo(CacheSPI c1, CacheSPI c2, Fqn fqn)
{
System.out.println("**** Versin Info for Fqn [" + fqn + "] ****");
17 years
JBoss Cache SVN: r4915 - in core/trunk/src: main/java/org/jboss/cache/config and 4 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-21 12:11:56 -0500 (Fri, 21 Dec 2007)
New Revision: 4915
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java
core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToBdbjeCacheLoaderTest.java
Log:
Fixed failing unit tests
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -48,6 +48,7 @@
import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.ThreadGate;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
+import org.jboss.cache.util.reflect.ReflectionUtil;
import org.jgroups.*;
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.RpcDispatcher;
@@ -216,7 +217,7 @@
private void injectDependencies(Notifier notifier, RegionManager regionManager, TransactionManager transactionManager, Marshaller marshaller,
TransactionTable transactionTable, StateTransferManager stateTransferManager, NodeFactory nodeFactory,
CacheSPI spi, CacheMessageListener messageListener, @ComponentName("remoteDelegate")RemoteCacheInvocationDelegate remoteDelegate,
- Interceptor interceptorChain)
+ Interceptor interceptorChain, BuddyManager buddyManager)
{
this.notifier = notifier;
this.regionManager = regionManager;
@@ -229,6 +230,7 @@
this.remoteDelegate = remoteDelegate;
this.marshaller = marshaller;
this.interceptorChain = interceptorChain;
+ this.buddyManager = buddyManager;
}
public Configuration getConfiguration()
@@ -3587,6 +3589,7 @@
if (channel != null)
{
+ ReflectionUtil.setValue(configuration, "accessible", true);
configuration.setUsingMultiplexer(true);
if (log.isDebugEnabled())
{
Modified: core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -43,6 +43,16 @@
private Integer eventQueueSize;
private EvictionPolicyConfig evictionPolicyConfig;
+ public EvictionRegionConfig()
+ {
+ }
+
+ public EvictionRegionConfig(Fqn regionFqn, EvictionPolicyConfig evictionPolicyConfig)
+ {
+ this.regionFqn = regionFqn;
+ this.evictionPolicyConfig = evictionPolicyConfig;
+ }
+
public EvictionPolicyConfig getEvictionPolicyConfig()
{
return evictionPolicyConfig;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -5,17 +5,7 @@
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
-import com.sleepycat.je.Cursor;
-import com.sleepycat.je.Database;
-import com.sleepycat.je.DatabaseConfig;
-import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DeadlockException;
-import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
-import com.sleepycat.je.JEVersion;
-import com.sleepycat.je.LockMode;
-import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.Transaction;
+import com.sleepycat.je.*;
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -24,6 +14,7 @@
import org.jboss.cache.Modification;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.AbstractCacheLoader;
+import org.jboss.cache.util.reflect.ReflectionUtil;
import java.io.File;
import java.io.IOException;
@@ -84,17 +75,17 @@
public void create() throws Exception
{
String license = "\n*************************************************************************************\n" +
- "Berkeley DB Java Edition version: " + JEVersion.CURRENT_VERSION.toString() + "\n" +
- "JBoss Cache can use Berkeley DB Java Edition from Oracle \n" +
- "(http://www.oracle.com/database/berkeley-db/je/index.html)\n" +
- "for persistent, reliable and transaction-protected data storage.\n" +
- "If you choose to use Berkeley DB Java Edition with JBoss Cache, you must comply with the terms\n" +
- "of Oracle's public license, included in the file LICENSE.txt.\n" +
- "If you prefer not to release the source code for your own application in order to comply\n" +
- "with the Oracle public license, you may purchase a different license for use of\n" +
- "Berkeley DB Java Edition with JBoss Cache.\n" +
- "See http://www.oracle.com/database/berkeley-db/je/index.html for pricing and license terms\n" +
- "*************************************************************************************";
+ "Berkeley DB Java Edition version: " + JEVersion.CURRENT_VERSION.toString() + "\n" +
+ "JBoss Cache can use Berkeley DB Java Edition from Oracle \n" +
+ "(http://www.oracle.com/database/berkeley-db/je/index.html)\n" +
+ "for persistent, reliable and transaction-protected data storage.\n" +
+ "If you choose to use Berkeley DB Java Edition with JBoss Cache, you must comply with the terms\n" +
+ "of Oracle's public license, included in the file LICENSE.txt.\n" +
+ "If you prefer not to release the source code for your own application in order to comply\n" +
+ "with the Oracle public license, you may purchase a different license for use of\n" +
+ "Berkeley DB Java Edition with JBoss Cache.\n" +
+ "See http://www.oracle.com/database/berkeley-db/je/index.html for pricing and license terms\n" +
+ "*************************************************************************************";
System.out.println(license);
log.trace("Creating BdbjeCacheLoader instance.");
@@ -123,6 +114,7 @@
if (config.getLocation() == null)
{
configStr = System.getProperty("java.io.tmpdir");
+ ReflectionUtil.setValue(config, "accessible", true);
config.setLocation(configStr);
}
@@ -333,7 +325,7 @@
OperationStatus status =
cursor.getSearchKeyRange(keyEntry, dataEntry, null);
if (status != OperationStatus.SUCCESS ||
- !startsWith(keyEntry, prefixEntry))
+ !startsWith(keyEntry, prefixEntry))
{
break;
}
@@ -728,7 +720,7 @@
cursor.delete();
status = cursor.getNext(foundKey, foundData, LockMode.RMW);
if (status == OperationStatus.SUCCESS &&
- !startsWith(foundKey, keyEntry))
+ !startsWith(foundKey, keyEntry))
{
status = OperationStatus.NOTFOUND;
}
@@ -1070,8 +1062,8 @@
/* Write the bytes of the prefix followed by the child name. */
TupleOutput tupleOutput = new TupleOutput();
tupleOutput.writeFast(prefix.getData(),
- prefix.getOffset(),
- prefix.getSize());
+ prefix.getOffset(),
+ prefix.getSize());
tupleOutput.writeString(namePart);
/* Return the tuple as an entry. */
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -13,12 +13,11 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.EvictionPolicyConfig;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.DummyEvictionConfiguration;
import org.jboss.cache.eviction.EvictedEventNode;
import org.jboss.cache.eviction.NodeEventType;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.InterceptorChainFactory;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
@@ -30,13 +29,15 @@
import org.testng.annotations.Test;
import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
/**
* @author Daniel Huang (dhuang(a)jboss.org)
* @version $Revision: $
*/
-@Test(groups = {"functional"})
+@Test(groups = "functional")
public class EvictionInterceptorTest
{
private static final String fqn1 = "/a/b/c";
@@ -55,53 +56,30 @@
cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache.getConfiguration().setCacheMode("LOCAL");
+ EvictionConfig ec = new EvictionConfig();
- regionManager = cache.getRegionManager();
- EvictionPolicyConfig config = new DummyEvictionConfiguration();
- regionManager.setUsingEvictions(true);
+ List<EvictionRegionConfig> ercs = new LinkedList<EvictionRegionConfig>();
+ ercs.add(new EvictionRegionConfig(Fqn.ROOT, new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/a/b/c"), new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/a/b/c/d"), new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/a/b"), new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/d/e/f"), new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/d/e/g"), new DummyEvictionConfiguration()));
+ ercs.add(new EvictionRegionConfig(Fqn.fromString("/d/e"), new DummyEvictionConfiguration()));
- regionManager.getRegion(Fqn.ROOT, true).setEvictionPolicy(config);
-
- regionManager.getRegion("/a/b/c", true).setEvictionPolicy(config);
- regionManager.getRegion("/a/b/c/d", true).setEvictionPolicy(config);
- regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
-
- regionManager.getRegion("/d/e/f", true).setEvictionPolicy(config);
- regionManager.getRegion("/d/e/g", true).setEvictionPolicy(config);
- regionManager.getRegion("/d/e", true).setEvictionPolicy(config);
-
- // make the interceptor chain (separate from the CacheSPI object.
-
- interceptor = new CacheMgmtInterceptor();
-
- TxInterceptor ti = new TxInterceptor();
- interceptor.setNext(ti);
-
- UnlockInterceptor ui = new UnlockInterceptor();
- ti.setNext(ui);
-
- PessimisticLockInterceptor pli = new PessimisticLockInterceptor();
- ui.setNext(pli);
-
- EvictionInterceptor ei = new EvictionInterceptor();
- pli.setNext(ei);
-
- CallInterceptor ci = new CallInterceptor();
- ei.setNext(ci);
-
- cache.getConfiguration().setCacheMode("LOCAL");
+ ec.setEvictionRegionConfigs(ercs);
+ cache.getConfiguration().setEvictionConfig(ec);
cache.start();
- ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
-
- cr.getComponent(InterceptorChainFactory.class).correctInterceptorChaining(interceptor);
+ interceptor = TestingUtil.extractComponentRegistry(cache).getComponent(Interceptor.class);
+ regionManager = cache.getRegionManager();
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- cache.removeNode(Fqn.ROOT);
- cache.stop();
+ TestingUtil.killCaches(cache);
}
@SuppressWarnings("unchecked")
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -54,7 +54,7 @@
*
* @since 2.0.0
*/
-@Test(groups = {"functional"})
+@Test(groups = "functional")
public class RemoteCacheListenerTest
{
protected boolean optLocking = false;
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -14,6 +14,7 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.SamplePojo;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.xml.XmlHelper;
@@ -41,7 +42,7 @@
* @author <a href="mailto:{hmesha@novell.com}">{Hany Mesha}</a>
* @version $Id$
*/
-@Test(groups = {"functional"})
+@Test(groups = "functional")
abstract public class PassivationTestsBase
{
@@ -88,10 +89,8 @@
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- cache.removeNode(Fqn.ROOT);
loader.remove(Fqn.ROOT);
- cache.stop();
- cache.destroy();
+ TestingUtil.killCaches(cache);
}
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToBdbjeCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToBdbjeCacheLoaderTest.java 2007-12-21 16:34:38 UTC (rev 4914)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToBdbjeCacheLoaderTest.java 2007-12-21 17:11:56 UTC (rev 4915)
@@ -1,13 +1,14 @@
package org.jboss.cache.passivation;
-import java.io.File;
-import java.io.FileFilter;
-
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.xml.XmlHelper;
+import org.testng.annotations.Test;
import org.w3c.dom.Element;
+import java.io.File;
+import java.io.FileFilter;
+
/**
* Runs the same tests as {@link PassivationToFileCacheLoaderTest}, but with
* Berkeley DB instead of a file-based CacheLoader
@@ -15,6 +16,7 @@
* @author <a href="mailto:{hmesha@novell.com}">{Hany Mesha}</a>
* @version $Id$
*/
+@Test(groups = "functional")
public class PassivationToBdbjeCacheLoaderTest extends PassivationTestsBase
{
private String tmp_location = System.getProperty("java.io.tmpdir", "c:\\tmp");
@@ -59,20 +61,20 @@
protected CacheLoaderConfig getCacheLoaderConfig(String loc) throws Exception
{
String xml = " <config>\n" +
- " \n" +
- " <passivation>true</passivation>\n" +
- " <preload></preload>\n" +
- "\n" +
- " <cacheloader>\n" +
- " <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>\n" +
- " <properties>\n" +
- " </properties>\n" +
- " <async>false</async>\n" +
- " <fetchPersistentState>false</fetchPersistentState>\n" +
- " <ignoreModifications>false</ignoreModifications>\n" +
- " </cacheloader>\n" +
- " \n" +
- " </config>";
+ " \n" +
+ " <passivation>true</passivation>\n" +
+ " <preload></preload>\n" +
+ "\n" +
+ " <cacheloader>\n" +
+ " <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>\n" +
+ " <properties>\n" +
+ " </properties>\n" +
+ " <async>false</async>\n" +
+ " <fetchPersistentState>false</fetchPersistentState>\n" +
+ " <ignoreModifications>false</ignoreModifications>\n" +
+ " </cacheloader>\n" +
+ " \n" +
+ " </config>";
Element element = XmlHelper.stringToElement(xml);
return XmlConfigurationParser.parseCacheLoaderConfig(element);
}
17 years
JBoss Cache SVN: r4913 - in core/trunk/src/test/java/org/jboss/cache: options and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-21 11:33:16 -0500 (Fri, 21 Dec 2007)
New Revision: 4913
Removed:
core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java
Modified:
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
Log:
Updated mem leak test
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-21 14:58:06 UTC (rev 4912)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-21 16:33:16 UTC (rev 4913)
@@ -328,6 +328,8 @@
*/
public void testMemLeakOnSuspendedTransactions() throws Exception
{
+ Fqn fqn2 = Fqn.fromString("/fqn/two");
+
tm1.begin();
cache1.putForExternalRead(fqn, key, value);
tm1.commit();
@@ -338,6 +340,43 @@
assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+
+ tm1.begin();
+ cache1.putForExternalRead(fqn, key, value);
+ cache1.put(fqn2, key, value);
+ tm1.commit();
+
+ asyncWait();
+
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+
+ tm1.begin();
+ cache1.put(fqn2, key, value);
+ cache1.putForExternalRead(fqn, key, value);
+ tm1.commit();
+
+ asyncWait();
+
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+
+ tm1.begin();
+ cache1.put(fqn2, key, value);
+ cache1.putForExternalRead(fqn, key, value);
+ cache1.put(fqn2, key, value);
+ tm1.commit();
+
+ asyncWait();
+
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
}
/**
Deleted: core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java 2007-12-21 14:58:06 UTC (rev 4912)
+++ core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java 2007-12-21 16:33:16 UTC (rev 4913)
@@ -1,90 +0,0 @@
-package org.jboss.cache.options;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
-import org.jboss.cache.transaction.TransactionTable;
-import org.testng.annotations.Test;
-
-import javax.transaction.TransactionManager;
-
-/**
- * To test memory leak reported in http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#4112143
- *
- * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
- */
-@Test(groups = "functional")
-public class OptimisticMemLeakTest
-{
- private Cache<Object, Object> cache;
- private TransactionManager tm;
- private TransactionTable tt;
- private Fqn fqn = Fqn.fromString("/a/b/c");
- private Fqn fqn1 = Fqn.fromString("/c/d/e");
- private String key = "key", value = "value";
-
- protected void tearDown()
- {
- cache.stop();
- }
-
- protected void setUp() throws Exception
- {
- cache = new DefaultCacheFactory<Object, Object>().createCache(false);
- cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache.start();
- tm = ((CacheSPI) cache).getTransactionManager();
- tt = ((CacheSPI) cache).getTransactionTable();
- }
-
- public void testLeakWithFailSilently() throws Exception
- {
- tm.begin();
- cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
- cache.put(fqn, key, value);
- tm.commit();
-
- int gtxCnt = tt.getNumGlobalTransactions();
- int txCnt = tt.getNumLocalTransactions();
- assert gtxCnt == 0 : "Global transaction count is > 0";
- assert txCnt == 0 : "Local transaction count is > 0";
-
- tm.begin();
- cache.put(fqn1, key, value);
- cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
- cache.put(fqn, key, value);
- tm.commit();
-
- gtxCnt = tt.getNumGlobalTransactions();
- txCnt = tt.getNumLocalTransactions();
- assert gtxCnt == 0 : "Global transaction count is > 0";
- assert txCnt == 0 : "Local transaction count is > 0";
-
- tm.begin();
- cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
- cache.put(fqn, key, value);
- cache.put(fqn1, key, value);
- tm.commit();
-
- gtxCnt = tt.getNumGlobalTransactions();
- txCnt = tt.getNumLocalTransactions();
- assert gtxCnt == 0 : "Global transaction count is > 0";
- assert txCnt == 0 : "Local transaction count is > 0";
-
- tm.begin();
- cache.put(fqn1, key, value);
- cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
- cache.put(fqn, key, value);
- cache.put(fqn1, key, value);
- tm.commit();
-
- gtxCnt = tt.getNumGlobalTransactions();
- txCnt = tt.getNumLocalTransactions();
- assert gtxCnt == 0 : "Global transaction count is > 0";
- assert txCnt == 0 : "Local transaction count is > 0";
- }
-}
17 years
JBoss Cache SVN: r4912 - in core/trunk: src/test/java/org/jboss/cache/factories and 9 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-12-21 09:58:06 -0500 (Fri, 21 Dec 2007)
New Revision: 4912
Added:
core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java
Modified:
core/trunk/pom.xml
core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
Log:
Unit test cleanups
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/pom.xml 2007-12-21 14:58:06 UTC (rev 4912)
@@ -73,12 +73,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>beanshell</groupId>
<artifactId>bsh</artifactId>
<version>2.0b4</version>
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.factories;
-import junit.framework.Assert;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -207,7 +206,7 @@
List<Interceptor> list = getInterceptorChainFactory(cache).asList(next);
Iterator<Interceptor> interceptors = list.iterator();
- Assert.assertEquals(8, list.size());
+ assertEquals(8, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
@@ -234,7 +233,7 @@
List<Interceptor> list = getInterceptorChainFactory(cache).asList(next);
Iterator<Interceptor> interceptors = list.iterator();
- Assert.assertEquals(9, list.size());
+ assertEquals(9, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
@@ -262,7 +261,7 @@
List<Interceptor> list = getInterceptorChainFactory(cache).asList(next);
Iterator<Interceptor> interceptors = list.iterator();
- Assert.assertEquals(10, list.size());
+ assertEquals(10, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
@@ -291,7 +290,7 @@
List<Interceptor> list = getInterceptorChainFactory(cache).asList(next);
Iterator<Interceptor> interceptors = list.iterator();
- Assert.assertEquals(10, list.size());
+ assertEquals(10, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
@@ -319,7 +318,7 @@
List<Interceptor> list = getInterceptorChainFactory(cache).asList(chain);
Iterator<Interceptor> interceptors = list.iterator();
- Assert.assertEquals(7, list.size());
+ assertEquals(7, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
@@ -341,7 +340,7 @@
list = getInterceptorChainFactory(cache).asList(chain);
interceptors = list.iterator();
- Assert.assertEquals(7, list.size());
+ assertEquals(7, list.size());
assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
assertEquals(TxInterceptor.class, interceptors.next().getClass());
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.invalidation;
-import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
@@ -62,8 +61,8 @@
cache1.put(fqn, "key", "value");
// test that this has NOT replicated, but rather has been invalidated:
- Assert.assertEquals("value", cache1.get(fqn, "key"));
- Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertNull("Should NOT have replicated!", cache2.getNode(fqn));
log.info("***** Node not replicated, as expected.");
@@ -73,11 +72,11 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation:
cache1.put(fqn, "key2", "value2");
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
n = cache2.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
}
@@ -122,8 +121,8 @@
cache1.put(fqn, "key", "value");
TestingUtil.sleepThread(500);// give it time to broadcast the evict call
// test that this has NOT replicated, but rather has been invalidated:
- Assert.assertEquals("value", cache1.get(fqn, "key"));
- Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertNull("Should NOT have replicated!", cache2.getNode(fqn));
// now make sure cache2 is in sync with cache1:
cache2.put(fqn, "key", "value");
@@ -132,11 +131,11 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation:
cache1.put(fqn, "key2", "value2");
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
TestingUtil.sleepThread(500);// give it time to broadcast the evict call
// since the node already exists even PL will not remove it - but will invalidate it's data
@@ -154,50 +153,50 @@
cache1.put(fqn, "key", "value");
// test that this has NOT replicated, but rather has been invalidated:
- Assert.assertEquals("value", cache1.get(fqn, "key"));
- Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertNull("Should NOT have replicated!", cache2.getNode(fqn));
log.info("***** Node not replicated, as expected.");
// now make sure cache2 is in sync with cache1:
// make sure this is in a tx
TransactionManager txm = cache2.getTransactionManager();
- Assert.assertEquals("value", cache1.get(fqn, "key"));
+ assertEquals("value", cache1.get(fqn, "key"));
txm.begin();
cache2.put(fqn, "key", "value");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
txm.commit();
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation again
txm = cache1.getTransactionManager();
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
txm.begin();
cache1.put(fqn, "key2", "value2");
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
txm.commit();
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
// since the node already exists even PL will not remove it - but will invalidate it's data
n = cache2.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
// test a rollback
txm = cache2.getTransactionManager();
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
txm.begin();
cache2.put(fqn, "key", "value");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
txm.rollback();
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
n = cache2.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
}
@@ -211,7 +210,7 @@
Fqn fqn = Fqn.fromString("/a/b");
cache2.put(fqn, "key", "value");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
Node n = cache1.getNode(fqn);
assertHasBeenInvalidated(n, "Should have been invalidated");
assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");
@@ -231,22 +230,22 @@
try
{
mgr1.commit();
- Assert.assertTrue("Ought to have succeeded!", true);
+ assertTrue("Ought to have succeeded!", true);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have succeeded!", false);
+ assertTrue("Ought to have succeeded!", false);
}
mgr2.resume(tx2);
try
{
mgr2.commit();
- Assert.assertTrue("Ought to have failed!", false);
+ assertTrue("Ought to have failed!", false);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have failed!", true);
+ assertTrue("Ought to have failed!", true);
}
}
@@ -258,8 +257,8 @@
Fqn fqn = Fqn.fromString("/a/b");
cache1.put("/a/b", "key", "value");
- Assert.assertEquals("value", cache1.get(fqn, "key"));
- Assert.assertNull(cache2.getNode(fqn));
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertNull(cache2.getNode(fqn));
// start a tx that cacahe1 will have to send out an evict ...
TransactionManager mgr1 = cache1.getTransactionManager();
@@ -276,22 +275,22 @@
try
{
mgr1.commit();
- Assert.assertTrue("Ought to have failed!", false);
+ assertTrue("Ought to have failed!", false);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have failed!", true);
+ assertTrue("Ought to have failed!", true);
}
mgr2.resume(tx2);
try
{
mgr2.commit();
- Assert.assertTrue("Ought to have succeeded!", true);
+ assertTrue("Ought to have succeeded!", true);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have succeeded!", false);
+ assertTrue("Ought to have succeeded!", false);
}
}
@@ -307,8 +306,8 @@
Fqn fqn = Fqn.fromString("/a/b");
cache1.put("/a/b", "key", "value");
- Assert.assertEquals("value", cache1.get(fqn, "key"));
- Assert.assertNull(cache2.getNode(fqn));
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertNull(cache2.getNode(fqn));
// start a tx that cacahe1 will have to send out an evict ...
TransactionManager mgr1 = cache1.getTransactionManager();
@@ -325,22 +324,22 @@
try
{
mgr1.commit();
- Assert.assertTrue("Ought to have succeeded!", true);
+ assertTrue("Ought to have succeeded!", true);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have succeeded!", false);
+ assertTrue("Ought to have succeeded!", false);
}
mgr2.resume(tx2);
try
{
mgr2.commit();
- Assert.assertTrue("Ought to have succeeded!", true);
+ assertTrue("Ought to have succeeded!", true);
}
catch (RollbackException roll)
{
- Assert.assertTrue("Ought to have succeeded!", false);
+ assertTrue("Ought to have succeeded!", false);
}
}
@@ -482,7 +481,7 @@
dumpVersionInfo(cache1, cache2, fqn);
// test that this has NOT replicated, but rather has been invalidated:
- Assert.assertEquals("value", cache1.get(fqn, "key"));
+ assertEquals("value", cache1.get(fqn, "key"));
Node n2 = cache2.getNode(fqn);
assertHasBeenInvalidated(n2, "Should have been invalidated");
assertHasBeenInvalidated(cache2.peek(fqn, true, true), "Should have been invalidated");
@@ -496,14 +495,14 @@
assertHasBeenInvalidated(n1, "Should have been invalidated");
assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation:
cache1.put(fqn, "key2", "value2");
dumpVersionInfo(cache1, cache2, fqn);
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.getNode(fqn);
assertHasBeenInvalidated(n2, "Should have been invalidated");
assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
@@ -513,25 +512,25 @@
txm.begin();
cache2.put(fqn, "key", "value");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
txm.commit();
n1 = cache1.getNode(fqn);
assertHasBeenInvalidated(n1, "Should have been invalidated");
assertHasBeenInvalidated(cache1.peek(fqn, false, false), "Should have been invalidated");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation again
txm = cache1.getTransactionManager();
txm.begin();
cache1.put(fqn, "key2", "value2");
- Assert.assertEquals("value", cache2.get(fqn, "key"));
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
txm.commit();
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.getNode(fqn);
assertHasBeenInvalidated(n2, "Should have been invalidated");
assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
@@ -541,11 +540,11 @@
txm.begin();
cache2.put(fqn, "key", "value");
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
- Assert.assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value", cache2.get(fqn, "key"));
txm.rollback();
- Assert.assertEquals("value2", cache1.get(fqn, "key2"));
+ assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.getNode(fqn);
assertHasBeenInvalidated(n2, "Should have been invalidated");
assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
@@ -560,20 +559,20 @@
Fqn fqn = Fqn.fromString("/a/b");
caches.get(0).put(fqn, "key", "value");
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
// now make sure cache2 is in sync with cache1:
caches.get(1).put(fqn, "key", "value");
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
// now test the invalidation:
caches.get(0).put(fqn, "key2", "value2");
- Assert.assertEquals("value2", caches.get(0).get(fqn, "key2"));
- Assert.assertEquals("value2", caches.get(1).get(fqn, "key2"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value2", caches.get(0).get(fqn, "key2"));
+ assertEquals("value2", caches.get(1).get(fqn, "key2"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
}
public void testPessimisticTransactionalWithCacheLoader() throws Exception
@@ -584,23 +583,23 @@
Fqn fqn = Fqn.fromString("/a/b");
TransactionManager mgr = caches.get(0).getTransactionManager();
- Assert.assertNull("Should be null", caches.get(0).get(fqn, "key"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key"));
+ assertNull("Should be null", caches.get(0).get(fqn, "key"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key"));
mgr.begin();
caches.get(0).put(fqn, "key", "value");
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
mgr.commit();
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
mgr.begin();
caches.get(0).put(fqn, "key2", "value2");
- Assert.assertEquals("value2", caches.get(0).get(fqn, "key2"));
+ assertEquals("value2", caches.get(0).get(fqn, "key2"));
mgr.rollback();
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
- Assert.assertNull("Should be null", caches.get(0).get(fqn, "key2"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key2"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertNull("Should be null", caches.get(0).get(fqn, "key2"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key2"));
}
public void testOptimisticWithCacheLoader() throws Exception
@@ -611,25 +610,25 @@
Fqn fqn = Fqn.fromString("/a/b");
TransactionManager mgr = caches.get(0).getTransactionManager();
- Assert.assertNull("Should be null", caches.get(0).get(fqn, "key"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key"));
+ assertNull("Should be null", caches.get(0).get(fqn, "key"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key"));
mgr.begin();
caches.get(0).put(fqn, "key", "value");
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key"));
mgr.commit();
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
mgr.begin();
caches.get(0).put(fqn, "key2", "value2");
- Assert.assertEquals("value2", caches.get(0).get(fqn, "key2"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key2"));
+ assertEquals("value2", caches.get(0).get(fqn, "key2"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key2"));
mgr.rollback();
- Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
- Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
- Assert.assertNull("Should be null", caches.get(0).get(fqn, "key2"));
- Assert.assertNull("Should be null", caches.get(1).get(fqn, "key2"));
+ assertEquals("value", caches.get(1).get(fqn, "key"));
+ assertEquals("value", caches.get(0).get(fqn, "key"));
+ assertNull("Should be null", caches.get(0).get(fqn, "key2"));
+ assertNull("Should be null", caches.get(1).get(fqn, "key2"));
}
public void testInvalidationWithRegionBasedMarshalling() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.jmx;
-import junit.framework.AssertionFailedError;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -349,7 +348,7 @@
private class MyListener implements NotificationListener
{
private RuntimeException exception;
- private AssertionFailedError failure;
+ private AssertionError failure;
private final String emitterObjectName;
MyListener(ObjectName emitter)
@@ -472,7 +471,7 @@
// Store so the test can rethrow
exception = e;
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
// Store so the test can rethrow
failure = e;
Modified: core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.loader;
-import junit.framework.Assert;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -63,11 +62,11 @@
try
{
loader.remove(Fqn.fromString("/blah"));
- Assert.assertTrue("Should have restricted this entry from being made", false);
+ assertTrue("Should have restricted this entry from being made", false);
}
catch (CacheException e)
{
- Assert.assertTrue(true);
+ assertTrue(true);
}
// clean up
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,13 +6,14 @@
*/
package org.jboss.cache.loader;
-import junit.framework.Assert;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -146,10 +147,10 @@
loader2 = ((CacheSPI<Object, Object>) cache2).getCacheLoaderManager().getCacheLoader();
// make sure everything is empty...
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
- Assert.assertNull(cache1.getRoot().getChild(fqn));
- Assert.assertNull(cache2.getRoot().getChild(fqn));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
+ assertNull(cache1.getRoot().getChild(fqn));
+ assertNull(cache2.getRoot().getChild(fqn));
mgr1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
mgr2 = cache2.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -162,31 +163,31 @@
mgr1.begin();
cache1.put(fqn, key, "value");
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertNull(cache2.get(fqn, key));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
+ assertEquals("value", cache1.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
mgr1.commit();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.begin();
cache1.put(fqn, key, "value2");
- Assert.assertEquals("value2", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.rollback();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
}
@@ -197,35 +198,35 @@
mgr1.begin();
cache1.put(fqn, key, "value");
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertNull(cache2.get(fqn, key));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
+ assertEquals("value", cache1.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
mgr1.commit();
TestingUtil.sleepThread(500);
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.begin();
cache1.put(fqn, key, "value2");
- Assert.assertEquals("value2", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.rollback();
TestingUtil.sleepThread(500);
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
}
public void testOptSyncRepl() throws Exception
@@ -234,31 +235,31 @@
mgr1.begin();
cache1.put(fqn, key, "value");
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertNull(cache2.get(fqn, key));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
+ assertEquals("value", cache1.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
mgr1.commit();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.begin();
cache1.put(fqn, key, "value2");
- Assert.assertEquals("value2", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.rollback();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
}
public void testOptAsyncRepl() throws Exception
@@ -268,34 +269,34 @@
mgr1.begin();
cache1.put(fqn, key, "value");
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertNull(cache2.get(fqn, key));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
+ assertEquals("value", cache1.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
mgr1.commit();
TestingUtil.sleepThread(500);
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.begin();
cache1.put(fqn, key, "value2");
- Assert.assertEquals("value2", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
mgr1.rollback();
TestingUtil.sleepThread(500);
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.loader;
-import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
@@ -16,6 +15,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -103,19 +103,19 @@
log.info("Finished put");
// test that this has propagated.
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertEquals("value", loader2.get(fqn).get(key));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertEquals("value", loader2.get(fqn).get(key));
cache1.evict(fqn);
// now cache 1 should not have this but cache 2 should.
// loader1 looks at cache2 while loader2 looks at cache1
- Assert.assertEquals("value", loader1.get(fqn).get(key));
- Assert.assertNull("Expecting null", loader2.get(fqn));
+ assertEquals("value", loader1.get(fqn).get(key));
+ assertNull("Expecting null", loader2.get(fqn));
// // calling a get on cache1 should cause the loader to retrieve the node from cache2
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// // and now loader2 should see it
- // Assert.assertEquals("value", loader2.get(fqn).get(key));
+ // assertEquals("value", loader2.get(fqn).get(key));
}
public void testGet() throws Exception
@@ -124,35 +124,35 @@
// test that this has propagated.
Map map = loader1.get(fqn);
- Assert.assertTrue("Should contain key", map.containsKey(key));
- Assert.assertEquals("value", map.get(key));
- Assert.assertEquals(1, map.size());
+ assertTrue("Should contain key", map.containsKey(key));
+ assertEquals("value", map.get(key));
+ assertEquals(1, map.size());
map = loader2.get(fqn);
- Assert.assertTrue("Should contain key", map.containsKey(key));
- Assert.assertEquals("value", map.get(key));
- Assert.assertEquals(1, map.size());
+ assertTrue("Should contain key", map.containsKey(key));
+ assertEquals("value", map.get(key));
+ assertEquals(1, map.size());
cache1.evict(fqn);
// now cache 1 should not have this but cache 2 should.
// loader1 looks at cache2 while loader2 looks at cache1
map = loader1.get(fqn);
- Assert.assertTrue(map.containsKey(key));
- Assert.assertEquals("value", map.get(key));
- Assert.assertEquals(1, map.size());
+ assertTrue(map.containsKey(key));
+ assertEquals("value", map.get(key));
+ assertEquals(1, map.size());
- Assert.assertNull("Expecting null", loader2.get(fqn));
+ assertNull("Expecting null", loader2.get(fqn));
map = loader2.get(fqn);
- Assert.assertNull("Should be null", map);
+ assertNull("Should be null", map);
// calling a get on cache1 should cause the loader to retrieve the node from cache2
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// and now loader2 should see it
map = loader2.get(fqn);
- Assert.assertTrue(map.containsKey(key));
- Assert.assertEquals("value", map.get(key));
- Assert.assertEquals(1, map.size());
+ assertTrue(map.containsKey(key));
+ assertEquals("value", map.get(key));
+ assertEquals(1, map.size());
}
public void testGetChildrenNames() throws Exception
@@ -167,9 +167,9 @@
// test that this has propagated.
Set childNames = loader1.getChildrenNames(fqn);
- Assert.assertEquals(3, childNames.size());
+ assertEquals(3, childNames.size());
childNames = loader2.getChildrenNames(fqn);
- Assert.assertEquals(3, childNames.size());
+ assertEquals(3, childNames.size());
cache1.evict(child1);
cache1.evict(child2);
@@ -179,19 +179,19 @@
// now cache 1 should not have this but cache 2 should.
// loader1 looks at cache2 while loader2 looks at cache1
childNames = loader1.getChildrenNames(fqn);
- Assert.assertEquals(3, childNames.size());
+ assertEquals(3, childNames.size());
childNames = loader2.getChildrenNames(fqn);
- Assert.assertNull("should be null", childNames);
+ assertNull("should be null", childNames);
// calling a get on cache1 should cause the loader to retrieve the node from cache2
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// load up children
- Assert.assertEquals("value", cache1.get(child1, key));
- Assert.assertEquals("value", cache1.get(child2, key));
- Assert.assertEquals("value", cache1.get(child3, key));
+ assertEquals("value", cache1.get(child1, key));
+ assertEquals("value", cache1.get(child2, key));
+ assertEquals("value", cache1.get(child3, key));
// and now loader2 should see it
childNames = loader2.getChildrenNames(fqn);
- Assert.assertEquals(3, childNames.size());
+ assertEquals(3, childNames.size());
}
public void testExists() throws Exception
@@ -199,19 +199,19 @@
cache1.put(fqn, key, "value");
// test that this has propagated.
- Assert.assertTrue("should exist", loader1.exists(fqn));
- Assert.assertTrue("should exist", loader2.exists(fqn));
+ assertTrue("should exist", loader1.exists(fqn));
+ assertTrue("should exist", loader2.exists(fqn));
cache1.evict(fqn);
// now cache 1 should not have this but cache 2 should.
// loader1 looks at cache2 while loader2 looks at cache1
- Assert.assertTrue("should exist", loader1.exists(fqn));
- Assert.assertTrue("should not exist", !loader2.exists(fqn));
+ assertTrue("should exist", loader1.exists(fqn));
+ assertTrue("should not exist", !loader2.exists(fqn));
// calling a get on cache1 should cause the loader to retrieve the node from cache2
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// and now loader2 should see it
- Assert.assertTrue("should exist", loader2.exists(fqn));
+ assertTrue("should exist", loader2.exists(fqn));
}
public void testCacheLoaderThreadSafety() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotificationThreadTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.notifications;
-import junit.framework.Assert;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
@@ -12,6 +11,8 @@
import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.assertNotSame;
+import static org.testng.AssertJUnit.assertSame;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -209,8 +210,8 @@
try
{
if (sameThreadExpected)
- Assert.assertSame(mainThread, Thread.currentThread());
- else Assert.assertNotSame(mainThread, Thread.currentThread());
+ assertSame(mainThread, Thread.currentThread());
+ else assertNotSame(mainThread, Thread.currentThread());
}
catch (Throwable t)
{
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,7 +1,5 @@
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
@@ -665,23 +663,23 @@
Transaction tx;
TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
mgr.begin();
cache.put(fqn, key, value);
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
tx = mgr.getTransaction();
mgr.suspend();
mgr.begin();
- Assert.assertNull(cache.get(fqn, key));
+ assertNull(cache.get(fqn, key));
mgr.commit();
mgr.resume(tx);
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.commit();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
}
@@ -691,26 +689,26 @@
Transaction tx;
TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
cache.put(fqn, key, value);
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.begin();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
cache.removeNode(fqn);
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
tx = mgr.getTransaction();
mgr.suspend();
mgr.begin();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.commit();
mgr.resume(tx);
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
mgr.commit();
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
}
@@ -720,25 +718,25 @@
Transaction tx;
TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
cache.put(fqn, key, value);
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.begin();
cache.removeNode(fqn);
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
tx = mgr.getTransaction();
mgr.suspend();
mgr.begin();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.commit();
mgr.resume(tx);
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
mgr.commit();
- Assert.assertNull(cache.getNode(fqn));
+ assertNull(cache.getNode(fqn));
}
public void testLoopedPutAndGet() throws Exception
@@ -774,7 +772,7 @@
catch (Exception e)
{
log.debug("Error: ", e);
- Assert.assertFalse("Threw exception!", true);
+ assertFalse("Threw exception!", true);
throw e;
}
}
@@ -815,27 +813,4 @@
destroyCache(cache1);
destroyCache(cache2);
}
-
- private void rollback(TransactionManager tm)
- {
- try
- {
- tm.rollback();
- }
- catch (Exception e)
- {
- log.error(e.getMessage(), e);
- }
-
- }
-
- private class ExceptionHolder
- {
- Exception node1Exception;
- Exception node2Exception;
-
- AssertionFailedError node1Failure;
- AssertionFailedError node2Failure;
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -11,6 +10,7 @@
import static org.jboss.cache.lock.NodeLock.LockType.READ;
import static org.jboss.cache.lock.NodeLock.LockType.WRITE;
import org.jboss.cache.misc.TestingUtil;
+import org.testng.AssertJUnit;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -201,7 +201,7 @@
void assertReceivedExpectedLocks()
{
- Assert.assertEquals(expected, actual);
+ AssertJUnit.assertEquals(expected, actual);
}
void expectsReadLock(Fqn f)
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,11 +6,12 @@
*/
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -55,9 +56,9 @@
DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("Version info should have propagated", v1, v2);
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("Version info should have propagated", v1, v2);
// change stuff in the node again...
cache1.put(fqn, key, "value2");
@@ -65,9 +66,9 @@
v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
- Assert.assertEquals("value2", cache1.get(fqn, key));
- Assert.assertEquals("value2", cache2.get(fqn, key));
- Assert.assertEquals("Version info should have propagated", v1, v2);
+ assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("Version info should have propagated", v1, v2);
}
public void testTwoCachesUpdatingSimultaneously() throws Exception
@@ -84,9 +85,9 @@
DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
- Assert.assertEquals("value", cache1.get(fqn, key));
- Assert.assertEquals("value", cache2.get(fqn, key));
- Assert.assertEquals("Version info should have propagated", v1, v2);
+ assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
+ assertEquals("Version info should have propagated", v1, v2);
// Start a tx on cache 1
mgr1.begin();
@@ -107,17 +108,17 @@
{
mgr2.resume(tx2);
mgr2.commit();
- Assert.assertTrue("Should have failed", false);
+ assertTrue("Should have failed", false);
}
catch (RollbackException rbe)
{
- Assert.assertTrue("Should have failed", true);
+ assertTrue("Should have failed", true);
}
// data versions should be in sync.
v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
- Assert.assertEquals("Version info should have propagated", v1, v2);
+ assertEquals("Version info should have propagated", v1, v2);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,12 +6,10 @@
*/
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.transaction.DummyTransactionManager;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.*;
import javax.transaction.Transaction;
@@ -30,12 +28,12 @@
// test the cache loader independently first ...
loader.remove(fqn);
- Assert.assertNull(loader.get(fqn));
+ assert loader.get(fqn) == null;
loader.put(fqn, key, value);
- Assert.assertEquals(value, loader.get(fqn).get(key));
+ assertEquals(value, loader.get(fqn).get(key));
// clean up
loader.remove(fqn);
- Assert.assertNull(loader.get(fqn));
+ assertNull(loader.get(fqn));
}
public void testCacheLoadOnTree() throws Exception
@@ -90,19 +88,19 @@
cache.put(fqn, key, value);
mgr.commit();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
//now lets see if the state has been persisted in the cache loader
- Assert.assertEquals(value, loader.get(fqn).get(key));
+ assertEquals(value, loader.get(fqn).get(key));
mgr.begin();
cache.removeNode(fqn);
mgr.commit();
- Assert.assertNull(cache.get(fqn, key));
+ assertNull(cache.get(fqn, key));
//now lets see if the state has been persisted in the cache loader
- Assert.assertNull(loader.get(fqn));
+ assertNull(loader.get(fqn));
mgr.begin();
cache.put(fqn, key, value);
@@ -110,15 +108,15 @@
mgr.suspend();
// lets see what we've got halfway within a tx
- Assert.assertNull(cache.get(fqn, key));
- Assert.assertNull(loader.get(fqn));
+ assertNull(cache.get(fqn, key));
+ assertNull(loader.get(fqn));
mgr.resume(tx);
mgr.commit();
// and after committing...
- Assert.assertEquals(value, cache.get(fqn, key));
- Assert.assertEquals(value, loader.get(fqn).get(key));
+ assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, loader.get(fqn).get(key));
// clean up loader
loader.remove(fqn);
@@ -129,20 +127,20 @@
CacheSPI<Object, Object> cache = createCacheWithLoader();
CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
- Assert.assertNull(cache.get(fqn, key));
+ assertNull(cache.get(fqn, key));
// put something in the loader
loader.put(fqn, key, value);
- Assert.assertEquals(value, loader.get(fqn).get(key));
+ assertEquals(value, loader.get(fqn).get(key));
// test that this can now be accessed by the cache
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
// clean up loader
loader.remove(fqn);
// what's in the cache now? Should not ne null...
- Assert.assertNotNull(cache.get(fqn, key));
+ assertNotNull(cache.get(fqn, key));
}
public void testCacheLoadingWithReplication() throws Exception
@@ -161,39 +159,39 @@
// add something in cache1
cache1.put(fqn, key, value);
- Assert.assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, cache1.get(fqn, key));
// test that loader1, loader2, cache2 doesnt have entry
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
- Assert.assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
+ assertNull(cache2.get(fqn, key));
// commit
mgr.commit();
// test that loader1, loader2, cache2 has entry
- Assert.assertEquals(value, cache1.get(fqn, key));
- Assert.assertEquals(value, loader1.get(fqn).get(key));
- Assert.assertEquals(value, loader2.get(fqn).get(key));
- Assert.assertEquals(value, cache2.get(fqn, key));
+ assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, loader1.get(fqn).get(key));
+ assertEquals(value, loader2.get(fqn).get(key));
+ assertEquals(value, cache2.get(fqn, key));
// cache2 removes entry
mgr.begin();
cache2.removeNode(fqn);
- Assert.assertNull(cache2.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
// test that loader1, loader2 and cache2 have the entry
- Assert.assertEquals(value, cache1.get(fqn, key));
- Assert.assertEquals(value, loader1.get(fqn).get(key));
- Assert.assertEquals(value, loader2.get(fqn).get(key));
+ assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, loader1.get(fqn).get(key));
+ assertEquals(value, loader2.get(fqn).get(key));
// commit
mgr.commit();
// test that the entry has been removed everywhere.
- Assert.assertNull(cache1.getNode(fqn));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
- Assert.assertNull(cache2.getNode(fqn));
+ assertNull(cache1.getNode(fqn));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
+ assertNull(cache2.getNode(fqn));
}
@@ -213,40 +211,40 @@
// add something in cache1
cache1.put(fqn, key, value);
- Assert.assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, cache1.get(fqn, key));
// test that loader1, loader2, cache2 doesnt have entry
System.out.println("*** " + loader1.get(fqn));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
- Assert.assertNull(cache2.get(fqn, key));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
+ assertNull(cache2.get(fqn, key));
// commit
mgr.commit();
// test that loader1, loader2, cache2 has entry
- Assert.assertEquals(value, cache1.get(fqn, key));
- Assert.assertEquals(value, loader1.get(fqn).get(key));
- Assert.assertEquals(value, loader2.get(fqn).get(key));
- Assert.assertEquals(value, cache2.get(fqn, key));
+ assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, loader1.get(fqn).get(key));
+ assertEquals(value, loader2.get(fqn).get(key));
+ assertEquals(value, cache2.get(fqn, key));
// cache2 removes entry
mgr.begin();
cache2.removeNode(fqn);
- Assert.assertNull(cache2.get(fqn, key));
+ assertNull(cache2.get(fqn, key));
// test that loader1, loader2 and cache2 have the entry
- Assert.assertEquals(value, cache1.get(fqn, key));
- Assert.assertEquals(value, loader1.get(fqn).get(key));
- Assert.assertEquals(value, loader2.get(fqn).get(key));
+ assertEquals(value, cache1.get(fqn, key));
+ assertEquals(value, loader1.get(fqn).get(key));
+ assertEquals(value, loader2.get(fqn).get(key));
// commit
mgr.commit();
// test that the entry has been removed everywhere.
- Assert.assertNull(cache1.getNode(fqn));
- Assert.assertNull(loader1.get(fqn));
- Assert.assertNull(loader2.get(fqn));
- Assert.assertNull(cache2.getNode(fqn));
+ assertNull(cache1.getNode(fqn));
+ assertNull(loader1.get(fqn));
+ assertNull(loader2.get(fqn));
+ assertNull(cache2.getNode(fqn));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,13 +6,14 @@
*/
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
import org.w3c.dom.Element;
/**
@@ -60,7 +61,7 @@
cache.removeNode(fqn);
loader.remove(fqn);
- Assert.assertNull(loader.get(fqn));
+ assertNull(loader.get(fqn));
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -70,8 +71,8 @@
mgr.commit();
// should be nothing in the loader
- Assert.assertEquals(value, cache.get(fqn, key));
- Assert.assertNull(loader.get(fqn));
+ assertEquals(value, cache.get(fqn, key));
+ assertNull(loader.get(fqn));
// evict from cache
mgr.begin();
@@ -81,14 +82,14 @@
mgr.begin();
// should now be passivated in the loader
// don't do a cache.get() first as this will activate this node from the loader again!
- // Assert.assertNull( cache.get( fqn ) );
- Assert.assertEquals(value, loader.get(fqn).get(key));
+ // assertNull( cache.get( fqn ) );
+ assertEquals(value, loader.get(fqn).get(key));
// now do a cache.get()...
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
// and the object should now be removed from the loader
- Assert.assertNull(loader.get(fqn));
+ assertNull(loader.get(fqn));
mgr.commit();
// clean up
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,11 +6,11 @@
*/
package org.jboss.cache.optimistic;
-import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
import javax.transaction.TransactionManager;
@@ -68,7 +68,7 @@
// test results.
for (int i = 0; i < numThreads; i++)
{
- Assert.assertTrue("Thread threw an exception!", threads[i].success);
+ assertTrue("Thread threw an exception!", threads[i].success);
}
}
@@ -96,7 +96,7 @@
catch (Exception e)
{
log.error("Caught Exception!", e);
- Assert.assertTrue("Caught Exception!", false);
+ assertTrue("Caught Exception!", false);
success = false;
try
{
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.options;
-import junit.framework.Assert;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
@@ -9,8 +8,7 @@
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -108,12 +106,12 @@
{
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (RollbackException e)
{
// should fail.
- Assert.assertTrue("expected to fail with a nested ClassCastException", true);
+ assertTrue("expected to fail with a nested ClassCastException", true);
}
}
@@ -159,12 +157,12 @@
try
{
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (RollbackException e)
{
// should fail.
- Assert.assertTrue("expected to fail with a CacheException to do with a versioning mismatch", true);
+ assertTrue("expected to fail with a CacheException to do with a versioning mismatch", true);
}
}
@@ -189,12 +187,12 @@
{
cache[1].put(fqn, key, "value2");
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (Exception e)
{
// should fail.
- Assert.assertTrue("expected to fail", true);
+ assertTrue("expected to fail", true);
}
}
@@ -239,12 +237,12 @@
{
// this call will use implicit versioning and will hence fail.
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (Exception e)
{
// should fail.
- Assert.assertTrue("expected to fail with a CacheException to do with a versioning mismatch", true);
+ assertTrue("expected to fail with a CacheException to do with a versioning mismatch", true);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.options;
-import junit.framework.Assert;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -16,8 +15,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -66,14 +64,14 @@
cache.put(fqn, key, "value");
//now retrieve the data from the cache.
- Assert.assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.get(fqn, key));
// get a hold of the node
NodeSPI<String, String> node = (NodeSPI<String, String>) cache.getNode(fqn);
DataVersion versionFromCache = node.getVersion();
- Assert.assertEquals(TestVersion.class, versionFromCache.getClass());
- Assert.assertEquals("99", ((TestVersion) versionFromCache).getInternalVersion());
+ assertEquals(TestVersion.class, versionFromCache.getClass());
+ assertEquals("99", ((TestVersion) versionFromCache).getInternalVersion());
}
public void testFailingPut() throws Exception
@@ -90,12 +88,12 @@
try
{
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (Exception e)
{
// should fail.
- Assert.assertTrue("expected to fail", true);
+ assertTrue("expected to fail", true);
}
}
@@ -112,12 +110,12 @@
{
// this call will use implicit versioning and will hence fail.
mgr.commit();
- Assert.assertTrue("expected to fail", false);
+ assertTrue("expected to fail", false);
}
catch (Exception e)
{
// should fail.
- Assert.assertTrue("expected to fail", true);
+ assertTrue("expected to fail", true);
}
}
Added: core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/options/OptimisticMemLeakTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -0,0 +1,90 @@
+package org.jboss.cache.options;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.transaction.TransactionTable;
+import org.testng.annotations.Test;
+
+import javax.transaction.TransactionManager;
+
+/**
+ * To test memory leak reported in http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#4112143
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ */
+@Test(groups = "functional")
+public class OptimisticMemLeakTest
+{
+ private Cache<Object, Object> cache;
+ private TransactionManager tm;
+ private TransactionTable tt;
+ private Fqn fqn = Fqn.fromString("/a/b/c");
+ private Fqn fqn1 = Fqn.fromString("/c/d/e");
+ private String key = "key", value = "value";
+
+ protected void tearDown()
+ {
+ cache.stop();
+ }
+
+ protected void setUp() throws Exception
+ {
+ cache = new DefaultCacheFactory<Object, Object>().createCache(false);
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+ cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.start();
+ tm = ((CacheSPI) cache).getTransactionManager();
+ tt = ((CacheSPI) cache).getTransactionTable();
+ }
+
+ public void testLeakWithFailSilently() throws Exception
+ {
+ tm.begin();
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, key, value);
+ tm.commit();
+
+ int gtxCnt = tt.getNumGlobalTransactions();
+ int txCnt = tt.getNumLocalTransactions();
+ assert gtxCnt == 0 : "Global transaction count is > 0";
+ assert txCnt == 0 : "Local transaction count is > 0";
+
+ tm.begin();
+ cache.put(fqn1, key, value);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, key, value);
+ tm.commit();
+
+ gtxCnt = tt.getNumGlobalTransactions();
+ txCnt = tt.getNumLocalTransactions();
+ assert gtxCnt == 0 : "Global transaction count is > 0";
+ assert txCnt == 0 : "Local transaction count is > 0";
+
+ tm.begin();
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, key, value);
+ cache.put(fqn1, key, value);
+ tm.commit();
+
+ gtxCnt = tt.getNumGlobalTransactions();
+ txCnt = tt.getNumLocalTransactions();
+ assert gtxCnt == 0 : "Global transaction count is > 0";
+ assert txCnt == 0 : "Local transaction count is > 0";
+
+ tm.begin();
+ cache.put(fqn1, key, value);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, key, value);
+ cache.put(fqn1, key, value);
+ tm.commit();
+
+ gtxCnt = tt.getNumGlobalTransactions();
+ txCnt = tt.getNumLocalTransactions();
+ assert gtxCnt == 0 : "Global transaction count is > 0";
+ assert txCnt == 0 : "Local transaction count is > 0";
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.options.cachemodelocal;
-import junit.framework.Assert;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -114,46 +113,46 @@
cache1.put(fqn, key, "value");
delay();
// cache1 should still have this
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// cache 2 should not
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value");
delay();
// cache1 should still have this
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
if (!isInvalidation)
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache2.get(fqn, key));
+ assertNull("should be invalidated", cache2.get(fqn, key));
}
// now cache2
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
- Assert.assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value2", cache1.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache1.get(fqn, key));
+ assertNull("should be invalidated", cache1.get(fqn, key));
}
}
@@ -166,24 +165,24 @@
cache1.put(fqn, map);
delay();
// cache1 should still have this
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// cache 2 should not
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
cache1.put(fqn, map);
delay();
// cache1 should still have this
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
if (!isInvalidation)
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache2.get(fqn, key));
+ assertNull("should be invalidated", cache2.get(fqn, key));
}
// now cache2
@@ -191,20 +190,20 @@
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, map);
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
- Assert.assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value2", cache1.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache1.get(fqn, key));
+ assertNull("should be invalidated", cache1.get(fqn, key));
}
}
@@ -215,14 +214,14 @@
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
delay();
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -230,28 +229,28 @@
delay();
// should be removed in cache1
- Assert.assertNull("should be null", cache1.get(fqn, key));
+ assertNull("should be null", cache1.get(fqn, key));
// Not in cache2
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
// replace cache entries
cache1.put(fqn, key, "value");
delay();
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
// now try again with passing the default options
@@ -260,8 +259,8 @@
delay();
// both should be null
- Assert.assertNull("should be null", cache1.get(fqn, key));
- Assert.assertNull("should be null", cache2.get(fqn, key));
+ assertNull("should be null", cache1.get(fqn, key));
+ assertNull("should be null", cache2.get(fqn, key));
}
public void testRemoveKey() throws Exception
@@ -270,14 +269,14 @@
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
delay();
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -285,28 +284,28 @@
delay();
// should be removed in cache1
- Assert.assertNull("should be null", cache1.get(fqn, key));
+ assertNull("should be null", cache1.get(fqn, key));
// Not in cache2
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
// replace cache entries
cache1.put(fqn, key, "value");
delay();
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
- Assert.assertNull("Should be null", cache2.get(fqn, key));
+ assertNull("Should be null", cache2.get(fqn, key));
}
else
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
// now try again with passing the default options
@@ -315,8 +314,8 @@
delay();
// both should be null
- Assert.assertNull("should be null", cache1.get(fqn, key));
- Assert.assertNull("should be null", cache2.get(fqn, key));
+ assertNull("should be null", cache1.get(fqn, key));
+ assertNull("should be null", cache2.get(fqn, key));
}
public void testTransactionalBehaviour() throws Exception
@@ -330,11 +329,11 @@
mgr.commit();
delay();
// cache1 should still have this
- Assert.assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value2", cache1.get(fqn, key));
if (!isInvalidation)
{
- Assert.assertEquals("value1", cache2.get(fqn, key));
+ assertEquals("value1", cache2.get(fqn, key));
}
else
{
@@ -350,16 +349,16 @@
mgr.commit();
delay();
// cache1 should still have this
- Assert.assertEquals("value", cache1.get(fqn, key));
+ assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
if (!isInvalidation)
{
- Assert.assertEquals("value", cache2.get(fqn, key));
+ assertEquals("value", cache2.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache2.get(fqn, key));
+ assertNull("should be invalidated", cache2.get(fqn, key));
}
// now cache2
@@ -372,7 +371,7 @@
mgr.commit();
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -390,14 +389,14 @@
cache2.put(fqn, key, "value2");
mgr.commit();
delay();
- Assert.assertEquals("value2", cache2.get(fqn, key));
+ assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
- Assert.assertEquals("value2", cache1.get(fqn, key));
+ assertEquals("value2", cache1.get(fqn, key));
}
else
{
- Assert.assertNull("should be invalidated", cache1.get(fqn, key));
+ assertNull("should be invalidated", cache1.get(fqn, key));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -15,7 +15,6 @@
@Test(groups = "profiling")
public class ProfileSlaveTest extends AbstractProfileTest
{
-
private void waitForTest() throws Exception
{
System.out.println("Slave listening for remote connections. Hit Enter when done.");
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -38,7 +38,7 @@
protected static final int NUM_THREADS = 10;
protected static final int MAX_RANDOM_SLEEP_MILLIS = 100;
protected static final int MAX_DEPTH = 8;
- protected static final int MAX_OVERALL_NODES = 10000;
+ protected static final int MAX_OVERALL_NODES = 100;
private List<Fqn> fqns = new ArrayList<Fqn>(MAX_OVERALL_NODES);
@@ -137,9 +137,11 @@
{
ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
long end = System.currentTimeMillis() + DURATION;
-
+ int i = 0;
+ long start = System.currentTimeMillis();
while (System.currentTimeMillis() < end)
{
+ i++;
exec.execute(new Runnable()
{
public void run()
@@ -155,8 +157,8 @@
// wait for executors to complete!
exec.shutdown();
exec.awaitTermination(10000, TimeUnit.MILLISECONDS);
-
- System.out.println("Completed Test!");
+ double durationSecs = (System.currentTimeMillis() - start) / 1000;
+ System.out.println("Completed Test! Achieved " + ((double) i / durationSecs) + " TPS.");
}
private String getRandomString()
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.transaction;
-import junit.framework.AssertionFailedError;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -41,8 +40,8 @@
private volatile boolean writerFailed;
private volatile boolean readerFailed;
- private volatile AssertionFailedError writerError;
- private volatile AssertionFailedError readerError;
+ private volatile AssertionError writerError;
+ private volatile AssertionError readerError;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
@@ -112,7 +111,7 @@
// notify the reading thread
secondCanRead.countDown();
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
writerError = e;
}
@@ -167,7 +166,7 @@
// I should still see the value I put
assertEquals("write lock not acquired on " + "creation of an empty node", VALUE, cache.get(a2, KEY));
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
readerError = e;
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.transaction;
-import junit.framework.AssertionFailedError;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
@@ -38,8 +37,8 @@
private volatile boolean writerFailed;
private volatile boolean readerFailed;
- private volatile AssertionFailedError writerError;
- private volatile AssertionFailedError readerError;
+ private volatile AssertionError writerError;
+ private volatile AssertionError readerError;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
@@ -122,7 +121,7 @@
// I should still be able to see the "clean" value
assertEquals("Could not read node with expected value!", VALUE, cache.get(FQN, KEY));
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
readerError = e;
}
@@ -179,7 +178,7 @@
tm.rollback();
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
writerError = e;
}
@@ -260,7 +259,7 @@
mgr.commit();
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
writerError = e;
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.transaction;
-import junit.framework.AssertionFailedError;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -33,7 +32,7 @@
private final String VALUE = "value";
private volatile boolean writerFailed;
- private volatile AssertionFailedError writerError;
+ private volatile AssertionError writerError;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
@@ -92,7 +91,7 @@
tm.commit();
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
writerError = e;
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2007-12-21 06:12:32 UTC (rev 4911)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java 2007-12-21 14:58:06 UTC (rev 4912)
@@ -1,6 +1,5 @@
package org.jboss.cache.transaction;
-import junit.framework.AssertionFailedError;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
@@ -35,7 +34,7 @@
private final String VALUE = "value";
private volatile boolean writerFailed;
- private volatile AssertionFailedError writerError;
+ private volatile AssertionError writerError;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
@@ -97,7 +96,7 @@
tx.commit();
}
- catch (AssertionFailedError e)
+ catch (AssertionError e)
{
writerError = e;
}
17 years
JBoss Cache SVN: r4911 - cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-12-21 01:12:32 -0500 (Fri, 21 Dec 2007)
New Revision: 4911
Modified:
cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh
Log:
Modified: cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh
===================================================================
--- cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh 2007-12-21 06:11:17 UTC (rev 4910)
+++ cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh 2007-12-21 06:12:32 UTC (rev 4911)
@@ -2,7 +2,7 @@
THIS_DIR="./cache-products/jbosscache-2.0.0"
-#adding lib files to classpath
+#adding lib files to classpath
for JAR in $THIS_DIR/lib/*
do
CLASSPATH=$CLASSPATH:$JAR
17 years
JBoss Cache SVN: r4910 - cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-12-21 01:11:17 -0500 (Fri, 21 Dec 2007)
New Revision: 4910
Added:
cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh
Log:
Added: cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh
===================================================================
--- cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh (rev 0)
+++ cache-bench-fwk/trunk/cache-products/jbosscache-2.0.0/config.sh 2007-12-21 06:11:17 UTC (rev 4910)
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+THIS_DIR="./cache-products/jbosscache-2.0.0"
+
+#adding lib files to classpath
+for JAR in $THIS_DIR/lib/*
+do
+ CLASSPATH=$CLASSPATH:$JAR
+done
+CLASSPATH=$CLASSPATH:./classes/production/jbosscache-2.0.0
+CLASSPATH=$CLASSPATH:$THIS_DIR/conf
+
17 years
JBoss Cache SVN: r4909 - cache-bench-fwk/trunk/conf.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-12-21 01:07:22 -0500 (Fri, 21 Dec 2007)
New Revision: 4909
Modified:
cache-bench-fwk/trunk/conf/log4j.xml
Log:
Modified: cache-bench-fwk/trunk/conf/log4j.xml
===================================================================
--- cache-bench-fwk/trunk/conf/log4j.xml 2007-12-21 05:13:55 UTC (rev 4908)
+++ cache-bench-fwk/trunk/conf/log4j.xml 2007-12-21 06:07:22 UTC (rev 4909)
@@ -27,6 +27,11 @@
</appender>
<!-- The list of Categories-->
+ <category name="ClusterConfigurationCheck" additivity="false">
+ <priority value="INFO"/>
+ <appender-ref ref="CONSOLE"/>
+ </category>
+
<category name="CacheException" additivity="false">
<priority value="ERROR"/>
<appender-ref ref="FILE"/>
@@ -40,6 +45,7 @@
<category name="org.cachebench" additivity="false">
<priority value="DEBUG"/>
<appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
</category>
<category name="org.cachebench.tests" additivity="false">
@@ -69,7 +75,7 @@
<!-- Here goes the root -->
<root>
- <priority value ="ERROR" />
+ <priority value ="DEBU" />
<appender-ref ref="FILE" />
</root>
17 years