[jboss-cvs] JBossAS SVN: r107003 - projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 21 16:14:36 EDT 2010
Author: pferraro
Date: 2010-07-21 16:14:35 -0400 (Wed, 21 Jul 2010)
New Revision: 107003
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerTest.java
Log:
More unit test progress
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerTest.java 2010-07-21 20:08:16 UTC (rev 107002)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerTest.java 2010-07-21 20:14:35 UTC (rev 107003)
@@ -36,6 +36,7 @@
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
import org.infinispan.transaction.tm.BatchModeTransactionManager;
import org.jboss.metadata.web.jboss.ReplicationConfig;
@@ -681,4 +682,60 @@
EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
}
+
+ @Test
+ public void modified()
+ {
+ CacheEntryModifiedEvent event = EasyMock.createNiceMock(CacheEntryModifiedEvent.class);
+
+ DistributedCacheManagerImpl<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+
+
+ EasyMock.expect(event.isPre()).andReturn(true);
+
+ EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+
+ manager.modified(event);
+
+ EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+ EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+
+
+ EasyMock.expect(event.isPre()).andReturn(false);
+ EasyMock.expect(event.isOriginLocal()).andReturn(true);
+
+ EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+
+ manager.modified(event);
+
+ EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+ EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+
+
+ @SuppressWarnings("unchecked")
+ AtomicMap<Object, Object> map = EasyMock.createNiceMock(AtomicMap.class);
+
+ Integer version = Integer.valueOf(10);
+ Long timestamp = Long.valueOf(System.currentTimeMillis());
+ DistributableSessionMetadata metadata = new DistributableSessionMetadata();
+
+ EasyMock.expect(event.isPre()).andReturn(false);
+ EasyMock.expect(event.isOriginLocal()).andReturn(false);
+ EasyMock.expect(event.getValue()).andReturn(map);
+
+ EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.VERSION.ordinal()))).andReturn(version);
+ EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.TIMESTAMP.ordinal()))).andReturn(timestamp);
+ EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.METADATA.ordinal()))).andReturn(metadata);
+
+ EasyMock.expect(event.getKey()).andReturn("abc");
+
+ EasyMock.expect(this.manager.sessionChangedInDistributedCache("abc", null, version.intValue(), timestamp.longValue(), metadata)).andReturn(false);
+
+ EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
+
+ manager.modified(event);
+
+ EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
+ EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
+ }
}
More information about the jboss-cvs-commits
mailing list