You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/11/28 18:13:31 UTC
svn commit: r599067 - in /incubator/qpid/trunk/qpid/cpp/src: ./ qpid/
qpid/broker/ tests/
Author: aconway
Date: Wed Nov 28 09:13:28 2007
New Revision: 599067
URL: http://svn.apache.org/viewvc?rev=599067&view=rev
Log:
Fixed to build with boost 1.34 as well as boost 1.33
- boost::ptr_map API changed.
- Boost.Test unit test framework changes.
Added:
incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h (with props)
incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h (with props)
Modified:
incubator/qpid/trunk/qpid/cpp/src/Makefile.am
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.h
incubator/qpid/trunk/qpid/cpp/src/tests/Array.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Cluster.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Cpg.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/InlineVector.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/RefCountedMap.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Serializer.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Url.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/cluster_client.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/interop_runner.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/logging.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/Makefile.am?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/Makefile.am Wed Nov 28 09:13:28 2007
@@ -236,6 +236,7 @@
qpid/Msg.h \
qpid/Options.h \
qpid/Plugin.h \
+ qpid/ptr_map.h \
qpid/RefCounted.h \
qpid/SharedObject.h \
qpid/Url.h \
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp Wed Nov 28 09:13:28 2007
@@ -18,24 +18,26 @@
* under the License.
*
*/
-#include "qpid/log/Statement.h"
-#include <iostream>
-#include <assert.h>
-
#include "Connection.h"
#include "SessionState.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
#include "BrokerAdapter.h"
#include "SemanticHandler.h"
+#include "qpid/log/Statement.h"
+#include "qpid/ptr_map.h"
+#include "qpid/framing/AMQP_ClientProxy.h"
+
#include <boost/bind.hpp>
#include <algorithm>
+#include <iostream>
+#include <assert.h>
using namespace boost;
using namespace qpid::sys;
using namespace qpid::framing;
using namespace qpid::sys;
+using namespace qpid::ptr_map;
namespace qpid {
namespace broker {
@@ -77,9 +79,8 @@
void Connection::closed(){ // Physically closed, suspend open sessions.
try {
- std::for_each(
- channels.begin(), channels.end(),
- boost::bind(&SessionHandler::localSuspend, _1));
+ for (ChannelMap::iterator i = channels.begin(); i != channels.end(); ++i)
+ get_pointer(i)->localSuspend();
while (!exclusiveQueues.empty()) {
Queue::shared_ptr q(exclusiveQueues.front());
q->releaseExclusiveOwnership();
@@ -105,7 +106,7 @@
if (i == channels.end()) {
i = channels.insert(id, new SessionHandler(*this, id)).first;
}
- return *i;
+ return *get_pointer(i);
}
}}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp Wed Nov 28 09:13:28 2007
@@ -22,10 +22,13 @@
#include "DtxTimeout.h"
#include "qpid/framing/reply_exceptions.h"
#include "qpid/log/Statement.h"
+#include "qpid/ptr_map.h"
+
#include <boost/format.hpp>
#include <iostream>
-using qpid::sys::Mutex;
+using qpid::sys::Mutex;
+using namespace qpid::ptr_map;
using namespace qpid::broker;
using namespace qpid::framing;
@@ -81,14 +84,14 @@
}
}
-DtxManager::WorkMap::iterator DtxManager::getWork(const std::string& xid)
+DtxWorkRecord* DtxManager::getWork(const std::string& xid)
{
Mutex::ScopedLock locker(lock);
WorkMap::iterator i = work.find(xid);
if (i == work.end()) {
throw InvalidArgumentException(QPID_MSG("Unrecognised xid " << xid));
}
- return i;
+ return get_pointer(i);
}
void DtxManager::remove(const std::string& xid)
@@ -102,20 +105,20 @@
}
}
-DtxManager::WorkMap::iterator DtxManager::createWork(std::string xid)
+DtxWorkRecord* DtxManager::createWork(std::string xid)
{
Mutex::ScopedLock locker(lock);
WorkMap::iterator i = work.find(xid);
if (i != work.end()) {
throw CommandInvalidException(QPID_MSG("Xid " << xid << " is already known (use 'join' to add work to an existing xid)"));
} else {
- return work.insert(xid, new DtxWorkRecord(xid, store)).first;
+ return get_pointer(work.insert(xid, new DtxWorkRecord(xid, store)).first);
}
}
void DtxManager::setTimeout(const std::string& xid, uint32_t secs)
{
- WorkMap::iterator record = getWork(xid);
+ DtxWorkRecord* record = getWork(xid);
DtxTimeout::shared_ptr timeout = record->getTimeout();
if (timeout.get()) {
if (timeout->timeout == secs) return;//no need to do anything further if timeout hasn't changed
@@ -140,7 +143,7 @@
if (i == work.end()) {
QPID_LOG(warning, "Transaction timeout failed: no record for xid");
} else {
- i->timedout();
+ get_pointer(i)->timedout();
//TODO: do we want to have a timed task to cleanup, or can we rely on an explicit completion?
//timer.add(TimerTask::shared_ptr(new DtxCleanup(60*30/*30 mins*/, *this, xid)));
}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.h?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.h Wed Nov 28 09:13:28 2007
@@ -35,7 +35,6 @@
class DtxManager{
typedef boost::ptr_map<std::string, DtxWorkRecord> WorkMap;
-
struct DtxCleanup : public TimerTask
{
DtxManager& mgr;
@@ -51,8 +50,8 @@
Timer timer;
void remove(const std::string& xid);
- WorkMap::iterator getWork(const std::string& xid);
- WorkMap::iterator createWork(std::string xid);
+ DtxWorkRecord* getWork(const std::string& xid);
+ DtxWorkRecord* createWork(std::string xid);
public:
DtxManager(TransactionalStore* const store);
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h?rev=599067&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h Wed Nov 28 09:13:28 2007
@@ -0,0 +1,116 @@
+#ifndef QPID_PTR_MAP
+#define QPID_PTR_MAP
+
+/*
+ *
+ * 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 <boost/ptr_container/ptr_map.hpp>
+#include <boost/version.hpp>
+
+namespace qpid {
+namespace ptr_map {
+
+/** @file
+ * Workaround for API change between boost 1.33 and 1.34.
+ *
+ * To be portable across these versions, code using boost::ptr_map
+ * iterators should use get_pointer(i) to get the pointer from
+ * a boost::ptr_map iterator.
+ *
+ * Can be removed when we no longer support platforms on 1.33.
+ *
+ * @see http://www.boost.org/libs/ptr_container/doc/ptr_container.html#upgrading-from-boost-v-1-33
+ */
+#if (BOOST_VERSION < 103400)
+
+template <class PtrMapIter>
+typename PtrMapIter::pointer get_pointer(const PtrMapIter& i)
+{ return &*i; }
+
+#else
+
+template <class PtrMapIter>
+typename PtrMapIter::value_type::second_type get_pointer(const PtrMapIter& i)
+{ return i->second; }
+
+#endif
+
+}} // namespace qpid::ptr_map
+
+#endif /*!QPID_PTR_MAP*/
+#ifndef QPID_PTR_MAP
+#define QPID_PTR_MAP
+
+/*
+ *
+ * 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 <boost/ptr_container/ptr_map.hpp>
+#include <boost/version.hpp>
+
+namespace qpid {
+namespace ptr_map {
+
+/** @file
+ * Workaround for API change between boost 1.33 and 1.34.
+ *
+ * To be portable across these versions, code using boost::ptr_map
+ * iterators should use get_pointer(i) to get the pointer from
+ * a boost::ptr_map iterator.
+ *
+ * Can be removed when we no longer support platforms on 1.33.
+ *
+ * @see http://www.boost.org/libs/ptr_container/doc/ptr_container.html#upgrading-from-boost-v-1-33
+ */
+#if (BOOST_VERSION < 103400)
+
+template <class PtrMapIter>
+typename PtrMapIter::pointer get_pointer(const PtrMapIter& i)
+{ return &*i; }
+
+#else
+
+template <class PtrMapIter>
+typename PtrMapIter::value_type::second_type get_pointer(const PtrMapIter& i)
+{ return i->second; }
+
+#endif
+
+}} // namespace qpid::ptr_map
+
+#endif /*!QPID_PTR_MAP*/
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/ptr_map.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Array.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Array.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Array.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Array.cpp Wed Nov 28 09:13:28 2007
@@ -23,8 +23,9 @@
#include "qpid/framing/Array.h"
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Array);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(ArrayTestSuite)
using namespace qpid::framing;
@@ -75,4 +76,4 @@
BOOST_CHECK(data == data2);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp Wed Nov 28 09:13:28 2007
@@ -18,9 +18,9 @@
*/
#include "qpid/framing/Blob.h"
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
-BOOST_AUTO_TEST_SUITE(Blob);
+QPID_AUTO_TEST_SUITE(BlobTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -125,4 +125,4 @@
BOOST_CHECK_EQUAL(0, Foo::instances);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Cluster.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Cluster.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Cluster.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Cluster.cpp Wed Nov 28 09:13:28 2007
@@ -24,11 +24,12 @@
#include "qpid/framing/all_method_bodies.h"
#include "qpid/cluster/ClassifierHandler.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Cluster);
+#include "unit_test.h"
#include <sys/wait.h>
+QPID_AUTO_TEST_SUITE(ClusterTestSuite)
+
static const ProtocolVersion VER;
/** Verify membership in a cluster with one member. */
@@ -107,4 +108,4 @@
BOOST_CHECK_EQUAL(1u, other.count);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Cpg.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Cpg.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Cpg.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Cpg.cpp Wed Nov 28 09:13:28 2007
@@ -22,8 +22,7 @@
#include "qpid/framing/AMQBody.h"
#include <boost/bind.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Cpg);
+#include "unit_test.h"
#include <string>
#include <iostream>
@@ -31,6 +30,9 @@
#include <vector>
#include <algorithm>
+QPID_AUTO_TEST_SUITE(CpgTestSuite)
+
+
using namespace std;
using namespace qpid::cluster;
using namespace qpid::framing;
@@ -106,4 +108,4 @@
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp Wed Nov 28 09:13:28 2007
@@ -22,11 +22,12 @@
#include "qpid/framing/FieldTable.h"
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(FieldTable);
+#include "unit_test.h"
using namespace qpid::framing;
+QPID_AUTO_TEST_SUITE(FieldTableTestSuite)
+
BOOST_AUTO_TEST_CASE(testMe)
{
FieldTable ft;
@@ -80,4 +81,4 @@
BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp Wed Nov 28 09:13:28 2007
@@ -18,8 +18,9 @@
*/
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(FieldValue);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(FieldValueTestSuite)
using namespace qpid::framing;
@@ -86,4 +87,4 @@
}
#endif
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp Wed Nov 28 09:13:28 2007
@@ -21,8 +21,9 @@
#include "qpid/framing/Frame.h"
#include <boost/lexical_cast.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Frame);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(FrameTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -76,4 +77,4 @@
}
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/InlineVector.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/InlineVector.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/InlineVector.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/InlineVector.cpp Wed Nov 28 09:13:28 2007
@@ -20,8 +20,9 @@
*/
#include "qpid/InlineVector.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(InlineVector);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(InlineVectorTestSuite)
using namespace qpid;
using namespace std;
@@ -85,4 +86,4 @@
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am Wed Nov 28 09:13:28 2007
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS)
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS) -DBOOST_TEST_DYN_LINK
INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen
abs_builddir=@abs_builddir@
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp Wed Nov 28 09:13:28 2007
@@ -18,8 +18,9 @@
#include "qpid/RefCounted.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(RefCounted);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(RefCountedTestSuiteTestSuite)
using namespace std;
using namespace qpid;
@@ -69,4 +70,4 @@
BOOST_CHECK_EQUAL(0, CountMe::instances);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/RefCountedMap.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/RefCountedMap.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/RefCountedMap.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/RefCountedMap.cpp Wed Nov 28 09:13:28 2007
@@ -18,10 +18,10 @@
#include "qpid/sys/RefCountedMap.h"
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
#include <boost/bind.hpp>
-BOOST_AUTO_TEST_SUITE(RefCountedMap);
+QPID_AUTO_TEST_SUITE(RefCountedMapTestSuite)
using namespace std;
using namespace qpid;
@@ -121,3 +121,5 @@
BOOST_CHECK_EQUAL(0, Data::instances);
BOOST_CHECK_EQUAL(0, Attachment::instances);
}
+
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Serializer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Serializer.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Serializer.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Serializer.cpp Wed Nov 28 09:13:28 2007
@@ -26,13 +26,15 @@
#include <boost/bind.hpp>
#include <boost/utility/value_init.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Serializer);
+#include "unit_test.h"
#include <set>
#include <unistd.h>
+QPID_AUTO_TEST_SUITE(SerializerTestSuite)
+
+
using namespace qpid;
using namespace qpid::sys;
using namespace qpid::framing;
@@ -152,4 +154,4 @@
BOOST_CHECK(Thread::logId() != *tester.threads.begin());
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp Wed Nov 28 09:13:28 2007
@@ -17,10 +17,12 @@
*/
#include "qpid/framing/SessionState.h"
+#include "qpid/Exception.h"
#include <boost/bind.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(SessionState);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(SessionStateTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -119,7 +121,7 @@
try {
session.receivedAck(6);
BOOST_FAIL("expected exception");
- } catch(const qpid::Exception&) {}
+ } catch(const std::exception&) {}
}
@@ -141,4 +143,4 @@
BOOST_CHECK_EQUAL(5u, *s3.received(f));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp Wed Nov 28 09:13:28 2007
@@ -22,8 +22,9 @@
#include "qpid/sys/Shlib.h"
#include "qpid/Exception.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Shlib);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(ShlibTestSuite)
using namespace qpid::sys;
typedef void (*CallMe)(int*);
@@ -56,4 +57,4 @@
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Url.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Url.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Url.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Url.cpp Wed Nov 28 09:13:28 2007
@@ -17,7 +17,7 @@
*/
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
#include "test_tools.h"
#include "qpid/Url.h"
#include <boost/assign.hpp>
@@ -26,7 +26,7 @@
using namespace qpid;
using namespace boost::assign;
-BOOST_AUTO_TEST_SUITE(Url);
+QPID_AUTO_TEST_SUITE(UrlTestSuite)
BOOST_AUTO_TEST_CASE(testUrl_str) {
Url url;
@@ -61,4 +61,4 @@
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp Wed Nov 28 09:13:28 2007
@@ -19,11 +19,12 @@
#include "qpid/framing/Uuid.h"
#include "qpid/framing/Buffer.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Uuid);
+#include "unit_test.h"
#include <set>
+QPID_AUTO_TEST_SUITE(UuidTestSuite)
+
using namespace std;
using namespace qpid::framing;
@@ -74,4 +75,4 @@
string(decoded.begin(), decoded.end()));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/cluster_client.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/cluster_client.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/cluster_client.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/cluster_client.cpp Wed Nov 28 09:13:28 2007
@@ -19,14 +19,15 @@
#include "qpid/client/Connection.h"
#include "qpid/shared_ptr.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(cluster_client);
+#include "unit_test.h"
#include <fstream>
#include <vector>
#include <functional>
+QPID_AUTO_TEST_SUITE(cluster_clientTestSuite)
+
using namespace std;
using namespace qpid;
using namespace qpid::client;
@@ -78,4 +79,4 @@
}
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/interop_runner.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/interop_runner.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/interop_runner.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/interop_runner.cpp Wed Nov 28 09:13:28 2007
@@ -20,6 +20,7 @@
*/
#include "qpid/Options.h"
+#include "qpid/ptr_map.h"
#include "qpid/Exception.h"
#include "qpid/client/Channel.h"
#include "qpid/client/Connection.h"
@@ -71,7 +72,7 @@
TestMap tests;
const string name;
const string topic;
- TestMap::iterator test;
+ TestCase* test;
auto_ptr<Thread> runner;
ReplyTo reportTo;
string reportCorrelator;
@@ -186,7 +187,7 @@
test->stop();
sendReport();
} else if (type == "TERMINATE") {
- if (test != tests.end()) test->stop();
+ if (test) test->stop();
shutdown();
} else {
cerr <<"ERROR!: Received unknown control message: " << type << endl;
@@ -201,8 +202,9 @@
bool Listener::invite(const string& name)
{
- test = tests.find(name);
- return test != tests.end();
+ TestMap::iterator i = tests.find(name);
+ test = (i != tests.end()) ? qpid::ptr_map::get_pointer(i) : 0;
+ return test;
}
void Listener::run()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/logging.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/logging.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/logging.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/logging.cpp Wed Nov 28 09:13:28 2007
@@ -16,7 +16,6 @@
*
*/
-
#include "test_tools.h"
#include "qpid/log/Logger.h"
#include "qpid/log/Options.h"
@@ -25,14 +24,15 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/format.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(logging);
+#include "unit_test.h"
#include <exception>
#include <fstream>
#include <time.h>
+QPID_AUTO_TEST_SUITE(loggingTestSuite)
+
using namespace std;
using namespace boost;
using namespace qpid::log;
@@ -42,7 +42,6 @@
BOOST_CHECK(!s.enabled);
BOOST_CHECK_EQUAL(string(__FILE__), s.file);
BOOST_CHECK_EQUAL(line, s.line);
- BOOST_CHECK_EQUAL(string("void testStatementInit()"), s.function);
BOOST_CHECK_EQUAL(debug, s.level);
}
@@ -141,7 +140,6 @@
vector<string> expect=list_of("foo\n");
BOOST_CHECK_EQUAL(expect, out->msg);
BOOST_CHECK_EQUAL(__FILE__, out->stmt.front().file);
- BOOST_CHECK_EQUAL("void testMacro()", out->stmt.front().function);
// Not enabled:
QPID_LOG(debug, "bar");
@@ -173,7 +171,6 @@
l.format(Logger::FUNCTION);
QPID_LOG(critical, "foo");
- BOOST_CHECK_EQUAL("void testLoggerFormat(): foo\n", out->last());
l.format(Logger::LEVEL);
QPID_LOG(critical, "foo");
@@ -181,7 +178,7 @@
l.format(~0); // Everything
QPID_LOG(critical, "foo");
- re=".* critical \\[[0-9a-f]*] "+string(__FILE__)+":\\d+:void testLoggerFormat\\(\\): foo\n";
+ re=".* critical \\[[0-9a-f]*] "+string(__FILE__)+":\\d+:void .*testLoggerFormat.*\\(\\): foo\n";
BOOST_CHECK_REGEX(re, out->last());
}
@@ -370,4 +367,4 @@
unlink("logging.tmp");
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.cpp?rev=599067&r1=599066&r2=599067&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.cpp Wed Nov 28 09:13:28 2007
@@ -16,7 +16,8 @@
*
*/
-#define BOOST_AUTO_TEST_MAIN // Must come before #include<boost/test/*>
-#include <boost/test/auto_unit_test.hpp>
-
// Defines test_main function to link with actual unit test code.
+#define BOOST_AUTO_TEST_MAIN // Boost 1.33
+#define BOOST_TEST_MAIN
+#include "unit_test.h"
+
Added: incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h?rev=599067&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h Wed Nov 28 09:13:28 2007
@@ -0,0 +1,44 @@
+#ifndef QPIPD_TEST_UNIT_TEST_H_
+#define QPIPD_TEST_UNIT_TEST_H_
+
+/*
+ *
+ * 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.
+ *
+ */
+
+// Workaround so we can build against boost 1.33 and boost 1.34.
+// Remove when we no longer need to support 1.33.
+//
+
+#if (BOOST_VERSION < 103400)
+
+# include <boost/test/auto_unit_test.hpp>
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name);
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END();
+
+#else
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name)
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
+
+# include <boost/test/unit_test.hpp>
+#endif
+
+#endif /*!QPIPD_TEST_UNIT_TEST_H_*/
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h
------------------------------------------------------------------------------
svn:keywords = Rev Date