summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-03-23 20:07:01 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-03-23 20:07:01 +0000
commitccce021f378b77725c27529a631e93605c283fd4 (patch)
tree30189e5525bf94eee1da272346594caef558ee0d
parent4811244f441b02ac10a9137ba71d45928780ed8c (diff)
downloadqpid-python-ccce021f378b77725c27529a631e93605c283fd4.tar.gz
merge r926606:926753 from trunk - trunk passes cluster tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qmf-devel0.7a@926759 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/BuildInstallSettings.cmake2
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionImpl.cpp9
-rw-r--r--qpid/python/qpid/messaging/message.py8
-rw-r--r--qpid/python/qpid/tests/messaging/message.py4
4 files changed, 16 insertions, 7 deletions
diff --git a/qpid/cpp/BuildInstallSettings.cmake b/qpid/cpp/BuildInstallSettings.cmake
index c1cf2bcba2..b3ca26b6ad 100644
--- a/qpid/cpp/BuildInstallSettings.cmake
+++ b/qpid/cpp/BuildInstallSettings.cmake
@@ -92,7 +92,7 @@ if (WIN32)
"Directory to install read-only arch.-independent data root")
set (QPID_INSTALL_EXAMPLESDIR examples CACHE STRING
"Directory to install programming examples in")
- set (QPID_INSTALL_HTMLDIR html CACHE STRING
+ set (QPID_INSTALL_HTMLDIR docs/api/html CACHE STRING
"Directory to install HTML documentation")
set (QPID_INSTALL_INCLUDEDIR include CACHE STRING
"Directory to install programming header files")
diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
index ec1f4584db..05a781c2d9 100644
--- a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -89,6 +89,8 @@ public:
void add() {
ScopedLock<Mutex> l(threadLock);
++connections;
+ if (!poller_)
+ poller_.reset(new Poller);
if (ioThreads < maxIOThreads) {
QPID_LOG(debug, "Created IO thread: " << ioThreads);
++ioThreads;
@@ -102,14 +104,14 @@ public:
}
Poller::shared_ptr poller() const {
+ assert(poller_);
return poller_;
}
// Here is where the maximum number of threads is set
IOThread(int c) :
ioThreads(0),
- connections(0),
- poller_(new Poller)
+ connections(0)
{
IOThreadOptions options(c);
options.parse(0, 0, QPIDC_CONF_FILE, true);
@@ -122,7 +124,8 @@ public:
// and we can't do that before we're unloaded as we can't
// restart the Poller after shutting it down
~IOThread() {
- poller_->shutdown();
+ if (poller_)
+ poller_->shutdown();
for (int i=0; i<ioThreads; ++i) {
t[i].join();
}
diff --git a/qpid/python/qpid/messaging/message.py b/qpid/python/qpid/messaging/message.py
index a9660b05b1..d89fa00dc3 100644
--- a/qpid/python/qpid/messaging/message.py
+++ b/qpid/python/qpid/messaging/message.py
@@ -47,20 +47,22 @@ TYPE_MAPPINGS={
None.__class__: None
}
+DEFAULT_CODEC = (lambda x: x, lambda x: x)
+
TYPE_CODEC={
"amqp/map": codec("map"),
"amqp/list": codec("list"),
"text/plain; charset=utf8": (lambda x: x.encode("utf8"), lambda x: x.decode("utf8")),
"text/plain": (lambda x: x.encode("utf8"), lambda x: x.decode("utf8")),
- "": (lambda x: x, lambda x: x),
- None: (lambda x: x, lambda x: x)
+ "": DEFAULT_CODEC,
+ None: DEFAULT_CODEC
}
def get_type(content):
return TYPE_MAPPINGS[content.__class__]
def get_codec(content_type):
- return TYPE_CODEC[content_type]
+ return TYPE_CODEC.get(content_type, DEFAULT_CODEC)
UNSPECIFIED = object()
diff --git a/qpid/python/qpid/tests/messaging/message.py b/qpid/python/qpid/tests/messaging/message.py
index 654076588b..f2701af64b 100644
--- a/qpid/python/qpid/tests/messaging/message.py
+++ b/qpid/python/qpid/tests/messaging/message.py
@@ -107,3 +107,7 @@ class MessageEchoTests(Base):
msg.properties = MessageEchoTests.TEST_MAP
msg.reply_to = "reply-address"
self.check(msg)
+
+ def testContentTypeUnknown(self):
+ msg = Message(content_type = "this-content-type-does-not-exist")
+ self.check(msg)