From b90ceab30a9f2040a868e76c90af47f09b4cbbb2 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 16 Oct 2006 14:12:49 +0000 Subject: Renamed unit tests to follow naming conventions, fixed some #include inconsistencies. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@464503 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/Makefile | 6 +- cpp/src/qpid/broker/AutoDelete.cpp | 2 +- cpp/src/qpid/broker/AutoDelete.h | 8 +- cpp/src/qpid/broker/Binding.h | 2 +- cpp/src/qpid/broker/Broker.cpp | 14 +-- cpp/src/qpid/broker/Broker.h | 8 +- cpp/src/qpid/broker/Channel.cpp | 4 +- cpp/src/qpid/broker/Channel.h | 18 +-- cpp/src/qpid/broker/Configuration.cpp | 2 +- cpp/src/qpid/broker/Configuration.h | 2 +- cpp/src/qpid/broker/Consumer.h | 2 +- cpp/src/qpid/broker/DirectExchange.cpp | 4 +- cpp/src/qpid/broker/DirectExchange.h | 10 +- cpp/src/qpid/broker/Exchange.h | 6 +- cpp/src/qpid/broker/ExchangeBinding.cpp | 4 +- cpp/src/qpid/broker/ExchangeBinding.h | 6 +- cpp/src/qpid/broker/ExchangeRegistry.cpp | 4 +- cpp/src/qpid/broker/ExchangeRegistry.h | 4 +- cpp/src/qpid/broker/FanOutExchange.cpp | 4 +- cpp/src/qpid/broker/FanOutExchange.h | 10 +- cpp/src/qpid/broker/HeadersExchange.cpp | 8 +- cpp/src/qpid/broker/HeadersExchange.h | 10 +- cpp/src/qpid/broker/Message.cpp | 6 +- cpp/src/qpid/broker/Message.h | 14 +-- cpp/src/qpid/broker/NameGenerator.cpp | 2 +- cpp/src/qpid/broker/NameGenerator.h | 2 +- cpp/src/qpid/broker/Queue.cpp | 4 +- cpp/src/qpid/broker/Queue.h | 14 +-- cpp/src/qpid/broker/QueueRegistry.cpp | 6 +- cpp/src/qpid/broker/QueueRegistry.h | 4 +- cpp/src/qpid/broker/Router.cpp | 2 +- cpp/src/qpid/broker/Router.h | 4 +- cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp | 8 +- cpp/src/qpid/broker/SessionHandlerFactoryImpl.h | 16 +-- cpp/src/qpid/broker/SessionHandlerImpl.cpp | 10 +- cpp/src/qpid/broker/SessionHandlerImpl.h | 26 ++-- cpp/src/qpid/broker/TopicExchange.cpp | 4 +- cpp/src/qpid/broker/TopicExchange.h | 10 +- cpp/src/qpid/framing/AMQBody.h | 2 +- cpp/src/qpid/framing/BodyHandler.cpp | 2 +- cpp/test/unit/qpid/broker/ChannelTest.cpp | 4 +- cpp/test/unit/qpid/broker/ExchangeTest.cpp | 8 +- cpp/test/unit/qpid/broker/HeadersExchangeTest.cpp | 6 +- cpp/test/unit/qpid/broker/MessageTest.cpp | 4 +- cpp/test/unit/qpid/broker/QueueRegistryTest.cpp | 2 +- cpp/test/unit/qpid/broker/QueueTest.cpp | 4 +- cpp/test/unit/qpid/broker/RouterTest.cpp | 10 +- cpp/test/unit/qpid/broker/TopicExchangeTest.cpp | 2 +- cpp/test/unit/qpid/broker/ValueTest.cpp | 2 +- cpp/test/unit/qpid/framing/BodyHandlerTest.cpp | 2 +- cpp/test/unit/qpid/framing/FieldTableTest.cpp | 52 ++++++++ cpp/test/unit/qpid/framing/FramingTest.cpp | 144 ++++++++++++++++++++++ cpp/test/unit/qpid/framing/HeaderTest.cpp | 141 +++++++++++++++++++++ cpp/test/unit/qpid/framing/field_table_test.cpp | 52 -------- cpp/test/unit/qpid/framing/framing_test.cpp | 144 ---------------------- cpp/test/unit/qpid/framing/header_test.cpp | 141 --------------------- 56 files changed, 494 insertions(+), 498 deletions(-) create mode 100644 cpp/test/unit/qpid/framing/FieldTableTest.cpp create mode 100644 cpp/test/unit/qpid/framing/FramingTest.cpp create mode 100644 cpp/test/unit/qpid/framing/HeaderTest.cpp delete mode 100644 cpp/test/unit/qpid/framing/field_table_test.cpp delete mode 100644 cpp/test/unit/qpid/framing/framing_test.cpp delete mode 100644 cpp/test/unit/qpid/framing/header_test.cpp (limited to 'cpp') diff --git a/cpp/Makefile b/cpp/Makefile index 586a934cce..15d73b4bd9 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -53,10 +53,6 @@ XSL := code_gen.xsl framing.xsl STYLESHEETS := $(XSL:%=$(CURDIR)/etc/stylesheets/%) TRANSFORM := java -jar $(CURDIR)/tools/saxon8.jar -o results.out $(SPEC) -.PHONY: generate - -generate: gen/timestamp - # Restart make if code is re-generated to get proper dependencies. # Remove "clean" to avoid infinite loop. REMAKE := exec $(MAKE) $(MAKECMDGOALS:clean=) @@ -78,7 +74,7 @@ LIB_CMD = $(CXX) -shared -o $@ $(LDFLAGS) $(CXXFLAGS) -lapr-1 COMMON_LIB := lib/libqpid_common.so.1.0 COMMON_DIRS := qpid/concurrent qpid/framing qpid/io qpid COMMON_SRC := $(wildcard gen/qpid/framing/*.cpp $(COMMON_DIRS:%=src/%/*.cpp)) -$(COMMON_LIB): generate $(COMMON_SRC:.cpp=.o) +$(COMMON_LIB): gen/timestamp $(COMMON_SRC:.cpp=.o) $(LIB_CMD) $(COMMON_SRC:.cpp=.o) all: $(COMMON_LIB) UNITTESTS := $(UNITTESTS) $(wildcard $(COMMON_DIRS:%=test/unit/%/*Test.cpp)) diff --git a/cpp/src/qpid/broker/AutoDelete.cpp b/cpp/src/qpid/broker/AutoDelete.cpp index 22076e9e0c..434bd4a3a0 100644 --- a/cpp/src/qpid/broker/AutoDelete.cpp +++ b/cpp/src/qpid/broker/AutoDelete.cpp @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./qpid/broker/AutoDelete.h" +#include "qpid/broker/AutoDelete.h" using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/AutoDelete.h b/cpp/src/qpid/broker/AutoDelete.h index 77a5a338e3..9faa4aa4c4 100644 --- a/cpp/src/qpid/broker/AutoDelete.h +++ b/cpp/src/qpid/broker/AutoDelete.h @@ -20,10 +20,10 @@ #include #include -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" -#include "./qpid/broker/QueueRegistry.h" -#include "./qpid/concurrent/ThreadFactoryImpl.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" +#include "qpid/broker/QueueRegistry.h" +#include "qpid/concurrent/ThreadFactoryImpl.h" namespace qpid { namespace broker{ diff --git a/cpp/src/qpid/broker/Binding.h b/cpp/src/qpid/broker/Binding.h index 4202d390c3..0e8f9b5d6c 100644 --- a/cpp/src/qpid/broker/Binding.h +++ b/cpp/src/qpid/broker/Binding.h @@ -18,7 +18,7 @@ #ifndef _Binding_ #define _Binding_ -#include "./qpid/framing/FieldTable.h" +#include "qpid/framing/FieldTable.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 27ce840d01..fe859b240b 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -17,13 +17,13 @@ */ #include #include -#include "./qpid/broker/Broker.h" -#include "./qpid/io/Acceptor.h" -#include "./qpid/broker/Configuration.h" -#include "./qpid/QpidError.h" -#include "./qpid/broker/SessionHandlerFactoryImpl.h" -#include "./qpid/io/BlockingAPRAcceptor.h" -#include "./qpid/io/LFAcceptor.h" +#include "qpid/broker/Broker.h" +#include "qpid/io/Acceptor.h" +#include "qpid/broker/Configuration.h" +#include "qpid/QpidError.h" +#include "qpid/broker/SessionHandlerFactoryImpl.h" +#include "qpid/io/BlockingAPRAcceptor.h" +#include "qpid/io/LFAcceptor.h" using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h index 3423dc0910..40b171e838 100644 --- a/cpp/src/qpid/broker/Broker.h +++ b/cpp/src/qpid/broker/Broker.h @@ -19,10 +19,10 @@ * */ -#include "./qpid/io/Acceptor.h" -#include "./qpid/broker/Configuration.h" -#include "./qpid/concurrent/Runnable.h" -#include "./qpid/broker/SessionHandlerFactoryImpl.h" +#include "qpid/io/Acceptor.h" +#include "qpid/broker/Configuration.h" +#include "qpid/concurrent/Runnable.h" +#include "qpid/broker/SessionHandlerFactoryImpl.h" #include #include diff --git a/cpp/src/qpid/broker/Channel.cpp b/cpp/src/qpid/broker/Channel.cpp index 8d1cce9f1b..5497eda842 100644 --- a/cpp/src/qpid/broker/Channel.cpp +++ b/cpp/src/qpid/broker/Channel.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/Channel.h" -#include "./qpid/QpidError.h" +#include "qpid/broker/Channel.h" +#include "qpid/QpidError.h" #include #include #include diff --git a/cpp/src/qpid/broker/Channel.h b/cpp/src/qpid/broker/Channel.h index a20f4d9599..e742f45279 100644 --- a/cpp/src/qpid/broker/Channel.h +++ b/cpp/src/qpid/broker/Channel.h @@ -20,16 +20,16 @@ #include #include -#include "./qpid/framing/AMQContentBody.h" -#include "./qpid/framing/AMQHeaderBody.h" +#include "qpid/framing/AMQContentBody.h" +#include "qpid/framing/AMQHeaderBody.h" #include "qpid/framing/BasicPublishBody.h" -#include "./qpid/broker/Binding.h" -#include "./qpid/broker/Consumer.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/NameGenerator.h" -#include "./qpid/framing/OutputHandler.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Binding.h" +#include "qpid/broker/Consumer.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/NameGenerator.h" +#include "qpid/framing/OutputHandler.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Configuration.cpp b/cpp/src/qpid/broker/Configuration.cpp index d4b27e4dd2..7aefe19b2b 100644 --- a/cpp/src/qpid/broker/Configuration.cpp +++ b/cpp/src/qpid/broker/Configuration.cpp @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./qpid/broker/Configuration.h" +#include "qpid/broker/Configuration.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/Configuration.h b/cpp/src/qpid/broker/Configuration.h index 3785e1bac0..61ecc89ed9 100644 --- a/cpp/src/qpid/broker/Configuration.h +++ b/cpp/src/qpid/broker/Configuration.h @@ -21,7 +21,7 @@ #include #include #include -#include "./qpid/Exception.h" +#include "qpid/Exception.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Consumer.h b/cpp/src/qpid/broker/Consumer.h index 7d346a4a0a..73b7ca9ed1 100644 --- a/cpp/src/qpid/broker/Consumer.h +++ b/cpp/src/qpid/broker/Consumer.h @@ -18,7 +18,7 @@ #ifndef _Consumer_ #define _Consumer_ -#include "./qpid/broker/Message.h" +#include "qpid/broker/Message.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/DirectExchange.cpp b/cpp/src/qpid/broker/DirectExchange.cpp index aa90d8dd81..63cfda8f51 100644 --- a/cpp/src/qpid/broker/DirectExchange.cpp +++ b/cpp/src/qpid/broker/DirectExchange.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/DirectExchange.h" -#include "./qpid/broker/ExchangeBinding.h" +#include "qpid/broker/DirectExchange.h" +#include "qpid/broker/ExchangeBinding.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/DirectExchange.h b/cpp/src/qpid/broker/DirectExchange.h index ce58a174c6..e998d3caa6 100644 --- a/cpp/src/qpid/broker/DirectExchange.h +++ b/cpp/src/qpid/broker/DirectExchange.h @@ -20,11 +20,11 @@ #include #include -#include "./qpid/broker/Exchange.h" -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Exchange.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Exchange.h b/cpp/src/qpid/broker/Exchange.h index 7b8bb1c034..f84f0d969e 100644 --- a/cpp/src/qpid/broker/Exchange.h +++ b/cpp/src/qpid/broker/Exchange.h @@ -18,9 +18,9 @@ #ifndef _Exchange_ #define _Exchange_ -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Message.h" -#include "./qpid/broker/Queue.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Message.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/ExchangeBinding.cpp b/cpp/src/qpid/broker/ExchangeBinding.cpp index 61f44f634c..115bf4f9ec 100644 --- a/cpp/src/qpid/broker/ExchangeBinding.cpp +++ b/cpp/src/qpid/broker/ExchangeBinding.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/ExchangeBinding.h" -#include "./qpid/broker/Exchange.h" +#include "qpid/broker/ExchangeBinding.h" +#include "qpid/broker/Exchange.h" using namespace qpid::broker; using namespace qpid::framing; diff --git a/cpp/src/qpid/broker/ExchangeBinding.h b/cpp/src/qpid/broker/ExchangeBinding.h index fda5fab153..692aa8a57f 100644 --- a/cpp/src/qpid/broker/ExchangeBinding.h +++ b/cpp/src/qpid/broker/ExchangeBinding.h @@ -18,9 +18,9 @@ #ifndef _ExchangeBinding_ #define _ExchangeBinding_ -#include "./qpid/broker/Binding.h" -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Binding.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/ExchangeRegistry.cpp b/cpp/src/qpid/broker/ExchangeRegistry.cpp index 0755393e68..f69c258ac1 100644 --- a/cpp/src/qpid/broker/ExchangeRegistry.cpp +++ b/cpp/src/qpid/broker/ExchangeRegistry.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/ExchangeRegistry.h" -#include "./qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/ExchangeRegistry.h" +#include "qpid/concurrent/MonitorImpl.h" using namespace qpid::broker; using namespace qpid::concurrent; diff --git a/cpp/src/qpid/broker/ExchangeRegistry.h b/cpp/src/qpid/broker/ExchangeRegistry.h index 7728ed0eff..335f1ad0ab 100644 --- a/cpp/src/qpid/broker/ExchangeRegistry.h +++ b/cpp/src/qpid/broker/ExchangeRegistry.h @@ -19,8 +19,8 @@ #define _ExchangeRegistry_ #include -#include "./qpid/broker/Exchange.h" -#include "./qpid/concurrent/Monitor.h" +#include "qpid/broker/Exchange.h" +#include "qpid/concurrent/Monitor.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/FanOutExchange.cpp b/cpp/src/qpid/broker/FanOutExchange.cpp index 1b4e3643d0..0a184d5993 100644 --- a/cpp/src/qpid/broker/FanOutExchange.cpp +++ b/cpp/src/qpid/broker/FanOutExchange.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/FanOutExchange.h" -#include "./qpid/broker/ExchangeBinding.h" +#include "qpid/broker/FanOutExchange.h" +#include "qpid/broker/ExchangeBinding.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/FanOutExchange.h b/cpp/src/qpid/broker/FanOutExchange.h index f79dd28ec5..b3255e3b0f 100644 --- a/cpp/src/qpid/broker/FanOutExchange.h +++ b/cpp/src/qpid/broker/FanOutExchange.h @@ -20,11 +20,11 @@ #include #include -#include "./qpid/broker/Exchange.h" -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Exchange.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp index 35feef22dd..12827da26b 100644 --- a/cpp/src/qpid/broker/HeadersExchange.cpp +++ b/cpp/src/qpid/broker/HeadersExchange.cpp @@ -15,10 +15,10 @@ * limitations under the License. * */ -#include "./qpid/broker/HeadersExchange.h" -#include "./qpid/broker/ExchangeBinding.h" -#include "./qpid/framing/Value.h" -#include "./qpid/QpidError.h" +#include "qpid/broker/HeadersExchange.h" +#include "qpid/broker/ExchangeBinding.h" +#include "qpid/framing/Value.h" +#include "qpid/QpidError.h" #include diff --git a/cpp/src/qpid/broker/HeadersExchange.h b/cpp/src/qpid/broker/HeadersExchange.h index a330e050f5..5c7525ee7c 100644 --- a/cpp/src/qpid/broker/HeadersExchange.h +++ b/cpp/src/qpid/broker/HeadersExchange.h @@ -19,11 +19,11 @@ #define _HeadersExchange_ #include -#include "./qpid/broker/Exchange.h" -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Exchange.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp index 7210ecc2f2..53cfe4ee43 100644 --- a/cpp/src/qpid/broker/Message.cpp +++ b/cpp/src/qpid/broker/Message.cpp @@ -15,9 +15,9 @@ * limitations under the License. * */ -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Message.h" -#include "./qpid/broker/ExchangeRegistry.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Message.h" +#include "qpid/broker/ExchangeRegistry.h" #include using namespace std::tr1;//for *_pointer_cast methods diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h index 7ba8767baf..c4e52db333 100644 --- a/cpp/src/qpid/broker/Message.h +++ b/cpp/src/qpid/broker/Message.h @@ -18,13 +18,13 @@ #ifndef _Message_ #define _Message_ -#include "./memory.h" -#include "./qpid/framing/AMQContentBody.h" -#include "./qpid/framing/AMQHeaderBody.h" -#include "./qpid/framing/BasicHeaderProperties.h" -#include "./qpid/framing/BasicPublishBody.h" -#include "./qpid/broker/ConnectionToken.h" -#include "./qpid/framing/OutputHandler.h" +#include "memory.h" +#include "qpid/framing/AMQContentBody.h" +#include "qpid/framing/AMQHeaderBody.h" +#include "qpid/framing/BasicHeaderProperties.h" +#include "qpid/framing/BasicPublishBody.h" +#include "qpid/broker/ConnectionToken.h" +#include "qpid/framing/OutputHandler.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/NameGenerator.cpp b/cpp/src/qpid/broker/NameGenerator.cpp index d9b758c5a0..5f1b1431f3 100644 --- a/cpp/src/qpid/broker/NameGenerator.cpp +++ b/cpp/src/qpid/broker/NameGenerator.cpp @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./qpid/broker/NameGenerator.h" +#include "qpid/broker/NameGenerator.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/NameGenerator.h b/cpp/src/qpid/broker/NameGenerator.h index 38f3c0a4c1..71643ef675 100644 --- a/cpp/src/qpid/broker/NameGenerator.h +++ b/cpp/src/qpid/broker/NameGenerator.h @@ -18,7 +18,7 @@ #ifndef _NameGenerator_ #define _NameGenerator_ -#include "./qpid/broker/Message.h" +#include "qpid/broker/Message.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index d672074555..ee9bff4513 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/Queue.h" -#include "./qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" +#include "qpid/concurrent/MonitorImpl.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h index 6cf9088633..d3cd29989d 100644 --- a/cpp/src/qpid/broker/Queue.h +++ b/cpp/src/qpid/broker/Queue.h @@ -20,14 +20,14 @@ #include #include -#include "./memory.h" +#include "memory.h" #include "apr_time.h" -#include "./qpid/framing/amqp_types.h" -#include "./qpid/broker/Binding.h" -#include "./qpid/broker/ConnectionToken.h" -#include "./qpid/broker/Consumer.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" +#include "qpid/framing/amqp_types.h" +#include "qpid/broker/Binding.h" +#include "qpid/broker/ConnectionToken.h" +#include "qpid/broker/Consumer.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/QueueRegistry.cpp b/cpp/src/qpid/broker/QueueRegistry.cpp index f2cb46648e..1f7684e608 100644 --- a/cpp/src/qpid/broker/QueueRegistry.cpp +++ b/cpp/src/qpid/broker/QueueRegistry.cpp @@ -15,9 +15,9 @@ * limitations under the License. * */ -#include "./qpid/broker/QueueRegistry.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/SessionHandlerImpl.h" +#include "qpid/broker/QueueRegistry.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/SessionHandlerImpl.h" #include #include diff --git a/cpp/src/qpid/broker/QueueRegistry.h b/cpp/src/qpid/broker/QueueRegistry.h index 9e6778153e..42d75fc3e0 100644 --- a/cpp/src/qpid/broker/QueueRegistry.h +++ b/cpp/src/qpid/broker/QueueRegistry.h @@ -19,8 +19,8 @@ #define _QueueRegistry_ #include -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/Router.cpp b/cpp/src/qpid/broker/Router.cpp index 6a81816aea..d5853473af 100644 --- a/cpp/src/qpid/broker/Router.cpp +++ b/cpp/src/qpid/broker/Router.cpp @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./qpid/broker/Router.h" +#include "qpid/broker/Router.h" using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/Router.h b/cpp/src/qpid/broker/Router.h index 23739e6527..3b4a3a0a4c 100644 --- a/cpp/src/qpid/broker/Router.h +++ b/cpp/src/qpid/broker/Router.h @@ -18,8 +18,8 @@ #ifndef _Router_ #define _Router_ -#include "./qpid/broker/ExchangeRegistry.h" -#include "./qpid/broker/Message.h" +#include "qpid/broker/ExchangeRegistry.h" +#include "qpid/broker/Message.h" /** * A routing functor diff --git a/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp b/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp index 8afff976e1..60ee9cc4ad 100644 --- a/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp +++ b/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp @@ -15,10 +15,10 @@ * limitations under the License. * */ -#include "./qpid/broker/SessionHandlerFactoryImpl.h" -#include "./qpid/broker/SessionHandlerImpl.h" -#include "./qpid/broker/FanOutExchange.h" -#include "./qpid/broker/HeadersExchange.h" +#include "qpid/broker/SessionHandlerFactoryImpl.h" +#include "qpid/broker/SessionHandlerImpl.h" +#include "qpid/broker/FanOutExchange.h" +#include "qpid/broker/HeadersExchange.h" using namespace qpid::broker; using namespace qpid::io; diff --git a/cpp/src/qpid/broker/SessionHandlerFactoryImpl.h b/cpp/src/qpid/broker/SessionHandlerFactoryImpl.h index 2875cf63e6..25b4c0c13a 100644 --- a/cpp/src/qpid/broker/SessionHandlerFactoryImpl.h +++ b/cpp/src/qpid/broker/SessionHandlerFactoryImpl.h @@ -18,14 +18,14 @@ #ifndef _SessionHandlerFactoryImpl_ #define _SessionHandlerFactoryImpl_ -#include "./qpid/framing/AMQFrame.h" -#include "./qpid/broker/AutoDelete.h" -#include "./qpid/broker/DirectExchange.h" -#include "./qpid/broker/ExchangeRegistry.h" -#include "./qpid/framing/ProtocolInitiation.h" -#include "./qpid/broker/QueueRegistry.h" -#include "./qpid/io/SessionHandlerFactory.h" -#include "./qpid/io/TimeoutHandler.h" +#include "qpid/framing/AMQFrame.h" +#include "qpid/broker/AutoDelete.h" +#include "qpid/broker/DirectExchange.h" +#include "qpid/broker/ExchangeRegistry.h" +#include "qpid/framing/ProtocolInitiation.h" +#include "qpid/broker/QueueRegistry.h" +#include "qpid/io/SessionHandlerFactory.h" +#include "qpid/io/TimeoutHandler.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.cpp b/cpp/src/qpid/broker/SessionHandlerImpl.cpp index 49d43d8f8b..157fca5acb 100644 --- a/cpp/src/qpid/broker/SessionHandlerImpl.cpp +++ b/cpp/src/qpid/broker/SessionHandlerImpl.cpp @@ -16,11 +16,11 @@ * */ #include -#include "./qpid/broker/SessionHandlerImpl.h" -#include "./qpid/broker/FanOutExchange.h" -#include "./qpid/broker/HeadersExchange.h" -#include "./qpid/broker/Router.h" -#include "./qpid/broker/TopicExchange.h" +#include "qpid/broker/SessionHandlerImpl.h" +#include "qpid/broker/FanOutExchange.h" +#include "qpid/broker/HeadersExchange.h" +#include "qpid/broker/Router.h" +#include "qpid/broker/TopicExchange.h" #include "assert.h" using namespace std::tr1; diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.h b/cpp/src/qpid/broker/SessionHandlerImpl.h index 09a4a67e66..4504541623 100644 --- a/cpp/src/qpid/broker/SessionHandlerImpl.h +++ b/cpp/src/qpid/broker/SessionHandlerImpl.h @@ -22,21 +22,21 @@ #include #include #include -#include "./qpid/framing/AMQFrame.h" +#include "qpid/framing/AMQFrame.h" #include "qpid/framing/AMQP_ClientProxy.h" #include "qpid/framing/AMQP_ServerOperations.h" -#include "./qpid/broker/AutoDelete.h" -#include "./qpid/broker/ExchangeRegistry.h" -#include "./qpid/broker/Channel.h" -#include "./qpid/broker/ConnectionToken.h" -#include "./qpid/broker/DirectExchange.h" -#include "./qpid/framing/OutputHandler.h" -#include "./qpid/framing/ProtocolInitiation.h" -#include "./qpid/broker/QueueRegistry.h" -#include "./qpid/io/SessionContext.h" -#include "./qpid/io/SessionHandler.h" -#include "./qpid/io/TimeoutHandler.h" -#include "./qpid/broker/TopicExchange.h" +#include "qpid/broker/AutoDelete.h" +#include "qpid/broker/ExchangeRegistry.h" +#include "qpid/broker/Channel.h" +#include "qpid/broker/ConnectionToken.h" +#include "qpid/broker/DirectExchange.h" +#include "qpid/framing/OutputHandler.h" +#include "qpid/framing/ProtocolInitiation.h" +#include "qpid/broker/QueueRegistry.h" +#include "qpid/io/SessionContext.h" +#include "qpid/io/SessionHandler.h" +#include "qpid/io/TimeoutHandler.h" +#include "qpid/broker/TopicExchange.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp index 2affa6057d..6498e7600d 100644 --- a/cpp/src/qpid/broker/TopicExchange.cpp +++ b/cpp/src/qpid/broker/TopicExchange.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "./qpid/broker/TopicExchange.h" -#include "./qpid/broker/ExchangeBinding.h" +#include "qpid/broker/TopicExchange.h" +#include "qpid/broker/ExchangeBinding.h" #include using namespace qpid::broker; diff --git a/cpp/src/qpid/broker/TopicExchange.h b/cpp/src/qpid/broker/TopicExchange.h index 8bad7aab4c..29772f5bce 100644 --- a/cpp/src/qpid/broker/TopicExchange.h +++ b/cpp/src/qpid/broker/TopicExchange.h @@ -20,11 +20,11 @@ #include #include -#include "./qpid/broker/Exchange.h" -#include "./qpid/framing/FieldTable.h" -#include "./qpid/broker/Message.h" -#include "./qpid/concurrent/MonitorImpl.h" -#include "./qpid/broker/Queue.h" +#include "qpid/broker/Exchange.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/broker/Message.h" +#include "qpid/concurrent/MonitorImpl.h" +#include "qpid/broker/Queue.h" namespace qpid { namespace broker { diff --git a/cpp/src/qpid/framing/AMQBody.h b/cpp/src/qpid/framing/AMQBody.h index 1c7f9419ed..e9d77225fa 100644 --- a/cpp/src/qpid/framing/AMQBody.h +++ b/cpp/src/qpid/framing/AMQBody.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./memory.h" +#include "memory.h" #include "qpid/framing/amqp_types.h" #include "qpid/framing/Buffer.h" diff --git a/cpp/src/qpid/framing/BodyHandler.cpp b/cpp/src/qpid/framing/BodyHandler.cpp index f9079c27ea..ddf80b276d 100644 --- a/cpp/src/qpid/framing/BodyHandler.cpp +++ b/cpp/src/qpid/framing/BodyHandler.cpp @@ -15,7 +15,7 @@ * limitations under the License. * */ -#include "./memory.h" +#include "memory.h" #include "qpid/framing/BodyHandler.h" using namespace qpid::framing; diff --git a/cpp/test/unit/qpid/broker/ChannelTest.cpp b/cpp/test/unit/qpid/broker/ChannelTest.cpp index 8d54208f77..2197c1724a 100644 --- a/cpp/test/unit/qpid/broker/ChannelTest.cpp +++ b/cpp/test/unit/qpid/broker/ChannelTest.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "../../src/qpid/broker/Channel.h" -#include "../../src/qpid/broker/Message.h" +#include "qpid/broker/Channel.h" +#include "qpid/broker/Message.h" #include #include #include diff --git a/cpp/test/unit/qpid/broker/ExchangeTest.cpp b/cpp/test/unit/qpid/broker/ExchangeTest.cpp index 3d21cb66f0..adebc87422 100644 --- a/cpp/test/unit/qpid/broker/ExchangeTest.cpp +++ b/cpp/test/unit/qpid/broker/ExchangeTest.cpp @@ -16,10 +16,10 @@ * */ -#include "../../src/qpid/broker/DirectExchange.h" -#include "../../src/qpid/broker/Exchange.h" -#include "../../src/qpid/broker/Queue.h" -#include "../../src/qpid/broker/TopicExchange.h" +#include "qpid/broker/DirectExchange.h" +#include "qpid/broker/Exchange.h" +#include "qpid/broker/Queue.h" +#include "qpid/broker/TopicExchange.h" #include #include diff --git a/cpp/test/unit/qpid/broker/HeadersExchangeTest.cpp b/cpp/test/unit/qpid/broker/HeadersExchangeTest.cpp index d8fe71350e..a57c1d8800 100644 --- a/cpp/test/unit/qpid/broker/HeadersExchangeTest.cpp +++ b/cpp/test/unit/qpid/broker/HeadersExchangeTest.cpp @@ -16,9 +16,9 @@ * */ -#include "../../src/qpid/broker/HeadersExchange.h" -#include "../../src/qpid/framing/FieldTable.h" -#include "../../src/qpid/framing/Value.h" +#include "qpid/broker/HeadersExchange.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/framing/Value.h" #include using namespace qpid::broker; diff --git a/cpp/test/unit/qpid/broker/MessageTest.cpp b/cpp/test/unit/qpid/broker/MessageTest.cpp index f6586f721a..210cd63934 100644 --- a/cpp/test/unit/qpid/broker/MessageTest.cpp +++ b/cpp/test/unit/qpid/broker/MessageTest.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "../../src/qpid/concurrent/APRBase.h" -#include "../../src/qpid/broker/Message.h" +#include "qpid/concurrent/APRBase.h" +#include "qpid/broker/Message.h" #include #include diff --git a/cpp/test/unit/qpid/broker/QueueRegistryTest.cpp b/cpp/test/unit/qpid/broker/QueueRegistryTest.cpp index 96fbc88069..59034fb7c8 100644 --- a/cpp/test/unit/qpid/broker/QueueRegistryTest.cpp +++ b/cpp/test/unit/qpid/broker/QueueRegistryTest.cpp @@ -1,4 +1,4 @@ -#include "../../src/qpid/broker/QueueRegistry.h" +#include "qpid/broker/QueueRegistry.h" #include #include diff --git a/cpp/test/unit/qpid/broker/QueueTest.cpp b/cpp/test/unit/qpid/broker/QueueTest.cpp index fa6344c265..5b06cb93ca 100644 --- a/cpp/test/unit/qpid/broker/QueueTest.cpp +++ b/cpp/test/unit/qpid/broker/QueueTest.cpp @@ -15,8 +15,8 @@ * limitations under the License. * */ -#include "../../src/qpid/broker/Queue.h" -#include "../../src/qpid/broker/QueueRegistry.h" +#include "qpid/broker/Queue.h" +#include "qpid/broker/QueueRegistry.h" #include #include diff --git a/cpp/test/unit/qpid/broker/RouterTest.cpp b/cpp/test/unit/qpid/broker/RouterTest.cpp index 7b77162905..f2c9f27abd 100644 --- a/cpp/test/unit/qpid/broker/RouterTest.cpp +++ b/cpp/test/unit/qpid/broker/RouterTest.cpp @@ -15,11 +15,11 @@ * limitations under the License. * */ -#include "../../src/qpid/broker/Channel.h" -#include "../../src/qpid/broker/Exchange.h" -#include "../../src/qpid/broker/ExchangeRegistry.h" -#include "../../src/qpid/broker/Message.h" -#include "../../src/qpid/broker/Router.h" +#include "qpid/broker/Channel.h" +#include "qpid/broker/Exchange.h" +#include "qpid/broker/ExchangeRegistry.h" +#include "qpid/broker/Message.h" +#include "qpid/broker/Router.h" #include #include #include diff --git a/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp b/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp index 4066a4709f..8d7903c4ac 100644 --- a/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp +++ b/cpp/test/unit/qpid/broker/TopicExchangeTest.cpp @@ -1,4 +1,4 @@ -#include "../../src/qpid/broker/TopicExchange.h" +#include "qpid/broker/TopicExchange.h" #include using namespace qpid::broker; diff --git a/cpp/test/unit/qpid/broker/ValueTest.cpp b/cpp/test/unit/qpid/broker/ValueTest.cpp index 89444c38cf..2cb2563b46 100644 --- a/cpp/test/unit/qpid/broker/ValueTest.cpp +++ b/cpp/test/unit/qpid/broker/ValueTest.cpp @@ -1,4 +1,4 @@ -#include "../../src/qpid/framing/Value.h" +#include "qpid/framing/Value.h" #include using namespace qpid::framing; diff --git a/cpp/test/unit/qpid/framing/BodyHandlerTest.cpp b/cpp/test/unit/qpid/framing/BodyHandlerTest.cpp index 6b011743c0..d6edf37d51 100644 --- a/cpp/test/unit/qpid/framing/BodyHandlerTest.cpp +++ b/cpp/test/unit/qpid/framing/BodyHandlerTest.cpp @@ -16,7 +16,7 @@ * */ #include -#include "../../src/qpid/framing/amqp_framing.h" +#include "qpid/framing/amqp_framing.h" #include "qpid_test_plugin.h" using namespace qpid::framing; diff --git a/cpp/test/unit/qpid/framing/FieldTableTest.cpp b/cpp/test/unit/qpid/framing/FieldTableTest.cpp new file mode 100644 index 0000000000..b11addfd0e --- /dev/null +++ b/cpp/test/unit/qpid/framing/FieldTableTest.cpp @@ -0,0 +1,52 @@ +/* + * + * 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. + * + */ +#include +#include "qpid/framing/amqp_framing.h" +#include + +using namespace qpid::framing; + +class FieldTableTest : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(FieldTableTest); + CPPUNIT_TEST(testMe); + CPPUNIT_TEST_SUITE_END(); + + public: + + void testMe() + { + FieldTable ft; + ft.setString("A", "BCDE"); + CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft.getString("A")); + + Buffer buffer(100); + buffer.putFieldTable(ft); + buffer.flip(); + FieldTable ft2; + buffer.getFieldTable(ft2); + CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft2.getString("A")); + + } +}; + + +// Make this test suite a plugin. +CPPUNIT_PLUGIN_IMPLEMENT(); +CPPUNIT_TEST_SUITE_REGISTRATION(FieldTableTest); + diff --git a/cpp/test/unit/qpid/framing/FramingTest.cpp b/cpp/test/unit/qpid/framing/FramingTest.cpp new file mode 100644 index 0000000000..950d1e045a --- /dev/null +++ b/cpp/test/unit/qpid/framing/FramingTest.cpp @@ -0,0 +1,144 @@ +/* + * + * 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. + * + */ +#include "qpid/framing/amqp_framing.h" +#include "qpid/framing/ConnectionRedirectBody.h" +#include +#include +#include +#include + +using namespace qpid::framing; + +// TODO aconway 2006-09-12: Why do we need explicit qpid::framing:: below? + +template +std::string tostring(const T& x) +{ + std::ostringstream out; + out << x; + return out.str(); +} + +class FramingTest : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(FramingTest); + CPPUNIT_TEST(testBasicQosBody); + CPPUNIT_TEST(testConnectionSecureBody); + CPPUNIT_TEST(testConnectionRedirectBody); + CPPUNIT_TEST(testAccessRequestBody); + CPPUNIT_TEST(testBasicConsumeBody); + CPPUNIT_TEST(ConnectionRedirectBody); + CPPUNIT_TEST(BasicConsumeOkBody); + CPPUNIT_TEST_SUITE_END(); + + private: + Buffer buffer; + + public: + + FramingTest() : buffer(100) {} + + void testBasicQosBody() + { + BasicQosBody in(0xCAFEBABE, 0xABBA, true); + in.encodeContent(buffer); + buffer.flip(); + BasicQosBody out; + out.decodeContent(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + void testConnectionSecureBody() + { + std::string s = "security credential"; + ConnectionSecureBody in(s); + in.encodeContent(buffer); + buffer.flip(); + ConnectionSecureBody out; + out.decodeContent(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + void testConnectionRedirectBody() + { + std::string a = "hostA"; + std::string b = "hostB"; + qpid::framing::ConnectionRedirectBody in(a, b); + in.encodeContent(buffer); + buffer.flip(); + qpid::framing::ConnectionRedirectBody out; + out.decodeContent(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + void testAccessRequestBody() + { + std::string s = "text"; + AccessRequestBody in(s, true, false, true, false, true); + in.encodeContent(buffer); + buffer.flip(); + AccessRequestBody out; + out.decodeContent(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + void testBasicConsumeBody() + { + std::string q = "queue"; + std::string t = "tag"; + BasicConsumeBody in(0, q, t, false, true, false, false); + in.encodeContent(buffer); + buffer.flip(); + BasicConsumeBody out; + out.decodeContent(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + + void ConnectionRedirectBody() + { + std::string a = "hostA"; + std::string b = "hostB"; + AMQFrame in(999, new qpid::framing::ConnectionRedirectBody(a, b)); + in.encode(buffer); + buffer.flip(); + AMQFrame out; + out.decode(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + + void BasicConsumeOkBody() + { + std::string s = "hostA"; + AMQFrame in(999, new qpid::framing::BasicConsumeOkBody(s)); + in.encode(buffer); + buffer.flip(); + AMQFrame out; + for(int i = 0; i < 5; i++){ + out.decode(buffer); + CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); + } + } +}; + +// Make this test suite a plugin. +CPPUNIT_PLUGIN_IMPLEMENT(); +CPPUNIT_TEST_SUITE_REGISTRATION(FramingTest); + + + diff --git a/cpp/test/unit/qpid/framing/HeaderTest.cpp b/cpp/test/unit/qpid/framing/HeaderTest.cpp new file mode 100644 index 0000000000..cf0d9fe5bd --- /dev/null +++ b/cpp/test/unit/qpid/framing/HeaderTest.cpp @@ -0,0 +1,141 @@ +/* + * + * 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. + * + */ +#include +#include "qpid/framing/amqp_framing.h" +#include + +using namespace qpid::framing; + +class HeaderTest : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(HeaderTest); + CPPUNIT_TEST(testGenericProperties); + CPPUNIT_TEST(testAllSpecificProperties); + CPPUNIT_TEST(testSomeSpecificProperties); + CPPUNIT_TEST_SUITE_END(); + +public: + + // TODO aconway 2006-09-12: Need more detailed tests, + // need tests to assert something! + // + void testGenericProperties() + { + AMQHeaderBody body(BASIC); + dynamic_cast(body.getProperties())->getHeaders().setString("A", "BCDE"); + Buffer buffer(100); + + body.encode(buffer); + buffer.flip(); + AMQHeaderBody body2; + body2.decode(buffer, body.size()); + BasicHeaderProperties* props = + dynamic_cast(body2.getProperties()); + CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), + props->getHeaders().getString("A")); + } + + void testAllSpecificProperties(){ + string contentType("text/html"); + string contentEncoding("UTF8"); + u_int8_t deliveryMode(2); + u_int8_t priority(3); + string correlationId("abc"); + string replyTo("no-address"); + string expiration("why is this a string?"); + string messageId("xyz"); + u_int64_t timestamp(0xabcd); + string type("eh?"); + string userId("guest"); + string appId("just testing"); + string clusterId("no clustering required"); + + AMQHeaderBody body(BASIC); + BasicHeaderProperties* properties = + dynamic_cast(body.getProperties()); + properties->setContentType(contentType); + properties->getHeaders().setString("A", "BCDE"); + properties->setDeliveryMode(deliveryMode); + properties->setPriority(priority); + properties->setCorrelationId(correlationId); + properties->setReplyTo(replyTo); + properties->setExpiration(expiration); + properties->setMessageId(messageId); + properties->setTimestamp(timestamp); + properties->setType(type); + properties->setUserId(userId); + properties->setAppId(appId); + properties->setClusterId(clusterId); + + Buffer buffer(10000); + body.encode(buffer); + buffer.flip(); + AMQHeaderBody temp; + temp.decode(buffer, body.size()); + properties = dynamic_cast(temp.getProperties()); + + CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); + CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), properties->getHeaders().getString("A")); + CPPUNIT_ASSERT_EQUAL(deliveryMode, properties->getDeliveryMode()); + CPPUNIT_ASSERT_EQUAL(priority, properties->getPriority()); + CPPUNIT_ASSERT_EQUAL(correlationId, properties->getCorrelationId()); + CPPUNIT_ASSERT_EQUAL(replyTo, properties->getReplyTo()); + CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); + CPPUNIT_ASSERT_EQUAL(messageId, properties->getMessageId()); + CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); + CPPUNIT_ASSERT_EQUAL(type, properties->getType()); + CPPUNIT_ASSERT_EQUAL(userId, properties->getUserId()); + CPPUNIT_ASSERT_EQUAL(appId, properties->getAppId()); + CPPUNIT_ASSERT_EQUAL(clusterId, properties->getClusterId()); + } + + void testSomeSpecificProperties(){ + string contentType("application/octet-stream"); + u_int8_t deliveryMode(5); + u_int8_t priority(6); + string expiration("Z"); + u_int64_t timestamp(0xabe4a34a); + + AMQHeaderBody body(BASIC); + BasicHeaderProperties* properties = + dynamic_cast(body.getProperties()); + properties->setContentType(contentType); + properties->setDeliveryMode(deliveryMode); + properties->setPriority(priority); + properties->setExpiration(expiration); + properties->setTimestamp(timestamp); + + Buffer buffer(100); + body.encode(buffer); + buffer.flip(); + AMQHeaderBody temp; + temp.decode(buffer, body.size()); + properties = dynamic_cast(temp.getProperties()); + + CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); + CPPUNIT_ASSERT_EQUAL((int) deliveryMode, (int) properties->getDeliveryMode()); + CPPUNIT_ASSERT_EQUAL((int) priority, (int) properties->getPriority()); + CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); + CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); + } +}; + +// Make this test suite a plugin. +CPPUNIT_PLUGIN_IMPLEMENT(); +CPPUNIT_TEST_SUITE_REGISTRATION(HeaderTest); + diff --git a/cpp/test/unit/qpid/framing/field_table_test.cpp b/cpp/test/unit/qpid/framing/field_table_test.cpp deleted file mode 100644 index 8f2fe61611..0000000000 --- a/cpp/test/unit/qpid/framing/field_table_test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * 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. - * - */ -#include -#include "../../src/qpid/framing/amqp_framing.h" -#include - -using namespace qpid::framing; - -class FieldTableTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FieldTableTest); - CPPUNIT_TEST(testMe); - CPPUNIT_TEST_SUITE_END(); - - public: - - void testMe() - { - FieldTable ft; - ft.setString("A", "BCDE"); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft.getString("A")); - - Buffer buffer(100); - buffer.putFieldTable(ft); - buffer.flip(); - FieldTable ft2; - buffer.getFieldTable(ft2); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft2.getString("A")); - - } -}; - - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(FieldTableTest); - diff --git a/cpp/test/unit/qpid/framing/framing_test.cpp b/cpp/test/unit/qpid/framing/framing_test.cpp deleted file mode 100644 index 40ce3d97ed..0000000000 --- a/cpp/test/unit/qpid/framing/framing_test.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * 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. - * - */ -#include "../../src/qpid/framing/amqp_framing.h" -#include "ConnectionRedirectBody.h" -#include -#include -#include -#include - -using namespace qpid::framing; - -// TODO aconway 2006-09-12: Why do we need explicit qpid::framing:: below? - -template -std::string tostring(const T& x) -{ - std::ostringstream out; - out << x; - return out.str(); -} - -class FramingTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FramingTest); - CPPUNIT_TEST(testBasicQosBody); - CPPUNIT_TEST(testConnectionSecureBody); - CPPUNIT_TEST(testConnectionRedirectBody); - CPPUNIT_TEST(testAccessRequestBody); - CPPUNIT_TEST(testBasicConsumeBody); - CPPUNIT_TEST(ConnectionRedirectBody); - CPPUNIT_TEST(BasicConsumeOkBody); - CPPUNIT_TEST_SUITE_END(); - - private: - Buffer buffer; - - public: - - FramingTest() : buffer(100) {} - - void testBasicQosBody() - { - BasicQosBody in(0xCAFEBABE, 0xABBA, true); - in.encodeContent(buffer); - buffer.flip(); - BasicQosBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionSecureBody() - { - std::string s = "security credential"; - ConnectionSecureBody in(s); - in.encodeContent(buffer); - buffer.flip(); - ConnectionSecureBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionRedirectBody() - { - std::string a = "hostA"; - std::string b = "hostB"; - qpid::framing::ConnectionRedirectBody in(a, b); - in.encodeContent(buffer); - buffer.flip(); - qpid::framing::ConnectionRedirectBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testAccessRequestBody() - { - std::string s = "text"; - AccessRequestBody in(s, true, false, true, false, true); - in.encodeContent(buffer); - buffer.flip(); - AccessRequestBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testBasicConsumeBody() - { - std::string q = "queue"; - std::string t = "tag"; - BasicConsumeBody in(0, q, t, false, true, false, false); - in.encodeContent(buffer); - buffer.flip(); - BasicConsumeBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - - void ConnectionRedirectBody() - { - std::string a = "hostA"; - std::string b = "hostB"; - AMQFrame in(999, new qpid::framing::ConnectionRedirectBody(a, b)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void BasicConsumeOkBody() - { - std::string s = "hostA"; - AMQFrame in(999, new qpid::framing::BasicConsumeOkBody(s)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - for(int i = 0; i < 5; i++){ - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - } -}; - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(FramingTest); - - - diff --git a/cpp/test/unit/qpid/framing/header_test.cpp b/cpp/test/unit/qpid/framing/header_test.cpp deleted file mode 100644 index 9268c54272..0000000000 --- a/cpp/test/unit/qpid/framing/header_test.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * 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. - * - */ -#include -#include "../../src/qpid/framing/amqp_framing.h" -#include - -using namespace qpid::framing; - -class HeaderTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(HeaderTest); - CPPUNIT_TEST(testGenericProperties); - CPPUNIT_TEST(testAllSpecificProperties); - CPPUNIT_TEST(testSomeSpecificProperties); - CPPUNIT_TEST_SUITE_END(); - -public: - - // TODO aconway 2006-09-12: Need more detailed tests, - // need tests to assert something! - // - void testGenericProperties() - { - AMQHeaderBody body(BASIC); - dynamic_cast(body.getProperties())->getHeaders().setString("A", "BCDE"); - Buffer buffer(100); - - body.encode(buffer); - buffer.flip(); - AMQHeaderBody body2; - body2.decode(buffer, body.size()); - BasicHeaderProperties* props = - dynamic_cast(body2.getProperties()); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), - props->getHeaders().getString("A")); - } - - void testAllSpecificProperties(){ - string contentType("text/html"); - string contentEncoding("UTF8"); - u_int8_t deliveryMode(2); - u_int8_t priority(3); - string correlationId("abc"); - string replyTo("no-address"); - string expiration("why is this a string?"); - string messageId("xyz"); - u_int64_t timestamp(0xabcd); - string type("eh?"); - string userId("guest"); - string appId("just testing"); - string clusterId("no clustering required"); - - AMQHeaderBody body(BASIC); - BasicHeaderProperties* properties = - dynamic_cast(body.getProperties()); - properties->setContentType(contentType); - properties->getHeaders().setString("A", "BCDE"); - properties->setDeliveryMode(deliveryMode); - properties->setPriority(priority); - properties->setCorrelationId(correlationId); - properties->setReplyTo(replyTo); - properties->setExpiration(expiration); - properties->setMessageId(messageId); - properties->setTimestamp(timestamp); - properties->setType(type); - properties->setUserId(userId); - properties->setAppId(appId); - properties->setClusterId(clusterId); - - Buffer buffer(10000); - body.encode(buffer); - buffer.flip(); - AMQHeaderBody temp; - temp.decode(buffer, body.size()); - properties = dynamic_cast(temp.getProperties()); - - CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), properties->getHeaders().getString("A")); - CPPUNIT_ASSERT_EQUAL(deliveryMode, properties->getDeliveryMode()); - CPPUNIT_ASSERT_EQUAL(priority, properties->getPriority()); - CPPUNIT_ASSERT_EQUAL(correlationId, properties->getCorrelationId()); - CPPUNIT_ASSERT_EQUAL(replyTo, properties->getReplyTo()); - CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); - CPPUNIT_ASSERT_EQUAL(messageId, properties->getMessageId()); - CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); - CPPUNIT_ASSERT_EQUAL(type, properties->getType()); - CPPUNIT_ASSERT_EQUAL(userId, properties->getUserId()); - CPPUNIT_ASSERT_EQUAL(appId, properties->getAppId()); - CPPUNIT_ASSERT_EQUAL(clusterId, properties->getClusterId()); - } - - void testSomeSpecificProperties(){ - string contentType("application/octet-stream"); - u_int8_t deliveryMode(5); - u_int8_t priority(6); - string expiration("Z"); - u_int64_t timestamp(0xabe4a34a); - - AMQHeaderBody body(BASIC); - BasicHeaderProperties* properties = - dynamic_cast(body.getProperties()); - properties->setContentType(contentType); - properties->setDeliveryMode(deliveryMode); - properties->setPriority(priority); - properties->setExpiration(expiration); - properties->setTimestamp(timestamp); - - Buffer buffer(100); - body.encode(buffer); - buffer.flip(); - AMQHeaderBody temp; - temp.decode(buffer, body.size()); - properties = dynamic_cast(temp.getProperties()); - - CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); - CPPUNIT_ASSERT_EQUAL((int) deliveryMode, (int) properties->getDeliveryMode()); - CPPUNIT_ASSERT_EQUAL((int) priority, (int) properties->getPriority()); - CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); - CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); - } -}; - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(HeaderTest); - -- cgit v1.2.1