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

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
                          extended by org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest
All Implemented Interfaces:
junit.framework.Test, org.apache.qpid.jms.ConnectionListener

public class AcknowledgeAfterFailoverTest
extends AcknowledgeTest
implements org.apache.qpid.jms.ConnectionListener


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
QpidBrokerTestCase.MessageType
 
Field Summary
protected  CountDownLatch _failoverCompleted
           
 
Fields inherited from class org.apache.qpid.test.unit.ack.AcknowledgeTest
_connection, _consumer, _consumerSession, _producer, _queue, 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
AcknowledgeAfterFailoverTest()
           
 
Method Summary
 void bytesReceived(long count)
           
 void bytesSent(long count)
           
 void doAcknowlegement(Message msg)
          Perform the acknowledgement of messages if additionally required.
 void failBroker(int port)
          Override so we can block until failover has completd
 void failoverComplete()
           
protected  void init(boolean transacted, int mode)
          Override default init to add connectionListener so we can verify that failover took place
 boolean preFailover(boolean redirect)
           
protected  void prepBroker(int index)
           
 boolean preResubscribe()
           
 void setUp()
           
protected  void testDirtyAcking(boolean transacted, int mode)
          Test that Acking/Committing a message received before failover causes an exception at commit/ack time.
 void testDirtyAckingTransacted()
           
 void testDirtyClientAck()
           
 
Methods inherited from class org.apache.qpid.test.unit.ack.AcknowledgeTest
testAcking, testAutoAck, testClientAck, testDupsOk, testNoAck, testPreAck, testTransacted
 
Methods inherited from class org.apache.qpid.test.utils.FailoverBaseCase
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

_failoverCompleted

protected CountDownLatch _failoverCompleted
Constructor Detail

AcknowledgeAfterFailoverTest

public AcknowledgeAfterFailoverTest()
Method Detail

setUp

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

init

protected void init(boolean transacted,
                    int mode)
             throws Exception
Override default init to add connectionListener so we can verify that failover took place

Overrides:
init in class AcknowledgeTest
Parameters:
transacted - create a transacted session for this test
mode - if not transacted what ack mode to use for this test
Throws:
Exception - if a problem occured during test setup.

prepBroker

protected void prepBroker(int index)
                   throws Exception
Throws:
Exception

doAcknowlegement

public void doAcknowlegement(Message msg)
                      throws JMSException
Description copied from class: AcknowledgeTest
Perform the acknowledgement of messages if additionally required.

Overrides:
doAcknowlegement in class AcknowledgeTest
Throws:
JMSException

testDirtyAcking

protected void testDirtyAcking(boolean transacted,
                               int mode)
                        throws Exception
Test that Acking/Committing a message received before failover causes an exception at commit/ack time.

Expected behaviour is that in: * tx mode commit() throws a transacted RolledBackException * client ack mode throws an IllegalStateException

Parameters:
transacted - is this session trasacted
mode - What ack mode should be used if not trasacted
Throws:
Exception - if something goes wrong.

testDirtyClientAck

public void testDirtyClientAck()
                        throws Exception
Throws:
Exception

testDirtyAckingTransacted

public void testDirtyAckingTransacted()
                               throws Exception
Throws:
Exception

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 -


Licensed to the Apache Software Foundation