org.apache.qpid.test.client
Class RollbackOrderTest

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.client.RollbackOrderTest
All Implemented Interfaces:
junit.framework.Test

public class RollbackOrderTest
extends QpidBrokerTestCase

RollbackOrderTest, QPID-1864, QPID-1871 Description: The problem that this test is exposing is that the dispatcher used to be capable of holding on to a message when stopped. This ment that when the rollback was called and the dispatcher stopped it may have hold of a message. So after all the local queues(preDeliveryQueue, SynchronousQueue, PostDeliveryTagQueue) have been cleared the client still had a single message, the one the dispatcher was holding on to. As a result the TxRollback operation would run and then release the dispatcher. Whilst the dispatcher would then proceed to reject the message it was holiding the Broker would already have resent that message so the rejection would silently fail. And the client would receieve that single message 'early', depending on the number of messages already recevied when rollback was called. Aims: The tests puts 50 messages on to the queue. The test then tries to cause the dispatcher to stop whilst it is in the process of moving a message from the preDeliveryQueue to a consumers sychronousQueue. To exercise this path we have 50 message flowing to the client to give the dispatcher a bit of work to do moving messages. Then we loop - 10 times - Validating that the first message received is always message 1. - Receive a few more so that there are a few messages to reject. - call rollback, to try and catch the dispatcher mid process. Outcome: The hope is that we catch the dispatcher mid process and cause a BasicReject to fail. Which will be indicated in the log but will also cause that failed rejected message to be the next to be delivered which will not be message 1 as expected. We are testing a race condition here but we can check through the log file if the race condition occured. However, performing that check will only validate the problem exists and will not be suitable as part of a system test.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
QpidBrokerTestCase.MessageType
 
Field Summary
 
Fields inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
_broker, _brokerLanguage, _brokerLogPrefix, _brokerOutputStream, _brokerPersistent, _brokers, _configFile, _connectionFactory, _connections, _initialContext, _interleaveBrokerLog, _logger, _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
RollbackOrderTest()
           
 
Method Summary
 void setUp()
           
 void tearDown()
           
 void testOrderingAfterRollback()
           
 void testOrderingAfterRollbackOnMessage()
           
 
Methods inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
cleanBroker, createMessage, createNextMessage, drainQueue, getBroker, getBrokerCommand, getClientConnection, getConfigurationStringProperty, getConnection, getConnection, getConnection, getConnectionFactory, 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
 

Constructor Detail

RollbackOrderTest

public RollbackOrderTest()
Method Detail

setUp

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

testOrderingAfterRollback

public void testOrderingAfterRollback()
                               throws Exception
Throws:
Exception

testOrderingAfterRollbackOnMessage

public void testOrderingAfterRollbackOnMessage()
                                        throws Exception
Throws:
Exception

tearDown

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


Licensed to the Apache Software Foundation