Add an additional transaction test

git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/branches/activemq-cpp-3.1.x@953719 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp b/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
index b3de22a..0604f61 100644
--- a/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
+++ b/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
@@ -75,6 +75,47 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void TransactionTest::testSendRollbackCommitRollback() {
+
+    // Create CMS Object for Comms
+    cms::Session* session = cmsProvider->getSession();
+    cms::MessageConsumer* consumer = cmsProvider->getConsumer();
+    cms::MessageProducer* producer = cmsProvider->getProducer();
+
+    producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
+
+    auto_ptr<TextMessage> outbound1( session->createTextMessage( "First Message" ) );
+    auto_ptr<TextMessage> outbound2( session->createTextMessage( "Second Message" ) );
+
+    // sends them and then rolls back.
+    producer->send( outbound1.get() );
+    producer->send( outbound2.get() );
+    session->rollback();
+
+    // Send one and commit.
+    producer->send( outbound1.get() );
+    session->commit();
+
+    // receives the first message
+    auto_ptr<TextMessage> inbound1(
+        dynamic_cast<TextMessage*>( consumer->receive( 1500 ) ) );
+
+    CPPUNIT_ASSERT( NULL == consumer->receive( 1500 ) );
+    CPPUNIT_ASSERT( outbound1->getText() == inbound1->getText() );
+
+    session->rollback();
+
+    inbound1.reset(
+        dynamic_cast<TextMessage*>( consumer->receive( 1500 ) ) );
+
+    CPPUNIT_ASSERT( NULL == consumer->receive( 1500 ) );
+    CPPUNIT_ASSERT( outbound1->getText() == inbound1->getText() );
+
+    // validates that the rollbacked was not consumed
+    session->commit();
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void TransactionTest::testSendRollback() {
 
     try {
diff --git a/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h b/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
index 918b90d..47dce48 100644
--- a/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
@@ -41,6 +41,7 @@
         };
 
         void testSendReceiveTransactedBatches();
+        void testSendRollbackCommitRollback();
         void testSendRollback();
         void testSendSessionClose();
         void testWithTTLSet();
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
index 977ce69..bf5ea89 100644
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
@@ -28,6 +28,7 @@
 
         CPPUNIT_TEST_SUITE( OpenwireTransactionTest );
         CPPUNIT_TEST( testSendReceiveTransactedBatches );
+        CPPUNIT_TEST( testSendRollbackCommitRollback );
         CPPUNIT_TEST( testSendRollback );
         CPPUNIT_TEST( testWithTTLSet );
 //        CPPUNIT_TEST( testSendSessionClose );