Author: ieugen
Date: Mon Mar 12 01:01:32 2012
New Revision: 1299515

URL: http://svn.apache.org/viewvc?rev=1299515&view=rev
Log:
JAMES-1393

- updated tests to juni 4.x style
- added @Override and reformated code
Issue #JAMES-1393 - Upgrate all test suites to junit 4.10

Modified:
    
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueue.java
    
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueueFactory.java

Modified: 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueue.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueue.java?rev=1299515&r1=1299514&r2=1299515&view=diff
==============================================================================
--- 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueue.java
 (original)
+++ 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueue.java
 Mon Mar 12 01:01:32 2012
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-
 package org.apache.james.queue.api.mock;
 
 import java.util.concurrent.Executors;
@@ -38,73 +37,78 @@ public class MockMailQueue implements Ma
      * Throw an {@link MailQueueException} on next operation
      */
     public void throwExceptionOnNextOperation() {
-        this.throwException = true;
+       this.throwException = true;
     }
 
+    @Override
     public MailQueueItem deQueue() throws MailQueueException {
-        if (throwException) {
-            throwException = false;
-            throw new MailQueueException("Mock");
-        }
-        try {
-            final Mail mail = queue.take();
-            if (queue.isEmpty())
-                lastMail = null;
-            return new MailQueueItem() {
-
-                public Mail getMail() {
-                    return mail;
-                }
-
-                public void done(boolean success) throws MailQueueException {
-                    // do nothing here
-
-                }
-            };
-
-        } catch (InterruptedException e) {
-            throw new MailQueueException("Mock", e);
-        }
+       if (throwException) {
+           throwException = false;
+           throw new MailQueueException("Mock");
+       }
+       try {
+           final Mail mail = queue.take();
+           if (queue.isEmpty()) {
+               lastMail = null;
+           }
+           return new MailQueueItem() {
+
+               @Override
+               public Mail getMail() {
+                   return mail;
+               }
+
+               @Override
+               public void done(boolean success) throws MailQueueException {
+                   // do nothing here
+               }
+           };
+
+       } catch (InterruptedException e) {
+           throw new MailQueueException("Mock", e);
+       }
     }
 
+    @Override
     public void enQueue(final Mail mail, long delay, TimeUnit unit) throws 
MailQueueException {
-        if (throwException) {
-            throwException = false;
-            throw new MailQueueException("Mock");
-        }
-
-        scheduler.schedule(new Runnable() {
-
-            public void run() {
-                try {
-                    queue.put(mail);
-                    lastMail = mail;
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-
-        }, delay, unit);
+       if (throwException) {
+           throwException = false;
+           throw new MailQueueException("Mock");
+       }
+
+       scheduler.schedule(new Runnable() {
+
+           @Override
+           public void run() {
+               try {
+                   queue.put(mail);
+                   lastMail = mail;
+               } catch (InterruptedException e) {
+                   e.printStackTrace();
+               }
+           }
+       }, delay, unit);
     }
 
+    @Override
     public void enQueue(Mail mail) throws MailQueueException {
-        if (throwException) {
-            throwException = false;
-            throw new MailQueueException("Mock");
-        }
-        try {
-            queue.put(mail);
-            lastMail = mail;
-        } catch (InterruptedException e) {
-            throw new MailQueueException("Mock", e);
-        }
+       if (throwException) {
+           throwException = false;
+           throw new MailQueueException("Mock");
+       }
+       try {
+           queue.put(mail);
+           lastMail = mail;
+       } catch (InterruptedException e) {
+           throw new MailQueueException("Mock", e);
+       }
     }
 
     public Mail getLastMail() {
-        return lastMail;
+       return lastMail;
     }
 
     public void clear() {
-        queue.clear();
+       queue.clear();
     }
 }

Modified: 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueueFactory.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueueFactory.java?rev=1299515&r1=1299514&r2=1299515&view=diff
==============================================================================
--- 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueueFactory.java
 (original)
+++ 
james/server/trunk/queue-api/src/test/java/org/apache/james/queue/api/mock/MockMailQueueFactory.java
 Mon Mar 12 01:01:32 2012
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-
 package org.apache.james.queue.api.mock;
 
 import java.util.HashMap;
@@ -26,19 +25,21 @@ import org.apache.james.queue.api.MailQu
 import org.apache.james.queue.api.MailQueueFactory;
 
 public class MockMailQueueFactory implements MailQueueFactory {
+
     private final Map<String, MailQueue> queues = new HashMap<String, 
MailQueue>();
 
+    @Override
     public synchronized MailQueue getQueue(String name) {
-        MailQueue queue = queues.get(name);
-        if (queue == null) {
-            queue = new MockMailQueue();
-            queues.put(name, queue);
-        }
+       MailQueue queue = queues.get(name);
+       if (queue == null) {
+           queue = new MockMailQueue();
+           queues.put(name, queue);
+       }
 
-        return queue;
+       return queue;
     }
 
     public void clear() {
-        queues.clear();
+       queues.clear();
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to