diff options
author | Ted Ross <tross@apache.org> | 2010-01-05 19:45:28 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2010-01-05 19:45:28 +0000 |
commit | 25d63a161d11d504e51ead2f76e761f561503b69 (patch) | |
tree | 8f018d410a0d9ba554afc61f0f603407ffd1ecb6 /qpid/cpp/bindings/qmf/tests/python_agent.py | |
parent | f41fee09de1f40adc1323e7d811a5a76bc0b6edc (diff) | |
download | qpid-python-25d63a161d11d504e51ead2f76e761f561503b69.tar.gz |
Added handling of MAP values for the wrapped QMF interfaces.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@896191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings/qmf/tests/python_agent.py')
-rw-r--r-- | qpid/cpp/bindings/qmf/tests/python_agent.py | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/qpid/cpp/bindings/qmf/tests/python_agent.py b/qpid/cpp/bindings/qmf/tests/python_agent.py index 0f5ffe5b8a..c42273d7b2 100644 --- a/qpid/cpp/bindings/qmf/tests/python_agent.py +++ b/qpid/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") |