You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/07/13 16:44:02 UTC
activemq-cpp git commit: Add another variety of the QueueBrowser
close test.
Repository: activemq-cpp
Updated Branches:
refs/heads/master b833e24fd -> 1fab5425c
Add another variety of the QueueBrowser close test.
Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/1fab5425
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/1fab5425
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/1fab5425
Branch: refs/heads/master
Commit: 1fab5425c21186b0c60bf0c846d788b65a031393
Parents: b833e24
Author: Timothy Bish <ta...@gmail.com>
Authored: Mon Jul 13 10:43:49 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Mon Jul 13 10:43:49 2015 -0400
----------------------------------------------------------------------
.../activemq/test/QueueBrowserTest.cpp | 34 ++++++++++++++++++++
.../activemq/test/QueueBrowserTest.h | 1 +
.../test/openwire/OpenwireQueueBrowserTest.h | 1 +
3 files changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/1fab5425/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.cpp b/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.cpp
index fe5cbca..5de5061 100644
--- a/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.cpp
+++ b/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.cpp
@@ -242,3 +242,37 @@ void QueueBrowserTest::testRepeatedQueueBrowserCreateDestroy() {
browser.reset(NULL);
}
}
+
+////////////////////////////////////////////////////////////////////////////////
+void QueueBrowserTest::testRepeatedQueueBrowserCreateDestroyWithMessageInQueue() {
+
+ ActiveMQConnection* connection = dynamic_cast<ActiveMQConnection*>(cmsProvider->getConnection());
+ CPPUNIT_ASSERT(connection != NULL);
+
+ std::auto_ptr<cms::Session> session(connection->createSession(cms::Session::AUTO_ACKNOWLEDGE));
+ std::auto_ptr<cms::Queue> queue(session->createTemporaryQueue());
+
+ std::auto_ptr<cms::MessageProducer> producer(session->createProducer(queue.get()));
+ std::auto_ptr<cms::TextMessage> textMessage(session->createTextMessage("Test"));
+
+ producer->setDeliveryMode(cms::DeliveryMode::NON_PERSISTENT);
+ for (int i = 0 ; i < 10; ++i) {
+ producer->send(textMessage.get());
+ }
+
+ connection->start();
+
+ std::auto_ptr<cms::QueueBrowser> browser(session->createBrowser(queue.get()));
+
+ for (int i = 0; i < 200; i++) {
+ browser.reset(session->createBrowser(queue.get()));
+ cms::MessageEnumeration* browserView = browser->getEnumeration();
+
+ if (browserView->hasMoreMessages()) {
+ std::auto_ptr<cms::Message> message(browserView->nextMessage());
+ CPPUNIT_ASSERT(message.get() != NULL);
+ }
+
+ browser.reset(NULL);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/1fab5425/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.h b/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.h
index c47568d..c8ed201 100644
--- a/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/QueueBrowserTest.h
@@ -34,6 +34,7 @@ namespace test {
void testBrowseReceive();
void testQueueBrowserWith2Consumers();
void testRepeatedQueueBrowserCreateDestroy();
+ void testRepeatedQueueBrowserCreateDestroyWithMessageInQueue();
};
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/1fab5425/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
index 1b9f2ff..97d8779 100644
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
@@ -32,6 +32,7 @@ namespace openwire {
CPPUNIT_TEST( testBrowseReceive );
CPPUNIT_TEST( testQueueBrowserWith2Consumers );
CPPUNIT_TEST( testRepeatedQueueBrowserCreateDestroy );
+ CPPUNIT_TEST( testRepeatedQueueBrowserCreateDestroyWithMessageInQueue );
CPPUNIT_TEST_SUITE_END();
public: