Author: manik.surtani(a)jboss.com
Date: 2008-01-02 20:58:38 -0500 (Wed, 02 Jan 2008)
New Revision: 4952
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
Log:
Fixed tests
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -1,8 +1,10 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.annotations.ComponentName;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -24,11 +26,13 @@
public class CallInterceptor extends Interceptor
{
private CacheImpl cacheImpl;
+ private CacheSPI remoteDelegate;
@Inject
- private void injectDependencies(CacheImpl cacheImpl)
+ private void injectDependencies(CacheImpl cacheImpl,
@ComponentName("remoteDelegate")CacheSPI remoteDelegate)
{
this.cacheImpl = cacheImpl;
+ this.remoteDelegate = remoteDelegate;
}
public Object invoke(InvocationContext ctx) throws Throwable
@@ -41,7 +45,7 @@
if (log.isTraceEnabled()) log.trace("Passing up method " + m + "
so it gets invoked on cache.");
try
{
- retval = m.invoke(cacheImpl);
+ retval = m.invoke(m.getMethodId() ==
MethodDeclarations.dataGravitationCleanupMethod_id ? remoteDelegate : cacheImpl);
}
catch (Throwable t)
{
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -131,7 +131,7 @@
return handleCrudMethod(ctx, fqn, null);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx,
GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn
primary, Fqn backup) throws Throwable
{
return handleCrudMethod(ctx, primary, null);
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -152,7 +152,7 @@
result = handlePutForExternalReadVersionedMethod(ctx, (GlobalTransaction)
args[0], (Fqn) args[1], args[2], args[3], (DataVersion) args[5]);
break;
case MethodDeclarations.dataGravitationCleanupMethod_id:
- result = handleDataGravitationCleanupMethod(ctx, (GlobalTransaction) args[0],
(Fqn) args[1], (Fqn) args[2]);
+ result = handleDataGravitationCleanupMethod(ctx, (Fqn) args[0], (Fqn)
args[1]);
break;
case MethodDeclarations.removeNodeVersionedMethodLocal_id:
result = handleRemoveNodeVersionedMethod(ctx, (GlobalTransaction) args[0],
(Fqn) args[1], (Boolean) args[2], (DataVersion) args[3]);
@@ -227,9 +227,9 @@
}
/**
- * Handles {@link
org.jboss.cache.CacheImpl#_dataGravitationCleanup(org.jboss.cache.transaction.GlobalTransaction,
org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
+ * Handles {@link
org.jboss.cache.invocation.RemoteCacheInvocationDelegate#dataGravitationCleanup(org.jboss.cache.Fqn,
org.jboss.cache.Fqn)}
*/
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx,
GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn
primary, Fqn backup) throws Throwable
{
return defaultHandlersBehavior();
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -176,7 +176,7 @@
*/
private Fqn getFqn(Object[] args, int methodId)
{
- return (Fqn) args[methodId == MethodDeclarations.moveMethodLocal_id ? 0 : 1];
+ return (Fqn) args[methodId == MethodDeclarations.moveMethodLocal_id || methodId ==
MethodDeclarations.dataGravitationCleanupMethod_id ? 0 : 1];
}
/**
@@ -187,7 +187,7 @@
*/
private Fqn getBackupFqn(Object[] args)
{
- return (Fqn) args[2];
+ return (Fqn) args[1];
}
/**
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -167,7 +167,7 @@
return handleCrudMethod(ctx);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx,
GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn
primary, Fqn backup) throws Throwable
{
return handleCrudMethod(ctx);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03
00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -162,7 +162,7 @@
return handleNonTxMethod(ctx);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx,
GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn
primary, Fqn backup) throws Throwable
{
return handleNonTxMethod(ctx);
}
@@ -1182,6 +1182,9 @@
modifications = entry.getModifications();
ctx = cache.getInvocationContext();
if (ctx.isOptionsUninitialised() && entry.getOption() != null)
ctx.setOptionOverrides(entry.getOption());
+
+ assertCanContinue();
+
ctx.setOriginLocal(false);
}
Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2008-01-03 00:57:22 UTC
(rev 4951)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2008-01-03 01:58:38 UTC
(rev 4952)
@@ -14,6 +14,7 @@
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -55,7 +56,7 @@
{
Cache cache = createCache(mode);
List<Cache> caches = new LinkedList<Cache>();
- if (c != null) for (Cache existingCache : c) caches.add(existingCache);
+ if (c != null) caches.addAll(Arrays.asList(c));
caches.add(cache);
c = caches.toArray(new CacheSPI[]{});
if (start)
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -6,9 +6,12 @@
*/
package org.jboss.cache.buddyreplication;
+import org.testng.annotations.Test;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
+@Test(groups = {"functional", "jgroups"})
public class BuddyReplicationWithOptimisticLockingTest extends
BuddyReplicationFailoverTest
{
public BuddyReplicationWithOptimisticLockingTest()
Modified:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -6,15 +6,16 @@
*/
package org.jboss.cache.buddyreplication;
+import org.jboss.cache.Fqn;
import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.Fqn;
-
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
+@Test(groups = {"functional", "jgroups"})
public class BuddyReplicationWithTransactionsTest extends BuddyReplicationTestsBase
{
private Fqn fqn = Fqn.fromString("test");
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-03
00:57:22 UTC (rev 4951)
+++
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-03
01:58:38 UTC (rev 4952)
@@ -195,7 +195,7 @@
{
cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
regionManager = cache.getRegionManager();
- assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
+ assertEquals(1, regionManager.getAllRegions(Region.Type.ANY).size());
}
private void setupCache(String configurationName)