org.apache.qpid.test.unit.xa
Class TopicTest

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.unit.xa.AbstractXATestCase
                      extended by org.apache.qpid.test.unit.xa.TopicTest
All Implemented Interfaces:
junit.framework.Test

public class TopicTest
extends AbstractXATestCase


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.unit.xa.AbstractXATestCase
_consumer, _message, _producer, _sequenceNumberPropertyName, _xaResource
 
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
TopicTest()
           
 
Method Summary
static void failure()
           
static boolean getFailureStatus()
           
static junit.framework.TestSuite getSuite()
          Gets the test suite tests
 void init()
          Initialize standard actors
static void main(String[] args)
          Run the test suite.
static void reset()
           
 void tearDown()
           
 void testDurSub()
          strategy: Produce a message within Tx1 and commit tx1.
 void testDurSubCrash()
          strategy: Produce a message within Tx1 and commit tx1.
 void testMigrateDurableSubscriber()
          strategy: create a standard durable subscriber produce 3 messages consume the first message with that durable subscriber close the standard session that deactivates the durable subscriber migrate the durable subscriber to an xa one consume the second message with that xa durable subscriber close the xa session that deactivates the durable subscriber reconnect to the durable subscriber with a standard session consume the two remaining messages and check that the topic is empty!
 void testMultiMessagesDurSub()
          strategy: create a XA durable subscriber dusSub, produce 7 messages with the standard session, consume 2 messages respectively with tx1, tx2 and tx3 abort tx2, we now expect to receive messages 3 and 4 first! Receive 3 messages within tx1 i.e.
 void testMultiMessagesDurSubCrash()
          strategy: create a XA durable subscriber dusSub, produce 10 messages with the standard session, consume 2 messages respectively with tx1, tx2 and tx3 prepare xid2 and xid3 crash the server Redo the job for xid1 that has been aborted by server crash abort tx2, we now expect to receive messages 3 and 4 first! Receive 3 messages within tx1 i.e.
 void testProducer()
          Uses two transactions respectively with xid1 and xid2 that are use to send a message within xid1 and xid2.
 void testRecover()
          strategy: Produce a message within Tx1 and prepare tx1.
 
Methods inherited from class org.apache.qpid.test.unit.xa.AbstractXATestCase
getNewXid, init, setUp
 
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

TopicTest

public TopicTest()
Method Detail

getSuite

public static junit.framework.TestSuite getSuite()
Gets the test suite tests

Returns:
the test suite tests

main

public static void main(String[] args)
Run the test suite.

Parameters:
args - Any command line arguments specified to this class.

tearDown

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

init

public void init()
Initialize standard actors

Specified by:
init in class AbstractXATestCase

testProducer

public void testProducer()
Uses two transactions respectively with xid1 and xid2 that are use to send a message within xid1 and xid2. xid2 is committed and xid1 is used to receive the message that was sent within xid2. Xid is then committed and a standard transaction is used to receive the message that was sent within xid1.


testDurSub

public void testDurSub()
strategy: Produce a message within Tx1 and commit tx1. consume this message within tx2 and abort tx2. Consume the same message within tx3 and commit it. Check that no more message is available.


testMultiMessagesDurSub

public void testMultiMessagesDurSub()
strategy: create a XA durable subscriber dusSub, produce 7 messages with the standard session, consume 2 messages respectively with tx1, tx2 and tx3 abort tx2, we now expect to receive messages 3 and 4 first! Receive 3 messages within tx1 i.e. 34 and 7! commit tx3 abort tx1: we now expect that only messages 5 and 6 are definitly consumed! start tx4 and consume messages 1 - 4 and 7 commit tx4 Now the topic should be empty!


testMultiMessagesDurSubCrash

public void testMultiMessagesDurSubCrash()
strategy: create a XA durable subscriber dusSub, produce 10 messages with the standard session, consume 2 messages respectively with tx1, tx2 and tx3 prepare xid2 and xid3 crash the server Redo the job for xid1 that has been aborted by server crash abort tx2, we now expect to receive messages 3 and 4 first! Receive 3 messages within tx1 i.e. 34 and 7! commit tx3 abort tx1: we now expect that only messages 5 and 6 are definitly consumed! start tx4 and consume messages 1 - 4 start tx5 and consume messages 7 - 10 abort tx4 consume messages 1-4 with tx5 commit tx5 Now the topic should be empty!


testDurSubCrash

public void testDurSubCrash()
strategy: Produce a message within Tx1 and commit tx1. a durable subscriber then receives that message within tx2 that is then prepared. Shutdown the server and get the list of in doubt transactions: we expect tx2, Tx2 is aborted and the message consumed within tx3 that is committed we then check that the topic is empty.


testRecover

public void testRecover()
strategy: Produce a message within Tx1 and prepare tx1. Shutdown the server and get the list of indoubt transactions: we expect tx1, Tx1 is committed so we expect the test topic not to be empty!


testMigrateDurableSubscriber

public void testMigrateDurableSubscriber()
strategy: create a standard durable subscriber produce 3 messages consume the first message with that durable subscriber close the standard session that deactivates the durable subscriber migrate the durable subscriber to an xa one consume the second message with that xa durable subscriber close the xa session that deactivates the durable subscriber reconnect to the durable subscriber with a standard session consume the two remaining messages and check that the topic is empty!


failure

public static void failure()

reset

public static void reset()

getFailureStatus

public static boolean getFailureStatus()


Licensed to the Apache Software Foundation