[jboss-cvs] JBossAS SVN: r107005 - 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:22:42 EDT 2010


Author: pferraro
Date: 2010-07-21 16:22:42 -0400 (Wed, 21 Jul 2010)
New Revision: 107005

Added:
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvokerTest.java
Removed:
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java
Log:
Rename unit test to match target class

Deleted: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java	2010-07-21 20:22:02 UTC (rev 107004)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java	2010-07-21 20:22:42 UTC (rev 107005)
@@ -1,226 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.web.tomcat.service.session.distributedcache.impl;
-
-import org.easymock.EasyMock;
-import org.infinispan.AdvancedCache;
-import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
-import org.infinispan.context.Flag;
-import org.infinispan.remoting.transport.jgroups.SuspectException;
-import org.infinispan.util.concurrent.TimeoutException;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @author Paul Ferraro
- *
- */
-public class RetryCacheInvokerTest
-{
-   @Test
-   public void simple()
-   {
-      @SuppressWarnings("unchecked")
-      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      Object expected = new Object();
-      
-      CacheInvoker invoker = new RetryingCacheInvoker();
-      
-      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
-      
-      EasyMock.replay(cache, operation);
-      
-      Object result = invoker.invoke(cache, operation);
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertSame(expected, result);
-      
-      EasyMock.reset(cache, operation);
-   }
-   
-   @Test
-   public void forceSynchronous()
-   {
-      CacheInvoker invoker = new RetryingCacheInvoker();
-      
-      invoker.setForceSynchronous(true);
-      
-      @SuppressWarnings("unchecked")
-      AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      Object expected = new Object();
-      
-      EasyMock.expect(cache.getAdvancedCache()).andReturn(cache);
-      EasyMock.expect(cache.withFlags(Flag.FORCE_SYNCHRONOUS)).andReturn(cache);
-      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
-      
-      EasyMock.replay(cache, operation);
-      
-      Object result = invoker.invoke(cache, operation);
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertSame(expected, result);
-      
-      EasyMock.reset(cache, operation);
-      
-      
-      invoker.setForceSynchronous(false);
-      
-      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
-      
-      EasyMock.replay(cache, operation);
-      
-      result = invoker.invoke(cache, operation);
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertSame(expected, result);
-      
-      EasyMock.reset(cache, operation);
-   }
-   
-   @Test
-   public void retryAfterTimeout()
-   {
-      @SuppressWarnings("unchecked")
-      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      Object expected = new Object();
-      
-      CacheInvoker invoker = new RetryingCacheInvoker(1);
-      
-      EasyMock.expect(operation.invoke(cache)).andThrow(new TimeoutException());
-      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
-      
-      EasyMock.replay(cache, operation);
-      
-      Object result = invoker.invoke(cache, operation);
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertSame(expected, result);
-      
-      EasyMock.reset(cache, operation);
-   }
-   
-   @Test
-   public void retryAfterSuspect()
-   {
-      @SuppressWarnings("unchecked")
-      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      Object expected = new Object();
-      
-      CacheInvoker invoker = new RetryingCacheInvoker(1);
-      
-      EasyMock.expect(operation.invoke(cache)).andThrow(new SuspectException());
-      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
-      
-      EasyMock.replay(cache, operation);
-      
-      Object result = invoker.invoke(cache, operation);
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertSame(expected, result);
-      
-      EasyMock.reset(cache, operation);
-   }
-   
-   @Test
-   public void timeout()
-   {
-      @SuppressWarnings("unchecked")
-      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      TimeoutException lastException = new TimeoutException();
-      
-      CacheInvoker invoker = new RetryingCacheInvoker(1);
-      
-      EasyMock.expect(operation.invoke(cache)).andThrow(new TimeoutException());
-      EasyMock.expect(operation.invoke(cache)).andThrow(lastException);
-      
-      EasyMock.replay(cache, operation);
-      
-      RuntimeException exception = null;
-      
-      try
-      {
-         invoker.invoke(cache, operation);
-      }
-      catch (RuntimeException e)
-      {
-         exception = e;
-      }
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertNotNull(exception);
-      Assert.assertSame(lastException, exception.getCause());
-      
-      EasyMock.reset(cache, operation);
-   }
-   
-   @Test
-   public void suspect()
-   {
-      @SuppressWarnings("unchecked")
-      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
-      @SuppressWarnings("unchecked")
-      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
-      SuspectException lastException = new SuspectException();
-      
-      CacheInvoker invoker = new RetryingCacheInvoker(1);
-      
-      EasyMock.expect(operation.invoke(cache)).andThrow(new SuspectException());
-      EasyMock.expect(operation.invoke(cache)).andThrow(lastException);
-      
-      EasyMock.replay(cache, operation);
-      
-      RuntimeException exception = null;
-      
-      try
-      {
-         invoker.invoke(cache, operation);
-      }
-      catch (RuntimeException e)
-      {
-         exception = e;
-      }
-      
-      EasyMock.verify(cache, operation);
-      
-      Assert.assertNotNull(exception);
-      Assert.assertSame(lastException, exception.getCause());
-      
-      EasyMock.reset(cache, operation);
-   }
-}

Copied: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvokerTest.java (from rev 106982, projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java)
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvokerTest.java	                        (rev 0)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvokerTest.java	2010-07-21 20:22:42 UTC (rev 107005)
@@ -0,0 +1,226 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.web.tomcat.service.session.distributedcache.impl;
+
+import org.easymock.EasyMock;
+import org.infinispan.AdvancedCache;
+import org.infinispan.Cache;
+import org.infinispan.atomic.AtomicMap;
+import org.infinispan.context.Flag;
+import org.infinispan.remoting.transport.jgroups.SuspectException;
+import org.infinispan.util.concurrent.TimeoutException;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class RetryingCacheInvokerTest
+{
+   @Test
+   public void simple()
+   {
+      @SuppressWarnings("unchecked")
+      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      Object expected = new Object();
+      
+      CacheInvoker invoker = new RetryingCacheInvoker();
+      
+      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
+      
+      EasyMock.replay(cache, operation);
+      
+      Object result = invoker.invoke(cache, operation);
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertSame(expected, result);
+      
+      EasyMock.reset(cache, operation);
+   }
+   
+   @Test
+   public void forceSynchronous()
+   {
+      CacheInvoker invoker = new RetryingCacheInvoker();
+      
+      invoker.setForceSynchronous(true);
+      
+      @SuppressWarnings("unchecked")
+      AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      Object expected = new Object();
+      
+      EasyMock.expect(cache.getAdvancedCache()).andReturn(cache);
+      EasyMock.expect(cache.withFlags(Flag.FORCE_SYNCHRONOUS)).andReturn(cache);
+      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
+      
+      EasyMock.replay(cache, operation);
+      
+      Object result = invoker.invoke(cache, operation);
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertSame(expected, result);
+      
+      EasyMock.reset(cache, operation);
+      
+      
+      invoker.setForceSynchronous(false);
+      
+      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
+      
+      EasyMock.replay(cache, operation);
+      
+      result = invoker.invoke(cache, operation);
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertSame(expected, result);
+      
+      EasyMock.reset(cache, operation);
+   }
+   
+   @Test
+   public void retryAfterTimeout()
+   {
+      @SuppressWarnings("unchecked")
+      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      Object expected = new Object();
+      
+      CacheInvoker invoker = new RetryingCacheInvoker(1);
+      
+      EasyMock.expect(operation.invoke(cache)).andThrow(new TimeoutException());
+      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
+      
+      EasyMock.replay(cache, operation);
+      
+      Object result = invoker.invoke(cache, operation);
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertSame(expected, result);
+      
+      EasyMock.reset(cache, operation);
+   }
+   
+   @Test
+   public void retryAfterSuspect()
+   {
+      @SuppressWarnings("unchecked")
+      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      Object expected = new Object();
+      
+      CacheInvoker invoker = new RetryingCacheInvoker(1);
+      
+      EasyMock.expect(operation.invoke(cache)).andThrow(new SuspectException());
+      EasyMock.expect(operation.invoke(cache)).andReturn(expected);
+      
+      EasyMock.replay(cache, operation);
+      
+      Object result = invoker.invoke(cache, operation);
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertSame(expected, result);
+      
+      EasyMock.reset(cache, operation);
+   }
+   
+   @Test
+   public void timeout()
+   {
+      @SuppressWarnings("unchecked")
+      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      TimeoutException lastException = new TimeoutException();
+      
+      CacheInvoker invoker = new RetryingCacheInvoker(1);
+      
+      EasyMock.expect(operation.invoke(cache)).andThrow(new TimeoutException());
+      EasyMock.expect(operation.invoke(cache)).andThrow(lastException);
+      
+      EasyMock.replay(cache, operation);
+      
+      RuntimeException exception = null;
+      
+      try
+      {
+         invoker.invoke(cache, operation);
+      }
+      catch (RuntimeException e)
+      {
+         exception = e;
+      }
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertNotNull(exception);
+      Assert.assertSame(lastException, exception.getCause());
+      
+      EasyMock.reset(cache, operation);
+   }
+   
+   @Test
+   public void suspect()
+   {
+      @SuppressWarnings("unchecked")
+      Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+      SuspectException lastException = new SuspectException();
+      
+      CacheInvoker invoker = new RetryingCacheInvoker(1);
+      
+      EasyMock.expect(operation.invoke(cache)).andThrow(new SuspectException());
+      EasyMock.expect(operation.invoke(cache)).andThrow(lastException);
+      
+      EasyMock.replay(cache, operation);
+      
+      RuntimeException exception = null;
+      
+      try
+      {
+         invoker.invoke(cache, operation);
+      }
+      catch (RuntimeException e)
+      {
+         exception = e;
+      }
+      
+      EasyMock.verify(cache, operation);
+      
+      Assert.assertNotNull(exception);
+      Assert.assertSame(lastException, exception.getCause());
+      
+      EasyMock.reset(cache, operation);
+   }
+}



More information about the jboss-cvs-commits mailing list