summaryrefslogtreecommitdiff
path: root/cpp/bindings/qmf/tests
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-08-28 22:03:26 +0000
committerTed Ross <tross@apache.org>2009-08-28 22:03:26 +0000
commitdc6068ce7a6bd0d9467886b44cd6252ba491e615 (patch)
tree7bf0b42a58d7f020fc61e81ae53ba7415e8fe91a /cpp/bindings/qmf/tests
parenta435a75437cd389c6fa08ae171f7d25b1d3a7e77 (diff)
downloadqpid-python-dc6068ce7a6bd0d9467886b44cd6252ba491e615.tar.gz
Major work in the QMF engine.
- The console framework now establishes connectivity with the broker. - The Ruby binding for console is tracking the engine development. - Overall improvements (thread safety in Ruby, etc.) have been added. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@809042 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qmf/tests')
-rwxr-xr-xcpp/bindings/qmf/tests/agent_ruby.rb10
-rwxr-xr-xcpp/bindings/qmf/tests/python_console.py12
-rwxr-xr-xcpp/bindings/qmf/tests/ruby_console.rb43
-rwxr-xr-xcpp/bindings/qmf/tests/run_interop_tests13
4 files changed, 77 insertions, 1 deletions
diff --git a/cpp/bindings/qmf/tests/agent_ruby.rb b/cpp/bindings/qmf/tests/agent_ruby.rb
index 0f85c90f37..75de2b5fa1 100755
--- a/cpp/bindings/qmf/tests/agent_ruby.rb
+++ b/cpp/bindings/qmf/tests/agent_ruby.rb
@@ -53,7 +53,10 @@ class Model
method = Qmf::SchemaMethod.new("create_child", :desc => "Create a new child object")
method.add_argument(Qmf::SchemaArgument.new("child_name", Qmf::TYPE_LSTR, :dir => Qmf::DIR_IN))
method.add_argument(Qmf::SchemaArgument.new("child_ref", Qmf::TYPE_REF, :dir => Qmf::DIR_OUT))
+ @parent_class.add_method(method)
+ method = Qmf::SchemaMethod.new("probe_userid", :desc => "Return the user-id for this method call")
+ method.add_argument(Qmf::SchemaArgument.new("userid", Qmf::TYPE_SSTR, :dir => Qmf::DIR_OUT))
@parent_class.add_method(method)
@child_class = Qmf::SchemaObjectClass.new("org.apache.qpid.qmf", "child")
@@ -136,6 +139,13 @@ class App < Qmf::AgentHandler
@child.set_attr("name", args.by_key("child_name"))
@child.set_object_id(oid)
@agent.method_response(context, 0, "OK", args)
+
+ elsif name == "probe_userid"
+ args['userid'] = userId
+ @agent.method_response(context, 0, "OK", args)
+
+ else
+ @agent.method_response(context, 1, "Unimplemented Method: #{name}", args)
end
end
diff --git a/cpp/bindings/qmf/tests/python_console.py b/cpp/bindings/qmf/tests/python_console.py
index 365f2ac33a..bcd3063fe3 100755
--- a/cpp/bindings/qmf/tests/python_console.py
+++ b/cpp/bindings/qmf/tests/python_console.py
@@ -128,6 +128,18 @@ class QmfInteropTests(TestBase010):
self.assertEqual(parent.int16val, -1000)
self.assertEqual(parent.int8val, -100)
+ def test_D_userid_for_method(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ result = parent.probe_userid()
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.userid, "guest")
+
def getProperty(self, msg, name):
for h in msg.headers:
if hasattr(h, name): return getattr(h, name)
diff --git a/cpp/bindings/qmf/tests/ruby_console.rb b/cpp/bindings/qmf/tests/ruby_console.rb
new file mode 100755
index 0000000000..c7ee9c3686
--- /dev/null
+++ b/cpp/bindings/qmf/tests/ruby_console.rb
@@ -0,0 +1,43 @@
+#!/usr/bin/ruby
+
+#
+# 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.
+#
+
+require 'qmf'
+require 'socket'
+
+class App < Qmf::ConsoleHandler
+
+ def main
+ @settings = Qmf::ConnectionSettings.new
+ @settings.set_attr("host", ARGV[0]) if ARGV.size > 0
+ @settings.set_attr("port", ARGV[1].to_i) if ARGV.size > 1
+ @connection = Qmf::Connection.new(@settings)
+ @qmf = Qmf::Console.new(self)
+
+ @qmf.add_connection(@connection)
+
+ sleep
+ end
+end
+
+app = App.new
+app.main
+
+
diff --git a/cpp/bindings/qmf/tests/run_interop_tests b/cpp/bindings/qmf/tests/run_interop_tests
index e6fc872dbb..f3f78185c7 100755
--- a/cpp/bindings/qmf/tests/run_interop_tests
+++ b/cpp/bindings/qmf/tests/run_interop_tests
@@ -54,12 +54,23 @@ if test -d ${PYTHON_DIR} ; then
echo "Running qmf interop tests using broker on port $BROKER_PORT"
PYTHONPATH=${PYTHON_DIR}:${MY_DIR}
export PYTHONPATH
- echo " Ruby Agent vs. Pure-Python Console"
+ echo " Ruby Agent (external storage) vs. Pure-Python Console"
start_ruby_agent
echo " Ruby agent started at pid $AGENT_PID"
${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
RETCODE=$?
stop_ruby_agent
+
+ # Also against the Pure-Python console:
+ # Ruby agent (internal storage)
+ # Python agent (external and internal)
+ # C++ agent (external and internal)
+ #
+ # Other consoles against the same set of agents:
+ # Wrapped Python console
+ # Ruby console
+ # C++ console
+
stop_broker
if test x$RETCODE != x0; then
echo "FAIL qmf interop tests"; exit 1;