summaryrefslogtreecommitdiff
path: root/cpp/bindings/qmf/tests/python_agent.py
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-01-05 19:45:28 +0000
committerTed Ross <tross@apache.org>2010-01-05 19:45:28 +0000
commit0e73326a611933479eb77f4b2f7bb9b74661f123 (patch)
treecbf873511e09bd078f459cd8f72228b494265954 /cpp/bindings/qmf/tests/python_agent.py
parent200a49f326198673edd53901a4b4d16533f3f5da (diff)
downloadqpid-python-0e73326a611933479eb77f4b2f7bb9b74661f123.tar.gz
Added handling of MAP values for the wrapped QMF interfaces.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@896191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qmf/tests/python_agent.py')
-rw-r--r--cpp/bindings/qmf/tests/python_agent.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/cpp/bindings/qmf/tests/python_agent.py b/cpp/bindings/qmf/tests/python_agent.py
index 0f5ffe5b8a..c42273d7b2 100644
--- a/cpp/bindings/qmf/tests/python_agent.py
+++ b/cpp/bindings/qmf/tests/python_agent.py
@@ -41,6 +41,12 @@ class Model:
self.parent_class.add_property(qmf.SchemaProperty("int16val", qmf.TYPE_INT16))
self.parent_class.add_property(qmf.SchemaProperty("int8val", qmf.TYPE_INT8))
+ self.parent_class.add_property(qmf.SchemaProperty("sstrval", qmf.TYPE_SSTR))
+ self.parent_class.add_property(qmf.SchemaProperty("lstrval", qmf.TYPE_LSTR))
+
+ self.parent_class.add_property(qmf.SchemaProperty("mapval", qmf.TYPE_MAP))
+
+
self.parent_class.add_statistic(qmf.SchemaStatistic("queryCount", qmf.TYPE_UINT32, {"unit":"query", "desc":"Query count"}))
_method = qmf.SchemaMethod("echo", {"desc":"Check responsiveness of the agent object"})
@@ -51,6 +57,19 @@ class Model:
_method.add_argument(qmf.SchemaArgument("test", qmf.TYPE_SSTR, {"dir":qmf.DIR_IN}))
self.parent_class.add_method(_method)
+ _method = qmf.SchemaMethod("set_map", {"desc":"Set the map value in the object"})
+ _method.add_argument(qmf.SchemaArgument("value", qmf.TYPE_MAP, {"dir":qmf.DIR_IN}))
+ _method.add_argument(qmf.SchemaArgument("output", qmf.TYPE_MAP, {"dir":qmf.DIR_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("set_short_string", {"desc":"Set the short string value in the object"})
+ _method.add_argument(qmf.SchemaArgument("value", qmf.TYPE_SSTR, {"dir":qmf.DIR_IN_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("set_long_string", {"desc":"Set the long string value in the object"})
+ _method.add_argument(qmf.SchemaArgument("value", qmf.TYPE_LSTR, {"dir":qmf.DIR_IN_OUT}))
+ self.parent_class.add_method(_method)
+
_method = qmf.SchemaMethod("create_child", {"desc":"Create a new child object"})
_method.add_argument(qmf.SchemaArgument("child_name", qmf.TYPE_LSTR, {"dir":qmf.DIR_IN}))
_method.add_argument(qmf.SchemaArgument("child_ref", qmf.TYPE_REF, {"dir":qmf.DIR_OUT}))
@@ -97,6 +116,12 @@ class App(qmf.AgentHandler):
if name == "echo":
self._agent.method_response(context, 0, "OK", args)
+ elif name == "set_map":
+ map = args['value']
+ map['added'] = "Added Text"
+ args['output'] = map
+ self._agent.method_response(context, 0, "OK", args)
+
elif name == "set_numerics":
_retCode = 0
_retText = "OK"
@@ -115,6 +140,17 @@ class App(qmf.AgentHandler):
self._parent["int16val"] = 10000
self._parent.set_attr("int8val", 100)
+ self._parent.set_attr("mapval", {'u64' : self._parent['uint64val'],
+ 'u32' : self._parent['uint32val'],
+ 'u16' : self._parent['uint16val'],
+ 'u8' : self._parent['uint8val'],
+ 'i64' : self._parent['int64val'],
+ 'i32' : self._parent['int32val'],
+ 'i16' : self._parent['int16val'],
+ 'i8' : self._parent['int8val'],
+ 'sstr' : "Short String",
+ 'map' : {'first' : 'FIRST', 'second' : 'SECOND'}})
+
## Test the __getattr__ implementation:
## @todo: remove once python_client implements this
## form of property access
@@ -150,6 +186,14 @@ class App(qmf.AgentHandler):
self._agent.method_response(context, _retCode, _retText, args)
+ elif name == "set_short_string":
+ self._parent.set_attr('sstrval', args['value'])
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "set_long_string":
+ self._parent.set_attr('lstrval', args['value'])
+ self._agent.method_response(context, 0, "OK", args)
+
elif name == "create_child":
#
# Instantiate an object based on the Child Schema Class
@@ -199,7 +243,7 @@ class App(qmf.AgentHandler):
## @todo how do we force a test failure?
# verify the properties() and statistics() object methods:
- assert len(self._parent.properties()) == 10
+ assert len(self._parent.properties()) == 13
assert len(self._parent.statistics()) == 1
self._parent.set_attr("name", "Parent One")