org.apache.qpid.test.unit.publish
Class DirtyTransactedPublishTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.qpid.test.utils.QpidTestCase
org.apache.qpid.test.utils.QpidBrokerTestCase
org.apache.qpid.test.utils.FailoverBaseCase
org.apache.qpid.test.unit.publish.DirtyTransactedPublishTest
- All Implemented Interfaces:
- junit.framework.Test, org.apache.qpid.jms.ConnectionListener
public class DirtyTransactedPublishTest
- extends FailoverBaseCase
- implements org.apache.qpid.jms.ConnectionListener
QPID-1816 : Whilst testing Acknoledgement after failover this completes testing
of the client after failover. When we have a dirty session we should receive
an error if we attempt to publish. This test ensures that both in the synchronous
and asynchronous message delivery paths we receive the expected exceptions at
the expected time.
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 |
Method Summary |
void |
bytesReceived(long count)
|
void |
bytesSent(long count)
|
protected void |
fail(Exception e)
Pass the given exception back to the waiting thread to fail the test run. |
void |
failBroker(int port)
Override so we can block until failover has completd |
void |
failoverComplete()
|
protected void |
init(boolean transacted,
int mode)
Initialise the test variables |
boolean |
preFailover(boolean redirect)
|
boolean |
preResubscribe()
|
protected void |
setUp()
|
void |
testDirtySendingOnMessageTransacted()
If a transacted session has failed over whilst it has uncommitted sent
data then we need to throw a TransactedRolledbackException on commit()
The alternative would be to maintain a replay buffer so that the message
could be resent. |
void |
testDirtySendingSynchronousTransacted()
If a transacted session has failed over whilst it has uncommitted sent
data then we need to throw a TransactedRolledbackException on commit()
The alternative would be to maintain a replay buffer so that the message
could be resent. |
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 |
_failoverCompleted
protected CountDownLatch _failoverCompleted
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
_receviedAll
protected CountDownLatch _receviedAll
_causeOfFailure
protected AtomicReference<Exception> _causeOfFailure
DirtyTransactedPublishTest
public DirtyTransactedPublishTest()
setUp
protected void setUp()
throws Exception
- Overrides:
setUp
in class FailoverBaseCase
- Throws:
Exception
init
protected void init(boolean transacted,
int mode)
throws Exception
- Initialise the test variables
- Parameters:
transacted
- is this a transacted testmode
- if not trasacted then what ack mode to use
- Throws:
Exception
- if there is a setup issue.
testDirtySendingSynchronousTransacted
public void testDirtySendingSynchronousTransacted()
throws Exception
- If a transacted session has failed over whilst it has uncommitted sent
data then we need to throw a TransactedRolledbackException on commit()
The alternative would be to maintain a replay buffer so that the message
could be resent. This is not currently implemented
- Throws:
Exception
- if something goes wrong.
testDirtySendingOnMessageTransacted
public void testDirtySendingOnMessageTransacted()
throws Exception
- If a transacted session has failed over whilst it has uncommitted sent
data then we need to throw a TransactedRolledbackException on commit()
The alternative would be to maintain a replay buffer so that the message
could be resent. This is not currently implemented
- Throws:
Exception
- if something goes wrong.
bytesSent
public void bytesSent(long count)
- Specified by:
bytesSent
in interface org.apache.qpid.jms.ConnectionListener
bytesReceived
public void bytesReceived(long count)
- Specified by:
bytesReceived
in interface org.apache.qpid.jms.ConnectionListener
preFailover
public boolean preFailover(boolean redirect)
- Specified by:
preFailover
in interface org.apache.qpid.jms.ConnectionListener
preResubscribe
public boolean preResubscribe()
- Specified by:
preResubscribe
in interface org.apache.qpid.jms.ConnectionListener
failoverComplete
public void failoverComplete()
- Specified by:
failoverComplete
in interface org.apache.qpid.jms.ConnectionListener
failBroker
public void failBroker(int port)
- Override so we can block until failover has completd
- Overrides:
failBroker
in class FailoverBaseCase
- Parameters:
port
- int the port of the broker to fail.
fail
protected void fail(Exception e)
- Pass the given exception back to the waiting thread to fail the test run.
- Parameters:
e
- The exception that is causing the test to fail.
Licensed to the Apache Software Foundation