JBoss Cache SVN: r6654 - core/trunk/src/test/java/org/jboss/cache/notifications.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-09-01 10:48:45 -0400 (Mon, 01 Sep 2008)
New Revision: 6654
Modified:
core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
Log:
fixed UT
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java 2008-09-01 14:07:15 UTC (rev 6653)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java 2008-09-01 14:48:45 UTC (rev 6654)
@@ -1,12 +1,12 @@
package org.jboss.cache.notifications;
-import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.*;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.invocation.LegacyInvocationContext;
+import org.jboss.cache.invocation.MVCCInvocationContext;
import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.*;
import org.jgroups.View;
@@ -36,9 +36,12 @@
public void setUp()
{
notifier = new NotifierImpl();
- notifier.injectDependencies(createNiceMock(CacheSPI.class), new Configuration());
+ CacheSPI cacheSPI = createNiceMock(CacheSPI.class);
+ expect(cacheSPI.getInvocationContext()).andStubReturn(new MVCCInvocationContext());
+ replay(cacheSPI);
+ notifier.injectDependencies(cacheSPI, new Configuration());
notifier.start();
- ctx = new LegacyInvocationContext(null);
+ ctx = new MVCCInvocationContext();
allEventsListener = new AllEventsListener();
notifier.addCacheListener(allEventsListener);
}
16 years, 4 months
JBoss Cache SVN: r6653 - in core/trunk/src: main/java/org/jboss/cache/remoting/jgroups and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-09-01 10:07:15 -0400 (Mon, 01 Sep 2008)
New Revision: 6653
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
Log:
update locking during region inactivation
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-09-01 07:45:36 UTC (rev 6652)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-09-01 14:07:15 UTC (rev 6653)
@@ -538,6 +538,7 @@
}
catch (Exception transferFailed)
{
+ if (log.isTraceEnabled()) log.trace("Error while fetching state",transferFailed);
successfulTransfer = false;
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-09-01 07:45:36 UTC (rev 6652)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-09-01 14:07:15 UTC (rev 6653)
@@ -489,10 +489,7 @@
*/
protected void inactivateRegion(Fqn fqn) throws CacheException
{
- NodeSPI parent = null;
NodeSPI subtreeRoot = null;
- boolean parentLocked = false;
- boolean subtreeLocked = false;
InvocationContext ctx = cache.getInvocationContext();
ctx.getOptionOverrides().setLockAcquisitionTimeout((int) (cache.getConfiguration().getLockAcquisitionTimeout() + 5000));
@@ -530,71 +527,13 @@
if (subtreeRoot != null)
{
- // Acquire locks
- subtreeLocked = lockManager.lockAllAndRecord(subtreeRoot, WRITE, ctx);
-
- // Lock the parent, as we're about to write to it
- parent = subtreeRoot.getParentDirect();
- if (parent != null) parentLocked = lockManager.lockAllAndRecord(parent, WRITE, ctx);
-
// Remove the subtree
cache.evict(subtree, true);
-
- // Release locks
- if (parent != null)
- {
- log.debug("forcing release of locks in parent");
- if (lockManager.isLocked(parent)) lockManager.unlock(parent.getFqn(), null);
- }
-
- parentLocked = false;
-
- log.debug("forcing release of all locks in subtree");
- lockManager.unlock(ctx);
- subtreeLocked = false;
}
}
}
- catch (InterruptedException e)
- {
- throw new CacheException(e);
- }
finally
{
- // If we didn't succeed, undo the marshalling change
- // NO. Since we inactivated, we may have missed changes
- //if (!success && !inactive)
- // marshaller_.activate(subtreeFqn);
-
- if (parentLocked)
- {
- log.debug("forcing release of locks in parent");
- try
- {
- if (parent != null && lockManager.isLocked(parent.getFqn())) lockManager.unlock(parent.getFqn(), null);
- }
- catch (Throwable t)
- {
- log.error("failed releasing locks", t);
- }
- }
- if (subtreeLocked)
- {
- log.debug("forcing release of all locks in subtree");
- try
- {
- if (subtreeRoot != null && lockManager.isLocked(subtreeRoot.getFqn()))
- lockManager.unlock(subtreeRoot.getFqn(), null);
- }
- catch (Throwable t)
- {
- log.error("failed releasing locks", t);
- }
- }
-
- // If necessary, release locks
- if (ctx != null) lockManager.unlock(ctx);
-
unlock(fqn);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2008-09-01 07:45:36 UTC (rev 6652)
+++ core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2008-09-01 14:07:15 UTC (rev 6653)
@@ -370,6 +370,7 @@
}
catch (Throwable t)
{
+ if (log.isTraceEnabled()) log.trace("Unknown error while integrating state", t);
stateReceivingFailed(t);
}
finally
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-09-01 07:45:36 UTC (rev 6652)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-09-01 14:07:15 UTC (rev 6653)
@@ -11,6 +11,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
+import org.jboss.cache.lock.LockManager;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.BuddyReplicationConfig;
@@ -256,6 +257,27 @@
}
+ public void testLocksAndStateTransfer() throws Exception
+ {
+ CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, false);
+ createAndActivateRegion(cache1, A);
+ cache1.put(A_B, "name", JOE);
+ CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, false);
+ // Pause to give caches time to see each other
+ TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
+ createAndActivateRegion(cache2, A_B);
+ assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
+
+ LockManager lockManager = cache1.getComponentRegistry().getComponent(LockManager.class);
+ assert !lockManager.isLocked(A_B);
+ cache1.getRegion(A, false).deactivate();
+ assert !lockManager.isLocked(A);
+ assert !lockManager.isLocked(A_B);
+ createAndActivateRegion(cache1, A_B);
+ assertEquals("Incorrect name for /a/b", JOE, cache1.get(A_B, "name"));
+ }
+
+
public void testPartialStateTferWithLoader() throws Exception
{
CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, true);
16 years, 4 months
JBoss Cache SVN: r6652 - in core/trunk/src/main/java/org/jboss/cache: notifications and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 03:45:36 -0400 (Mon, 01 Sep 2008)
New Revision: 6652
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
Log:
Fixed stuff in invocation context
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-09-01 07:08:56 UTC (rev 6651)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-09-01 07:45:36 UTC (rev 6652)
@@ -5,6 +5,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
+import java.util.Collections;
import java.util.Map;
/**
@@ -31,7 +32,7 @@
public void putLookedUpNode(Fqn f, NodeSPI n)
{
- throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
+ // a no-op by default.
}
public void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes)
@@ -46,7 +47,8 @@
public Map<Fqn, NodeSPI> getLookedUpNodes()
{
- throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
+ // a no-op by default.
+ return Collections.emptyMap();
}
public InvocationContext copy()
Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-09-01 07:08:56 UTC (rev 6651)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-09-01 07:45:36 UTC (rev 6652)
@@ -612,6 +612,8 @@
private void restoreInvocationContext(InvocationContext backup)
{
+ InvocationContext currentIC = cache.getInvocationContext();
+ backup.putLookedUpNodes(currentIC.getLookedUpNodes());
cache.setInvocationContext(backup);
}
16 years, 4 months
JBoss Cache SVN: r6651 - in support/trunk: common and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 03:08:56 -0400 (Mon, 01 Sep 2008)
New Revision: 6651
Modified:
support/trunk/common/pom.xml
support/trunk/pom.xml
support/trunk/xslt/pom.xml
Log:
Sources will now be generated for builds
Modified: support/trunk/common/pom.xml
===================================================================
--- support/trunk/common/pom.xml 2008-09-01 05:30:11 UTC (rev 6650)
+++ support/trunk/common/pom.xml 2008-09-01 07:08:56 UTC (rev 6651)
@@ -4,11 +4,11 @@
<parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-support</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-common-parent</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JBoss Cache Common Parent</name>
<description>The parent POM for all JBoss Cache modules.</description>
@@ -178,9 +178,32 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
+ <downloadSources>true</downloadSources>
<buildOutputDirectory>${basedir}/eclipse-output</buildOutputDirectory>
</configuration>
- </plugin>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+
+ <!-- Generate src jars as well -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<finalName>${artifactId}</finalName>
</build>
Modified: support/trunk/pom.xml
===================================================================
--- support/trunk/pom.xml 2008-09-01 05:30:11 UTC (rev 6650)
+++ support/trunk/pom.xml 2008-09-01 07:08:56 UTC (rev 6651)
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-support</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JBoss Cache Support Modules</name>
<description>Grouping of JBoss Cache support modules</description>
Modified: support/trunk/xslt/pom.xml
===================================================================
--- support/trunk/xslt/pom.xml 2008-09-01 05:30:11 UTC (rev 6650)
+++ support/trunk/xslt/pom.xml 2008-09-01 07:08:56 UTC (rev 6651)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-support</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-doc-xslt-support</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
<name>JBoss Cache Documentation XSLT support</name>
<description>JBoss Cache Documentation XSLT support</description>
16 years, 4 months
JBoss Cache SVN: r6650 - in core/trunk/src/test/java/org/jboss/cache: util/internals and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 01:30:11 -0400 (Mon, 01 Sep 2008)
New Revision: 6650
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionTestsBase.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionWatcher.java
Log:
Better timing control between eviction tests
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionTestsBase.java 2008-09-01 05:15:40 UTC (rev 6649)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionTestsBase.java 2008-09-01 05:30:11 UTC (rev 6650)
@@ -13,7 +13,6 @@
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.EvictionController;
import org.jboss.cache.util.internals.EvictionWatcher;
import java.util.concurrent.TimeUnit;
@@ -49,10 +48,6 @@
*/
public boolean waitForEviction(Cache cache, long timeToWait, TimeUnit unit, Fqn... fqnsToEvict) throws InterruptedException
{
- EvictionController ec = new EvictionController(cache);
- EvictionController.Signaller signaller = ec.getEvictionThreadSignaller();
- boolean evicted = new EvictionWatcher(cache, fqnsToEvict).waitForEviction(timeToWait, unit);
- signaller.waitForEvictionThreadCompletion(timeToWait, unit);
- return evicted;
+ return new EvictionWatcher(cache, fqnsToEvict).waitForEviction(timeToWait, unit);
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-09-01 05:15:40 UTC (rev 6649)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java 2008-09-01 05:30:11 UTC (rev 6650)
@@ -156,7 +156,7 @@
{
String str = rootStr + Integer.toString(i);
Fqn fqn = Fqn.fromString(str);
- assertNull(cache.get(fqn, str));
+ assertNull("Fqn " + fqn + " should be null", cache.get(fqn, str));
}
for (int i = 5; i < 10; i++)
{
Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionWatcher.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionWatcher.java 2008-09-01 05:15:40 UTC (rev 6649)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionWatcher.java 2008-09-01 05:30:11 UTC (rev 6650)
@@ -24,6 +24,7 @@
Cache<?, ?> cache;
List<Fqn> fqnsToWaitFor;
CountDownLatch latch;
+ EvictionController.Signaller signaller;
public EvictionWatcher(Cache<?, ?> cache, Fqn... fqnsToWaitFor)
{
@@ -35,6 +36,8 @@
this.cache = cache;
this.fqnsToWaitFor = new ArrayList<Fqn>(fqnsToWaitFor);
latch = new CountDownLatch(fqnsToWaitFor.size());
+ EvictionController ec = new EvictionController(cache);
+ signaller = ec.getEvictionThreadSignaller();
cache.addCacheListener(this);
}
@@ -61,7 +64,12 @@
{
try
{
- return latch.await(timeout, unit);
+ boolean evicted = latch.await(timeout, unit);
+
+ // now make sure the eviction thread has completed.
+ signaller.waitForEvictionThreadCompletion(timeout, unit);
+ return evicted;
+
}
finally
{
16 years, 4 months
JBoss Cache SVN: r6649 - in core/trunk/src: main/java/org/jboss/cache/invocation and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 01:15:40 -0400 (Mon, 01 Sep 2008)
New Revision: 6649
Modified:
core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
Log:
Notification callbacks to allow for looked up nodes to be injected into call back contexts
Modified: core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -74,6 +74,13 @@
public abstract void putLookedUpNode(Fqn f, NodeSPI n);
/**
+ * Adds a map of looked up nodes to the current map of looked up nodes
+ *
+ * @param lookedUpNodes looked up nodes to add
+ */
+ public abstract void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes);
+
+ /**
* Clears the registry of looked up nodes.
*
* @since 3.0.
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -34,6 +34,11 @@
throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
}
+ public void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes)
+ {
+ // a no-op by default.
+ }
+
public void clearLookedUpNodes()
{
// no-op
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -63,6 +63,19 @@
}
}
+ public void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes)
+ {
+ if (mvccTCtx != null)
+ mvccTCtx.putLookedUpNodes(lookedUpNodes);
+ else
+ {
+ if (this.lookedUpNodes == null)
+ this.lookedUpNodes = new HashMap<Fqn, NodeSPI>(lookedUpNodes);
+ else
+ lookedUpNodes.putAll(lookedUpNodes);
+ }
+ }
+
/**
* Clears the registry of looked up nodes.
* <p/>
Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -6,43 +6,6 @@
*/
package org.jboss.cache.notifications;
-import static org.jboss.cache.notifications.event.Event.Type.BUDDY_GROUP_CHANGED;
-import static org.jboss.cache.notifications.event.Event.Type.CACHE_BLOCKED;
-import static org.jboss.cache.notifications.event.Event.Type.CACHE_STARTED;
-import static org.jboss.cache.notifications.event.Event.Type.CACHE_STOPPED;
-import static org.jboss.cache.notifications.event.Event.Type.CACHE_UNBLOCKED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_ACTIVATED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_CREATED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_EVICTED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_INVALIDATED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_LOADED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_MODIFIED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_MOVED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_PASSIVATED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_REMOVED;
-import static org.jboss.cache.notifications.event.Event.Type.NODE_VISITED;
-import static org.jboss.cache.notifications.event.Event.Type.TRANSACTION_COMPLETED;
-import static org.jboss.cache.notifications.event.Event.Type.TRANSACTION_REGISTERED;
-import static org.jboss.cache.notifications.event.Event.Type.VIEW_CHANGED;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.transaction.Transaction;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
@@ -58,49 +21,30 @@
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.marshall.MarshalledValueMap;
-import org.jboss.cache.notifications.annotation.BuddyGroupChanged;
-import org.jboss.cache.notifications.annotation.CacheBlocked;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.CacheUnblocked;
-import org.jboss.cache.notifications.annotation.NodeActivated;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeInvalidated;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodePassivated;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.annotation.TransactionCompleted;
-import org.jboss.cache.notifications.annotation.TransactionRegistered;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.BuddyGroupChangedEvent;
-import org.jboss.cache.notifications.event.CacheBlockedEvent;
-import org.jboss.cache.notifications.event.CacheStartedEvent;
-import org.jboss.cache.notifications.event.CacheStoppedEvent;
-import org.jboss.cache.notifications.event.CacheUnblockedEvent;
-import org.jboss.cache.notifications.event.Event;
-import org.jboss.cache.notifications.event.EventImpl;
-import org.jboss.cache.notifications.event.NodeActivatedEvent;
-import org.jboss.cache.notifications.event.NodeCreatedEvent;
-import org.jboss.cache.notifications.event.NodeEvictedEvent;
-import org.jboss.cache.notifications.event.NodeInvalidatedEvent;
-import org.jboss.cache.notifications.event.NodeLoadedEvent;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.notifications.event.NodeMovedEvent;
-import org.jboss.cache.notifications.event.NodePassivatedEvent;
-import org.jboss.cache.notifications.event.NodeRemovedEvent;
-import org.jboss.cache.notifications.event.NodeVisitedEvent;
-import org.jboss.cache.notifications.event.TransactionCompletedEvent;
-import org.jboss.cache.notifications.event.TransactionRegisteredEvent;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
+import org.jboss.cache.notifications.annotation.*;
+import org.jboss.cache.notifications.event.*;
+import static org.jboss.cache.notifications.event.Event.Type.*;
import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
import org.jgroups.View;
+import javax.transaction.Transaction;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* Helper class that handles all notifications to registered listeners.
*
@@ -682,6 +626,9 @@
{
// wipe current context.
cache.setInvocationContext(null);
+ // get a new Invocation Context
+ InvocationContext newContext = cache.getInvocationContext();
+ newContext.putLookedUpNodes(ctx.getLookedUpNodes());
return ctx;
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -86,4 +86,9 @@
super.reset();
lookedUpNodes.clear();
}
+
+ public void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes)
+ {
+ lookedUpNodes.putAll(lookedUpNodes);
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-09-01 05:13:32 UTC (rev 6648)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-09-01 05:15:40 UTC (rev 6649)
@@ -50,7 +50,6 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- log.debug("");
CacheFactory<String, String> instance = new DefaultCacheFactory<String, String>();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode("local");
@@ -124,6 +123,9 @@
Object obj = cache.get(fqn, "bean");
assertEquals("Got bean", "A bean", obj);
+ if (listener.activationException != null) throw listener.activationException;
+ if (listener.passivationException != null) throw listener.passivationException;
+
assertNull("No activation exception", listener.activationException);
assertNull("No passivation exception", listener.passivationException);
assertTrue(listener.activated.contains(fqn));
16 years, 4 months
JBoss Cache SVN: r6648 - in core/trunk/src/test/java/org/jboss/cache: mgmt and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 01:13:32 -0400 (Mon, 01 Sep 2008)
New Revision: 6648
Modified:
core/trunk/src/test/java/org/jboss/cache/commands/read/ExistsCommandTest.java
core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
Log:
Fixed broken tests
Modified: core/trunk/src/test/java/org/jboss/cache/commands/read/ExistsCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/read/ExistsCommandTest.java 2008-09-01 04:29:13 UTC (rev 6647)
+++ core/trunk/src/test/java/org/jboss/cache/commands/read/ExistsCommandTest.java 2008-09-01 05:13:32 UTC (rev 6648)
@@ -1,6 +1,8 @@
package org.jboss.cache.commands.read;
-import static org.easymock.EasyMock.*;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.MVCCInvocationContext;
+import org.jboss.cache.mock.NodeSpiMock;
import org.testng.annotations.Test;
/**
@@ -22,13 +24,12 @@
public void testPerform()
{
- expect(container.exists(testFqn)).andReturn(false);
- replay(container);
- assert !((Boolean) command.perform(null));
- reset(container);
+ InvocationContext ctx = new MVCCInvocationContext();
+ ctx.putLookedUpNode(testFqn, null);
+ assert !((Boolean) command.perform(ctx));
- expect(container.exists(testFqn)).andReturn(true);
- replay(container);
- assert Boolean.TRUE == command.perform(null);
+ ctx.putLookedUpNode(testFqn, new NodeSpiMock(testFqn));
+
+ assert Boolean.TRUE == command.perform(ctx);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-09-01 04:29:13 UTC (rev 6647)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java 2008-09-01 05:13:32 UTC (rev 6648)
@@ -5,6 +5,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.interceptors.TxInterceptor;
import static org.testng.AssertJUnit.*;
@@ -213,6 +214,7 @@
CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
cache.getConfiguration().setUseRegionBasedMarshalling(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
+ cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setExposeManagementStatistics(true);
cache.getConfiguration().setClusterName(clusterName);
cache.create();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-09-01 04:29:13 UTC (rev 6647)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-09-01 05:13:32 UTC (rev 6648)
@@ -13,6 +13,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeModified;
@@ -77,7 +78,10 @@
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
cache2.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache1.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
+ cache2.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
+
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
/*
16 years, 4 months
JBoss Cache SVN: r6647 - core/trunk/src/test/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-01 00:29:13 -0400 (Mon, 01 Sep 2008)
New Revision: 6647
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
Log:
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java 2008-08-29 16:16:29 UTC (rev 6646)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java 2008-09-01 04:29:13 UTC (rev 6647)
@@ -1,7 +1,7 @@
package org.jboss.cache.marshall;
import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.legacy.write.PessPutKeyValueCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.Test;
@@ -29,7 +29,7 @@
Map map = createMap(size);
Fqn fqn = Fqn.fromString("/my/stuff");
String key = "key";
- PessPutKeyValueCommand putCommand = new PessPutKeyValueCommand(null, fqn, key, map);
+ PutKeyValueCommand putCommand = new PutKeyValueCommand(null, fqn, key, map);
ReplicateCommand replicateCommand = new ReplicateCommand(putCommand);
byte[] buf = marshaller.objectToByteBuffer(replicateCommand);
16 years, 4 months