james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Maurer <nor...@apache.org>
Subject Re: svn commit: r1052367 - in /james/server/trunk: queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
Date Fri, 24 Dec 2010 17:44:39 GMT
Hi Eric,

I don't get why you want to do this. It's just a test dependency.
queue-jms is a queue implemention which should work with every jms
implementation which works like descripted in the spec. Activemq is
such an implementation, so it make sense to test against it.

Bye
Norman

Am Freitag, 24. Dezember 2010 schrieb Eric Charles <eric@apache.org>:
> ... or we could make it abstract and move the methods depending on amq to queue-activemq
?
> Tks,
> Eric
>
> On 24/12/2010 16:06, Norman Maurer wrote:
>
> Well it could be possible.. But I don't see anything useful in
> removing it, its like mocking the database for JPA tests and not use
> h2 or derby...
>
> Bye,
> Norman
>
>
> 2010/12/24 Eric Charles<eric@apache.org>:
>
> Hi,
> JMSMailQueueTest in queue-jms uses the AMQ Broker.
> Would it be possible to mock the broker (get rid of amq dependencies) in
> queue-jms?
>
> Tks,
> Eric
>
> On 23/12/2010 20:45, norman@apache.org wrote:
>
> Author: norman
> Date: Thu Dec 23 19:45:09 2010
> New Revision: 1052367
>
> URL: http://svn.apache.org/viewvc?rev=1052367&view=rev
> Log:
> Add tests for mail priority support. I think all functions of our
> MailQueue implementations are now tested
>
> Modified:
>
> james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
>
> james/server/trunk/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
>
> Modified:
> james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
> URL:
> http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java?rev=1052367&r1=1052366&r2=1052367&view=diff
>
> ==============================================================================
> ---
> james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
> (original)
> +++
> james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
> Thu Dec 23 19:45:09 2010
> @@ -18,9 +18,11 @@
>    ****************************************************************/
>   package org.apache.james.queue.activemq;
>
> +import java.io.IOException;
>   import java.util.Arrays;
>
>   import javax.jms.ConnectionFactory;
> +import javax.mail.MessagingException;
>
>   import org.apache.activemq.broker.BrokerPlugin;
>   import org.apache.activemq.broker.BrokerService;
> @@ -28,8 +30,10 @@ import org.apache.activemq.broker.region
>   import org.apache.activemq.broker.region.policy.PolicyMap;
>   import org.apache.activemq.plugin.StatisticsBrokerPlugin;
>   import org.apache.commons.logging.impl.SimpleLog;
> +import org.apache.james.queue.api.MailQueue.MailQueueItem;
>   import org.apache.james.queue.jms.JMSMailQueue;
>   import org.apache.james.queue.jms.JMSMailQueueTest;
> +import org.apache.mailet.Mail;
>
>   public class ActiveMQMailQueueTest extends JMSMailQueueTest{
>
> @@ -59,5 +63,43 @@ public class ActiveMQMailQueueTest exten
>           ActiveMQMailQueue queue = new ActiveMQMailQueue(factory, "test",
> false,log);
>           return queue;
>       }
> +
> +    public void testPrioritySupport() throws InterruptedException,
> MessagingException, IOException {
> +            // should be empty
> +            assertEquals(0, queue.getSize());
> +
> +            Mail mail = createMail();
> +            Mail mail2 =createMail();
> +            mail2.setAttribute(ActiveMQMailQueue.MAIL_PRIORITY,
> ActiveMQMailQueue.HIGH_PRIORITY);
> +
> +            queue.enQueue(mail);
> +            queue.enQueue(mail2);
> +
> +            Thread.sleep(200);
> +
> +            assertEquals(2, queue.getSize());
> +
> +
> +            // we should get mail2 first as it has a higher priority set
> +            assertEquals(2, queue.getSize());
> +            MailQueueItem item2 = queue.deQueue();
> +            checkMail(mail2, item2.getMail());
> +            item2.done(true);
> +
> +            Thread.sleep(200);
> +
> +
> +
> +            assertEquals(1, queue.getSize());
> +            MailQueueItem item3 = queue.deQueue();
> +            checkMail(mail, item3.getMail());
> +            item3.done(true);
> +
> +            Thread.sleep(200);
> +
> +            // should be empty
> +            assertEquals(0, queue.getSize());
> +        }
> +
>
>   }
>
> Modified:
> james/server/trunk/queue-jms/src/test/java/org/apache/james/qu

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message