summaryrefslogtreecommitdiff
path: root/python/qmf2/tests
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-02-01 21:14:39 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-02-01 21:14:39 +0000
commit9c671c02327a02bb744e28d25dc4c8d23aa1755c (patch)
treed05e4eb70bf304e8b0ddbdade17921b770a12f06 /python/qmf2/tests
parent7f1cc4b0a660cbe837e0261bd576eb4dd51dffd6 (diff)
downloadqpid-python-9c671c02327a02bb744e28d25dc4c8d23aa1755c.tar.gz
QPID-2261: add schema_id to object query target params. Add more tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@905415 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qmf2/tests')
-rw-r--r--python/qmf2/tests/basic_method.py117
-rw-r--r--python/qmf2/tests/basic_query.py137
-rw-r--r--python/qmf2/tests/events.py2
-rw-r--r--python/qmf2/tests/obj_gets.py119
4 files changed, 308 insertions, 67 deletions
diff --git a/python/qmf2/tests/basic_method.py b/python/qmf2/tests/basic_method.py
index a1847efee9..745fa5d83c 100644
--- a/python/qmf2/tests/basic_method.py
+++ b/python/qmf2/tests/basic_method.py
@@ -148,7 +148,8 @@ class _agentApp(Thread):
raise Exception("Unexpected method call parameters")
if mc.get_name() == "set_meth":
- obj = self.agent.get_object(mc.get_object_id())
+ obj = self.agent.get_object(mc.get_object_id(),
+ mc.get_schema_id())
if obj is None:
error_info = QmfData.create({"code": -2,
"description":
@@ -164,7 +165,8 @@ class _agentApp(Thread):
self.agent.method_response(wi.get_handle(),
{"code" : 0})
elif mc.get_name() == "a_method":
- obj = self.agent.get_object(mc.get_object_id())
+ obj = self.agent.get_object(mc.get_object_id(),
+ mc.get_schema_id())
if obj is None:
error_info = QmfData.create({"code": -3,
"description":
@@ -246,38 +248,82 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
- query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
- [QmfQuery.AND,
- [QmfQuery.EXISTS, [QmfQuery.QUOTE, SchemaClassId.KEY_PACKAGE]],
- [QmfQuery.EQ, SchemaClassId.KEY_PACKAGE, [QmfQuery.QUOTE, "MyPackage"]]])
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_SCHEMA_ID)
+
+ sid_list = self.console.do_query(agent, query)
+ self.assertTrue(sid_list and len(sid_list) == 1)
+ for sid in sid_list:
+ t_params = {QmfData.KEY_SCHEMA_ID: sid}
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_OBJECT,
+ _target_params=t_params)
+ obj_list = self.console.do_query(agent, query)
+ self.assertTrue(len(obj_list) == 2)
+ for obj in obj_list:
+ mr = obj.invoke_method( "set_meth", {"arg_int": -99,
+ "arg_str": "Now set!"},
+ _timeout=3)
+ self.assertTrue(isinstance(mr, qmf2.console.MethodResult))
+ self.assertTrue(mr.succeeded())
+ self.assertTrue(mr.get_argument("code") == 0)
+
+ self.assertTrue(obj.get_value("method_call_count") == 0)
+ self.assertTrue(obj.get_value("set_string") == "UNSET")
+ self.assertTrue(obj.get_value("set_int") == 0)
+
+ obj.refresh()
+
+ self.assertTrue(obj.get_value("method_call_count") == 1)
+ self.assertTrue(obj.get_value("set_string") == "Now set!")
+ self.assertTrue(obj.get_value("set_int") == -99)
- obj_list = self.console.do_query(agent, query)
- self.assertTrue(len(obj_list) == 2)
- for obj in obj_list:
- mr = obj.invoke_method( "set_meth", {"arg_int": -99,
- "arg_str": "Now set!"},
- _timeout=3)
- self.assertTrue(isinstance(mr, qmf2.console.MethodResult))
- self.assertTrue(mr.succeeded())
- self.assertTrue(mr.get_argument("code") == 0)
+ self.console.destroy(10)
- self.assertTrue(obj.get_value("method_call_count") == 0)
- self.assertTrue(obj.get_value("set_string") == "UNSET")
- self.assertTrue(obj.get_value("set_int") == 0)
- obj.refresh()
+ def test_bad_method_schema(self):
+ # create console
+ # find agents
+ # synchronous query for all objects with schema
+ # invalid method call on each object
+ # - should throw a ValueError
+ self.notifier = _testNotifier()
+ self.console = qmf2.console.Console(notifier=self.notifier,
+ agent_timeout=3)
+ self.conn = qpid.messaging.Connection(self.broker.host,
+ self.broker.port,
+ self.broker.user,
+ self.broker.password)
+ self.conn.connect()
+ self.console.add_connection(self.conn)
- self.assertTrue(obj.get_value("method_call_count") == 1)
- self.assertTrue(obj.get_value("set_string") == "Now set!")
- self.assertTrue(obj.get_value("set_int") == -99)
+ for aname in ["agent1", "agent2"]:
+ agent = self.console.find_agent(aname, timeout=3)
+ self.assertTrue(agent and agent.get_name() == aname)
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_SCHEMA_ID)
+
+ sid_list = self.console.do_query(agent, query)
+ self.assertTrue(sid_list and len(sid_list) == 1)
+ for sid in sid_list:
+
+ t_params = {QmfData.KEY_SCHEMA_ID: sid}
+ query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
+ [QmfQuery.TRUE],
+ _target_params=t_params)
+
+ obj_list = self.console.do_query(agent, query)
+ self.assertTrue(len(obj_list) == 2)
+ for obj in obj_list:
+ self.failUnlessRaises(ValueError,
+ obj.invoke_method,
+ "unknown_meth",
+ {"arg1": -99, "arg2": "Now set!"},
+ _timeout=3)
self.console.destroy(10)
-
- def test_bad_method(self):
+ def test_bad_method_no_schema(self):
# create console
# find agents
- # synchronous query for all objects in schema
+ # synchronous query for all objects with no schema
# invalid method call on each object
# - should throw a ValueError
self.notifier = _testNotifier()
@@ -294,21 +340,20 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
- query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
- [QmfQuery.AND,
- [QmfQuery.EXISTS, [QmfQuery.QUOTE, SchemaClassId.KEY_PACKAGE]],
- [QmfQuery.EQ, [QmfQuery.UNQUOTE, SchemaClassId.KEY_PACKAGE], [QmfQuery.QUOTE, "MyPackage"]]])
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_OBJECT)
obj_list = self.console.do_query(agent, query)
- self.assertTrue(len(obj_list) == 2)
+ self.assertTrue(len(obj_list) == 1)
for obj in obj_list:
- self.failUnlessRaises(ValueError,
- obj.invoke_method,
- "unknown_meth",
- {"arg1": -99, "arg2": "Now set!"},
- _timeout=3)
- self.console.destroy(10)
+ self.assertTrue(obj.get_schema_class_id() == None)
+ mr = obj.invoke_method("unknown_meth",
+ {"arg1": -99, "arg2": "Now set!"},
+ _timeout=3)
+ self.assertTrue(isinstance(mr, qmf2.console.MethodResult))
+ self.assertFalse(mr.succeeded())
+ self.assertTrue(isinstance(mr.get_exception(), QmfData))
+ self.console.destroy(10)
def test_managed_obj(self):
# create console
diff --git a/python/qmf2/tests/basic_query.py b/python/qmf2/tests/basic_query.py
index 5a1f4c55c8..0f45348d9f 100644
--- a/python/qmf2/tests/basic_query.py
+++ b/python/qmf2/tests/basic_query.py
@@ -94,13 +94,22 @@ class _agentApp(Thread):
self.agent.add_object( _obj1 )
self.agent.add_object( QmfAgentData( self.agent, _schema=_schema,
- _values={"index1":99,
+ _values={"index1":99,
"index2": "another name",
"set_string": "UNSET",
"set_int": 0,
"query_count": 0,
"method_call_count": 0} ))
+ self.agent.add_object( QmfAgentData( self.agent, _schema=_schema,
+ _values={"index1":50,
+ "index2": "my name",
+ "set_string": "SET",
+ "set_int": 0,
+ "query_count": 0,
+ "method_call_count": 0} ))
+
+
# add an "unstructured" object to the Agent
_obj2 = QmfAgentData(self.agent, _object_id="01545")
_obj2.set_value("field1", "a value")
@@ -110,6 +119,30 @@ class _agentApp(Thread):
_obj2.set_value("index1", 50)
self.agent.add_object(_obj2)
+ _obj2 = QmfAgentData(self.agent, _object_id="01546")
+ _obj2.set_value("field1", "a value")
+ _obj2.set_value("field2", 3)
+ _obj2.set_value("field3", {"a":1, "map":2, "value":3})
+ _obj2.set_value("field4", ["a", "list", "value"])
+ _obj2.set_value("index1", 51)
+ self.agent.add_object(_obj2)
+
+ _obj2 = QmfAgentData(self.agent, _object_id="01544")
+ _obj2.set_value("field1", "a value")
+ _obj2.set_value("field2", 4)
+ _obj2.set_value("field3", {"a":1, "map":2, "value":3})
+ _obj2.set_value("field4", ["a", "list", "value"])
+ _obj2.set_value("index1", 49)
+ self.agent.add_object(_obj2)
+
+ _obj2 = QmfAgentData(self.agent, _object_id="01543")
+ _obj2.set_value("field1", "a value")
+ _obj2.set_value("field2", 4)
+ _obj2.set_value("field3", {"a":1, "map":2, "value":3})
+ _obj2.set_value("field4", ["a", "list", "value"])
+ _obj2.set_value("index1", 48)
+ self.agent.add_object(_obj2)
+
self.running = False
self.ready = Event()
@@ -178,7 +211,8 @@ class BaseTest(unittest.TestCase):
def test_all_oids(self):
# create console
# find agents
- # synchronous query for all objects by id
+ # synchronous query for all schemas
+ # synchronous query for all objects per schema
# verify known object ids are returned
self.notifier = _testNotifier()
self.console = qmf2.console.Console(notifier=self.notifier,
@@ -194,15 +228,39 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
+ # first, find objects per schema
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_SCHEMA_ID)
+ sid_list = self.console.do_query(agent, query)
+ self.assertTrue(sid_list and len(sid_list) == 1)
+ for sid in sid_list:
+ t_params = {QmfData.KEY_SCHEMA_ID: sid}
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_OBJECT_ID,
+ _target_params=t_params)
+
+ oid_list = self.console.do_query(agent, query)
+
+ self.assertTrue(isinstance(oid_list, type([])),
+ "Unexpected return type")
+ self.assertTrue(len(oid_list) == 3, "Wrong count")
+ self.assertTrue('100a name' in oid_list)
+ self.assertTrue('99another name' in oid_list)
+ self.assertTrue('50my name' in oid_list)
+ self.assertTrue('01545' not in oid_list)
+
+
+ # now, find all unmanaged objects (no schema)
query = QmfQuery.create_wildcard(QmfQuery.TARGET_OBJECT_ID)
oid_list = self.console.do_query(agent, query)
self.assertTrue(isinstance(oid_list, type([])),
"Unexpected return type")
- self.assertTrue(len(oid_list) == 3, "Wrong count")
- self.assertTrue('100a name' in oid_list)
- self.assertTrue('99another name' in oid_list)
+ self.assertTrue(len(oid_list) == 4, "Wrong count")
+ self.assertTrue('100a name' not in oid_list)
+ self.assertTrue('99another name' not in oid_list)
self.assertTrue('01545' in oid_list)
+ self.assertTrue('01544' in oid_list)
+ self.assertTrue('01543' in oid_list)
+ self.assertTrue('01546' in oid_list)
self.console.destroy(10)
@@ -226,8 +284,13 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
- for oid in ['100a name', '99another name', '01545']:
- query = QmfQuery.create_id(QmfQuery.TARGET_OBJECT, oid)
+ # first, find objects per schema
+ query = QmfQuery.create_wildcard(QmfQuery.TARGET_SCHEMA_ID)
+ sid_list = self.console.do_query(agent, query)
+ self.assertTrue(sid_list and len(sid_list) == 1)
+
+ for oid in ['100a name', '99another name']:
+ query = QmfQuery.create_id_object(oid, sid_list[0])
obj_list = self.console.do_query(agent, query)
self.assertTrue(isinstance(obj_list, type([])),
@@ -236,15 +299,23 @@ class BaseTest(unittest.TestCase):
obj = obj_list[0]
self.assertTrue(isinstance(obj, QmfData))
self.assertTrue(obj.get_object_id() == oid)
+ self.assertTrue(obj.get_schema_class_id() == sid_list[0])
+ schema_id = obj.get_schema_class_id()
+ self.assertTrue(isinstance(schema_id, SchemaClassId))
+ self.assertTrue(obj.is_described())
+
+ # now find schema-less objects
+ for oid in ['01545']:
+ query = QmfQuery.create_id_object(oid)
+ obj_list = self.console.do_query(agent, query)
- if obj.is_described():
- self.assertTrue(oid in ['100a name', '99another name'])
- schema_id = obj.get_schema_class_id()
- self.assertTrue(isinstance(schema_id, SchemaClassId))
- else:
- self.assertTrue(oid == "01545")
-
-
+ self.assertTrue(isinstance(obj_list, type([])),
+ "Unexpected return type")
+ self.assertTrue(len(obj_list) == 1)
+ obj = obj_list[0]
+ self.assertTrue(isinstance(obj, QmfData))
+ self.assertTrue(obj.get_object_id() == oid)
+ self.assertFalse(obj.is_described())
self.console.destroy(10)
@@ -360,11 +431,21 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
+ # get the schema id for MyPackage:MyClass schema
+ query = QmfQuery.create_predicate(QmfQuery.TARGET_SCHEMA_ID,
+ [QmfQuery.AND,
+ [QmfQuery.EQ, SchemaClassId.KEY_PACKAGE,
+ [QmfQuery.QUOTE, "MyPackage"]],
+ [QmfQuery.EQ, SchemaClassId.KEY_CLASS,
+ [QmfQuery.QUOTE, "MyClass"]]])
+ sid_list = self.console.do_query(agent, query)
+ self.assertTrue(len(sid_list) == 1)
+
query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
[QmfQuery.AND,
[QmfQuery.EXISTS, [QmfQuery.QUOTE, "set_string"]],
- [QmfQuery.EQ, "set_string", [QmfQuery.QUOTE, "UNSET"]]])
-
+ [QmfQuery.EQ, "set_string", [QmfQuery.QUOTE, "UNSET"]]],
+ _target_params={QmfData.KEY_SCHEMA_ID: sid_list[0]})
obj_list = self.console.do_query(agent, query)
self.assertTrue(len(obj_list) == 2)
for obj in obj_list:
@@ -394,41 +475,43 @@ class BaseTest(unittest.TestCase):
agent = self.console.find_agent(aname, timeout=3)
self.assertTrue(agent and agent.get_name() == aname)
- # == 99
+ # Query the unmanaged (no schema) objects
+
+ # == 50
query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
[QmfQuery.AND,
[QmfQuery.EXISTS, [QmfQuery.QUOTE, "index1"]],
- [QmfQuery.EQ, "index1", 99]])
+ [QmfQuery.EQ, "index1", 50]])
obj_list = self.console.do_query(agent, query)
self.assertTrue(len(obj_list) == 1)
self.assertTrue(obj_list[0].has_value("index1"))
- self.assertTrue(obj_list[0].get_value("index1") == 99)
+ self.assertTrue(obj_list[0].get_value("index1") == 50)
- # <= 99
+ # <= 50
query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
[QmfQuery.AND,
[QmfQuery.EXISTS, [QmfQuery.QUOTE, "index1"]],
- [QmfQuery.LE, "index1", 99]])
+ [QmfQuery.LE, "index1", 50]])
obj_list = self.console.do_query(agent, query)
- self.assertTrue(len(obj_list) == 2)
+ self.assertTrue(len(obj_list) == 3)
for obj in obj_list:
self.assertTrue(obj.has_value("index1"))
- self.assertTrue(obj.get_value("index1") <= 99)
+ self.assertTrue(obj.get_value("index1") <= 50)
- # > 99
+ # > 50
query = QmfQuery.create_predicate(QmfQuery.TARGET_OBJECT,
[QmfQuery.AND,
[QmfQuery.EXISTS, [QmfQuery.QUOTE, "index1"]],
- [QmfQuery.GT, "index1", 99]])
+ [QmfQuery.GT, "index1", 50]])
obj_list = self.console.do_query(agent, query)
self.assertTrue(len(obj_list) == 1)
for obj in obj_list:
self.assertTrue(obj.has_value("index1"))
- self.assertTrue(obj.get_value("index1") > 99)
+ self.assertTrue(obj.get_value("index1") > 50)
self.console.destroy(10)
diff --git a/python/qmf2/tests/events.py b/python/qmf2/tests/events.py
index a621aa0392..9a96fbd9a4 100644
--- a/python/qmf2/tests/events.py
+++ b/python/qmf2/tests/events.py
@@ -84,7 +84,6 @@ class _agentApp(Thread):
if not self.ready.is_set():
raise Exception("Agent failed to connect to broker.")
# time.sleep(1)
- print("!!! agent=%s setup complete (%s)" % (self.agent, time.time()))
def stop_app(self):
self.running = False
@@ -106,7 +105,6 @@ class _agentApp(Thread):
raise Skipped(e)
self.agent.set_connection(conn)
- print("!!! agent=%s connection done (%s)" % (self.agent, time.time()))
self.ready.set()
counter = 1
diff --git a/python/qmf2/tests/obj_gets.py b/python/qmf2/tests/obj_gets.py
index 514121980e..43f2da5da2 100644
--- a/python/qmf2/tests/obj_gets.py
+++ b/python/qmf2/tests/obj_gets.py
@@ -17,6 +17,7 @@
#
import unittest
import logging
+import datetime
from threading import Thread, Event
import qpid.messaging
@@ -193,8 +194,10 @@ class BaseTest(unittest.TestCase):
agent = _agentApp("agent-" + str(i), self.broker, 1)
agent.start_app()
self.agents.append(agent)
+ #print("!!!! STARTING TEST: %s" % datetime.datetime.utcnow())
def tearDown(self):
+ #print("!!!! STOPPING TEST: %s" % datetime.datetime.utcnow())
for agent in self.agents:
if agent is not None:
agent.stop_app()
@@ -221,25 +224,34 @@ class BaseTest(unittest.TestCase):
self.assertTrue(agent and agent.get_name() == aname)
# console has discovered all agents, now query all undesc-2 objects
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
objs = self.console.get_objects(_object_id="undesc-2", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
self.assertTrue(len(objs) == self.agent_count)
for obj in objs:
self.assertTrue(obj.get_object_id() == "undesc-2")
# now query all objects from schema "package1"
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
objs = self.console.get_objects(_pname="package1", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
self.assertTrue(len(objs) == (self.agent_count * 3))
for obj in objs:
self.assertTrue(obj.get_schema_class_id().get_package_name() == "package1")
# now query all objects from schema "package2"
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
objs = self.console.get_objects(_pname="package2", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
self.assertTrue(len(objs) == (self.agent_count * 2))
for obj in objs:
self.assertTrue(obj.get_schema_class_id().get_package_name() == "package2")
# now query all objects from schema "package1/class2"
- objs = self.console.get_objects(_pname="package1", _cname="class2", _timeout=5)
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package1", _cname="class2",
+ _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
self.assertTrue(len(objs) == self.agent_count)
for obj in objs:
self.assertTrue(obj.get_schema_class_id().get_package_name() == "package1")
@@ -247,7 +259,9 @@ class BaseTest(unittest.TestCase):
# given the schema identifier from the last query, repeat using the
# specific schema id
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
schema_id = objs[0].get_schema_class_id()
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
objs = self.console.get_objects(_schema_id=schema_id, _timeout=5)
self.assertTrue(len(objs) == self.agent_count)
for obj in objs:
@@ -352,7 +366,7 @@ class BaseTest(unittest.TestCase):
self.assertTrue(agent and agent.get_name() == aname)
agent_list.append(agent)
- # Only use one agetn
+ # Only use one agent
agent = agent_list[0]
# console has discovered all agents, now query all undesc-2 objects
@@ -400,3 +414,104 @@ class BaseTest(unittest.TestCase):
self.console.destroy(10)
+
+
+ def test_all_objs_by_oid(self):
+ # create console
+ # find all agents
+ # synchronous query for all described objects by:
+ # oid & schema_id
+ # oid & package name
+ # oid & package and class name
+ # verify known object ids are returned
+ self.notifier = _testNotifier()
+ self.console = qmf2.console.Console(notifier=self.notifier,
+ agent_timeout=3)
+ self.conn = qpid.messaging.Connection(self.broker.host,
+ self.broker.port,
+ self.broker.user,
+ self.broker.password)
+ self.conn.connect()
+ self.console.add_connection(self.conn)
+
+ for agent_app in self.agents:
+ aname = agent_app.agent.get_name()
+ agent = self.console.find_agent(aname, timeout=3)
+ self.assertTrue(agent and agent.get_name() == aname)
+
+ # now query all objects from schema "package1"
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package1",
+ _object_id="p1c1_key1", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(len(objs) == self.agent_count)
+ for obj in objs:
+ self.assertTrue(obj.get_schema_class_id().get_package_name() == "package1")
+ self.assertTrue(obj.get_schema_class_id().get_class_name() == "class1")
+ self.assertTrue(obj.get_object_id() == "p1c1_key1")
+ # mooch the schema for a later test
+ schema_id_p1c1 = objs[0].get_schema_class_id()
+
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package1",
+ _object_id="p1c2_name1", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(len(objs) == self.agent_count)
+ for obj in objs:
+ self.assertTrue(obj.get_schema_class_id().get_package_name() == "package1")
+ self.assertTrue(obj.get_schema_class_id().get_class_name() == "class2")
+ self.assertTrue(obj.get_object_id() == "p1c2_name1")
+
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package2", _cname="class1",
+ _object_id="p2c1_key1", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(len(objs) == self.agent_count)
+ for obj in objs:
+ self.assertTrue(obj.get_schema_class_id().get_package_name() == "package2")
+ self.assertTrue(obj.get_schema_class_id().get_class_name() == "class1")
+ self.assertTrue(obj.get_object_id() == "p2c1_key1")
+
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_schema_id=schema_id_p1c1,
+ _object_id="p1c1_key2", _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(len(objs) == self.agent_count)
+ for obj in objs:
+ self.assertTrue(obj.get_schema_class_id().get_package_name() == "package1")
+ self.assertTrue(obj.get_schema_class_id().get_class_name() == "class1")
+ self.assertTrue(obj.get_object_id() == "p1c1_key2")
+
+ # this should return all "undescribed" objects
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(len(objs) == (self.agent_count * 2))
+ for obj in objs:
+ self.assertTrue(obj.get_object_id() == "undesc-1" or
+ obj.get_object_id() == "undesc-2")
+
+ # these should fail
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_schema_id=schema_id_p1c1,
+ _object_id="does not exist",
+ _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(objs == None)
+
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package2",
+ _object_id="does not exist",
+ _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(objs == None)
+
+ #print("!!!! STARTING GET: %s" % datetime.datetime.utcnow())
+ objs = self.console.get_objects(_pname="package3",
+ _object_id="does not exist",
+ _timeout=5)
+ #print("!!!! STOPPING GET: %s" % datetime.datetime.utcnow())
+ self.assertTrue(objs == None)
+
+ self.console.destroy(10)
+