diff options
Diffstat (limited to 'qpid/cpp/src/tests')
49 files changed, 1081 insertions, 1206 deletions
diff --git a/qpid/cpp/src/tests/AsyncCompletion.cpp b/qpid/cpp/src/tests/AsyncCompletion.cpp index e33b2dc35d..41423d8245 100644 --- a/qpid/cpp/src/tests/AsyncCompletion.cpp +++ b/qpid/cpp/src/tests/AsyncCompletion.cpp @@ -24,6 +24,8 @@ #include "qpid/sys/BlockingQueue.h" #include "qpid/client/AsyncSession.h" #include "qpid/sys/Time.h" +#include "qpid/framing/QueueQueryResult.h" +#include "qpid/client/TypedResult.h" using namespace std; using namespace qpid; @@ -97,4 +99,15 @@ QPID_AUTO_TEST_CASE(testWaitTillComplete) { sync.wait(); // Should complete now, all messages are completed. } +QPID_AUTO_TEST_CASE(testGetResult) { + SessionFixture fix; + AsyncSession s = fix.session; + + s.queueDeclare("q", arg::durable=true); + TypedResult<QueueQueryResult> tr = s.queueQuery("q"); + QueueQueryResult qq = tr.get(); + BOOST_CHECK_EQUAL(qq.getQueue(), "q"); + BOOST_CHECK_EQUAL(qq.getMessageCount(), 0U); +} + QPID_AUTO_TEST_SUITE_END() diff --git a/qpid/cpp/src/tests/BasicP2PTest.cpp b/qpid/cpp/src/tests/BasicP2PTest.cpp deleted file mode 100644 index f4a4cce7f2..0000000000 --- a/qpid/cpp/src/tests/BasicP2PTest.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "BasicP2PTest.h" - -using namespace qpid; -using namespace qpid::client; - -class BasicP2PTest::Receiver : public Worker, public MessageListener -{ - const std::string queue; - std::string tag; -public: - Receiver(ConnectionOptions& options, const std::string& _queue, const int _messages) - : Worker(options, _messages), queue(_queue){} - void init() - { - Queue q(queue, true); - channel.declareQueue(q); - framing::FieldTable args; - channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, q, queue, args); - channel.consume(q, tag, this); - channel.start(); - } - - void start() - { - } - - void received(Message&) - { - count++; - } -}; - -void BasicP2PTest::assign(const std::string& role, framing::FieldTable& params, ConnectionOptions& options) -{ - std::string queue = params.getString("P2P_QUEUE_AND_KEY_NAME"); - int messages = params.getInt("P2P_NUM_MESSAGES"); - if (role == "SENDER") { - worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_DIRECT_EXCHANGE, queue, messages)); - } else if(role == "RECEIVER"){ - worker = std::auto_ptr<Worker>(new Receiver(options, queue, messages)); - } else { - throw Exception("unrecognised role"); - } - worker->init(); -} diff --git a/qpid/cpp/src/tests/BasicP2PTest.h b/qpid/cpp/src/tests/BasicP2PTest.h deleted file mode 100644 index b2611f0301..0000000000 --- a/qpid/cpp/src/tests/BasicP2PTest.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _BasicP2PTest_ -#define _BasicP2PTest_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <memory> -#include <sstream> - -#include "qpid/Exception.h" -#include "qpid/client/Channel.h" -#include "qpid/client/Message.h" -#include "qpid/client/Connection.h" -#include "qpid/client/MessageListener.h" -#include "SimpleTestCaseBase.h" - - -namespace qpid { - -class BasicP2PTest : public SimpleTestCaseBase -{ - class Receiver; -public: - void assign(const std::string& role, framing::FieldTable& params, ConnectionOptions& options); -}; - -} - -#endif diff --git a/qpid/cpp/src/tests/BasicPubSubTest.cpp b/qpid/cpp/src/tests/BasicPubSubTest.cpp deleted file mode 100644 index 1e9ff364f1..0000000000 --- a/qpid/cpp/src/tests/BasicPubSubTest.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "BasicPubSubTest.h" - -using namespace qpid; - -class BasicPubSubTest::Receiver : public Worker, public MessageListener -{ - const Exchange& exchange; - const std::string queue; - const std::string key; - std::string tag; -public: - Receiver(ConnectionOptions& options, const Exchange& _exchange, const std::string& _queue, const std::string& _key, const int _messages) - : Worker(options, _messages), exchange(_exchange), queue(_queue), key(_key){} - - void init() - { - Queue q(queue, true); - channel.declareQueue(q); - framing::FieldTable args; - channel.bind(exchange, q, key, args); - channel.consume(q, tag, this); - channel.start(); - } - - void start(){ - } - - void received(Message&) - { - count++; - } -}; - -class BasicPubSubTest::MultiReceiver : public Worker, public MessageListener -{ - typedef boost::ptr_vector<Receiver> ReceiverList; - ReceiverList receivers; - -public: - MultiReceiver(ConnectionOptions& options, const Exchange& exchange, const std::string& key, const int _messages, int receiverCount) - : Worker(options, _messages) - { - for (int i = 0; i != receiverCount; i++) { - std::string queue = (boost::format("%1%_%2%") % options.clientid % i).str(); - receivers.push_back(new Receiver(options, exchange, queue, key, _messages)); - } - } - - void init() - { - for (ReceiverList::size_type i = 0; i != receivers.size(); i++) { - receivers[i].init(); - } - } - - void start() - { - for (ReceiverList::size_type i = 0; i != receivers.size(); i++) { - receivers[i].start(); - } - } - - void received(Message& msg) - { - for (ReceiverList::size_type i = 0; i != receivers.size(); i++) { - receivers[i].received(msg); - } - } - - virtual int getCount() - { - count = 0; - for (ReceiverList::size_type i = 0; i != receivers.size(); i++) { - count += receivers[i].getCount(); - } - return count; - } - virtual void stop() - { - for (ReceiverList::size_type i = 0; i != receivers.size(); i++) { - receivers[i].stop(); - } - } -}; - -void BasicPubSubTest::assign(const std::string& role, framing::FieldTable& params, ConnectionOptions& options) -{ - std::string key = params.getString("PUBSUB_KEY"); - int messages = params.getInt("PUBSUB_NUM_MESSAGES"); - int receivers = params.getInt("PUBSUB_NUM_RECEIVERS"); - if (role == "SENDER") { - worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages)); - } else if(role == "RECEIVER"){ - worker = std::auto_ptr<Worker>(new MultiReceiver(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages, receivers)); - } else { - throw Exception("unrecognised role"); - } - worker->init(); -} - diff --git a/qpid/cpp/src/tests/BasicPubSubTest.h b/qpid/cpp/src/tests/BasicPubSubTest.h deleted file mode 100644 index 242d2847d7..0000000000 --- a/qpid/cpp/src/tests/BasicPubSubTest.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _BasicPubSubTest_ -#define _BasicPubSubTest_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <memory> -#include <sstream> - -#include "qpid/Exception.h" -#include "qpid/client/Channel.h" -#include "qpid/client/Message.h" -#include "qpid/client/Connection.h" -#include "qpid/client/MessageListener.h" -#include "SimpleTestCaseBase.h" -#include <boost/ptr_container/ptr_vector.hpp> -#include <boost/format.hpp> - - -namespace qpid { - -using namespace qpid::client; - -class BasicPubSubTest : public SimpleTestCaseBase -{ - class Receiver; - class MultiReceiver; -public: - void assign(const std::string& role, framing::FieldTable& params, ConnectionOptions& options); -}; - -} - -#endif diff --git a/qpid/cpp/src/tests/BrokerFixture.h b/qpid/cpp/src/tests/BrokerFixture.h index f55560739d..b32b7f44ba 100644 --- a/qpid/cpp/src/tests/BrokerFixture.h +++ b/qpid/cpp/src/tests/BrokerFixture.h @@ -114,10 +114,12 @@ struct ClientT { SessionType session; qpid::client::SubscriptionManager subs; qpid::client::LocalQueue lq; - ClientT(uint16_t port, const std::string& name=std::string()) - : connection(port), session(connection.newSession(name)), subs(session) {} - ClientT(const qpid::client::ConnectionSettings& settings, const std::string& name=std::string()) - : connection(settings), session(connection.newSession(name)), subs(session) {} + std::string name; + + ClientT(uint16_t port, const std::string& name_=std::string()) + : connection(port), session(connection.newSession(name_)), subs(session), name(name_) {} + ClientT(const qpid::client::ConnectionSettings& settings, const std::string& name_=std::string()) + : connection(settings), session(connection.newSession(name_)), subs(session), name(name_) {} ~ClientT() { connection.close(); } }; diff --git a/qpid/cpp/src/tests/ClientMessageTest.cpp b/qpid/cpp/src/tests/ClientMessageTest.cpp new file mode 100644 index 0000000000..bc0945674f --- /dev/null +++ b/qpid/cpp/src/tests/ClientMessageTest.cpp @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +/**@file Unit tests for the client::Message class. */ + +#include "unit_test.h" +#include "qpid/client/Message.h" + +using namespace qpid::client; + +QPID_AUTO_TEST_SUITE(ClientMessageTestSuite) + +QPID_AUTO_TEST_CASE(MessageCopyAssign) { + // Verify that message has normal copy semantics. + Message m("foo"); + BOOST_CHECK_EQUAL("foo", m.getData()); + Message c(m); + BOOST_CHECK_EQUAL("foo", c.getData()); + Message a; + BOOST_CHECK_EQUAL("", a.getData()); + a = m; + BOOST_CHECK_EQUAL("foo", a.getData()); + a.setData("a"); + BOOST_CHECK_EQUAL("a", a.getData()); + c.setData("c"); + BOOST_CHECK_EQUAL("c", c.getData()); + BOOST_CHECK_EQUAL("foo", m.getData()); +} + +QPID_AUTO_TEST_SUITE_END() diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp index 589e1154e1..1c719d16dc 100644 --- a/qpid/cpp/src/tests/ClientSessionTest.cpp +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -28,7 +28,7 @@ #include "qpid/sys/Runnable.h" #include "qpid/sys/Time.h" #include "qpid/client/Session.h" -#include "qpid/framing/TransferContent.h" +#include "qpid/client/Message.h" #include "qpid/framing/reply_exceptions.h" #include <boost/optional.hpp> @@ -121,7 +121,7 @@ QPID_AUTO_TEST_CASE(testDispatcher) fix.session =fix.connection.newSession(); size_t count = 100; for (size_t i = 0; i < count; ++i) - fix.session.messageTransfer(arg::content=TransferContent(boost::lexical_cast<string>(i), "my-queue")); + fix.session.messageTransfer(arg::content=Message(boost::lexical_cast<string>(i), "my-queue")); DummyListener listener(fix.session, "my-queue", count); listener.run(); BOOST_CHECK_EQUAL(count, listener.messages.size()); @@ -137,7 +137,7 @@ QPID_AUTO_TEST_CASE(testDispatcherThread) DummyListener listener(fix.session, "my-queue", count); sys::Thread t(listener); for (size_t i = 0; i < count; ++i) { - fix.session.messageTransfer(arg::content=TransferContent(boost::lexical_cast<string>(i), "my-queue")); + fix.session.messageTransfer(arg::content=Message(boost::lexical_cast<string>(i), "my-queue")); } t.join(); BOOST_CHECK_EQUAL(count, listener.messages.size()); @@ -173,7 +173,7 @@ QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testSuspendResume, 1) fix.session.suspend(); // Make sure we are still subscribed after resume. fix.connection.resume(fix.session); - fix.session.messageTransfer(arg::content=TransferContent("my-message", "my-queue")); + fix.session.messageTransfer(arg::content=Message("my-message", "my-queue")); FrameSet::shared_ptr msg = fix.session.get(); BOOST_CHECK_EQUAL(string("my-message"), msg->getContent()); } diff --git a/qpid/cpp/src/tests/ClusterFailover.cpp b/qpid/cpp/src/tests/ClusterFailover.cpp new file mode 100644 index 0000000000..db2392b296 --- /dev/null +++ b/qpid/cpp/src/tests/ClusterFailover.cpp @@ -0,0 +1,59 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/**@file Tests for partial failure in a cluster. + * Partial failure means some nodes experience a failure while others do not. + * In this case the failed nodes must shut down. + */ + +#include "test_tools.h" +#include "unit_test.h" +#include "ClusterFixture.h" +#include "qpid/client/FailoverManager.h" +#include <boost/assign.hpp> +#include <boost/algorithm/string.hpp> +#include <boost/bind.hpp> + +QPID_AUTO_TEST_SUITE(ClusterFailoverTestSuite) + +using namespace std; +using namespace qpid; +using namespace qpid::cluster; +using namespace qpid::framing; +using namespace qpid::client; +using namespace qpid::client::arg; +using namespace boost::assign; +using broker::Broker; +using boost::shared_ptr; + +// Timeout for tests that wait for messages +const sys::Duration TIMEOUT=sys::TIME_SEC/4; + + +// Test re-connecting with same session name after a failure. +QPID_AUTO_TEST_CASE(testReconnectSameSessionName) { + ClusterFixture cluster(2, -1); + Client c0(cluster[0], "foo"); + cluster.kill(0, 9); + Client c1(cluster[1], "foo"); // Using same name, should be cleaned up. +} + +QPID_AUTO_TEST_SUITE_END() diff --git a/qpid/cpp/src/tests/ClusterFixture.cpp b/qpid/cpp/src/tests/ClusterFixture.cpp index 5658957b48..70d60b10b4 100644 --- a/qpid/cpp/src/tests/ClusterFixture.cpp +++ b/qpid/cpp/src/tests/ClusterFixture.cpp @@ -61,8 +61,14 @@ using boost::assign::list_of; #include "ClusterFixture.h" -ClusterFixture::ClusterFixture(size_t n, int localIndex_, const Args& args_) - : name(Uuid(true).str()), localIndex(localIndex_), userArgs(args_) +ClusterFixture::ClusterFixture(size_t n, int localIndex_, const Args& args_, const string& clusterLib_) + : name(Uuid(true).str()), localIndex(localIndex_), userArgs(args_), clusterLib(clusterLib_) +{ + add(n); +} + +ClusterFixture::ClusterFixture(size_t n, int localIndex_, boost::function<void (Args&, size_t)> updateArgs_, const string& clusterLib_) + : name(Uuid(true).str()), localIndex(localIndex_), updateArgs(updateArgs_), clusterLib(clusterLib_) { add(n); } @@ -70,13 +76,14 @@ ClusterFixture::ClusterFixture(size_t n, int localIndex_, const Args& args_) const ClusterFixture::Args ClusterFixture::DEFAULT_ARGS = list_of<string>("--auth=no")("--no-data-dir"); -ClusterFixture::Args ClusterFixture::makeArgs(const std::string& prefix) { - Args args = list_of<string>("qpidd " __FILE__) +ClusterFixture::Args ClusterFixture::makeArgs(const std::string& prefix, size_t index) { + Args args = list_of<string>("qpidd ") ("--no-module-dir") - ("--load-module=../.libs/cluster.so") - ("--cluster-name")(name) + ("--load-module")(clusterLib) + ("--cluster-name")(name) ("--log-prefix")(prefix); args.insert(args.end(), userArgs.begin(), userArgs.end()); + if (updateArgs) updateArgs(args, index); return args; } @@ -84,7 +91,7 @@ void ClusterFixture::add() { if (size() != size_t(localIndex)) { // fork a broker process. std::ostringstream os; os << "fork" << size(); std::string prefix = os.str(); - forkedBrokers.push_back(shared_ptr<ForkedBroker>(new ForkedBroker(makeArgs(prefix)))); + forkedBrokers.push_back(shared_ptr<ForkedBroker>(new ForkedBroker(makeArgs(prefix, size())))); push_back(forkedBrokers.back()->getPort()); } else { // Run in this process @@ -106,7 +113,7 @@ void ClusterFixture::addLocal() { assert(int(size()) == localIndex); ostringstream os; os << "local" << localIndex; string prefix = os.str(); - Args args(makeArgs(prefix)); + Args args(makeArgs(prefix, localIndex)); vector<const char*> argv(args.size()); transform(args.begin(), args.end(), argv.begin(), boost::bind(&string::c_str, _1)); qpid::log::Logger::instance().setPrefix(prefix); @@ -116,7 +123,7 @@ void ClusterFixture::addLocal() { } bool ClusterFixture::hasLocal() const { return localIndex >= 0 && size_t(localIndex) < size(); } - + /** Kill a forked broker with sig, or shutdown localBroker if n==0. */ void ClusterFixture::kill(size_t n, int sig) { if (n == size_t(localIndex)) @@ -131,3 +138,22 @@ void ClusterFixture::killWithSilencer(size_t n, client::Connection& c, int sig) kill(n,sig); try { c.close(); } catch(...) {} } + +/** + * Get the known broker ports from a Connection. + *@param n if specified wait for the cluster size to be n, up to a timeout. + */ +std::set<int> knownBrokerPorts(qpid::client::Connection& source, int n) { + std::vector<qpid::Url> urls = source.getKnownBrokers(); + if (n >= 0 && unsigned(n) != urls.size()) { + // Retry up to 10 secs in .1 second intervals. + for (size_t retry=100; urls.size() != unsigned(n) && retry != 0; --retry) { + qpid::sys::usleep(1000*100); // 0.1 secs + urls = source.getKnownBrokers(); + } + } + std::set<int> s; + for (std::vector<qpid::Url>::const_iterator i = urls.begin(); i != urls.end(); ++i) + s.insert((*i)[0].get<qpid::TcpAddress>()->port); + return s; +} diff --git a/qpid/cpp/src/tests/ClusterFixture.h b/qpid/cpp/src/tests/ClusterFixture.h index 84fb9f2202..353ec0c88d 100644 --- a/qpid/cpp/src/tests/ClusterFixture.h +++ b/qpid/cpp/src/tests/ClusterFixture.h @@ -38,6 +38,7 @@ #include "qpid/log/Logger.h" #include <boost/bind.hpp> +#include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <string> @@ -59,43 +60,55 @@ using qpid::broker::Broker; using boost::shared_ptr; using qpid::cluster::Cluster; - +#define DEFAULT_CLUSTER_LIB "../.libs/cluster.so" /** Cluster fixture is a vector of ports for the replicas. - * + * * At most one replica (by default replica 0) is in the current * process, all others are forked as children. */ class ClusterFixture : public vector<uint16_t> { public: typedef std::vector<std::string> Args; + static const Args DEFAULT_ARGS; + /** @param localIndex can be -1 meaning don't automatically start a local broker. * A local broker can be started with addLocal(). */ - ClusterFixture(size_t n, int localIndex=0, const Args& args=DEFAULT_ARGS); + ClusterFixture(size_t n, int localIndex=0, const Args& args=DEFAULT_ARGS, const string& clusterLib = DEFAULT_CLUSTER_LIB); + + /**@param updateArgs function is passed the index of the cluster member and can update the arguments. */ + ClusterFixture(size_t n, int localIndex, boost::function<void (Args&, size_t)> updateArgs, const string& clusterLib = DEFAULT_CLUSTER_LIB); + void add(size_t n) { for (size_t i=0; i < n; ++i) add(); } void add(); // Add a broker. void setup(); bool hasLocal() const; - - /** Kill a forked broker with sig, or shutdown localBroker if n==0. */ + + /** Kill a forked broker with sig, or shutdown localBroker. */ void kill(size_t n, int sig=SIGINT); /** Kill a broker and suppressing errors from closing connection c. */ void killWithSilencer(size_t n, client::Connection& c, int sig=SIGINT); private: - static const Args DEFAULT_ARGS; - + void addLocal(); // Add a local broker. - Args makeArgs(const std::string& prefix); + Args makeArgs(const std::string& prefix, size_t index); string name; std::auto_ptr<BrokerFixture> localBroker; int localIndex; std::vector<shared_ptr<ForkedBroker> > forkedBrokers; Args userArgs; + boost::function<void (Args&, size_t)> updateArgs; + string clusterLib; }; +/** + * Get the known broker ports from a Connection. + *@param n if specified wait for the cluster size to be n, up to a timeout. + */ +std::set<int> knownBrokerPorts(qpid::client::Connection& source, int n=-1); #endif /*!CLUSTER_FIXTURE_H*/ diff --git a/qpid/cpp/src/tests/ForkedBroker.cpp b/qpid/cpp/src/tests/ForkedBroker.cpp index f90f76aeb2..12175d3287 100644 --- a/qpid/cpp/src/tests/ForkedBroker.cpp +++ b/qpid/cpp/src/tests/ForkedBroker.cpp @@ -20,20 +20,39 @@ */ #include "ForkedBroker.h" +#include "qpid/log/Statement.h" #include <boost/bind.hpp> +#include <boost/algorithm/string.hpp> #include <algorithm> #include <stdlib.h> #include <sys/types.h> #include <signal.h> -ForkedBroker::ForkedBroker(const Args& args) { init(args); } +using namespace std; +using qpid::ErrnoException; -ForkedBroker::ForkedBroker(int argc, const char* const argv[]) { init(Args(argv, argc+argv)); } +ForkedBroker::ForkedBroker(const Args& constArgs) { + Args args(constArgs); + Args::iterator i = find(args.begin(), args.end(), string("TMP_DATA_DIR")); + if (i != args.end()) { + args.erase(i); + char dd[] = "/tmp/ForkedBroker.XXXXXX"; + if (!mkdtemp(dd)) + throw qpid::ErrnoException("Can't create data dir"); + dataDir = dd; + args.push_back("--data-dir"); + args.push_back(dataDir); + } + init(args); +} ForkedBroker::~ForkedBroker() { - try { kill(); } catch(const std::exception& e) { + try { kill(); } + catch (const std::exception& e) { QPID_LOG(error, QPID_MSG("Killing forked broker: " << e.what())); } + if (!dataDir.empty()) + ::system(("rm -rf "+dataDir).c_str()); } void ForkedBroker::kill(int sig) { @@ -42,14 +61,25 @@ void ForkedBroker::kill(int sig) { pid = 0; // Reset pid here in case of an exception. using qpid::ErrnoException; if (::kill(savePid, sig) < 0) - throw ErrnoException("kill failed"); + throw ErrnoException("kill failed"); int status; if (::waitpid(savePid, &status, 0) < 0 && sig != 9) throw ErrnoException("wait for forked process failed"); if (WEXITSTATUS(status) != 0 && sig != 9) throw qpid::Exception(QPID_MSG("Forked broker exited with: " << WEXITSTATUS(status))); } + +namespace std { +static ostream& operator<<(ostream& o, const ForkedBroker::Args& a) { + copy(a.begin(), a.end(), ostream_iterator<string>(o, " ")); + return o; +} +bool isLogOption(const std::string& s) { + return boost::starts_with(s, "--log-enable") || boost::starts_with(s, "--trace"); +} + +} void ForkedBroker::init(const Args& userArgs) { using qpid::ErrnoException; @@ -70,17 +100,20 @@ void ForkedBroker::init(const Args& userArgs) { } else { // child ::close(pipeFds[0]); - // FIXME aconway 2009-02-12: int fd = ::dup2(pipeFds[1], 1); // pipe stdout to the parent. if (fd < 0) throw ErrnoException("dup2 failed"); - const char* prog = "../qpidd"; + const char* prog = ::getenv("QPID_FORKED_BROKER"); + if (!prog) prog = "../qpidd"; Args args(userArgs); args.push_back("--port=0"); - if (!::getenv("QPID_TRACE") && !::getenv("QPID_LOG_ENABLE")) - args.push_back("--log-enable=error+"); // Keep quiet except for errors. + // Keep quiet except for errors. + if (!::getenv("QPID_TRACE") && !::getenv("QPID_LOG_ENABLE") + && find_if(userArgs.begin(), userArgs.end(), isLogOption) == userArgs.end()) + args.push_back("--log-enable=error+"); std::vector<const char*> argv(args.size()); std::transform(args.begin(), args.end(), argv.begin(), boost::bind(&std::string::c_str, _1)); argv.push_back(0); + QPID_LOG(debug, "ForkedBroker exec " << prog << ": " << args); execv(prog, const_cast<char* const*>(&argv[0])); throw ErrnoException("execv failed"); } diff --git a/qpid/cpp/src/tests/ForkedBroker.h b/qpid/cpp/src/tests/ForkedBroker.h index 6f97fbdc09..45b522068c 100644 --- a/qpid/cpp/src/tests/ForkedBroker.h +++ b/qpid/cpp/src/tests/ForkedBroker.h @@ -48,19 +48,26 @@ class ForkedBroker { public: typedef std::vector<std::string> Args; + // argv args are passed to broker. + // + // Special value "TMP_DATA_DIR" is substituted with a temporary + // data directory for the broker. + // ForkedBroker(const Args& argv); - ForkedBroker(int argc, const char* const argv[]); ~ForkedBroker(); void kill(int sig=SIGINT); + int wait(); // Wait for exit, return exit status. uint16_t getPort() { return port; } pid_t getPID() { return pid; } private: + void init(const Args& args); pid_t pid; int port; + std::string dataDir; }; #endif /*!TESTS_FORKEDBROKER_H*/ diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am index 9a81ef18b3..161428fcad 100644 --- a/qpid/cpp/src/tests/Makefile.am +++ b/qpid/cpp/src/tests/Makefile.am @@ -96,7 +96,9 @@ unit_test_SOURCES= unit_test.cpp unit_test.h \ RetryList.cpp \ RateFlowcontrolTest.cpp \ FrameDecoder.cpp \ - ReplicationTest.cpp + ReplicationTest.cpp \ + ClientMessageTest.cpp \ + PollableCondition.cpp if HAVE_XML unit_test_SOURCES+= XmlClientSessionTest.cpp @@ -110,11 +112,17 @@ endif # amqp_0_10/Map.cpp \ # amqp_0_10/handlers.cpp +TESTLIBFLAGS = -module -rpath $(abs_builddir) check_LTLIBRARIES += libshlibtest.la -libshlibtest_la_LDFLAGS = -module -rpath $(abs_builddir) +libshlibtest_la_LDFLAGS = $(TESTLIBFLAGS) libshlibtest_la_SOURCES = shlibtest.cpp +check_LTLIBRARIES += test_store.la +test_store_la_SOURCES = test_store.cpp +test_store_la_LIBADD = $(lib_broker) # FIXME aconway 2009-04-03: required? +test_store_la_LDFLAGS = $(TESTLIBFLAGS) + include cluster.mk if SSL include ssl.mk @@ -236,24 +244,6 @@ libdlclose_noop_la_SOURCES = dlclose_noop.c CLEANFILES+=valgrind.out *.log *.vglog* dummy_test $(unit_wrappers) -# FIXME aconway 2008-05-23: Disabled interop_runner because it uses -# the obsolete Channel class. Convert to Session and re-enable. -# -# check_PROGRAMS += interop_runner - -# interop_runner_SOURCES = \ -# interop_runner.cpp \ -# SimpleTestCaseBase.cpp \ -# BasicP2PTest.cpp \ -# BasicPubSubTest.cpp \ -# SimpleTestCaseBase.h \ -# BasicP2PTest.h \ -# BasicPubSubTest.h \ -# TestCase.h \ -# TestOptions.h ConnectionOptions.h -# interop_runner_LDADD = $(lib_client) $(lib_common) $(extra_libs) - - # Longer running stability tests, not run by default check: target. # Not run under valgrind, too slow diff --git a/qpid/cpp/src/tests/PartialFailure.cpp b/qpid/cpp/src/tests/PartialFailure.cpp new file mode 100644 index 0000000000..5137672e7d --- /dev/null +++ b/qpid/cpp/src/tests/PartialFailure.cpp @@ -0,0 +1,219 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/**@file Tests for partial failure in a cluster. + * Partial failure means some nodes experience a failure while others do not. + * In this case the failed nodes must shut down. + */ + +#include "test_tools.h" +#include "unit_test.h" +#include "ClusterFixture.h" +#include <boost/assign.hpp> +#include <boost/algorithm/string.hpp> +#include <boost/bind.hpp> + +QPID_AUTO_TEST_SUITE(PartialFailureTestSuite) + + using namespace std; +using namespace qpid; +using namespace qpid::cluster; +using namespace qpid::framing; +using namespace qpid::client; +using namespace qpid::client::arg; +using namespace boost::assign; +using broker::Broker; +using boost::shared_ptr; + +// Timeout for tests that wait for messages +const sys::Duration TIMEOUT=sys::TIME_SEC/4; + +static bool isLogOption(const std::string& s) { return boost::starts_with(s, "--log-enable"); } + +void updateArgs(ClusterFixture::Args& args, size_t index) { + ostringstream os; + os << "--test-store-name=s" << index; + args.push_back(os.str()); + args.push_back("--load-module=.libs/test_store.so"); + args.push_back("--auth=no"); + args.push_back("TMP_DATA_DIR"); + + // These tests generate errors deliberately, disable error logging unless a log env var is set. + if (!::getenv("QPID_TRACE") && !::getenv("QPID_LOG_ENABLE")) { + remove_if(args.begin(), args.end(), isLogOption); + args.push_back("--log-enable=critical+:DISABLED"); // hacky way to disable logs. + } +} + +Message pMessage(string data, string q) { + Message msg(data, q); + msg.getDeliveryProperties().setDeliveryMode(PERSISTENT); + return msg; +} + +void queueAndSub(Client& c) { + c.session.queueDeclare(c.name, durable=true); + c.subs.subscribe(c.lq, c.name); +} + +// Verify normal cluster-wide errors. +QPID_AUTO_TEST_CASE(testNormalErrors) { + // FIXME aconway 2009-04-10: Would like to put a scope just around + // the statements expected to fail (in BOOST_CHECK_THROW) but that + // sproadically lets out messages, possibly because they're in + // Connection thread. + ScopedSuppressLogging allQuiet; + + ClusterFixture cluster(3, -1, updateArgs); + Client c0(cluster[0], "c0"); + Client c1(cluster[1], "c1"); + Client c2(cluster[2], "c2"); + + queueAndSub(c0); + c0.session.messageTransfer(content=Message("x", "c0")); + BOOST_CHECK_EQUAL(c0.lq.get(TIMEOUT).getData(), "x"); + + // Session error. + BOOST_CHECK_THROW(c0.session.exchangeBind(), SessionException); + c1.session.messageTransfer(content=Message("stay", "c0")); // Will stay on queue, session c0 is dead. + + // Connection error, kill c1 on all members. + queueAndSub(c1); + BOOST_CHECK_THROW( + c1.session.messageTransfer( + content=pMessage("TEST_STORE_DO: s0[exception] s1[exception] s2[exception] testNormalErrors", "c1")), + ConnectionException); + c2.session.messageTransfer(content=Message("stay", "c1")); // Will stay on queue, session/connection c1 is dead. + + BOOST_CHECK_EQUAL(3u, knownBrokerPorts(c2.connection, 3).size()); + BOOST_CHECK_EQUAL(c2.subs.get("c0", TIMEOUT).getData(), "stay"); + BOOST_CHECK_EQUAL(c2.subs.get("c1", TIMEOUT).getData(), "stay"); +} + + +// Test errors after a new member joins to verify frame-sequence-numbers are ok in update. +QPID_AUTO_TEST_CASE(testErrorAfterJoin) { + ScopedSuppressLogging allQuiet; + + ClusterFixture cluster(1, -1, updateArgs); + Client c0(cluster[0]); + c0.session.queueDeclare("q", durable=true); + c0.session.messageTransfer(content=pMessage("a", "q")); + + // Kill the new guy + cluster.add(); + Client c1(cluster[1]); + c0.session.messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception] testErrorAfterJoin", "q")); + BOOST_CHECK_THROW(c1.session.messageTransfer(content=pMessage("xxx", "q")), TransportFailure); + BOOST_CHECK_EQUAL(1u, knownBrokerPorts(c0.connection, 1).size()); + + // Kill the old guy + cluster.add(); + Client c2(cluster[2]); + c2.session.messageTransfer(content=pMessage("TEST_STORE_DO: s0[exception] testErrorAfterJoin2", "q")); + BOOST_CHECK_THROW(c0.session.messageTransfer(content=pMessage("xxx", "q")), TransportFailure); + + BOOST_CHECK_EQUAL(1u, knownBrokerPorts(c2.connection, 1).size()); +} + +// Test that if one member fails and others do not, the failure leaves the cluster. +QPID_AUTO_TEST_CASE(testSinglePartialFailure) { + ScopedSuppressLogging allQuiet; + + ClusterFixture cluster(3, -1, updateArgs); + Client c0(cluster[0], "c0"); + Client c1(cluster[1], "c1"); + Client c2(cluster[2], "c2"); + + c0.session.queueDeclare("q", durable=true); + c0.session.messageTransfer(content=pMessage("a", "q")); + // Cause partial failure on c1 + c0.session.messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception] testSinglePartialFailure", "q")); + BOOST_CHECK_THROW(c1.session.queueQuery("q"), TransportFailure); + + c0.session.messageTransfer(content=pMessage("b", "q")); + BOOST_CHECK_EQUAL(c0.session.queueQuery("q").getMessageCount(), 3u); + BOOST_CHECK_EQUAL(2u, knownBrokerPorts(c0.connection, 2).size()); + + // Cause partial failure on c2 + c0.session.messageTransfer(content=pMessage("TEST_STORE_DO: s2[exception] testSinglePartialFailure2", "q")); + BOOST_CHECK_THROW(c2.session.queueQuery("q"), TransportFailure); + + c0.session.messageTransfer(content=pMessage("c", "q")); + BOOST_CHECK_EQUAL(c0.session.queueQuery("q").getMessageCount(), 5u); + BOOST_CHECK_EQUAL(1u, knownBrokerPorts(c0.connection, 1).size()); +} + +// Test multiple partial falures: 2 fail 2 pass +QPID_AUTO_TEST_CASE(testMultiPartialFailure) { + ScopedSuppressLogging allQuiet; + + ClusterFixture cluster(4, -1, updateArgs); + Client c0(cluster[0], "c0"); + Client c1(cluster[1], "c1"); + Client c2(cluster[2], "c2"); + Client c3(cluster[3], "c3"); + + c0.session.queueDeclare("q", durable=true); + c0.session.messageTransfer(content=pMessage("a", "q")); + + // Cause partial failure on c1, c2 + c0.session.messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception] s2[exception] testMultiPartialFailure", "q")); + BOOST_CHECK_THROW(c1.session.queueQuery("q"), TransportFailure); + BOOST_CHECK_THROW(c2.session.queueQuery("q"), TransportFailure); + + c0.session.messageTransfer(content=pMessage("b", "q")); + c3.session.messageTransfer(content=pMessage("c", "q")); + BOOST_CHECK_EQUAL(c3.session.queueQuery("q").getMessageCount(), 4u); + BOOST_CHECK_EQUAL(2u, knownBrokerPorts(c0.connection, 2).size()); +} + +/** FIXME aconway 2009-04-10: + * The current approach to shutting down a process in test_store + * sometimes leads to assertion failures and errors in the shut-down + * process. Need a cleaner solution + */ +#if 0 +QPID_AUTO_TEST_CASE(testPartialFailureMemberLeaves) { + ScopedSuppressLogging allQuiet; + + ClusterFixture cluster(2, -1, updateArgs); + Client c0(cluster[0], "c0"); + Client c1(cluster[1], "c1"); + + c0.session.queueDeclare("q", durable=true); + c0.session.messageTransfer(content=pMessage("a", "q")); + + // Cause failure on member 0 and simultaneous crash on member 1. + BOOST_CHECK_THROW( + c0.session.messageTransfer( + content=pMessage("TEST_STORE_DO: s0[exception] s1[exit_process] testPartialFailureMemberLeaves", "q")), + ConnectionException); + cluster.wait(1); + + Client c00(cluster[0], "c00"); // Old connection is dead. + BOOST_CHECK_EQUAL(c00.session.queueQuery("q").getMessageCount(), 1u); + BOOST_CHECK_EQUAL(1u, knownBrokerPorts(c00.connection, 1).size()); +} +#endif + + +QPID_AUTO_TEST_SUITE_END() diff --git a/qpid/cpp/src/tests/PollableCondition.cpp b/qpid/cpp/src/tests/PollableCondition.cpp new file mode 100644 index 0000000000..33664d43fc --- /dev/null +++ b/qpid/cpp/src/tests/PollableCondition.cpp @@ -0,0 +1,117 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "test_tools.h" +#include "unit_test.h" +#include "qpid/sys/Poller.h" +#include "qpid/sys/PollableCondition.h" +#include "qpid/sys/Monitor.h" +#include "qpid/sys/Time.h" +#include "qpid/sys/Thread.h" +#include <boost/bind.hpp> + + +QPID_AUTO_TEST_SUITE(PollableConditionTest) + +using namespace qpid::sys; + +const Duration SHORT = TIME_SEC/100; +const Duration LONG = TIME_SEC/10; + +class Callback { + public: + enum Action { NONE, DISARM, CLEAR, DISARM_CLEAR }; + + Callback() : count(), action(NONE) {} + + void call(PollableCondition& pc) { + Mutex::ScopedLock l(lock); + ++count; + switch(action) { + case NONE: break; + case DISARM: pc.disarm(); break; + case CLEAR: pc.clear(); break; + case DISARM_CLEAR: pc.disarm(); pc.clear(); break; + } + action = NONE; + lock.notify(); + } + + bool isCalling() { Mutex::ScopedLock l(lock); return wait(LONG); } + + bool isNotCalling() { Mutex::ScopedLock l(lock); return !wait(SHORT); } + + bool nextCall(Action a=NONE) { + Mutex::ScopedLock l(lock); + action = a; + return wait(LONG); + } + + private: + bool wait(Duration timeout) { + int n = count; + AbsTime deadline(now(), timeout); + while (n == count && lock.wait(deadline)) + ; + return n != count; + } + + Monitor lock; + int count; + Action action; +}; + +QPID_AUTO_TEST_CASE(testPollableCondition) { + boost::shared_ptr<Poller> poller(new Poller()); + Callback callback; + PollableCondition pc(boost::bind(&Callback::call, &callback, _1), poller); + + Thread runner = Thread(*poller); + + BOOST_CHECK(callback.isNotCalling()); // condition is not set or armed. + + pc.rearm(); + BOOST_CHECK(callback.isNotCalling()); // Armed but not set + + pc.set(); + BOOST_CHECK(callback.isCalling()); // Armed and set. + BOOST_CHECK(callback.isCalling()); // Still armed and set. + + callback.nextCall(Callback::DISARM); + BOOST_CHECK(callback.isNotCalling()); // set but not armed + + pc.rearm(); + BOOST_CHECK(callback.isCalling()); // Armed and set. + callback.nextCall(Callback::CLEAR); + BOOST_CHECK(callback.isNotCalling()); // armed but not set + + pc.set(); + BOOST_CHECK(callback.isCalling()); // Armed and set. + callback.nextCall(Callback::DISARM_CLEAR); + BOOST_CHECK(callback.isNotCalling()); // not armed or set. + + poller->shutdown(); + runner.join(); +} + +QPID_AUTO_TEST_SUITE_END() + + diff --git a/qpid/cpp/src/tests/SimpleTestCaseBase.cpp b/qpid/cpp/src/tests/SimpleTestCaseBase.cpp deleted file mode 100644 index 2739734731..0000000000 --- a/qpid/cpp/src/tests/SimpleTestCaseBase.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "SimpleTestCaseBase.h" - -using namespace qpid; - -void SimpleTestCaseBase::start() -{ - if (worker.get()) { - worker->start(); - } -} - -void SimpleTestCaseBase::stop() -{ - if (worker.get()) { - worker->stop(); - } -} - -void SimpleTestCaseBase::report(client::Message& report) -{ - if (worker.get()) { - report.getHeaders().setInt("MESSAGE_COUNT", worker->getCount()); - //add number of messages sent or received - std::stringstream reportstr; - reportstr << worker->getCount(); - report.setData(reportstr.str()); - } -} - -SimpleTestCaseBase::Sender::Sender(ConnectionOptions& options, - const Exchange& _exchange, - const std::string& _key, - const int _messages) - : Worker(options, _messages), exchange(_exchange), key(_key) {} - -void SimpleTestCaseBase::Sender::init() -{ - channel.start(); -} - -void SimpleTestCaseBase::Sender::start(){ - Message msg; - while (count < messages) { - channel.publish(msg, exchange, key); - count++; - } - stop(); -} - -SimpleTestCaseBase::Worker::Worker(ConnectionOptions& options, const int _messages) : - messages(_messages), count(0) -{ - connection.open(options.host, options.port); - connection.openChannel(channel); -} - -void SimpleTestCaseBase::Worker::stop() -{ - channel.close(); - connection.close(); -} - -int SimpleTestCaseBase::Worker::getCount() -{ - return count; -} - diff --git a/qpid/cpp/src/tests/SimpleTestCaseBase.h b/qpid/cpp/src/tests/SimpleTestCaseBase.h deleted file mode 100644 index 0c1052d0c2..0000000000 --- a/qpid/cpp/src/tests/SimpleTestCaseBase.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _SimpleTestCaseBase_ -#define _SimpleTestCaseBase_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <memory> -#include <sstream> - -#include "qpid/Exception.h" -#include "qpid/client/Channel.h" -#include "qpid/client/Message.h" -#include "qpid/client/Connection.h" -#include "ConnectionOptions.h" -#include "qpid/client/MessageListener.h" -#include "TestCase.h" - - -namespace qpid { - -using namespace qpid::client; - -class SimpleTestCaseBase : public TestCase -{ -protected: - class Worker - { - protected: - client::Connection connection; - client::Channel channel; - const int messages; - int count; - - public: - - Worker(ConnectionOptions& options, const int messages); - virtual ~Worker(){} - - virtual void stop(); - virtual int getCount(); - virtual void init() = 0; - virtual void start() = 0; - }; - - class Sender : public Worker - { - const Exchange& exchange; - const std::string key; - public: - Sender(ConnectionOptions& options, - const Exchange& exchange, - const std::string& key, - const int messages); - void init(); - void start(); - }; - - std::auto_ptr<Worker> worker; - -public: - virtual void assign(const std::string& role, framing::FieldTable& params, ConnectionOptions& options) = 0; - - virtual ~SimpleTestCaseBase() {} - - void start(); - void stop(); - void report(client::Message& report); -}; - -} - -#endif diff --git a/qpid/cpp/src/tests/SocketProxy.h b/qpid/cpp/src/tests/SocketProxy.h index d2a93c902b..ccce3c8842 100644 --- a/qpid/cpp/src/tests/SocketProxy.h +++ b/qpid/cpp/src/tests/SocketProxy.h @@ -21,45 +21,58 @@ * */ +#include "qpid/sys/IOHandle.h" +#ifdef _WIN32 +# include "qpid/sys/windows/IoHandlePrivate.h" + typedef SOCKET FdType; +#else +# include "qpid/sys/posix/PrivatePosix.h" + typedef int FdType; +#endif #include "qpid/sys/Socket.h" -#include "qpid/sys/Poller.h" #include "qpid/sys/Runnable.h" #include "qpid/sys/Thread.h" #include "qpid/sys/Mutex.h" -#include "qpid/client/Connection.h" #include "qpid/log/Statement.h" -#include <algorithm> - /** * A simple socket proxy that forwards to another socket. * Used between client & local broker to simulate network failures. */ class SocketProxy : private qpid::sys::Runnable { + // Need a Socket we can get the fd from + class LowSocket : public qpid::sys::Socket { + public: + FdType getFd() { return toFd(impl); } + }; + public: /** Connect to connectPort on host, start a forwarding thread. * Listen for connection on getPort(). */ SocketProxy(int connectPort, const std::string host="localhost") - : closed(false), port(listener.listen()), dropClient(), dropServer() + : closed(false), joined(true), + port(listener.listen()), dropClient(), dropServer() { client.connect(host, connectPort); + joined = false; thread = qpid::sys::Thread(static_cast<qpid::sys::Runnable*>(this)); } - ~SocketProxy() { close(); } + ~SocketProxy() { close(); if (!joined) thread.join(); } /** Simulate a network disconnect. */ void close() { { qpid::sys::Mutex::ScopedLock l(lock); - if (closed) return; + if (closed) { return; } closed=true; } - poller.shutdown(); - if (thread.id() != qpid::sys::Thread::current().id()) - thread.join(); + if (thread.id() != qpid::sys::Thread::current().id()) { + thread.join(); + joined = true; + } client.close(); } @@ -85,56 +98,72 @@ class SocketProxy : private qpid::sys::Runnable } void run() { - std::auto_ptr<qpid::sys::Socket> server; + std::auto_ptr<LowSocket> server; try { - qpid::sys::PollerHandle listenerHandle(listener); - poller.addFd(listenerHandle, qpid::sys::Poller::INPUT); - qpid::sys::Poller::Event event = poller.wait(); - throwIf(event.type == qpid::sys::Poller::SHUTDOWN, "SocketProxy: Closed by close()"); - throwIf(!(event.type == qpid::sys::Poller::READABLE && event.handle == &listenerHandle), "SocketProxy: Accept failed"); - - poller.delFd(listenerHandle); - server.reset(listener.accept()); - - // Pump data between client & server sockets - qpid::sys::PollerHandle clientHandle(client); - qpid::sys::PollerHandle serverHandle(*server); - poller.addFd(clientHandle, qpid::sys::Poller::INPUT); - poller.addFd(serverHandle, qpid::sys::Poller::INPUT); + fd_set socks; + FdType maxFd = listener.getFd(); + struct timeval tmo; + for (;;) { + FD_ZERO(&socks); + FD_SET(maxFd, &socks); + tmo.tv_sec = 0; + tmo.tv_usec = 500 * 1000; + if (select(maxFd+1, &socks, 0, 0, &tmo) == 0) { + qpid::sys::Mutex::ScopedLock l(lock); + throwIf(closed, "SocketProxy: Closed by close()"); + continue; + } + throwIf(!FD_ISSET(maxFd, &socks), "SocketProxy: Accept failed"); + break; // Accept ready... go to next step + } + server.reset(reinterpret_cast<LowSocket *>(listener.accept())); + maxFd = server->getFd(); + if (client.getFd() > maxFd) + maxFd = client.getFd(); char buffer[1024]; for (;;) { - qpid::sys::Poller::Event event = poller.wait(); - throwIf(event.type == qpid::sys::Poller::SHUTDOWN, "SocketProxy: Closed by close()"); - throwIf(event.type == qpid::sys::Poller::DISCONNECTED, "SocketProxy: client/server disconnected"); - if (event.handle == &serverHandle) { + FD_ZERO(&socks); + tmo.tv_sec = 0; + tmo.tv_usec = 500 * 1000; + FD_SET(client.getFd(), &socks); + FD_SET(server->getFd(), &socks); + if (select(maxFd+1, &socks, 0, 0, &tmo) == 0) { + qpid::sys::Mutex::ScopedLock l(lock); + throwIf(closed, "SocketProxy: Closed by close()"); + continue; + } + // Something is set; relay data as needed until something closes + if (FD_ISSET(server->getFd(), &socks)) { ssize_t n = server->read(buffer, sizeof(buffer)); + throwIf(n <= 0, "SocketProxy: server disconnected"); if (!dropServer) client.write(buffer, n); - poller.rearmFd(serverHandle); - } else if (event.handle == &clientHandle) { + } + if (FD_ISSET(client.getFd(), &socks)) { ssize_t n = client.read(buffer, sizeof(buffer)); - if (!dropClient) server->write(buffer, n); - poller.rearmFd(clientHandle); - } else { - throwIf(true, "SocketProxy: No handle ready"); + throwIf(n <= 0, "SocketProxy: client disconnected"); + if (!dropServer) server->write(buffer, n); } + if (!FD_ISSET(client.getFd(), &socks) && + !FD_ISSET(server->getFd(), &socks)) + throwIf(true, "SocketProxy: No handle ready"); } } catch (const std::exception& e) { QPID_LOG(debug, "SocketProxy::run exception: " << e.what()); } try { - if (server.get()) server->close(); - close(); - } + if (server.get()) server->close(); + close(); + } catch (const std::exception& e) { QPID_LOG(debug, "SocketProxy::run exception in client/server close()" << e.what()); } } mutable qpid::sys::Mutex lock; - bool closed; - qpid::sys::Poller poller; - qpid::sys::Socket client, listener; + mutable bool closed; + bool joined; + LowSocket client, listener; uint16_t port; qpid::sys::Thread thread; bool dropClient, dropServer; diff --git a/qpid/cpp/src/tests/TestCase.h b/qpid/cpp/src/tests/TestCase.h deleted file mode 100644 index ba3330c951..0000000000 --- a/qpid/cpp/src/tests/TestCase.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef _TestCase_ -#define _TestCase_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "ConnectionOptions.h" -#include "qpid/client/Message.h" - - -namespace qpid { - -/** - * Interface to be implemented by test cases for use with the test - * runner. - */ -class TestCase -{ -public: - /** - * Directs the test case to act in a particular role. Some roles - * may be 'activated' at this stage others may require an explicit - * start request. - */ - virtual void assign(const std::string& role, framing::FieldTable& params, client::ConnectionOptions& options) = 0; - /** - * Each test will be started on its own thread, which should block - * until the test completes (this may or may not require an - * explicit stop() request). - */ - virtual void start() = 0; - /** - * Requests that the test be stopped if still running. - */ - virtual void stop() = 0; - /** - * Allows the test to fill in details on the final report - * message. Will be called only after start has returned. - */ - virtual void report(client::Message& report) = 0; - - virtual ~TestCase() {} -}; - -} - -#endif diff --git a/qpid/cpp/src/tests/XmlClientSessionTest.cpp b/qpid/cpp/src/tests/XmlClientSessionTest.cpp index 98558f0a76..aeb13c292f 100644 --- a/qpid/cpp/src/tests/XmlClientSessionTest.cpp +++ b/qpid/cpp/src/tests/XmlClientSessionTest.cpp @@ -26,7 +26,7 @@ #include "qpid/sys/Monitor.h" #include "qpid/sys/Thread.h" #include "qpid/sys/Runnable.h" -#include "qpid/framing/TransferContent.h" +#include "qpid/client/Message.h" #include "qpid/framing/reply_exceptions.h" #include "qpid/client/Connection.h" #include "qpid/client/SubscriptionManager.h" diff --git a/qpid/cpp/src/tests/client_test.cpp b/qpid/cpp/src/tests/client_test.cpp index 204c2c4b71..05b42f620c 100644 --- a/qpid/cpp/src/tests/client_test.cpp +++ b/qpid/cpp/src/tests/client_test.cpp @@ -32,8 +32,8 @@ #include "qpid/client/Connection.h" #include "qpid/client/Message.h" #include "qpid/client/Session.h" -#include "qpid/framing/FrameSet.h" -#include "qpid/framing/all_method_bodies.h" +#include "qpid/client/SubscriptionManager.h" + using namespace qpid; using namespace qpid::client; @@ -113,35 +113,18 @@ int main(int argc, char** argv) session.messageTransfer(arg::destination="MyExchange", arg::content=msgOut, arg::acceptMode=1); if (opts.verbose) print("Published message: ", msgOut); - //subscribe to the queue, add sufficient credit and then get - //incoming 'frameset', check that its a message transfer and - //then convert it to a message (see Dispatcher and - //SubscriptionManager utilties for common reusable patterns at - //a higher level) - session.messageSubscribe(arg::queue="MyQueue", arg::destination="MyId"); - session.messageFlow(arg::destination="MyId", arg::unit=0, arg::value=1); //credit for one message - session.messageFlow(arg::destination="MyId", arg::unit=1, arg::value=0xFFFFFFFF); //credit for infinite bytes - if (opts.verbose) std::cout << "Subscribed to queue." << std::endl; - FrameSet::shared_ptr incoming = session.get(); - if (incoming->isA<MessageTransferBody>()) { - Message msgIn(*incoming); - if (msgIn.getData() == msgOut.getData()) { - if (opts.verbose) std::cout << "Received the exepected message." << std::endl; - session.messageAccept(SequenceSet(msgIn.getId())); - session.markCompleted(msgIn.getId(), true, true); - } else { - print("Received an unexepected message: ", msgIn); - } - } else { - throw Exception("Unexpected command received"); - } - + // Using the SubscriptionManager, get the message from the queue. + SubscriptionManager subs(session); + Message msgIn = subs.get("MyQueue"); + if (msgIn.getData() == msgOut.getData()) + if (opts.verbose) std::cout << "Received the exepected message." << std::endl; + //close the session & connection session.close(); if (opts.verbose) std::cout << "Closed session." << std::endl; connection.close(); if (opts.verbose) std::cout << "Closed connection." << std::endl; - return 0; + return 0; } catch(const std::exception& e) { std::cout << e.what() << std::endl; } diff --git a/qpid/cpp/src/tests/client_test.vcproj b/qpid/cpp/src/tests/client_test.vcproj index 1623c2961e..32c90bce04 100644 --- a/qpid/cpp/src/tests/client_test.vcproj +++ b/qpid/cpp/src/tests/client_test.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="client_test"
- ProjectGUID="{9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="client_test"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/cluster.mk b/qpid/cpp/src/tests/cluster.mk index 5d115de5a5..e5e803003a 100644 --- a/qpid/cpp/src/tests/cluster.mk +++ b/qpid/cpp/src/tests/cluster.mk @@ -34,8 +34,10 @@ EXTRA_DIST+=ais_check start_cluster stop_cluster restart_cluster cluster_python_ federated_cluster_test clustered_replication_test check_PROGRAMS+=cluster_test -cluster_test_SOURCES=unit_test.cpp cluster_test.cpp ClusterFixture.cpp ClusterFixture.h ForkedBroker.h ForkedBroker.cpp -cluster_test_LDADD=$(lib_client) ../cluster.la -lboost_unit_test_framework +cluster_test_SOURCES=unit_test.cpp ClusterFixture.cpp ClusterFixture.h ForkedBroker.h ForkedBroker.cpp \ + cluster_test.cpp PartialFailure.cpp ClusterFailover.cpp + +cluster_test_LDADD=$(lib_client) ../cluster.la test_store.la -lboost_unit_test_framework unit_test_LDADD+=../cluster.la diff --git a/qpid/cpp/src/tests/cluster_test.cpp b/qpid/cpp/src/tests/cluster_test.cpp index eee2df58cc..d38d84025b 100644 --- a/qpid/cpp/src/tests/cluster_test.cpp +++ b/qpid/cpp/src/tests/cluster_test.cpp @@ -35,6 +35,7 @@ #include "qpid/framing/Uuid.h" #include "qpid/framing/reply_exceptions.h" #include "qpid/framing/enum.h" +#include "qpid/framing/MessageTransferBody.h" #include "qpid/log/Logger.h" #include "qpid/sys/Monitor.h" #include "qpid/sys/Thread.h" @@ -73,7 +74,7 @@ const sys::Duration TIMEOUT=sys::TIME_SEC/4; ostream& operator<<(ostream& o, const cpg_name* n) { - return o << cluster::Cpg::str(*n); + return o << Cpg::str(*n); } ostream& operator<<(ostream& o, const cpg_address& a) { @@ -89,29 +90,12 @@ ostream& operator<<(ostream& o, const pair<T*, int>& array) { return o; } -template <class C> set<uint16_t> makeSet(const C& c) { - set<uint16_t> s; +template <class C> set<int> makeSet(const C& c) { + set<int> s; copy(c.begin(), c.end(), inserter(s, s.begin())); return s; } -template <class T> set<uint16_t> knownBrokerPorts(T& source, int n=-1) { - vector<Url> urls = source.getKnownBrokers(); - if (n >= 0 && unsigned(n) != urls.size()) { - BOOST_MESSAGE("knownBrokerPorts waiting for " << n << ": " << urls); - // Retry up to 10 secs in .1 second intervals. - for (size_t retry=100; urls.size() != unsigned(n) && retry != 0; --retry) { - sys::usleep(1000*100); // 0.1 secs - urls = source.getKnownBrokers(); - } - } - BOOST_MESSAGE("knownBrokerPorts expecting " << n << ": " << urls); - set<uint16_t> s; - for (vector<Url>::const_iterator i = urls.begin(); i != urls.end(); ++i) - s.insert((*i)[0].get<TcpAddress>()->port); - return s; -} - class Sender { public: Sender(boost::shared_ptr<ConnectionImpl> ci, uint16_t ch) : connection(ci), channel(ch) {} @@ -175,7 +159,6 @@ ConnectionSettings aclSettings(int port, const std::string& id) { QPID_AUTO_TEST_CASE(testAcl) { ofstream policyFile("cluster_test.acl"); - // FIXME aconway 2009-02-12: guest -> qpidd? policyFile << "acl allow foo@QPID create queue name=foo" << endl << "acl allow foo@QPID create queue name=foo2" << endl << "acl deny foo@QPID create queue name=bar" << endl @@ -446,13 +429,13 @@ QPID_AUTO_TEST_CASE(testUpdateMessageBuilder) { QPID_AUTO_TEST_CASE(testConnectionKnownHosts) { ClusterFixture cluster(1); Client c0(cluster[0], "c0"); - set<uint16_t> kb0 = knownBrokerPorts(c0.connection); + set<int> kb0 = knownBrokerPorts(c0.connection); BOOST_CHECK_EQUAL(kb0.size(), 1u); BOOST_CHECK_EQUAL(kb0, makeSet(cluster)); cluster.add(); Client c1(cluster[1], "c1"); - set<uint16_t> kb1 = knownBrokerPorts(c1.connection); + set<int> kb1 = knownBrokerPorts(c1.connection); kb0 = knownBrokerPorts(c0.connection, 2); BOOST_CHECK_EQUAL(kb1.size(), 2u); BOOST_CHECK_EQUAL(kb1, makeSet(cluster)); @@ -460,7 +443,7 @@ QPID_AUTO_TEST_CASE(testConnectionKnownHosts) { cluster.add(); Client c2(cluster[2], "c2"); - set<uint16_t> kb2 = knownBrokerPorts(c2.connection); + set<int> kb2 = knownBrokerPorts(c2.connection); kb1 = knownBrokerPorts(c1.connection, 3); kb0 = knownBrokerPorts(c0.connection, 3); BOOST_CHECK_EQUAL(kb2.size(), 3u); diff --git a/qpid/cpp/src/tests/clustered_replication_test b/qpid/cpp/src/tests/clustered_replication_test index 2a3e742632..7afda87733 100755 --- a/qpid/cpp/src/tests/clustered_replication_test +++ b/qpid/cpp/src/tests/clustered_replication_test @@ -23,6 +23,7 @@ # failures: srcdir=`dirname $0` PYTHON_DIR=$srcdir/../../../python +export PYTHONPATH=$PYTHON_DIR trap stop_brokers INT EXIT diff --git a/qpid/cpp/src/tests/consume.vcproj b/qpid/cpp/src/tests/consume.vcproj index 2e1f8e3e56..1fb72e2fb3 100644 --- a/qpid/cpp/src/tests/consume.vcproj +++ b/qpid/cpp/src/tests/consume.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="consume"
- ProjectGUID="{7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="consume"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/declare_queues.cpp b/qpid/cpp/src/tests/declare_queues.cpp index 7f61bde12a..d17a72b940 100644 --- a/qpid/cpp/src/tests/declare_queues.cpp +++ b/qpid/cpp/src/tests/declare_queues.cpp @@ -33,14 +33,15 @@ using namespace std; int main(int argc, char ** argv) { ConnectionSettings settings; - if ( argc != 3 ) + if ( argc != 4 ) { - cerr << "Usage: declare_queues host port\n"; + cerr << "Usage: declare_queues host port durability\n"; return 1; } settings.host = argv[1]; settings.port = atoi(argv[2]); + int durability = atoi(argv[3]); FailoverManager connection(settings); try { @@ -48,7 +49,10 @@ int main(int argc, char ** argv) while (!complete) { Session session = connection.connect().newSession(); try { - session.queueDeclare(arg::queue="message_queue"); + if ( durability ) + session.queueDeclare(arg::queue="message_queue", arg::durable=true); + else + session.queueDeclare(arg::queue="message_queue"); complete = true; } catch (const qpid::TransportFailure&) {} } diff --git a/qpid/cpp/src/tests/echotest.vcproj b/qpid/cpp/src/tests/echotest.vcproj index 2848894228..d41a0df4e6 100644 --- a/qpid/cpp/src/tests/echotest.vcproj +++ b/qpid/cpp/src/tests/echotest.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="echotest"
- ProjectGUID="{0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="echotest"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/failover_soak.cpp b/qpid/cpp/src/tests/failover_soak.cpp index 4f16e469b8..c8f67aadd8 100644 --- a/qpid/cpp/src/tests/failover_soak.cpp +++ b/qpid/cpp/src/tests/failover_soak.cpp @@ -220,63 +220,13 @@ struct children : public vector<child *> cout << "\n\n\n\n"; } - - /* - Only call this if you already know there is at least - one child still running. Supply a time in seconds. - If it has been at least that long since a shild stopped - running, we judge the system to have hung. - */ - int - hanging ( int hangTime ) - { - struct timeval now, - duration; - gettimeofday ( &now, 0 ); - - int how_many_hanging = 0; - - vector<child *>::iterator i; - for ( i = begin(); i != end(); ++ i ) - { - //Not in POSIX - //timersub ( & now, &((*i)->startTime), & duration ); - duration.tv_sec = now.tv_sec - (*i)->startTime.tv_sec; - duration.tv_usec = now.tv_usec - (*i)->startTime.tv_usec; - if (duration.tv_usec < 0) { - --duration.tv_sec; - duration.tv_usec += 1000000; - } - - if ( (COMPLETED != (*i)->status) // child isn't done running - && - ( duration.tv_sec >= hangTime ) // it's been too long - ) - { - std::cerr << "Child of type " - << (*i)->type - << " hanging. " - << "PID is " - << (*i)->pid - << endl; - ++ how_many_hanging; - } - } - - return how_many_hanging; - } - - int verbosity; }; - children allMyChildren; - - void childExit ( int ) { @@ -361,36 +311,45 @@ wait_for_newbie ( ) } } - +bool endsWith(const char* str, const char* suffix) { + return (strlen(suffix) < strlen(str) && 0 == strcmp(str+strlen(str)-strlen(suffix), suffix)); +} void startNewBroker ( brokerVector & brokers, - char const * srcRoot, - char const * moduleDir, + char const * moduleOrDir, string const clusterName, - int verbosity ) + int verbosity, + int durable ) { static int brokerId = 0; - stringstream path, prefix, module; - module << moduleDir << "/cluster.so"; - path << srcRoot << "/qpidd"; + stringstream path, prefix; prefix << "soak-" << brokerId; std::vector<std::string> argv = list_of<string> ("qpidd") - ("--no-module-dir") - ("--load-module=cluster.so") - ("--cluster-name") - (clusterName) + ("--cluster-name")(clusterName) ("--auth=no") - ("--no-data-dir") ("--mgmt-enable=no") - ("--log-prefix") - (prefix.str()) - ("--log-to-file") - (prefix.str()+".log"); + ("--log-prefix")(prefix.str()) + ("--log-to-file")(prefix.str()+".log") + ("--log-enable=error+") + ("TMP_DATA_DIR"); + + if (endsWith(moduleOrDir, "cluster.so")) { + // Module path specified, load only that module. + argv.push_back(string("--load-module=")+moduleOrDir); + argv.push_back("--no-module-dir"); + if ( durable ) { + std::cerr << "failover_soak warning: durable arg hass no effect. Use \"dir\" option of \"moduleOrDir\".\n"; + } + } + else { + // Module directory specified, load all modules in dir. + argv.push_back(string("--module-dir=")+moduleOrDir); + } - newbie = new ForkedBroker ( argv ); + newbie = new ForkedBroker (argv); newbie_port = newbie->getPort(); ForkedBroker * broker = newbie; @@ -473,7 +432,8 @@ pid_t runDeclareQueuesClient ( brokerVector brokers, char const * host, char const * path, - int verbosity + int verbosity, + int durable ) { string name("declareQueues"); @@ -492,6 +452,10 @@ runDeclareQueuesClient ( brokerVector brokers, argv.push_back ( "declareQueues" ); argv.push_back ( host ); argv.push_back ( portSs.str().c_str() ); + if ( durable ) + argv.push_back ( "1" ); + else + argv.push_back ( "0" ); argv.push_back ( 0 ); pid_t pid = fork(); @@ -562,7 +526,8 @@ startSendingClient ( brokerVector brokers, char const * senderPath, char const * nMessages, char const * reportFrequency, - int verbosity + int verbosity, + int durability ) { string name("sender"); @@ -586,6 +551,10 @@ startSendingClient ( brokerVector brokers, argv.push_back ( nMessages ); argv.push_back ( reportFrequency ); argv.push_back ( verbosityStr ); + if ( durability ) + argv.push_back ( "1" ); + else + argv.push_back ( "0" ); argv.push_back ( 0 ); pid_t pid = fork(); @@ -613,27 +582,33 @@ startSendingClient ( brokerVector brokers, #define ERROR_KILLING_BROKER 8 +// If you want durability, use the "dir" option of "moduleOrDir" . + + int main ( int argc, char const ** argv ) { - if ( argc < 9 ) { - cerr << "Usage: failoverSoak srcRoot moduleDir host senderPath receiverPath nMessages verbosity\n"; - cerr << " ( argc was " << argc << " )\n"; + if ( argc != 9 ) { + cerr << "Usage: " + << argv[0] + << "moduleOrDir declareQueuesPath senderPath receiverPath nMessages reportFrequency verbosity durable" + << endl; + cerr << "\tverbosity is an integer, durable is 0 or 1\n"; return BAD_ARGS; } - signal ( SIGCHLD, childExit ); - char const * srcRoot = argv[1]; - char const * moduleDir = argv[2]; - char const * host = argv[3]; - char const * declareQueuesPath = argv[4]; - char const * senderPath = argv[5]; - char const * receiverPath = argv[6]; - char const * nMessages = argv[7]; - char const * reportFrequency = argv[8]; - int verbosity = atoi(argv[9]); - + int i = 1; + char const * moduleOrDir = argv[i++]; + char const * declareQueuesPath = argv[i++]; + char const * senderPath = argv[i++]; + char const * receiverPath = argv[i++]; + char const * nMessages = argv[i++]; + char const * reportFrequency = argv[i++]; + int verbosity = atoi(argv[i++]); + int durable = atoi(argv[i++]); + + char const * host = "127.0.0.1"; int maxBrokers = 50; allMyChildren.verbosity = verbosity; @@ -652,10 +627,10 @@ main ( int argc, char const ** argv ) int nBrokers = 3; for ( int i = 0; i < nBrokers; ++ i ) { startNewBroker ( brokers, - srcRoot, - moduleDir, + moduleOrDir, clusterName, - verbosity ); + verbosity, + durable ); } @@ -665,7 +640,7 @@ main ( int argc, char const ** argv ) // Run the declareQueues child. int childStatus; pid_t dqClientPid = - runDeclareQueuesClient ( brokers, host, declareQueuesPath, verbosity ); + runDeclareQueuesClient ( brokers, host, declareQueuesPath, verbosity, durable ); if ( -1 == dqClientPid ) { cerr << "END_OF_TEST ERROR_START_DECLARE_1\n"; return CANT_FORK_DQ; @@ -701,7 +676,8 @@ main ( int argc, char const ** argv ) senderPath, nMessages, reportFrequency, - verbosity ); + verbosity, + durable ); if ( -1 == sendingClientPid ) { cerr << "END_OF_TEST ERROR_START_SENDER\n"; return CANT_FORK_SENDER; @@ -745,10 +721,10 @@ main ( int argc, char const ** argv ) cout << "Starting new broker.\n\n"; startNewBroker ( brokers, - srcRoot, - moduleDir, + moduleOrDir, clusterName, - verbosity ); + verbosity, + durable ); if ( verbosity > 1 ) printBrokers ( brokers ); @@ -787,16 +763,6 @@ main ( int argc, char const ** argv ) return ERROR_ON_CHILD; } - // If one is hanging, quit. - if ( allMyChildren.hanging ( 120 ) ) - { - /* - * Don't kill any processes. Leave alive for questioning. - * */ - std::cerr << "END_OF_TEST ERROR_HANGING\n"; - return HANGING; - } - if ( verbosity > 1 ) { std::cerr << "------- next kill-broker loop --------\n"; allMyChildren.print(); diff --git a/qpid/cpp/src/tests/header_test.vcproj b/qpid/cpp/src/tests/header_test.vcproj index da761a6edb..cdfc984f46 100644 --- a/qpid/cpp/src/tests/header_test.vcproj +++ b/qpid/cpp/src/tests/header_test.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="header_test"
- ProjectGUID="{1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{1B23F05D-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="header_test"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/interop_runner.cpp b/qpid/cpp/src/tests/interop_runner.cpp deleted file mode 100644 index 8c6e0a6991..0000000000 --- a/qpid/cpp/src/tests/interop_runner.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/Options.h" -#include "qpid/ptr_map.h" -#include "qpid/Exception.h" -#include "qpid/client/Channel.h" -#include "qpid/client/Connection.h" -#include "qpid/client/ConnectionOptions.h" -#include "qpid/client/Exchange.h" -#include "qpid/client/MessageListener.h" -#include "qpid/client/Queue.h" -#include "qpid/sys/Thread.h" -#include "qpid/sys/Time.h" -#include <iostream> -#include <memory> -#include "BasicP2PTest.h" -#include "BasicPubSubTest.h" -#include "TestCase.h" -#include <boost/ptr_container/ptr_map.hpp> - -/** - * Framework for interop tests. - * - * [see http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification for details]. - */ - -using namespace qpid::client; -using namespace qpid::sys; -using qpid::TestCase; -using qpid::framing::FieldTable; -using qpid::framing::ReplyTo; -using namespace std; - -class DummyRun : public TestCase -{ -public: - DummyRun() {} - void assign(const string&, FieldTable&, ConnectionOptions&) {} - void start() {} - void stop() {} - void report(qpid::client::Message&) {} -}; - -string parse_next_word(const string& input, const string& delims, string::size_type& position); - -/** - */ -class Listener : public MessageListener, private Runnable{ - typedef boost::ptr_map<string, TestCase> TestMap; - - Channel& channel; - ConnectionOptions& options; - TestMap tests; - const string name; - const string topic; - TestCase* test; - auto_ptr<Thread> runner; - ReplyTo reportTo; - string reportCorrelator; - - void shutdown(); - bool invite(const string& name); - void run(); - - void sendResponse(Message& response, ReplyTo replyTo); - void sendResponse(Message& response, Message& request); - void sendSimpleResponse(const string& type, Message& request); - void sendReport(); -public: - Listener(Channel& channel, ConnectionOptions& options); - void received(Message& msg); - void bindAndConsume(); - void registerTest(string name, TestCase* test); -}; - -struct TestSettings : ConnectionOptions -{ - bool help; - - TestSettings() : help(false) - { - addOptions() - ("help", qpid::optValue(help), "print this usage statement"); - } -}; - -int main(int argc, char** argv) { - try { - TestSettings options; - options.parse(argc, argv); - if (options.help) { - cout << options; - } else { - Connection connection; - connection.open(options.host, options.port, "guest", "guest", options.virtualhost); - - Channel channel; - connection.openChannel(channel); - - Listener listener(channel, options); - listener.registerTest("TC1_DummyRun", new DummyRun()); - listener.registerTest("TC2_BasicP2P", new qpid::BasicP2PTest()); - listener.registerTest("TC3_BasicPubSub", new qpid::BasicPubSubTest()); - - listener.bindAndConsume(); - - channel.run(); - connection.close(); - } - } catch(const exception& error) { - cout << error.what() << endl << "Type " << argv[0] << " --help for help" << endl; - } -} - -Listener::Listener(Channel& _channel, ConnectionOptions& _options) : channel(_channel), options(_options), name(options.clientid), topic("iop.control." + name) -{} - -void Listener::registerTest(string name, TestCase* test) -{ - tests.insert(name, test); -} - -void Listener::bindAndConsume() -{ - Queue control(name, true); - channel.declareQueue(control); - qpid::framing::FieldTable bindArgs; - //replace these separate binds with a wildcard once that is supported on java broker - channel.bind(Exchange::STANDARD_TOPIC_EXCHANGE, control, "iop.control", bindArgs); - channel.bind(Exchange::STANDARD_TOPIC_EXCHANGE, control, topic, bindArgs); - - string tag; - channel.consume(control, tag, this); -} - -void Listener::sendSimpleResponse(const string& type, Message& request) -{ - Message response; - response.getHeaders().setString("CONTROL_TYPE", type); - response.getHeaders().setString("CLIENT_NAME", name); - response.getHeaders().setString("CLIENT_PRIVATE_CONTROL_KEY", topic); - response.getMessageProperties().setCorrelationId(request.getMessageProperties().getCorrelationId()); - sendResponse(response, request); -} - -void Listener::sendResponse(Message& response, Message& request) -{ - sendResponse(response, request.getMessageProperties().getReplyTo()); -} - -void Listener::sendResponse(Message& response, ReplyTo replyTo) -{ - string exchange = replyTo.getExchange(); - string routingKey = replyTo.getRoutingKey(); - channel.publish(response, exchange, routingKey); -} - -void Listener::received(Message& message) -{ - string type(message.getHeaders().getString("CONTROL_TYPE")); - - if (type == "INVITE") { - string name(message.getHeaders().getString("TEST_NAME")); - if (name.empty() || invite(name)) { - sendSimpleResponse("ENLIST", message); - } else { - cout << "Can't take part in '" << name << "'" << endl; - } - } else if (type == "ASSIGN_ROLE") { - test->assign(message.getHeaders().getString("ROLE"), message.getHeaders(), options); - sendSimpleResponse("ACCEPT_ROLE", message); - } else if (type == "START") { - reportTo = message.getMessageProperties().getReplyTo(); - reportCorrelator = message.getMessageProperties().getCorrelationId(); - runner = auto_ptr<Thread>(new Thread(this)); - } else if (type == "STATUS_REQUEST") { - reportTo = message.getMessageProperties().getReplyTo(); - reportCorrelator = message.getMessageProperties().getCorrelationId(); - test->stop(); - sendReport(); - } else if (type == "TERMINATE") { - if (test) test->stop(); - shutdown(); - } else { - cerr <<"ERROR!: Received unknown control message: " << type << endl; - shutdown(); - } -} - -void Listener::shutdown() -{ - channel.close(); -} - -bool Listener::invite(const string& name) -{ - TestMap::iterator i = tests.find(name); - test = (i != tests.end()) ? qpid::ptr_map_ptr(i) : 0; - return test; -} - -void Listener::run() -{ - //NB: this method will be called in its own thread - //start test and when start returns... - test->start(); - sendReport(); -} - -void Listener::sendReport() -{ - Message report; - report.getHeaders().setString("CONTROL_TYPE", "REPORT"); - test->report(report); - report.getMessageProperties().setCorrelationId(reportCorrelator); - sendResponse(report, reportTo); -} - -string parse_next_word(const string& input, const string& delims, string::size_type& position) -{ - string::size_type start = input.find_first_not_of(delims, position); - if (start == string::npos) { - return ""; - } else { - string::size_type end = input.find_first_of(delims, start); - if (end == string::npos) { - end = input.length(); - } - position = end; - return input.substr(start, end - start); - } -} diff --git a/qpid/cpp/src/tests/latencytest.vcproj b/qpid/cpp/src/tests/latencytest.vcproj index 758302029a..da48e682bf 100644 --- a/qpid/cpp/src/tests/latencytest.vcproj +++ b/qpid/cpp/src/tests/latencytest.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="latencytest"
- ProjectGUID="{4A809018-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{4A809018-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="latencytest"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/perftest.vcproj b/qpid/cpp/src/tests/perftest.vcproj index 3a2397ac9b..83cd550df5 100644 --- a/qpid/cpp/src/tests/perftest.vcproj +++ b/qpid/cpp/src/tests/perftest.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="perftest"
- ProjectGUID="{1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{1F2066BE-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="perftest"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/publish.vcproj b/qpid/cpp/src/tests/publish.vcproj index 7422606a32..849b845025 100644 --- a/qpid/cpp/src/tests/publish.vcproj +++ b/qpid/cpp/src/tests/publish.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="publish"
- ProjectGUID="{AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{AE773E7F-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="publish"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/receiver.vcproj b/qpid/cpp/src/tests/receiver.vcproj index ce6fad366e..8744ac3234 100644 --- a/qpid/cpp/src/tests/receiver.vcproj +++ b/qpid/cpp/src/tests/receiver.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="receiver"
- ProjectGUID="{7D314A98-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{7D314A98-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="receiver"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/replaying_sender.cpp b/qpid/cpp/src/tests/replaying_sender.cpp index ea2a13bd54..3ee69eec14 100644 --- a/qpid/cpp/src/tests/replaying_sender.cpp +++ b/qpid/cpp/src/tests/replaying_sender.cpp @@ -40,9 +40,10 @@ class Sender : public FailoverManager::Command public: Sender(const std::string& queue, uint count, uint reportFreq); void execute(AsyncSession& session, bool isRetry); - uint getSent(); + uint getSent(); - int verbosity; + void setVerbosity ( int v ) { verbosity = v; } + void setPersistence ( int p ) { persistence = p; } private: MessageReplayTracker sender; @@ -51,9 +52,11 @@ class Sender : public FailoverManager::Command const uint reportFrequency; Message message; + int verbosity; + int persistence; }; -Sender::Sender(const std::string& queue, uint count_, uint reportFreq ) : sender(10), count(count_), sent(0), reportFrequency(reportFreq) +Sender::Sender(const std::string& queue, uint count_, uint reportFreq ) : sender(10), count(count_), sent(0), reportFrequency(reportFreq), verbosity(0), persistence(0) { message.getDeliveryProperties().setRoutingKey(queue); } @@ -69,6 +72,9 @@ void Sender::execute(AsyncSession& session, bool isRetry) message_data << ++sent; message.setData(message_data.str()); message.getHeaders().setInt("sn", sent); + if ( persistence ) + message.getDeliveryProperties().setDeliveryMode(PERSISTENT); + sender.send(message); if (count > reportFrequency && !(sent % reportFrequency)) { if ( verbosity > 0 ) @@ -91,9 +97,9 @@ int main(int argc, char ** argv) { ConnectionSettings settings; - if ( argc != 6 ) + if ( argc != 7 ) { - std::cerr << "Usage: replaying_sender host port n_messages report_frequency verbosity\n"; + std::cerr << "Usage: replaying_sender host port n_messages report_frequency verbosity persistence\n"; return 1; } @@ -102,10 +108,12 @@ int main(int argc, char ** argv) int n_messages = atoi(argv[3]); int reportFrequency = atoi(argv[4]); int verbosity = atoi(argv[5]); + int persistence = atoi(argv[6]); FailoverManager connection(settings); Sender sender("message_queue", n_messages, reportFrequency ); - sender.verbosity = verbosity; + sender.setVerbosity ( verbosity ); + sender.setPersistence ( persistence ); try { connection.execute ( sender ); if ( verbosity > 0 ) diff --git a/qpid/cpp/src/tests/run_failover_soak b/qpid/cpp/src/tests/run_failover_soak index 36dfed79a6..3c9a5589c4 100755 --- a/qpid/cpp/src/tests/run_failover_soak +++ b/qpid/cpp/src/tests/run_failover_soak @@ -45,12 +45,12 @@ fi host=127.0.0.1 -src_root=.. -module_dir=$src_root/.libs - +MODULES=${MODULES:-../.libs} MESSAGES=${MESSAGES:-300000} REPORT_FREQUENCY=${REPORT_FREQUENCY:-`expr $MESSAGES / 20`} VERBOSITY=${VERBOSITY:-1} +DURABILITY=${DURABILITY:-1} -exec ./failover_soak $src_root $module_dir $host ./declare_queues ./replaying_sender ./resuming_receiver $MESSAGES $REPORT_FREQUENCY $VERBOSITY +rm -f soak-*.log +exec ./failover_soak $MODULES ./declare_queues ./replaying_sender ./resuming_receiver $MESSAGES $REPORT_FREQUENCY $VERBOSITY $DURABILITY diff --git a/qpid/cpp/src/tests/sender.vcproj b/qpid/cpp/src/tests/sender.vcproj index 616b665406..fe564cb3c6 100644 --- a/qpid/cpp/src/tests/sender.vcproj +++ b/qpid/cpp/src/tests/sender.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="sender"
- ProjectGUID="{09714CB8-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{09714CB8-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="sender"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/shlibtest.vcproj b/qpid/cpp/src/tests/shlibtest.vcproj index 4a139a2cb5..2052230740 100644 --- a/qpid/cpp/src/tests/shlibtest.vcproj +++ b/qpid/cpp/src/tests/shlibtest.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="shlibtest"
- ProjectGUID="{37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{37AB26B9-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="shlibtest"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/start_cluster b/qpid/cpp/src/tests/start_cluster index 053b23da33..585ba082d5 100755 --- a/qpid/cpp/src/tests/start_cluster +++ b/qpid/cpp/src/tests/start_cluster @@ -28,15 +28,17 @@ with_ais_group() { echo $* | newgrp ais } -rm -f cluster*.log -SIZE=${1:-1}; shift +rm -f cluster*.log cluster.ports qpidd.port + +SIZE=${1:-3}; shift CLUSTER=`pwd` # Cluster name=pwd, avoid clashes. -OPTS="-d --no-module-dir --load-module ../.libs/cluster.so --cluster-name=$CLUSTER --no-data-dir --auth=no $@" +OPTS="-d --no-module-dir --load-module ../.libs/cluster.so --cluster-name=$CLUSTER --auth=no $@" for (( i=0; i<SIZE; ++i )); do - PORT=`with_ais_group ../qpidd -p0 --log-to-file=cluster$i.log $OPTS` || exit 1 + DDIR=`mktemp -d /tmp/start_cluster.XXXXXXXXXX` + PORT=`with_ais_group ../qpidd -p0 --log-to-file=cluster$i.log $OPTS --data-dir=$DDIR` || exit 1 echo $PORT >> cluster.ports done -head cluster.ports > qpidd.port # First member's port for tests. +head -n 1 cluster.ports > qpidd.port # First member's port for tests. diff --git a/qpid/cpp/src/tests/test_store.cpp b/qpid/cpp/src/tests/test_store.cpp new file mode 100644 index 0000000000..e5c3522852 --- /dev/null +++ b/qpid/cpp/src/tests/test_store.cpp @@ -0,0 +1,147 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + + +/**@file + * Plug-in message store for tests. + * + * Add functionality as required, build up a comprehensive set of + * features to support persistent behavior tests. + * + * Current features special "action" messages can: + * - raise exception from enqueue. + * - force host process to exit. + * - do async completion after a delay. + */ + +#include "qpid/broker/NullMessageStore.h" +#include "qpid/broker/Broker.h" +#include "qpid/log/Statement.h" +#include "qpid/Plugin.h" +#include "qpid/Options.h" +#include <boost/algorithm/string.hpp> +#include <boost/cast.hpp> +#include <boost/lexical_cast.hpp> + +using namespace qpid; +using namespace broker; +using namespace std; +using namespace boost; +using namespace qpid::sys; + +struct TestStoreOptions : public Options { + + string name; + + TestStoreOptions() : Options("Test Store Options") { + addOptions() + ("test-store-name", optValue(name, "NAME"), "Name to identify test store instance."); + } +}; + +struct Completer : public Runnable { + intrusive_ptr<PersistableMessage> message; + int usecs; + Completer(intrusive_ptr<PersistableMessage> m, int u) : message(m), usecs(u) {} + void run() { + qpid::sys::usleep(usecs); + message->enqueueComplete(); + delete this; + } +}; + +class TestStore : public NullMessageStore { + public: + TestStore(const string& name_, Broker& broker_) : name(name_), broker(broker_) {} + + ~TestStore() { + for_each(threads.begin(), threads.end(), boost::bind(&Thread::join, _1)); + } + + void enqueue(TransactionContext* , + const boost::intrusive_ptr<PersistableMessage>& msg, + const PersistableQueue& ) + { + string data = polymorphic_downcast<Message*>(msg.get())->getFrames().getContent(); + + // Check the message for special instructions. + size_t i = string::npos; + size_t j = string::npos; + if (starts_with(data, TEST_STORE_DO) + && (i = data.find(name+"[")) != string::npos + && (j = data.find("]", i)) != string::npos) + { + size_t start = i+name.size()+1; + string action = data.substr(start, j-start); + + if (action == EXCEPTION) { + throw Exception(QPID_MSG("TestStore " << name << " throwing exception for: " << data)); + } + else if (action == EXIT_PROCESS) { + // FIXME aconway 2009-04-10: this is a dubious way to + // close the process at best, it can cause assertions or seg faults + // rather than clean exit. + QPID_LOG(critical, "TestStore " << name << " forcing process exit for: " << data); + exit(0); + } + else if (starts_with(action, ASYNC)) { + std::string delayStr(action.substr(ASYNC.size())); + int delay = lexical_cast<int>(delayStr); + threads.push_back(Thread(*new Completer(msg, delay))); + } + else { + QPID_LOG(error, "TestStore " << name << " unknown action " << action); + msg->enqueueComplete(); + } + } + else + msg->enqueueComplete(); + } + + private: + static const string TEST_STORE_DO, EXCEPTION, EXIT_PROCESS, ASYNC; + string name; + Broker& broker; + vector<Thread> threads; +}; + +const string TestStore::TEST_STORE_DO = "TEST_STORE_DO: "; +const string TestStore::EXCEPTION = "exception"; +const string TestStore::EXIT_PROCESS = "exit_process"; +const string TestStore::ASYNC="async "; + +struct TestStorePlugin : public Plugin { + + TestStoreOptions options; + + Options* getOptions() { return &options; } + + void earlyInitialize (Plugin::Target& target) + { + Broker* broker = dynamic_cast<Broker*>(&target); + if (!broker) return; + broker->setStore (new TestStore(options.name, *broker)); + } + + void initialize(qpid::Plugin::Target&) {} +}; + +static TestStorePlugin pluginInstance; diff --git a/qpid/cpp/src/tests/tests.sln b/qpid/cpp/src/tests/tests.sln index 273e90d1c8..9e24487820 100644 --- a/qpid/cpp/src/tests/tests.sln +++ b/qpid/cpp/src/tests/tests.sln @@ -8,37 +8,37 @@ Microsoft Visual Studio Solution File, Format Version 10.00 #
# MPC Command:
# C:\ace\MPC\mwc.pl -type vc9 -features boost=1 tests.mwc
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_test", "client_test.vcproj", "{9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_test", "client_test.vcproj", "{9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "consume", "consume.vcproj", "{7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "consume", "consume.vcproj", "{7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echotest", "echotest.vcproj", "{0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echotest", "echotest.vcproj", "{0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "header_test", "header_test.vcproj", "{1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "header_test", "header_test.vcproj", "{1B23F05D-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "latencytest", "latencytest.vcproj", "{4A809018-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "latencytest", "latencytest.vcproj", "{4A809018-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perftest", "perftest.vcproj", "{1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perftest", "perftest.vcproj", "{1F2066BE-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "publish", "publish.vcproj", "{AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "publish", "publish.vcproj", "{AE773E7F-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "receiver", "receiver.vcproj", "{7D314A98-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "receiver", "receiver.vcproj", "{7D314A98-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sender", "sender.vcproj", "{09714CB8-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sender", "sender.vcproj", "{09714CB8-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shlibtest", "shlibtest.vcproj", "{37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shlibtest", "shlibtest.vcproj", "{37AB26B9-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "topic_listener", "topic_listener.vcproj", "{9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "topic_listener", "topic_listener.vcproj", "{9392D1EE-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "topic_publisher", "topic_publisher.vcproj", "{7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "topic_publisher", "topic_publisher.vcproj", "{7D66FE10-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txjob", "txjob.vcproj", "{09034A53-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txjob", "txjob.vcproj", "{09034A53-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txshift", "txshift.vcproj", "{6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txshift", "txshift.vcproj", "{6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txtest", "txtest.vcproj", "{697786BE-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "txtest", "txtest.vcproj", "{697786BE-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit_test", "unit_test.vcproj", "{51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit_test", "unit_test.vcproj", "{51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,134 +48,134 @@ Global Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {9A95F0E4-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {7F5DE0A1-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {0A5AF6BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {1B23F05D-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {4A809018-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {1F2066BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {AE773E7F-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {7D314A98-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {09714CB8-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {37AB26B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {09034A53-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {697786BE-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.ActiveCfg = Debug|Win32
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|Win32.Build.0 = Debug|Win32
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.ActiveCfg = Debug|x64
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Debug|x64.Build.0 = Debug|x64
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.ActiveCfg = Release|Win32
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|Win32.Build.0 = Release|Win32
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.ActiveCfg = Release|x64
- {51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}.Release|x64.Build.0 = Release|x64
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {9A95F0E4-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {7F5DE0A1-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {0A5AF6BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {1B23F05D-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {4A809018-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {1F2066BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {AE773E7F-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {7D314A98-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {09714CB8-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {37AB26B9-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {9392D1EE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {7D66FE10-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {09034A53-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {697786BE-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|Win32.Build.0 = Debug|Win32
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.ActiveCfg = Debug|x64
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Debug|x64.Build.0 = Debug|x64
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.ActiveCfg = Release|Win32
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Release|Win32.Build.0 = Release|Win32
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.ActiveCfg = Release|x64
+ {51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/qpid/cpp/src/tests/topic_listener.vcproj b/qpid/cpp/src/tests/topic_listener.vcproj index 0be31b8348..3f338bfb62 100644 --- a/qpid/cpp/src/tests/topic_listener.vcproj +++ b/qpid/cpp/src/tests/topic_listener.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="topic_listener"
- ProjectGUID="{9392D1EE-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{9392D1EE-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="topic_listener"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/topic_publisher.vcproj b/qpid/cpp/src/tests/topic_publisher.vcproj index 016c6d4a38..5b0fd21ef4 100644 --- a/qpid/cpp/src/tests/topic_publisher.vcproj +++ b/qpid/cpp/src/tests/topic_publisher.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="topic_publisher"
- ProjectGUID="{7D66FE10-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{7D66FE10-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="topic_publisher"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/txjob.vcproj b/qpid/cpp/src/tests/txjob.vcproj index 19fe3fba12..e002d58ae9 100644 --- a/qpid/cpp/src/tests/txjob.vcproj +++ b/qpid/cpp/src/tests/txjob.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="txjob"
- ProjectGUID="{09034A53-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{09034A53-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="txjob"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/txshift.vcproj b/qpid/cpp/src/tests/txshift.vcproj index 3212881351..75ccfc6d4f 100644 --- a/qpid/cpp/src/tests/txshift.vcproj +++ b/qpid/cpp/src/tests/txshift.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="txshift"
- ProjectGUID="{6E3B2A6B-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{6E3B2A6B-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="txshift"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/txtest.vcproj b/qpid/cpp/src/tests/txtest.vcproj index 663291a9d5..3549ba97aa 100644 --- a/qpid/cpp/src/tests/txtest.vcproj +++ b/qpid/cpp/src/tests/txtest.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="txtest"
- ProjectGUID="{697786BE-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{697786BE-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="txtest"
Keyword="Win32Proj"
SignManifests="true"
diff --git a/qpid/cpp/src/tests/unit_test.vcproj b/qpid/cpp/src/tests/unit_test.vcproj index 8710b617f8..9653290013 100644 --- a/qpid/cpp/src/tests/unit_test.vcproj +++ b/qpid/cpp/src/tests/unit_test.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="9.00"
Name="unit_test"
- ProjectGUID="{51E5F6B9-FECA-1BAD-2431-8A11DB0D67CE}"
+ ProjectGUID="{51E5F6B9-FECA-1BAD-2431-8A11CDC7409E}"
RootNamespace="unit_test"
Keyword="Win32Proj"
SignManifests="true"
@@ -76,7 +76,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="qpidcommond.lib qpidclientd.lib qpidbrokerd.lib qmfconsoled.lib"
+ AdditionalDependencies="qpidcommond.lib qpidclientd.lib qpidbrokerd.lib qmfconsoled.lib ws2_32.lib"
OutputFile="$(OutDir)\unit_test.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
@@ -155,7 +155,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="qpidcommon.lib qpidclient.lib qpidbroker.lib qmfconsole.lib"
+ AdditionalDependencies="qpidcommon.lib qpidclient.lib qpidbroker.lib qmfconsole.lib ws2_32.lib"
OutputFile="$(OutDir)\unit_test.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
@@ -240,7 +240,7 @@ <Tool
Name="VCLinkerTool"
AdditionalOptions="/machine:AMD64"
- AdditionalDependencies="qpidcommond.lib qpidclientd.lib qpidbrokerd.lib qmfconsoled.lib"
+ AdditionalDependencies="qpidcommond.lib qpidclientd.lib qpidbrokerd.lib qmfconsoled.lib ws2_32.lib"
OutputFile="$(OutDir)\unit_test.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
@@ -320,7 +320,7 @@ <Tool
Name="VCLinkerTool"
AdditionalOptions="/machine:AMD64"
- AdditionalDependencies="qpidcommon.lib qpidclient.lib qpidbroker.lib qmfconsole.lib"
+ AdditionalDependencies="qpidcommon.lib qpidclient.lib qpidbroker.lib qmfconsole.lib ws2_32.lib"
OutputFile="$(OutDir)\unit_test.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
|