summaryrefslogtreecommitdiff
path: root/cpp/bindings
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2012-05-04 15:39:19 +0000
committerKim van der Riet <kpvdr@apache.org>2012-05-04 15:39:19 +0000
commit633c33f224f3196f3f9bd80bd2e418d8143fea06 (patch)
tree1391da89470593209466df68c0b40b89c14963b1 /cpp/bindings
parentc73f9286ebff93a6c8dbc29cf05e258c4b55c976 (diff)
downloadqpid-python-633c33f224f3196f3f9bd80bd2e418d8143fea06.tar.gz
QPID-3858: Updated branch - merged from trunk r.1333987
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1334037 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings')
-rw-r--r--cpp/bindings/qmf/ruby/qmf.rb26
-rwxr-xr-xcpp/bindings/qmf/tests/run_interop_tests3
-rw-r--r--cpp/bindings/qpid/Makefile.am2
-rw-r--r--cpp/bindings/qpid/dotnet/Makefile.am2
-rw-r--r--cpp/bindings/qpid/python/python.i42
-rw-r--r--cpp/bindings/qpid/ruby/README.rdoc2
-rw-r--r--cpp/bindings/qpid/ruby/Rakefile4
-rw-r--r--cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb19
-rw-r--r--cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb19
-rw-r--r--cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb19
-rw-r--r--cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb19
-rw-r--r--cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb19
-rw-r--r--cpp/bindings/qpid/ruby/lib/qpid/encoding.rb6
-rw-r--r--cpp/bindings/qpid/ruby/lib/qpid/version.rb2
-rw-r--r--cpp/bindings/swig_python_typemaps.i6
15 files changed, 153 insertions, 37 deletions
diff --git a/cpp/bindings/qmf/ruby/qmf.rb b/cpp/bindings/qmf/ruby/qmf.rb
index 34d3255d8d..9fbd50cbf6 100644
--- a/cpp/bindings/qmf/ruby/qmf.rb
+++ b/cpp/bindings/qmf/ruby/qmf.rb
@@ -26,18 +26,28 @@ module Qmf
# Pull all the TYPE_* constants into Qmf namespace. Maybe there's an easier way?
Qmfengine.constants.each do |c|
+ c = c.to_s
if c.index('TYPE_') == 0 or c.index('ACCESS_') == 0 or c.index('DIR_') == 0 or
c.index('CLASS_') == 0 or c.index('SEV_') == 0
const_set(c, Qmfengine.const_get(c))
end
end
+ module StringHelpers
+ def ensure_encoding(str)
+ enc = (Encoding.default_external.name || "UTF-8" rescue "UTF-8")
+ str.respond_to?(:force_encoding) ? str.force_encoding(enc) : str
+ end
+ end
+
class Util
+ include StringHelpers
+
def qmf_to_native(val)
case val.getType
when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
when TYPE_UINT64 then val.asUint64
- when TYPE_SSTR, TYPE_LSTR then val.asString
+ when TYPE_SSTR, TYPE_LSTR then ensure_encoding(val.asString)
when TYPE_ABSTIME then val.asInt64
when TYPE_DELTATIME then val.asUint64
when TYPE_REF then ObjectId.new(val.asObjectId)
@@ -161,6 +171,7 @@ module Qmf
##==============================================================================
class ConnectionSettings
+ include StringHelpers
attr_reader :impl
def initialize(url = nil)
@@ -192,7 +203,7 @@ module Qmf
def get_attr(key)
_v = @impl.getAttr(key)
if _v.isString()
- return _v.asString()
+ return ensure_encoding(_v.asString())
elsif _v.isUint()
return _v.asUint()
elsif _v.isBool()
@@ -348,7 +359,7 @@ module Qmf
@broker = kwargs[:broker] if kwargs.include?(:broker)
@allow_sets = :true
- if cls:
+ if cls
@event_class = cls
@impl = Qmfengine::Event.new(@event_class.impl)
elsif kwargs.include?(:impl)
@@ -434,7 +445,7 @@ module Qmf
@allow_sets = :false
@broker = kwargs[:broker] if kwargs.include?(:broker)
- if cls:
+ if cls
@object_class = cls
@impl = Qmfengine::Object.new(@object_class.impl)
elsif kwargs.include?(:impl)
@@ -707,6 +718,8 @@ module Qmf
end
class MethodResponse
+ include StringHelpers
+
def initialize(impl)
@impl = Qmfengine::MethodResponse.new(impl)
end
@@ -720,7 +733,7 @@ module Qmf
end
def text
- exception.asString
+ ensure_encoding(exception.asString)
end
def args
@@ -885,6 +898,7 @@ module Qmf
end
class SchemaClassKey
+ include StringHelpers
attr_reader :impl
def initialize(i)
@impl = Qmfengine::SchemaClassKey.new(i)
@@ -899,7 +913,7 @@ module Qmf
end
def to_s
- @impl.asString
+ ensure_encoding(@impl.asString)
end
end
diff --git a/cpp/bindings/qmf/tests/run_interop_tests b/cpp/bindings/qmf/tests/run_interop_tests
index 83e7f2593b..c370f211af 100755
--- a/cpp/bindings/qmf/tests/run_interop_tests
+++ b/cpp/bindings/qmf/tests/run_interop_tests
@@ -24,6 +24,7 @@ MY_DIR=`dirname \`which $0\``
QPID_DIR=${MY_DIR}/../../../..
BUILD_DIR=../../..
PYTHON_DIR=${QPID_DIR}/python
+TOOLS_PY_DIR=${QPID_DIR}/tools/src/py
QMF_DIR=${QPID_DIR}/extras/qmf
QMF_DIR_PY=${QMF_DIR}/src/py
BROKER_DIR=${BUILD_DIR}/src
@@ -68,7 +69,7 @@ TESTS_FAILED=0
if test -d ${PYTHON_DIR} ; then
start_broker
echo "Running qmf interop tests using broker on port $BROKER_PORT"
- PYTHONPATH=${PYTHON_DIR}:${QMF_DIR_PY}:${MY_DIR}
+ PYTHONPATH=${PYTHON_DIR}:${QMF_DIR_PY}:${MY_DIR}:${TOOLS_PY_DIR}
export PYTHONPATH
if test -d ${PYTHON_LIB_DIR} ; then
diff --git a/cpp/bindings/qpid/Makefile.am b/cpp/bindings/qpid/Makefile.am
index eaf45c2076..ae81696f27 100644
--- a/cpp/bindings/qpid/Makefile.am
+++ b/cpp/bindings/qpid/Makefile.am
@@ -35,7 +35,7 @@ if HAVE_PERL_DEVEL
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src -I$(PERL_INC)
-EXTRA_DIST += perl/perl.i
+EXTRA_DIST += perl/perl.i perl/CMakeLists.txt
BUILT_SOURCES = perl/cqpid_perl.cpp
SWIG_FLAGS = -w362,401
diff --git a/cpp/bindings/qpid/dotnet/Makefile.am b/cpp/bindings/qpid/dotnet/Makefile.am
index f212a37bbe..82ae315578 100644
--- a/cpp/bindings/qpid/dotnet/Makefile.am
+++ b/cpp/bindings/qpid/dotnet/Makefile.am
@@ -80,7 +80,6 @@ EXTRA_DIST = configure-windows.ps1 \
examples/msvc9/csharp.map.callback.sender/csharp.map.callback.sender.csproj \
examples/msvc9/csharp.map.receiver/csharp.map.receiver.csproj \
examples/msvc9/csharp.map.sender/csharp.map.sender.csproj \
- extra_dist.txt \
Makefile.am \
msvc10/org.apache.qpid.messaging.sessionreceiver.sln \
msvc10/org.apache.qpid.messaging.sln \
@@ -93,7 +92,6 @@ EXTRA_DIST = configure-windows.ps1 \
src/AssemblyInfo.cpp \
src/Connection.cpp \
src/Connection.h \
- src/Duration.cpp \
src/Duration.h \
src/FailoverUpdates.cpp \
src/FailoverUpdates.h \
diff --git a/cpp/bindings/qpid/python/python.i b/cpp/bindings/qpid/python/python.i
index 9d45bf54ee..a53cf3b853 100644
--- a/cpp/bindings/qpid/python/python.i
+++ b/cpp/bindings/qpid/python/python.i
@@ -132,7 +132,10 @@ static PyObject* pTransportFailure;
# equivalent in C++, so we will translate them to sasl_mechanism
# when possible.
def __init__(self, url=None, **options):
- args = [url] if url else []
+ if url:
+ args = [url]
+ else:
+ args = []
if options :
if "sasl_mechanisms" in options :
if ' ' in options.get("sasl_mechanisms",'') :
@@ -196,7 +199,7 @@ static PyObject* pTransportFailure;
self._acknowledge_all(sync)
__swig_getmethods__["connection"] = getConnection
- if _newclass: connection = _swig_property(getConnection)
+ if _newclass: connection = property(getConnection)
%}
}
@@ -205,10 +208,10 @@ static PyObject* pTransportFailure;
%pythoncode %{
__swig_getmethods__["capacity"] = getCapacity
__swig_setmethods__["capacity"] = setCapacity
- if _newclass: capacity = _swig_property(getCapacity, setCapacity)
+ if _newclass: capacity = property(getCapacity, setCapacity)
__swig_getmethods__["session"] = getSession
- if _newclass: session = _swig_property(getSession)
+ if _newclass: session = property(getSession)
%}
%pythoncode %{
@@ -233,10 +236,10 @@ static PyObject* pTransportFailure;
__swig_getmethods__["capacity"] = getCapacity
__swig_setmethods__["capacity"] = setCapacity
- if _newclass: capacity = _swig_property(getCapacity, setCapacity)
+ if _newclass: capacity = property(getCapacity, setCapacity)
__swig_getmethods__["session"] = getSession
- if _newclass: session = _swig_property(getSession)
+ if _newclass: session = property(getSession)
%}
}
@@ -298,24 +301,23 @@ static PyObject* pTransportFailure;
self.setContent(content)
__swig_getmethods__["content"] = _get_content
__swig_setmethods__["content"] = _set_content
- if _newclass: content = _swig_property(_get_content, _set_content)
+ if _newclass: content = property(_get_content, _set_content)
__swig_getmethods__["content_type"] = getContentType
__swig_setmethods__["content_type"] = setContentType
- if _newclass: content_type = _swig_property(getContentType,
- setContentType)
+ if _newclass: content_type = property(getContentType, setContentType)
__swig_getmethods__["id"] = getMessageId
__swig_setmethods__["id"] = setMessageId
- if _newclass: id = _swig_property(getMessageId, setMessageId)
+ if _newclass: id = property(getMessageId, setMessageId)
__swig_getmethods__["subject"] = getSubject
__swig_setmethods__["subject"] = setSubject
- if _newclass: subject = _swig_property(getSubject, setSubject)
+ if _newclass: subject = property(getSubject, setSubject)
__swig_getmethods__["priority"] = getPriority
__swig_setmethods__["priority"] = setPriority
- if _newclass: priority = _swig_property(getPriority, setPriority)
+ if _newclass: priority = property(getPriority, setPriority)
def getTtl(self) :
return self._getTtl().getMilliseconds()/1000.0
@@ -323,28 +325,26 @@ static PyObject* pTransportFailure;
self._setTtl(Duration(int(1000*duration)))
__swig_getmethods__["ttl"] = getTtl
__swig_setmethods__["ttl"] = setTtl
- if _newclass: ttl = _swig_property(getTtl, setTtl)
+ if _newclass: ttl = property(getTtl, setTtl)
__swig_getmethods__["user_id"] = getUserId
__swig_setmethods__["user_id"] = setUserId
- if _newclass: user_id = _swig_property(getUserId, setUserId)
+ if _newclass: user_id = property(getUserId, setUserId)
__swig_getmethods__["correlation_id"] = getCorrelationId
__swig_setmethods__["correlation_id"] = setCorrelationId
- if _newclass: correlation_id = _swig_property(getCorrelationId,
- setCorrelationId)
+ if _newclass: correlation_id = property(getCorrelationId, setCorrelationId)
__swig_getmethods__["redelivered"] = getRedelivered
__swig_setmethods__["redelivered"] = setRedelivered
- if _newclass: redelivered = _swig_property(getRedelivered,
- setRedelivered)
+ if _newclass: redelivered = property(getRedelivered, setRedelivered)
__swig_getmethods__["durable"] = getDurable
__swig_setmethods__["durable"] = setDurable
- if _newclass: durable = _swig_property(getDurable, setDurable)
+ if _newclass: durable = property(getDurable, setDurable)
__swig_getmethods__["properties"] = getProperties
- if _newclass: properties = _swig_property(getProperties)
+ if _newclass: properties = property(getProperties)
def getReplyTo(self) :
return self._getReplyTo().str()
@@ -352,7 +352,7 @@ static PyObject* pTransportFailure;
self._setReplyTo(Address(address_str))
__swig_getmethods__["reply_to"] = getReplyTo
__swig_setmethods__["reply_to"] = setReplyTo
- if _newclass: reply_to = _swig_property(getReplyTo, setReplyTo)
+ if _newclass: reply_to = property(getReplyTo, setReplyTo)
def __repr__(self):
args = []
diff --git a/cpp/bindings/qpid/ruby/README.rdoc b/cpp/bindings/qpid/ruby/README.rdoc
index 0ae7e5cbed..478fc939d9 100644
--- a/cpp/bindings/qpid/ruby/README.rdoc
+++ b/cpp/bindings/qpid/ruby/README.rdoc
@@ -2,7 +2,7 @@
Qpid is an cross-platform enterprise messaging system.
-Version :: 0.10.0.alpha.0
+Version :: 0.17.0
= Links
diff --git a/cpp/bindings/qpid/ruby/Rakefile b/cpp/bindings/qpid/ruby/Rakefile
index df0b3970b6..99c3e13c83 100644
--- a/cpp/bindings/qpid/ruby/Rakefile
+++ b/cpp/bindings/qpid/ruby/Rakefile
@@ -120,7 +120,9 @@ spec = Gem::Specification.new do |s|
"lib/**/*.rb",
"test/**/*.rb",
"examples/**/*.rb",
- "ext/**/*"]
+ "ext/**/*",
+ "features/**/*",
+ "spec/**/*"]
end
Gem::PackageTask.new(spec) do |pkg|
diff --git a/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb b/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
index e5071ca4e6..845cc2b116 100644
--- a/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
+++ b/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
Given /^an Address with the name "([^"]*)" and subject "([^"]*)" and option "([^"]*)" set to "([^"]*)"$/ do |name, subject, key, value|
options = Hash.new
options["#{key}"] = "#{value}"
diff --git a/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb b/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
index b4146ac1fb..3fe3e6941f 100644
--- a/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
+++ b/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
# close all connections
After do
@connection.close if @connection
diff --git a/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb b/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
index 8157fb7735..a8c8aa4a43 100644
--- a/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
+++ b/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
Given /^an existing receiver for "([^"]*)"$/ do |address|
steps %Q{
Given an open session
diff --git a/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb b/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
index 3ff081c7d2..93dbd2d5c0 100644
--- a/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
+++ b/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
Given /^the message "([^"]*)" is sent$/ do |content|
@sender.send Qpid::Messaging::Message.new :content => "#{content}"
end
diff --git a/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb b/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
index f97e423ee9..cf775d917d 100644
--- a/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
+++ b/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
Given /^a closed session/ do
steps %Q{
Given an open connection
diff --git a/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb b/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb
index 7b9130156d..2f20fab18e 100644
--- a/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb
+++ b/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb
@@ -45,8 +45,10 @@ module Qpid
content_type = message.content_type unless content_type
case content_type
- when "amqp/map": Cqpid.decodeMap message.message_impl
- when "amqp/list": Cqpid.decodeList message.message_impl
+ when "amqp/map"
+ Cqpid.decodeMap message.message_impl
+ when "amqp/list"
+ Cqpid.decodeList message.message_impl
end
message.content
diff --git a/cpp/bindings/qpid/ruby/lib/qpid/version.rb b/cpp/bindings/qpid/ruby/lib/qpid/version.rb
index f387ba98dc..39524e428f 100644
--- a/cpp/bindings/qpid/ruby/lib/qpid/version.rb
+++ b/cpp/bindings/qpid/ruby/lib/qpid/version.rb
@@ -22,7 +22,7 @@ module Qpid
module Version
NUMBERS = [MAJOR = 0,
- MINOR = 13,
+ MINOR = 17,
BUILD = 0]
end
diff --git a/cpp/bindings/swig_python_typemaps.i b/cpp/bindings/swig_python_typemaps.i
index e99ce65254..25a4e46b18 100644
--- a/cpp/bindings/swig_python_typemaps.i
+++ b/cpp/bindings/swig_python_typemaps.i
@@ -25,7 +25,11 @@ static PyObject* pUuidModule;
%}
%init %{
- pUuidModule = PyImport_ImportModule("uuid");
+ /* Instead of directly referencing the uuid module (which is not available
+ * on older versions of Python), reference the wrapper defined in
+ * qpid.datatypes.
+ */
+ pUuidModule = PyImport_ImportModule("qpid.datatypes");
/* Although it is not required, we'll publish the uuid module in our
* module, as if this module was a python module and we called