You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/03/14 18:34:42 UTC

svn commit: r637172 - in /incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test: ./ client/

Author: ritchiem
Date: Fri Mar 14 10:34:39 2008
New Revision: 637172

URL: http://svn.apache.org/viewvc?rev=637172&view=rev
Log:
QPID-854 : Added more tests for QueueBrowser

Added:
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java   (with props)
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java   (contents, props changed)
      - copied, changed from r637086, incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java   (with props)
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java   (with props)
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java   (with props)
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java   (with props)
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java   (with props)
Removed:
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,76 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test;
+
+import org.apache.qpid.test.VMTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.NamingException;
+import java.util.Hashtable;
+import java.util.Map;
+
+public class FailoverBaseCase extends VMTestCase
+{
+    private boolean failedOver = true;
+
+    public void setUp() throws Exception
+    {
+        // Make Broker 2 the first one so we can kill it and allow VMTestCase to clean up vm://:1
+        _brokerlist = "vm://:2;vm://:1";
+        _clientID = this.getClass().getName();
+        _virtualhost = "/test";
+
+        _connections.put("connection1", "amqp://guest:guest@" + _clientID + _virtualhost + "?brokerlist='vm://:1'");
+        _connections.put("connection2", "amqp://guest:guest@" + _clientID + _virtualhost + "?brokerlist='vm://:2'");
+
+        try
+        {
+            TransportConnection.createVMBroker(2);
+        }
+        catch (Exception e)
+        {
+            fail("Unable to create broker: " + e);
+        }
+
+        super.setUp();
+    }
+
+    public void tearDown() throws Exception
+    {
+        if (!failedOver)
+        {
+            TransportConnection.killVMBroker(2);
+            ApplicationRegistry.remove(2);
+        }
+        super.tearDown();
+    }
+
+
+    public void failBroker()
+    {
+        failedOver = true;
+        TransportConnection.killVMBroker(2);
+        ApplicationRegistry.remove(2);
+    }
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/FailoverBaseCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java (from r637086, incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java?p2=incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java&p1=incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java&r1=637086&r2=637172&rev=637172&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java (original)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java Fri Mar 14 10:34:39 2008
@@ -21,39 +21,36 @@
 package org.apache.qpid.test.client;
 
 import org.apache.log4j.Logger;
-import org.apache.qpid.test.VMTestCase;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.test.FailoverBaseCase;
 
-import javax.jms.Queue;
-import javax.jms.ConnectionFactory;
-import javax.jms.Session;
 import javax.jms.Connection;
-import javax.jms.MessageProducer;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
 import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
 import javax.jms.QueueBrowser;
+import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.jms.JMSException;
-import javax.jms.QueueReceiver;
-import javax.jms.Message;
 import javax.naming.NamingException;
-
 import java.util.Enumeration;
+import java.util.Random;
 
-import junit.framework.TestCase;
-
-public class QueueBrowserTest extends VMTestCase
+public class QueueBrowserAutoAckTest extends FailoverBaseCase
 {
-    private static final Logger _logger = Logger.getLogger(QueueBrowserTest.class);
+    private static final Logger _logger = Logger.getLogger(QueueBrowserAutoAckTest.class);
 
-    private Connection _clientConnection;
-    private Session _clientSession;
-    private Queue _queue;
+    protected Connection _clientConnection;
+    protected Session _clientSession;
+    protected Queue _queue;
+    protected static final String MESSAGE_ID_PROPERTY = "MessageIDProperty";
 
     public void setUp() throws Exception
     {
-
         super.setUp();
 
         _queue = (Queue) _context.lookup("queue");
@@ -65,31 +62,60 @@
 
         _clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
-        //Ensure _queue is created
-        _clientSession.createConsumer(_queue).close();
     }
 
-    private void sendMessages(int num) throws JMSException, NamingException
+    protected void sendMessages(int num) throws JMSException
     {
+        Connection producerConnection = null;
+        try
+        {
+            producerConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+        }
+        catch (NamingException e)
+        {
+            fail("Unable to lookup connection in JNDI.");
+        }
 
-        //Create Producer put some messages on the queue
-        Connection producerConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+        sendMessages(producerConnection, num);
+    }
 
+    protected void sendMessages(String connection, int num) throws JMSException
+    {
+        Connection producerConnection = null;
+        try
+        {
+            producerConnection = ((ConnectionFactory) _context.lookup(connection)).createConnection();
+        }
+        catch (NamingException e)
+        {
+            fail("Unable to lookup connection in JNDI.");
+        }
+        sendMessages(producerConnection, num);
+    }
+
+
+    protected void sendMessages(Connection producerConnection, int num) throws JMSException
+    {
         producerConnection.start();
 
         Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
+        //Ensure _queue is created
+        producerSession.createConsumer(_queue).close();
+
         MessageProducer producer = producerSession.createProducer(_queue);
 
-        for (int msg = 0; msg < num; msg++)
+        for (int messsageID = 0; messsageID < num; messsageID++)
         {
-            producer.send(producerSession.createTextMessage("Message " + msg));
+            TextMessage textMsg = producerSession.createTextMessage("Message " + messsageID);
+            textMsg.setIntProperty(MESSAGE_ID_PROPERTY, messsageID);
+            producer.send(textMsg);
         }
 
         producerConnection.close();
     }
 
-    private void checkQueueDepth(int depth) throws JMSException, NamingException
+    protected void checkQueueDepth(int depth) throws JMSException
     {
 
         // create QueueBrowser
@@ -137,22 +163,110 @@
         queueBrowser.close();
     }
 
-    /*
-     * Test Messages Remain on Queue
-     * Create a queu and send messages to it. Browse them and then receive them all to verify they were still there
-     *
-     */
+    protected void closeBrowserBeforeAfterGetNext(int messageCount) throws JMSException
+    {
+        QueueBrowser queueBrowser = _clientSession.createBrowser(_queue);
 
-    public void testQueueBrowserMsgsRemainOnQueue() throws Exception
+        Enumeration msgs = queueBrowser.getEnumeration();
+
+        int msgCount = 0;
+
+        while (msgs.hasMoreElements() && msgCount < messageCount)
+        {
+            msgs.nextElement();
+            msgCount++;
+        }
+
+        try
+        {
+            queueBrowser.close();
+        }
+        catch (JMSException e)
+        {
+            fail("Close should happen without error:" + e.getMessage());
+        }
+    }
+
+
+    protected void checkMultipleGetEnum(int sentMessages, int browserCount) throws JMSException
     {
-        int messages = 10;
+        QueueBrowser queueBrowser = _clientSession.createBrowser(_queue);
 
-        sendMessages(messages);
+        for (int count = 0; count < browserCount; count++)
+        {
+            Enumeration msgs = queueBrowser.getEnumeration();
 
-        checkQueueDepth(messages);
+            int msgCount = 0;
+
+            while (msgs.hasMoreElements())
+            {
+                msgs.nextElement();
+                msgCount++;
+            }
+            assertEquals(msgCount, sentMessages);
+        }
+
+        try
+        {
+            queueBrowser.close();
+        }
+        catch (JMSException e)
+        {
+            fail("Close should happen without error:" + e.getMessage());
+        }
+    }
+
+    protected void checkOverlappingMultipleGetEnum(int browserCount, int expectedMessages) throws JMSException
+    {
+        checkOverlappingMultipleGetEnum(browserCount, expectedMessages, null);
+    }
+
+    protected void checkOverlappingMultipleGetEnum(int browserCount, int expectedMessages, String selector) throws JMSException
+    {
+        QueueBrowser queueBrowser = selector == null ?
+                                    _clientSession.createBrowser(_queue, selector) :
+                                    _clientSession.createBrowser(_queue);
 
-        // VERIFY
+        Enumeration[] msgs = new Enumeration[browserCount];
+        int[] msgCount = new int[browserCount];
 
+        //create Enums
+        for (int count = 0; count < browserCount; count++)
+        {
+            msgs[count] = queueBrowser.getEnumeration();
+        }
+
+        //interleave reads
+        for (int cnt = 0; cnt < expectedMessages; cnt++)
+        {
+            for (int count = 0; count < browserCount; count++)
+            {
+                if (msgs[count].hasMoreElements())
+                {
+                    msgs[count].nextElement();
+                    msgCount[count]++;
+                }
+            }
+        }
+
+        //validate all browsers get right message count.
+        for (int count = 0; count < browserCount; count++)
+        {
+            assertEquals(msgCount[count], expectedMessages);
+        }
+
+        try
+        {
+            queueBrowser.close();
+        }
+        catch (JMSException e)
+        {
+            fail("Close should happen without error:" + e.getMessage());
+        }
+    }
+
+    protected void validate(int messages) throws JMSException
+    {
         // continue and try to receive all messages
         MessageConsumer consumer = _clientSession.createConsumer(_queue);
 
@@ -172,8 +286,21 @@
         consumer.close();
 
         _logger.info("All messages recevied from queue");
+
+        //ensure no message left.
+        checkQueueDepth(0);
+
+    }
+
+    protected void checkQueueDepthWithSelectors(int clients, int totalMessages) throws JMSException
+    {
+
+        String selector = MESSAGE_ID_PROPERTY + " % " + clients;
+
+        checkOverlappingMultipleGetEnum(clients, totalMessages / clients, selector);
     }
 
+
     /**
      * This tests you can browse an empty queue, see QPID-785
      *
@@ -182,6 +309,156 @@
     public void testBrowsingEmptyQueue() throws Exception
     {
         checkQueueDepth(0);
+    }
+
+    /*
+    * Test Messages Remain on Queue
+    * Create a queu and send messages to it. Browse them and then receive them all to verify they were still there
+    *
+    */
+    public void testQueueBrowserMsgsRemainOnQueue() throws Exception
+    {
+        int messages = 10;
+
+        sendMessages(messages);
+
+        checkQueueDepth(messages);
+
+        validate(messages);
+    }
+
+
+    public void testClosingBrowserMidReceiving() throws NamingException, JMSException
+    {
+        int messages = 100;
+
+        sendMessages(messages);
+
+        checkQueueDepth(messages);
+
+        closeBrowserBeforeAfterGetNext(10);
+
+        validate(messages);
+
+    }
+
+    public void testMultipleGetEnum() throws NamingException, JMSException
+    {
+        int messages = 100;
+
+        sendMessages(messages);
+
+        checkQueueDepth(messages);
+
+        checkMultipleGetEnum(messages, 5);
+
+        validate(messages);
+    }
+
+    public void testMultipleOverlappingGetEnum() throws NamingException, JMSException
+    {
+        int messages = 25;
+
+        sendMessages(messages);
+
+        checkQueueDepth(messages);
+
+        checkOverlappingMultipleGetEnum(5, messages);
+
+        validate(messages);
+    }
+
+
+    public void testBrowsingWithSelector() throws JMSException
+    {
+        int messages = 40;
+
+        sendMessages(messages);
+
+        checkQueueDepth(messages);
+
+        for (int clients = 1; clients < 10; clients++)
+        {
+            checkQueueDepthWithSelectors(clients, messages);
+        }
+
+        validate(messages);
+    }
+
+    public void testFailoverWithQueueBrowser() throws JMSException
+    {
+        int messages = 50;
+
+        sendMessages("connection1", messages);
+        sendMessages("connection2", messages);
+
+
+        checkQueueDepth(messages);
+
+
+        _logger.info("Creating Queue Browser");
+
+        QueueBrowser queueBrowser = _clientSession.createBrowser(_queue);
+
+        long queueDepth = 0;
+
+        try
+        {
+            queueDepth = ((AMQSession) _clientSession).getQueueDepth((AMQDestination) _queue);
+        }
+        catch (AMQException e)
+        {
+        }
+
+        assertEquals("Session reports Queue depth not as expected", messages, queueDepth);
+
+
+        int msgCount = 0;
+
+        int failPoint = 0;
+
+        failPoint = new Random().nextInt(messages) + 1;
+
+        Enumeration msgs = queueBrowser.getEnumeration();
+
+        while (msgs.hasMoreElements())
+        {
+            msgs.nextElement();
+            msgCount++;
+
+            if (msgCount == failPoint)
+            {
+                failBroker();
+            }
+        }
+
+        assertTrue("We should get atleast " + messages + " msgs.", msgCount >= messages);
+
+        if (_logger.isDebugEnabled())
+        {
+            _logger.debug("QBAAT Found " + msgCount + " messages total in browser");
+        }
+
+        //Close browser
+        queueBrowser.close();
+
+        //Validate all messages still on Broker 1
+        validate(messages);
+    }
+
+    public void testFailoverAsQueueBrowserCreated() throws JMSException
+    {
+        int messages = 50;
+
+        sendMessages("connection1", messages);
+        sendMessages("connection2", messages);
+
+        failBroker();
+
+        checkQueueDepth(messages);
+
+        //Validate all messages still on Broker 1
+        validate(messages);
     }
 
     public void loop() throws JMSException

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.client;
+
+import javax.jms.Queue;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+
+public class QueueBrowserClientAckTest extends QueueBrowserAutoAckTest
+{
+    public void setUp() throws Exception
+    {
+
+        super.setUp();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _queue = (Queue) _context.lookup("queue");
+
+        //Create Client
+        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+        _clientConnection.start();
+
+        _clientSession = _clientConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+        //Ensure _queue is created
+        _clientSession.createConsumer(_queue).close();
+    }
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserClientAckTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.client;
+
+import javax.jms.Queue;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+
+public class QueueBrowserDupsOkTest extends QueueBrowserAutoAckTest
+{
+    public void setUp() throws Exception
+    {
+
+        super.setUp();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _queue = (Queue) _context.lookup("queue");
+
+        //Create Client
+        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+        _clientConnection.start();
+
+        _clientSession = _clientConnection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+
+        //Ensure _queue is created
+        _clientSession.createConsumer(_queue).close();
+    }
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserDupsOkTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.client;
+
+import org.apache.qpid.client.AMQSession;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Queue;
+
+public class QueueBrowserNoAckTest extends QueueBrowserAutoAckTest
+{
+    public void setUp() throws Exception
+    {
+
+        super.setUp();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _queue = (Queue) _context.lookup("queue");
+
+        //Create Client
+        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+        _clientConnection.start();
+
+        _clientSession = _clientConnection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
+
+        //Ensure _queue is created
+        _clientSession.createConsumer(_queue).close();
+    }
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserNoAckTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,53 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.client;
+
+import org.apache.qpid.client.AMQSession;
+
+import javax.jms.Queue;
+import javax.jms.ConnectionFactory;
+
+public class QueueBrowserPreAckTest extends QueueBrowserAutoAckTest
+{
+    public void setUp() throws Exception
+    {
+
+        super.setUp();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _queue = (Queue) _context.lookup("queue");
+
+        //Create Client
+        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+        _clientConnection.start();
+
+        _clientSession = _clientConnection.createSession(false, AMQSession.PRE_ACKNOWLEDGE);
+
+        //Ensure _queue is created
+        _clientSession.createConsumer(_queue).close();
+    }
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserPreAckTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java?rev=637172&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java (added)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java Fri Mar 14 10:34:39 2008
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.client;
+
+import javax.jms.Queue;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+
+public class QueueBrowserTransactedTest extends QueueBrowserAutoAckTest
+{
+    public void setUp() throws Exception
+    {
+
+        super.setUp();
+
+        _clientConnection.close();
+        _clientSession.close();
+
+        _queue = (Queue) _context.lookup("queue");
+
+        //Create Client
+        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+        _clientConnection.start();
+
+        _clientSession = _clientConnection.createSession(true, Session.SESSION_TRANSACTED);
+
+        //Ensure _queue is created
+        _clientSession.createConsumer(_queue).close();
+    }
+
+
+}

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTransactedTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date