qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1159268 - in /qpid/trunk/qpid/cpp/src/tests: BrokerFixture.h ClientSessionTest.cpp MessageReplayTracker.cpp QueueEvents.cpp QueuePolicyTest.cpp ReplicationTest.cpp SocketProxy.h XmlClientSessionTest.cpp exception_test.cpp
Date Thu, 18 Aug 2011 14:58:54 GMT
Author: aconway
Date: Thu Aug 18 14:58:53 2011
New Revision: 1159268

URL: http://svn.apache.org/viewvc?rev=1159268&view=rev
Log:
NO-JIRA: eliminate SocketProxy from tests.

Was causing problems with changes to introduce IPv6.
In most cases this was being used unnecessarilly due to cut-and-paste of tests.
In the 2 cases it was useful, replaced by simply shutting down the broker
to simulate network failure.

Removed:
    qpid/trunk/qpid/cpp/src/tests/SocketProxy.h
Modified:
    qpid/trunk/qpid/cpp/src/tests/BrokerFixture.h
    qpid/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp
    qpid/trunk/qpid/cpp/src/tests/MessageReplayTracker.cpp
    qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp
    qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp
    qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp
    qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp
    qpid/trunk/qpid/cpp/src/tests/exception_test.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/BrokerFixture.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/BrokerFixture.h?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/BrokerFixture.h (original)
+++ qpid/trunk/qpid/cpp/src/tests/BrokerFixture.h Thu Aug 18 14:58:53 2011
@@ -22,8 +22,6 @@
  *
  */
 
-#include "SocketProxy.h"
-
 #include "qpid/broker/Broker.h"
 #include "qpid/client/Connection.h"
 #include "qpid/client/ConnectionImpl.h"
@@ -71,16 +69,15 @@ struct  BrokerFixture : private boost::n
         brokerThread = qpid::sys::Thread(*broker);
     };
 
-    void shutdownBroker()
-    {
-        broker->shutdown();
-        broker = BrokerPtr();
+    void shutdownBroker() {
+        if (broker) {
+            broker->shutdown();
+            brokerThread.join();
+            broker = BrokerPtr();
+        }
     }
 
-    ~BrokerFixture() {
-        if (broker) broker->shutdown();
-        brokerThread.join();
-    }
+    ~BrokerFixture() {  shutdownBroker(); }
 
     /** Open a connection to the broker. */
     void open(qpid::client::Connection& c) {
@@ -97,20 +94,6 @@ struct LocalConnection : public qpid::cl
     ~LocalConnection() { close(); }
 };
 
-/** A local client connection via a socket proxy. */
-struct ProxyConnection : public qpid::client::Connection {
-    SocketProxy proxy;
-    ProxyConnection(int brokerPort) : proxy(brokerPort) {
-        open("localhost", proxy.getPort());
-    }
-    ProxyConnection(const qpid::client::ConnectionSettings& s) : proxy(s.port) {
-        qpid::client::ConnectionSettings proxySettings(s);
-        proxySettings.port = proxy.getPort();
-        open(proxySettings);
-    }
-    ~ProxyConnection() { close(); }
-};
-
 /** Convenience class to create and open a connection and session
  * and some related useful objects.
  */
@@ -147,7 +130,6 @@ struct  SessionFixtureT : BrokerFixture,
 };
 
 typedef SessionFixtureT<LocalConnection> SessionFixture;
-typedef SessionFixtureT<ProxyConnection> ProxySessionFixture;
 
 }} // namespace qpid::tests
 

Modified: qpid/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp Thu Aug 18 14:58:53 2011
@@ -102,9 +102,9 @@ struct SimpleListener : public MessageLi
     }
 };
 
-struct ClientSessionFixture : public ProxySessionFixture
+struct ClientSessionFixture : public SessionFixture
 {
-    ClientSessionFixture(Broker::Options opts = Broker::Options()) : ProxySessionFixture(opts)
{
+    ClientSessionFixture(Broker::Options opts = Broker::Options()) : SessionFixture(opts)
{
         session.queueDeclare(arg::queue="my-queue");
     }
 };
@@ -150,16 +150,6 @@ QPID_AUTO_TEST_CASE(testDispatcherThread
         BOOST_CHECK_EQUAL(boost::lexical_cast<string>(i), listener.messages[i].getData());
 }
 
-// FIXME aconway 2009-06-17: test for unimplemented feature, enable when implemented.
-void testSuspend0Timeout() {
-    ClientSessionFixture fix;
-    fix.session.suspend();  // session has 0 timeout.
-    try {
-        fix.connection.resume(fix.session);
-        BOOST_FAIL("Expected InvalidArgumentException.");
-    } catch(const InternalErrorException&) {}
-}
-
 QPID_AUTO_TEST_CASE(testUseSuspendedError)
 {
     ClientSessionFixture fix;
@@ -171,18 +161,6 @@ QPID_AUTO_TEST_CASE(testUseSuspendedErro
     } catch(const NotAttachedException&) {}
 }
 
-// FIXME aconway 2009-06-17: test for unimplemented feature, enable when implemented.
-void testSuspendResume() {
-    ClientSessionFixture fix;
-    fix.session.timeout(60);
-    fix.session.suspend();
-    // Make sure we are still subscribed after resume.
-    fix.connection.resume(fix.session);
-    fix.session.messageTransfer(arg::content=Message("my-message", "my-queue"));
-    BOOST_CHECK_EQUAL("my-message", fix.subs.get("my-queue", TIME_SEC).getData());
-}
-
-
 QPID_AUTO_TEST_CASE(testSendToSelf) {
     ClientSessionFixture fix;
     SimpleListener mylistener;

Modified: qpid/trunk/qpid/cpp/src/tests/MessageReplayTracker.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessageReplayTracker.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessageReplayTracker.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessageReplayTracker.cpp Thu Aug 18 14:58:53 2011
@@ -51,7 +51,7 @@ class ReplayBufferChecker
 
 QPID_AUTO_TEST_CASE(testReplay)
 {
-    ProxySessionFixture fix;
+    SessionFixture fix;
     fix.session.queueDeclare(arg::queue="my-queue", arg::exclusive=true, arg::autoDelete=true);
 
     MessageReplayTracker tracker(10);
@@ -77,7 +77,7 @@ QPID_AUTO_TEST_CASE(testReplay)
 
 QPID_AUTO_TEST_CASE(testCheckCompletion)
 {
-    ProxySessionFixture fix;
+    SessionFixture fix;
     fix.session.queueDeclare(arg::queue="my-queue", arg::exclusive=true, arg::autoDelete=true);
 
     MessageReplayTracker tracker(10);

Modified: qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp Thu Aug 18 14:58:53 2011
@@ -147,7 +147,7 @@ struct EventRecorder
 
 QPID_AUTO_TEST_CASE(testSystemLevelEventProcessing)
 {
-    ProxySessionFixture fixture;
+    SessionFixture fixture;
     //register dummy event listener to broker
     EventRecorder listener;
     fixture.broker->getQueueEvents().registerListener("recorder", boost::bind(&EventRecorder::handle,
&listener, _1));
@@ -194,7 +194,7 @@ QPID_AUTO_TEST_CASE(testSystemLevelEvent
 
 QPID_AUTO_TEST_CASE(testSystemLevelEventProcessing_enqueuesOnly)
 {
-    ProxySessionFixture fixture;
+    SessionFixture fixture;
     //register dummy event listener to broker
     EventRecorder listener;
     fixture.broker->getQueueEvents().registerListener("recorder", boost::bind(&EventRecorder::handle,
&listener, _1));

Modified: qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp Thu Aug 18 14:58:53 2011
@@ -152,7 +152,7 @@ QPID_AUTO_TEST_CASE(testRingPolicyCount)
     std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy("test", 5, 0,
QueuePolicy::RING);
     policy->update(args);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("my-ring-queue");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     for (int i = 0; i < 10; i++) {
@@ -187,7 +187,7 @@ QPID_AUTO_TEST_CASE(testRingPolicySize)
     std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy("test", 0, 500,
QueuePolicy::RING);
     policy->update(args);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("my-ring-queue");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
 
@@ -259,7 +259,7 @@ QPID_AUTO_TEST_CASE(testStrictRingPolicy
     std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy("test", 5, 0,
QueuePolicy::RING_STRICT);
     policy->update(args);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("my-ring-queue");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     LocalQueue incoming;
@@ -285,7 +285,7 @@ QPID_AUTO_TEST_CASE(testPolicyWithDtx)
     std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy("test", 5, 0,
QueuePolicy::REJECT);
     policy->update(args);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("my-policy-queue");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     LocalQueue incoming;
@@ -345,7 +345,7 @@ QPID_AUTO_TEST_CASE(testFlowToDiskWithNo
     // Disable flow control, or else we'll never hit the max limit
     args.setInt(QueueFlowLimit::flowStopCountKey, 0);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("my-queue");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     LocalQueue incoming;
@@ -371,7 +371,7 @@ QPID_AUTO_TEST_CASE(testPolicyFailureOnC
     std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy("test", 5, 0,
QueuePolicy::REJECT);
     policy->update(args);
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("q");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     f.session.txSelect();
@@ -388,7 +388,7 @@ QPID_AUTO_TEST_CASE(testCapacityConversi
     args.setString("qpid.max_count", "5");
     args.setString("qpid.flow_stop_count", "0");
 
-    ProxySessionFixture f;
+    SessionFixture f;
     std::string q("q");
     f.session.queueDeclare(arg::queue=q, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args);
     for (int i = 0; i < 5; i++) {

Modified: qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp Thu Aug 18 14:58:53 2011
@@ -74,7 +74,7 @@ QPID_AUTO_TEST_CASE(testReplicationExcha
 {
     qpid::broker::Broker::Options brokerOpts(getBrokerOpts(list_of<string>("qpidd")
                                                            ("--replication-exchange-name=qpid.replication")));
-    ProxySessionFixture f(brokerOpts);
+    SessionFixture f(brokerOpts);
 
 
     std::string dataQ("queue-1");

Modified: qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp Thu Aug 18 14:58:53 2011
@@ -90,7 +90,7 @@ struct SimpleListener : public MessageLi
     }
 };
 
-struct ClientSessionFixture : public ProxySessionFixture
+struct ClientSessionFixture : public SessionFixture
 {
     void declareSubscribe(const string& q="odd_blue",
                           const string& dest="xml")

Modified: qpid/trunk/qpid/cpp/src/tests/exception_test.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/exception_test.cpp?rev=1159268&r1=1159267&r2=1159268&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/exception_test.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/exception_test.cpp Thu Aug 18 14:58:53 2011
@@ -92,32 +92,30 @@ QPID_AUTO_TEST_CASE(TestSessionBusy) {
 }
 
 QPID_AUTO_TEST_CASE(DisconnectedPop) {
-    ProxySessionFixture fix;
-    ProxyConnection c(fix.broker->getPort(Broker::TCP_TRANSPORT));
+    SessionFixture fix;
     fix.session.queueDeclare(arg::queue="q");
     fix.subs.subscribe(fix.lq, "q");
     Catcher<TransportFailure> pop(bind(&LocalQueue::pop, &fix.lq, sys::TIME_SEC));
-    fix.connection.proxy.close();
+    fix.shutdownBroker();
     BOOST_CHECK(pop.join());
 }
 
 QPID_AUTO_TEST_CASE(DisconnectedListen) {
-    ProxySessionFixture fix;
+    SessionFixture fix;
     struct NullListener : public MessageListener {
         void received(Message&) { BOOST_FAIL("Unexpected message"); }
     } l;
-    ProxyConnection c(fix.broker->getPort(Broker::TCP_TRANSPORT));
     fix.session.queueDeclare(arg::queue="q");
     fix.subs.subscribe(l, "q");
 
     Catcher<TransportFailure> runner(bind(&SubscriptionManager::run, boost::ref(fix.subs)));
-    fix.connection.proxy.close();
-    runner.join();    
+    fix.shutdownBroker();
+    runner.join();
     BOOST_CHECK_THROW(fix.session.queueDeclare(arg::queue="x"), TransportFailure);
 }
 
 QPID_AUTO_TEST_CASE(NoSuchQueueTest) {
-    ProxySessionFixture fix;
+    SessionFixture fix;
     ScopedSuppressLogging sl; // Suppress messages for expected errors.
     BOOST_CHECK_THROW(fix.subs.subscribe(fix.lq, "no such queue"), NotFoundException);
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message