org.apache.qpid.test.unit.ack
Class AcknowledgeTest

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.unit.ack.AcknowledgeTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AcknowledgeAfterFailoverTest, AcknowledgeOnMessageTest

public class AcknowledgeTest
extends FailoverBaseCase

Test the various JMS Acknowledge Modes the single testAcking method does all the work of receiving and validation of acking. The ack mode is provided from the various test methods.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
QpidBrokerTestCase.MessageType
 
Field Summary
protected  Connection _connection
           
protected  MessageConsumer _consumer
           
protected  Session _consumerSession
           
protected  MessageProducer _producer
           
protected  Queue _queue
           
protected  int NUM_MESSAGES
           
 
Fields inherited from class org.apache.qpid.test.utils.FailoverBaseCase
_logger, 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
AcknowledgeTest()
           
 
Method Summary
protected  void doAcknowlegement(Message msg)
          Perform the acknowledgement of messages if additionally required.
protected  void init(boolean transacted, int mode)
           
protected  void setUp()
           
protected  void testAcking(boolean transacted, int mode)
          The main test method.
 void testAutoAck()
           
 void testClientAck()
           
 void testDupsOk()
           
 void testNoAck()
           
 void testPreAck()
           
 void testTransacted()
           
 
Methods inherited from class org.apache.qpid.test.utils.FailoverBaseCase
failBroker, getConnectionFactory, getFailingPort, tearDown
 
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

NUM_MESSAGES

protected int NUM_MESSAGES

_connection

protected Connection _connection

_queue

protected Queue _queue

_consumerSession

protected Session _consumerSession

_consumer

protected MessageConsumer _consumer

_producer

protected MessageProducer _producer
Constructor Detail

AcknowledgeTest

public AcknowledgeTest()
Method Detail

setUp

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

init

protected void init(boolean transacted,
                    int mode)
             throws Exception
Throws:
Exception

testAcking

protected void testAcking(boolean transacted,
                          int mode)
                   throws Exception
The main test method. Receive the initial message and then proceed to send and ack messages until we have processed NUM_MESSAGES worth of messages. Each message is tagged with an INDEX value and these are used to check that the messages are received in the correct order. The test concludes by validating that the queue depth is 0 as expected.

Parameters:
transacted -
mode -
Throws:
Exception

doAcknowlegement

protected void doAcknowlegement(Message msg)
                         throws JMSException
Perform the acknowledgement of messages if additionally required.

Parameters:
msg -
Throws:
JMSException

testClientAck

public void testClientAck()
                   throws Exception
Throws:
Exception

testAutoAck

public void testAutoAck()
                 throws Exception
Throws:
Exception

testTransacted

public void testTransacted()
                    throws Exception
Throws:
Exception

testDupsOk

public void testDupsOk()
                throws Exception
Throws:
Exception

testNoAck

public void testNoAck()
               throws Exception
Throws:
Exception

testPreAck

public void testPreAck()
                throws Exception
Throws:
Exception


Licensed to the Apache Software Foundation