activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r953719 - in /activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test: TransactionTest.cpp TransactionTest.h openwire/OpenwireTransactionTest.h
Date Fri, 11 Jun 2010 15:14:44 GMT
Author: tabish
Date: Fri Jun 11 15:14:43 2010
New Revision: 953719

URL: http://svn.apache.org/viewvc?rev=953719&view=rev
Log:
Add an additional transaction test

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp?rev=953719&r1=953718&r2=953719&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
Fri Jun 11 15:14:43 2010
@@ -75,6 +75,47 @@ void TransactionTest::testSendReceiveTra
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+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 {

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h?rev=953719&r1=953718&r2=953719&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/TransactionTest.h
Fri Jun 11 15:14:43 2010
@@ -41,6 +41,7 @@ namespace test{
         };
 
         void testSendReceiveTransactedBatches();
+        void testSendRollbackCommitRollback();
         void testSendRollback();
         void testSendSessionClose();
         void testWithTTLSet();

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h?rev=953719&r1=953718&r2=953719&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTransactionTest.h
Fri Jun 11 15:14:43 2010
@@ -28,6 +28,7 @@ namespace openwire{
 
         CPPUNIT_TEST_SUITE( OpenwireTransactionTest );
         CPPUNIT_TEST( testSendReceiveTransactedBatches );
+        CPPUNIT_TEST( testSendRollbackCommitRollback );
         CPPUNIT_TEST( testSendRollback );
         CPPUNIT_TEST( testWithTTLSet );
 //        CPPUNIT_TEST( testSendSessionClose );



Mime
View raw message