qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbie Gemmell <robbie.gemm...@gmail.com>
Subject Re: svn commit: r992352 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
Date Mon, 06 Sep 2010 11:06:07 GMT
Both the included test cases are failing on the default and java
profiles because the addressing syntax isnt supported, so I have
excluded them from the 0-8/9 test profiles.

As the queue policy types arent currently supported by the Java broker
at all I have also seperately excluded the tests from all of the Java
test profiles. I did note however that testRejectPolicy() is actually
passing on the java.0.10 profile which im guessing it probably
shouldnt, so perhaps that test needs updated.

Robbie

On 3 September 2010 17:22,  <rajith@apache.org> wrote:
> Author: rajith
> Date: Fri Sep  3 16:22:07 2010
> New Revision: 992352
>
> URL: http://svn.apache.org/viewvc?rev=992352&view=rev
> Log:
> QPID-2845
> Adjusted the address string to include arguments inside the arguments map instead of
putting them directly in x-declare.
>
> Added:
>    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
>
> Added: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
> URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java?rev=992352&view=auto
> ==============================================================================
> --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
(added)
> +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
Fri Sep  3 16:22:07 2010
> @@ -0,0 +1,89 @@
> +package org.apache.qpid.test.client.queue;
> +
> +import javax.jms.Connection;
> +import javax.jms.Destination;
> +import javax.jms.MessageConsumer;
> +import javax.jms.MessageProducer;
> +import javax.jms.Session;
> +import javax.jms.TextMessage;
> +
> +import org.apache.qpid.AMQException;
> +import org.apache.qpid.client.AMQSession;
> +import org.apache.qpid.test.utils.QpidBrokerTestCase;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +public class QueuePolicyTest extends QpidBrokerTestCase
> +{
> +    private static final Logger _logger = LoggerFactory.getLogger(QueuePolicyTest.class);
> +    private Connection _connection;
> +
> +    @Override
> +    public void setUp() throws Exception
> +    {
> +        super.setUp();
> +        _connection = getConnection() ;
> +        _connection.start();
> +    }
> +
> +    @Override
> +    public void tearDown() throws Exception
> +    {
> +        _connection.close();
> +        super.tearDown();
> +    }
> +
> +    public void testRejectPolicy() throws Exception
> +    {
> +        String addr = "ADDR:queue; {create: always, " +
> +        "node: {x-bindings: [{exchange : 'amq.direct', key : test}], " +
> +        "x-declare:{ arguments : {'qpid.max_count':5} }}}";
> +
> +        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
> +
> +        Destination dest = ssn.createQueue(addr);
> +        MessageConsumer consumer = ssn.createConsumer(dest);
> +        MessageProducer prod = ssn.createProducer(ssn.createQueue("ADDR:amq.direct/test"));
> +
> +        for (int i=0; i<50; i++)
> +        {
> +            prod.send(ssn.createMessage());
> +        }
> +
> +        try
> +        {
> +            prod.send(ssn.createMessage());
> +            ((AMQSession)ssn).sync();
> +        }
> +        catch (AMQException e)
> +        {
> +           assertTrue("The correct error code is not set",e.getErrorCode().toString().contains("506"));
> +        }
> +    }
> +
> +    public void testRingPolicy() throws Exception
> +    {
> +        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
> +
> +        String addr = "ADDR:my-ring-queue; {create: always, " +
> +        "node: {x-bindings: [{exchange : 'amq.direct', key : test}], " +
> +               "x-declare:{arguments : {'qpid.policy_type':ring, 'qpid.max_count':2}
}}}";
> +
> +        Destination dest = ssn.createQueue(addr);
> +        MessageConsumer consumer = ssn.createConsumer(dest);
> +        MessageProducer prod = ssn.createProducer(ssn.createQueue("ADDR:amq.direct/test"));
> +
> +        prod.send(ssn.createTextMessage("Test1"));
> +        prod.send(ssn.createTextMessage("Test2"));
> +        prod.send(ssn.createTextMessage("Test3"));
> +
> +        TextMessage msg = (TextMessage)consumer.receive(1000);
> +        assertEquals("The consumer should receive the msg with body='Test2'",msg.getText(),"Test2");
> +
> +        msg = (TextMessage)consumer.receive(1000);
> +        assertEquals("The consumer should receive the msg with body='Test3'",msg.getText(),"Test3");
> +
> +        prod.send(ssn.createTextMessage("Test4"));
> +        assertEquals("The consumer should receive the msg with body='Test4'",msg.getText(),"Test3");
> +    }
> +}
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:commits-subscribe@qpid.apache.org
>
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message