You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2011/01/04 10:46:35 UTC

svn commit: r1054945 - /mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java

Author: ngn
Date: Tue Jan  4 09:46:34 2011
New Revision: 1054945

URL: http://svn.apache.org/viewvc?rev=1054945&view=rev
Log:
Fixing test ExecutorService so that it compiles on both Java 1.5 and 1.6

Modified:
    mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java

Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java?rev=1054945&r1=1054944&r2=1054945&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java (original)
+++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/TestExecutorService.java Tue Jan  4 09:46:34 2011
@@ -1,79 +1,19 @@
 package org.apache.vysper.xmpp.delivery.inbound;
 
-import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.Callable;
+import java.util.concurrent.AbstractExecutorService;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 /**
- * Executes tasks syncronously, useful for test purposes
+ * Executes tasks synchronously, useful for test purposes
  *
  */
-public class TestExecutorService implements ExecutorService {
+public class TestExecutorService extends AbstractExecutorService {
 
-    public void execute(Runnable command) {
-        command.run();
-    }
-
-    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
-        return true;
-    }
-
-    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
-        return null;
-    }
-
-    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
-            throws InterruptedException {
-        return null;
-    }
-
-    public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
-        return null;
-    }
-
-    public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
-            throws InterruptedException, ExecutionException, TimeoutException {
-        return null;
-    }
-
-    public boolean isShutdown() {
-        return false;
-    }
-
-    public boolean isTerminated() {
-        return false;
-    }
-
-    public void shutdown() {
-    }
-
-    public List<Runnable> shutdownNow() {
-        return null;
-    }
-
-    public <T> Future<T> submit(Callable<T> task) {
-        try {
-            return new TestFuture<T>(task.call());
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Future<?> submit(Runnable task) {
-        task.run();
-        return new TestFuture();
-    }
-
-    public <T> Future<T> submit(Runnable task, T result) {
-        task.run();
-        return new TestFuture<T>(result);
-    }
     
     public static class TestFuture<V> implements Future<V> {
 
@@ -106,4 +46,28 @@ public class TestExecutorService impleme
             return true;
         }
     }
+
+    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+        return true;
+    }
+
+    public boolean isShutdown() {
+        return false;
+    }
+
+    public boolean isTerminated() {
+        return false;
+    }
+
+    public void shutdown() {
+    }
+
+    public List<Runnable> shutdownNow() {
+        return Collections.emptyList();
+    }
+
+    public void execute(Runnable runnable) {
+        runnable.run();
+        
+    }
 }
\ No newline at end of file