summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/Makefile20
-rw-r--r--cpp/src/qpid/broker/SessionHandlerImpl.cpp9
-rw-r--r--cpp/src/qpid/broker/SessionHandlerImpl.h20
-rw-r--r--cpp/src/qpid/client/Channel.cpp4
-rw-r--r--cpp/src/qpid/framing/AMQHeaderBody.cpp4
-rw-r--r--cpp/src/qpid/io/APRSocket.cpp1
-rw-r--r--cpp/src/qpid/io/BlockingAPRSessionContext.cpp3
-rw-r--r--cpp/test/unit/qpid/broker/ExchangeTest.cpp3
-rw-r--r--cpp/test/unit/qpid/broker/MessageTest.cpp3
-rw-r--r--cpp/test/unit/qpid/broker/TopicExchangeTest.cpp2
-rw-r--r--cpp/test/unit/qpid/broker/ValueTest.cpp12
-rw-r--r--cpp/test/unit/qpid/framing/FramingTest.cpp22
-rw-r--r--cpp/test/unit/qpid/framing/HeaderTest.cpp3
13 files changed, 33 insertions, 73 deletions
diff --git a/cpp/Makefile b/cpp/Makefile
index 33a020780d..5eb9f29382 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -44,7 +44,7 @@ include options.mk
.PHONY: test all all-nogen generate unittest pythontest
-test: all unittest pythontest
+test: unittest pythontest
# Must run this as two separate make processes to pick up generated files.
all:
@@ -81,21 +81,21 @@ UNITTESTS := $(UNITTESTS) $(wildcard $(COMMON_DIRS:%=test/unit/%/*Test.cpp))
# Client library.
CLIENT_LIB := lib/libqpid_client.so.1.0
CLIENT_SRC := $(wildcard src/qpid/client/*.cpp)
-$(CLIENT_LIB): $(CLIENT_SRC:.cpp=.o)
- $(LIB_CMD) $^ $(CURDIR)/$(COMMON_LIB)
+$(CLIENT_LIB): $(CLIENT_SRC:.cpp=.o) $(CURDIR)/$(COMMON_LIB)
+ $(LIB_CMD) $^
all-nogen: $(CLIENT_LIB)
UNITTESTS := $(UNITTESTS) $(wildcard $(COMMON_DIRS:%=test/unit/%/*Test.cpp))
# Broker library.
BROKER_LIB := lib/libqpid_broker.so.1.0
BROKER_SRC := $(wildcard src/qpid/broker/*.cpp)
-$(BROKER_LIB): $(BROKER_SRC:.cpp=.o)
- $(LIB_CMD) $^ $(CURDIR)/$(COMMON_LIB)
+$(BROKER_LIB): $(BROKER_SRC:.cpp=.o) $(CURDIR)/$(COMMON_LIB)
+ $(LIB_CMD) $^
all-nogen: $(BROKER_LIB)
UNITTESTS := $(UNITTESTS) $(wildcard test/unit/qpid/broker/*Test.cpp)
# Implicit rule for unit test plugin libraries.
-%Test.so: %Test.cpp
+%Test.so: %Test.cpp $(CURDIR)/$(COMMON_LIB) $(CURDIR)/$(BROKER_LIB)
$(CXX) -shared -o $@ $< $($(LIB)_FLAGS) -Itest/include $(CXXFLAGS) $(LDFLAGS) -lapr-1 -lcppunit $(CURDIR)/$(COMMON_LIB) $(CURDIR)/$(BROKER_LIB)
## Client tests
@@ -106,16 +106,16 @@ test/client/%: test/client/%.cpp
## Daemon executable
-bin/qpidd: src/qpidd.o $(CURDIR)/$(COMMON_LIB)
- $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -lapr-1 $^ $(CURDIR)/$(BROKER_LIB)
+bin/qpidd: src/qpidd.o $(CURDIR)/$(COMMON_LIB) $(CURDIR)/$(BROKER_LIB)
+ $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -lapr-1 $^
all-nogen: bin/qpidd
## Run unit tests.
-unittest: $(UNITTESTS:.cpp=.so)
+unittest: all
DllPlugInTester -c -b $(UNITTESTS:.cpp=.so)
## Run python tests
-pythontest: bin/qpidd
+pythontest: all
bin/qpidd > qpidd.log &
cd ../python ; ./run-tests -v -I cpp_failing.txt
diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.cpp b/cpp/src/qpid/broker/SessionHandlerImpl.cpp
index 157fca5acb..0713b84164 100644
--- a/cpp/src/qpid/broker/SessionHandlerImpl.cpp
+++ b/cpp/src/qpid/broker/SessionHandlerImpl.cpp
@@ -48,14 +48,7 @@ SessionHandlerImpl::SessionHandlerImpl(SessionContext* _context,
framemax(65536),
heartbeat(0) {}
-SessionHandlerImpl::~SessionHandlerImpl(){
- // TODO aconway 2006-09-07: Should be auto_ptr or plain members.
- delete channelHandler;
- delete connectionHandler;
- delete basicHandler;
- delete exchangeHandler;
- delete queueHandler;
-}
+SessionHandlerImpl::~SessionHandlerImpl(){}
Channel* SessionHandlerImpl::getChannel(u_int16_t channel){
channel_iterator i = channels.find(channel);
diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.h b/cpp/src/qpid/broker/SessionHandlerImpl.h
index 4504541623..afaae74d97 100644
--- a/cpp/src/qpid/broker/SessionHandlerImpl.h
+++ b/cpp/src/qpid/broker/SessionHandlerImpl.h
@@ -71,11 +71,11 @@ class SessionHandlerImpl : public virtual qpid::io::SessionHandler,
AutoDelete* const cleaner;
const u_int32_t timeout;//timeout for auto-deleted queues (in ms)
- ConnectionHandler* connectionHandler;
- ChannelHandler* channelHandler;
- BasicHandler* basicHandler;
- ExchangeHandler* exchangeHandler;
- QueueHandler* queueHandler;
+ std::auto_ptr<ConnectionHandler> connectionHandler;
+ std::auto_ptr<ChannelHandler> channelHandler;
+ std::auto_ptr<BasicHandler> basicHandler;
+ std::auto_ptr<ExchangeHandler> exchangeHandler;
+ std::auto_ptr<QueueHandler> queueHandler;
std::map<u_int16_t, Channel*> channels;
std::vector<Queue::shared_ptr> exclusiveQueues;
@@ -212,11 +212,11 @@ class SessionHandlerImpl : public virtual qpid::io::SessionHandler,
virtual ~BasicHandlerImpl(){}
};
- inline virtual ChannelHandler* getChannelHandler(){ return channelHandler; }
- inline virtual ConnectionHandler* getConnectionHandler(){ return connectionHandler; }
- inline virtual BasicHandler* getBasicHandler(){ return basicHandler; }
- inline virtual ExchangeHandler* getExchangeHandler(){ return exchangeHandler; }
- inline virtual QueueHandler* getQueueHandler(){ return queueHandler; }
+ inline virtual ChannelHandler* getChannelHandler(){ return channelHandler.get(); }
+ inline virtual ConnectionHandler* getConnectionHandler(){ return connectionHandler.get(); }
+ inline virtual BasicHandler* getBasicHandler(){ return basicHandler.get(); }
+ inline virtual ExchangeHandler* getExchangeHandler(){ return exchangeHandler.get(); }
+ inline virtual QueueHandler* getQueueHandler(){ return queueHandler.get(); }
inline virtual AccessHandler* getAccessHandler(){ return 0; }
inline virtual FileHandler* getFileHandler(){ return 0; }
diff --git a/cpp/src/qpid/client/Channel.cpp b/cpp/src/qpid/client/Channel.cpp
index 0563dbaaba..99e827488c 100644
--- a/cpp/src/qpid/client/Channel.cpp
+++ b/cpp/src/qpid/client/Channel.cpp
@@ -119,9 +119,7 @@ void Channel::deleteQueue(Queue& queue, bool ifunused, bool ifempty, bool synch)
void Channel::bind(const Exchange& exchange, const Queue& queue, const std::string& key, const FieldTable& args, bool synch){
string e = exchange.getName();
string q = queue.getName();
- // TODO aconway 2006-10-10: not const correct, get rid of const_cast.
- //
- AMQFrame* frame = new AMQFrame(id, new QueueBindBody(0, q, e, key,!synch, const_cast<FieldTable&>(args)));
+ AMQFrame* frame = new AMQFrame(id, new QueueBindBody(0, q, e, key,!synch, args));
if(synch){
sendAndReceive(frame, queue_bind_ok);
}else{
diff --git a/cpp/src/qpid/framing/AMQHeaderBody.cpp b/cpp/src/qpid/framing/AMQHeaderBody.cpp
index eb360d8bc8..6bb24e67c7 100644
--- a/cpp/src/qpid/framing/AMQHeaderBody.cpp
+++ b/cpp/src/qpid/framing/AMQHeaderBody.cpp
@@ -63,11 +63,7 @@ void qpid::framing::AMQHeaderBody::print(std::ostream& out) const
{
out << "header, content_size=" << getContentSize()
<< " (" << size() << " bytes)" << ", headers=" ;
- // TODO aconway 2006-09-26: Hack to see headers.
- // Should write proper op << for BasicHeaderProperties.
- //
const BasicHeaderProperties* props =
dynamic_cast<const BasicHeaderProperties*>(getProperties());
- // TODO aconway 2006-09-26: Lose the static cast, fix BasicHeaderProperties
if (props) out << const_cast<BasicHeaderProperties*>(props)->getHeaders();
}
diff --git a/cpp/src/qpid/io/APRSocket.cpp b/cpp/src/qpid/io/APRSocket.cpp
index 80fb642c8e..824c376c3b 100644
--- a/cpp/src/qpid/io/APRSocket.cpp
+++ b/cpp/src/qpid/io/APRSocket.cpp
@@ -45,7 +45,6 @@ void APRSocket::write(qpid::framing::Buffer& buffer){
do{
bytes = buffer.available();
apr_socket_send(socket, buffer.start(), &bytes);
- // TODO aconway 2006-10-05: why don't we check status here?
buffer.move(bytes);
}while(bytes > 0);
}
diff --git a/cpp/src/qpid/io/BlockingAPRSessionContext.cpp b/cpp/src/qpid/io/BlockingAPRSessionContext.cpp
index aee223ca3b..88e6b6b0fc 100644
--- a/cpp/src/qpid/io/BlockingAPRSessionContext.cpp
+++ b/cpp/src/qpid/io/BlockingAPRSessionContext.cpp
@@ -122,8 +122,7 @@ void BlockingAPRSessionContext::write(){
int written = 0;
apr_size_t bytes = available;
while(available > written){
- apr_status_t s = apr_socket_send(socket, data + written, &bytes);
- assert(s == 0); // TODO aconway 2006-10-05: Error Handling.
+ apr_socket_send(socket, data + written, &bytes);
written += bytes;
bytes = available - written;
}
diff --git a/cpp/test/unit/qpid/broker/ExchangeTest.cpp b/cpp/test/unit/qpid/broker/ExchangeTest.cpp
index adebc87422..40fa9cb032 100644
--- a/cpp/test/unit/qpid/broker/ExchangeTest.cpp
+++ b/cpp/test/unit/qpid/broker/ExchangeTest.cpp
@@ -34,8 +34,6 @@ class ExchangeTest : public CppUnit::TestCase
public:
- // TODO aconway 2006-09-12: Need more detailed tests.
-
void testMe()
{
Queue::shared_ptr queue(new Queue("queue", true, true));
@@ -56,7 +54,6 @@ class ExchangeTest : public CppUnit::TestCase
topic.route(msg, "abc", 0);
direct.route(msg, "abc", 0);
- // TODO aconway 2006-09-12: TODO Why no assertions?
}
};
diff --git a/cpp/test/unit/qpid/broker/MessageTest.cpp b/cpp/test/unit/qpid/broker/MessageTest.cpp
index 210cd63934..9b4040a8ca 100644
--- a/cpp/test/unit/qpid/broker/MessageTest.cpp
+++ b/cpp/test/unit/qpid/broker/MessageTest.cpp
@@ -32,9 +32,6 @@ class MessageTest : public CppUnit::TestCase
public:
- // TODO aconway 2006-09-12: Need more detailed tests,
- // need tests to assert something!
- //
void testMe()
{
APRBase::increment();
diff --git a/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp b/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp
index 8d7903c4ac..6a15573e51 100644
--- a/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp
+++ b/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp
@@ -17,8 +17,6 @@ Tokens makeTokens(char** begin, char** end)
#define TOKENS(a) makeTokens(a, a + LEN(a))
// Allow CPPUNIT_EQUALS to print a Tokens.
-// TODO aconway 2006-09-19: Make it a template and put it in a shared test lib.
-//
CppUnit::OStringStream& operator <<(CppUnit::OStringStream& out, const Tokens& v)
{
out << "[ ";
diff --git a/cpp/test/unit/qpid/broker/ValueTest.cpp b/cpp/test/unit/qpid/broker/ValueTest.cpp
index 2cb2563b46..8ea536f59f 100644
--- a/cpp/test/unit/qpid/broker/ValueTest.cpp
+++ b/cpp/test/unit/qpid/broker/ValueTest.cpp
@@ -4,18 +4,6 @@
using namespace qpid::framing;
-// Allow CPPUNIT_EQUALS to print a Tokens.
-// TODO aconway 2006-09-19: Make it a template and put it in a shared test lib.
-//
-template <class T>
-CppUnit::OStringStream& operator <<(CppUnit::OStringStream& out,
- const ValueOps<T>& v)
-{
- out << v.getValue();
- return out;
-}
-
-
class ValueTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(ValueTest);
diff --git a/cpp/test/unit/qpid/framing/FramingTest.cpp b/cpp/test/unit/qpid/framing/FramingTest.cpp
index 950d1e045a..ad2d651fe0 100644
--- a/cpp/test/unit/qpid/framing/FramingTest.cpp
+++ b/cpp/test/unit/qpid/framing/FramingTest.cpp
@@ -15,17 +15,15 @@
* limitations under the License.
*
*/
-#include "qpid/framing/amqp_framing.h"
#include "qpid/framing/ConnectionRedirectBody.h"
+#include "qpid/framing/amqp_framing.h"
#include <iostream>
-#include <sstream>
#include <qpid_test_plugin.h>
+#include <sstream>
#include <typeinfo>
using namespace qpid::framing;
-// TODO aconway 2006-09-12: Why do we need explicit qpid::framing:: below?
-
template <class T>
std::string tostring(const T& x)
{
@@ -42,8 +40,8 @@ class FramingTest : public CppUnit::TestCase
CPPUNIT_TEST(testConnectionRedirectBody);
CPPUNIT_TEST(testAccessRequestBody);
CPPUNIT_TEST(testBasicConsumeBody);
- CPPUNIT_TEST(ConnectionRedirectBody);
- CPPUNIT_TEST(BasicConsumeOkBody);
+ CPPUNIT_TEST(testConnectionRedirectBodyFrame);
+ CPPUNIT_TEST(testBasicConsumeOkBodyFrame);
CPPUNIT_TEST_SUITE_END();
private:
@@ -78,10 +76,10 @@ class FramingTest : public CppUnit::TestCase
{
std::string a = "hostA";
std::string b = "hostB";
- qpid::framing::ConnectionRedirectBody in(a, b);
+ ConnectionRedirectBody in(a, b);
in.encodeContent(buffer);
buffer.flip();
- qpid::framing::ConnectionRedirectBody out;
+ ConnectionRedirectBody out;
out.decodeContent(buffer);
CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
}
@@ -110,11 +108,11 @@ class FramingTest : public CppUnit::TestCase
}
- void ConnectionRedirectBody()
+ void testConnectionRedirectBodyFrame()
{
std::string a = "hostA";
std::string b = "hostB";
- AMQFrame in(999, new qpid::framing::ConnectionRedirectBody(a, b));
+ AMQFrame in(999, new ConnectionRedirectBody(a, b));
in.encode(buffer);
buffer.flip();
AMQFrame out;
@@ -122,10 +120,10 @@ class FramingTest : public CppUnit::TestCase
CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
}
- void BasicConsumeOkBody()
+ void testBasicConsumeOkBodyFrame()
{
std::string s = "hostA";
- AMQFrame in(999, new qpid::framing::BasicConsumeOkBody(s));
+ AMQFrame in(999, new BasicConsumeOkBody(s));
in.encode(buffer);
buffer.flip();
AMQFrame out;
diff --git a/cpp/test/unit/qpid/framing/HeaderTest.cpp b/cpp/test/unit/qpid/framing/HeaderTest.cpp
index cf0d9fe5bd..8b613127b1 100644
--- a/cpp/test/unit/qpid/framing/HeaderTest.cpp
+++ b/cpp/test/unit/qpid/framing/HeaderTest.cpp
@@ -31,9 +31,6 @@ class HeaderTest : public CppUnit::TestCase
public:
- // TODO aconway 2006-09-12: Need more detailed tests,
- // need tests to assert something!
- //
void testGenericProperties()
{
AMQHeaderBody body(BASIC);