org.apache.qpid.test.client
Class QueueBrowserAutoAckTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.qpid.test.utils.QpidTestCase
              extended by org.apache.qpid.test.utils.QpidBrokerTestCase
                  extended by org.apache.qpid.test.utils.FailoverBaseCase
                      extended by org.apache.qpid.test.client.QueueBrowserAutoAckTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
QueueBrowserClientAckTest, QueueBrowserDupsOkTest, QueueBrowserNoAckTest, QueueBrowserPreAckTest, QueueBrowserTransactedTest

public class QueueBrowserAutoAckTest
extends FailoverBaseCase


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
QpidBrokerTestCase.MessageType
 
Field Summary
protected  Connection _clientConnection
           
protected  Session _clientSession
           
protected  Queue _queue
           
protected  boolean CLUSTERED
           
protected static String MESSAGE_ID_PROPERTY
           
 
Fields inherited from class org.apache.qpid.test.utils.FailoverBaseCase
DEFAULT_FAILOVER_TIME, FAILING_PORT, FAILING_VM_PORT, failingPort
 
Fields inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
_broker, _brokerLanguage, _brokerLogPrefix, _brokerOutputStream, _brokerPersistent, _brokers, _configFile, _connectionFactory, _connections, _initialContext, _interleaveBrokerLog, _output, _outputFile, _testName, BROKER_READY, CONTENT, CPP, DEFAULT_MANAGEMENT_PORT, DEFAULT_MESSAGE_SIZE, DEFAULT_PORT, DEFAULT_SSL_PORT, DEFAULT_VM_PORT, EXTERNAL, INDEX, JAVA, LOGMONITOR_TIMEOUT, QPID_HOME, QpidHome, QUEUE, RECEIVE_TIMEOUT, TOPIC, VM
 
Fields inherited from class org.apache.qpid.test.utils.QpidTestCase
MEMORY_STORE_CLASS_NAME, MS_CLASS_NAME_KEY
 
Constructor Summary
QueueBrowserAutoAckTest()
           
 
Method Summary
protected  void checkMultipleGetEnum(int sentMessages, int browserEnumerationCount)
          This method checks that multiple calls to getEnumeration() on a queueBrowser provide the same behaviour.
protected  void checkOverlappingMultipleGetEnum(int expectedMessages, int browserEnumerationCount)
           
protected  void checkOverlappingMultipleGetEnum(int expectedMessages, int browserEnumerationCount, String selector)
           
protected  void checkQueueDepth(int expectedDepth)
          Using the Protocol getQueueDepth method ensure that the correct number of messages are on the queue.
protected  void checkQueueDepthWithSelectors(int totalMessages, int clients)
           
protected  void closeBrowserBeforeAfterGetNext(int messageCount)
           
protected  void sendMessages(Connection producerConnection, int messageSendCount)
           
protected  void sendMessages(int num)
           
protected  void sendMessages(String connection, int num)
           
 void setUp()
           
protected  void setupSession()
           
 void tearDown()
           
 void testBrowsingEmptyQueue()
          This tests you can browse an empty queue, see QPID-785
 void testBrowsingWithSelector()
           
 void testClosingBrowserMidReceiving()
           
 void testFailoverAsQueueBrowserCreated()
           
 void testFailoverWithQueueBrowser()
          Testing that a QueueBrowser doesn't actually consume messages from a broker when it fails over.
 void testMultipleGetEnum()
          This tests that multiple getEnumerations on a QueueBrowser return the required number of messages.
 void testMultipleOverlappingGetEnum()
           
 void testQueueBrowserMsgsRemainOnQueue()
           
protected  void validate(int messages)
           
 
Methods inherited from class org.apache.qpid.test.utils.FailoverBaseCase
failBroker, getConnectionFactory, getFailingPort
 
Methods inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
cleanBroker, createMessage, createNextMessage, drainQueue, getBroker, getBrokerCommand, getClientConnection, getConfigurationStringProperty, getConnection, getConnection, getConnection, getConnectionFactory, getConnectionURL, getInitialContext, getLogger, getManagementPort, getMessageSize, getPort, getPort, getTestConfigFile, getTestQueue, getTestQueueName, getTestVirtualhostsFile, isBroker010, isBroker08, isBrokerStorePersistent, isCppBroker, isExternalBroker, isJavaBroker, makeVirtualHostPersistent, reloadBrokerSecurityConfig, restartBroker, restartBroker, revertLoggingLevels, revertSystemProperties, runBare, saveTestConfiguration, saveTestVirtualhosts, sendMessage, sendMessage, sendMessage, setBrokerEnvironment, setBrokerOnlySystemProperty, setConfigurationProperty, setLoggerLevel, setMessageSize, setSystemProperty, setSystemProperty, setTestClientSystemProperty, startBroker, startBroker, stopBroker, stopBroker
 
Methods inherited from class org.apache.qpid.test.utils.QpidTestCase
getTestProfileMessageStoreClassName, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_clientConnection

protected Connection _clientConnection

_clientSession

protected Session _clientSession

_queue

protected Queue _queue

MESSAGE_ID_PROPERTY

protected static final String MESSAGE_ID_PROPERTY
See Also:
Constant Field Values

CLUSTERED

protected boolean CLUSTERED
Constructor Detail

QueueBrowserAutoAckTest

public QueueBrowserAutoAckTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class FailoverBaseCase
Throws:
Exception

setupSession

protected void setupSession()
                     throws Exception
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Overrides:
tearDown in class FailoverBaseCase
Throws:
Exception

sendMessages

protected void sendMessages(int num)
                     throws JMSException
Throws:
JMSException

sendMessages

protected void sendMessages(String connection,
                            int num)
                     throws JMSException
Throws:
JMSException

sendMessages

protected void sendMessages(Connection producerConnection,
                            int messageSendCount)
                     throws JMSException
Throws:
JMSException

checkQueueDepth

protected void checkQueueDepth(int expectedDepth)
                        throws JMSException
Using the Protocol getQueueDepth method ensure that the correct number of messages are on the queue. Also uses a QueueBrowser as a second method of validating the message count on the queue.

Parameters:
expectedDepth - The expected Queue depth
Throws:
JMSException - on error

closeBrowserBeforeAfterGetNext

protected void closeBrowserBeforeAfterGetNext(int messageCount)
                                       throws JMSException
Throws:
JMSException

checkMultipleGetEnum

protected void checkMultipleGetEnum(int sentMessages,
                                    int browserEnumerationCount)
                             throws JMSException
This method checks that multiple calls to getEnumeration() on a queueBrowser provide the same behaviour.

Parameters:
sentMessages - The number of messages sent
browserEnumerationCount - The number of times to call getEnumeration()
Throws:
JMSException

checkOverlappingMultipleGetEnum

protected void checkOverlappingMultipleGetEnum(int expectedMessages,
                                               int browserEnumerationCount)
                                        throws JMSException
Throws:
JMSException

checkOverlappingMultipleGetEnum

protected void checkOverlappingMultipleGetEnum(int expectedMessages,
                                               int browserEnumerationCount,
                                               String selector)
                                        throws JMSException
Throws:
JMSException

validate

protected void validate(int messages)
                 throws JMSException
Throws:
JMSException

checkQueueDepthWithSelectors

protected void checkQueueDepthWithSelectors(int totalMessages,
                                            int clients)
                                     throws JMSException
Throws:
JMSException

testBrowsingEmptyQueue

public void testBrowsingEmptyQueue()
                            throws Exception
This tests you can browse an empty queue, see QPID-785

Throws:
Exception

testQueueBrowserMsgsRemainOnQueue

public void testQueueBrowserMsgsRemainOnQueue()
                                       throws Exception
Throws:
Exception

testClosingBrowserMidReceiving

public void testClosingBrowserMidReceiving()
                                    throws NamingException,
                                           JMSException
Throws:
NamingException
JMSException

testMultipleGetEnum

public void testMultipleGetEnum()
                         throws NamingException,
                                JMSException
This tests that multiple getEnumerations on a QueueBrowser return the required number of messages.

Throws:
NamingException
JMSException

testMultipleOverlappingGetEnum

public void testMultipleOverlappingGetEnum()
                                    throws NamingException,
                                           JMSException
Throws:
NamingException
JMSException

testBrowsingWithSelector

public void testBrowsingWithSelector()
                              throws JMSException
Throws:
JMSException

testFailoverWithQueueBrowser

public void testFailoverWithQueueBrowser()
                                  throws JMSException
Testing that a QueueBrowser doesn't actually consume messages from a broker when it fails over.

Throws:
JMSException

testFailoverAsQueueBrowserCreated

public void testFailoverAsQueueBrowserCreated()
                                       throws JMSException
Throws:
JMSException


Licensed to the Apache Software Foundation