diff options
author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-01-27 16:36:37 +0000 |
---|---|---|
committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-01-27 16:36:37 +0000 |
commit | cd739d3ecad88ad28f6891e9e1b119b763b53120 (patch) | |
tree | 2d0e930f75949d0ea8020663b4c4a41649d0d7df | |
parent | 3e3a93720e107cee63920b13c7b686e0fdef5f1d (diff) | |
download | qpid-python-cd739d3ecad88ad28f6891e9e1b119b763b53120.tar.gz |
QPID-2261: make code compliant with Python PEP-8 style
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@903717 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/python/qmf2/agent.py | 24 | ||||
-rw-r--r-- | qpid/python/qmf2/common.py | 40 | ||||
-rw-r--r-- | qpid/python/qmf2/console.py | 92 | ||||
-rw-r--r-- | qpid/python/qmf2/tests/agent_discovery.py | 14 | ||||
-rw-r--r-- | qpid/python/qmf2/tests/basic_method.py | 12 | ||||
-rw-r--r-- | qpid/python/qmf2/tests/basic_query.py | 20 | ||||
-rw-r--r-- | qpid/python/qmf2/tests/events.py | 2 | ||||
-rw-r--r-- | qpid/python/qmf2/tests/obj_gets.py | 6 |
8 files changed, 104 insertions, 106 deletions
diff --git a/qpid/python/qmf2/agent.py b/qpid/python/qmf2/agent.py index 88aee8034f..7c090ad36b 100644 --- a/qpid/python/qmf2/agent.py +++ b/qpid/python/qmf2/agent.py @@ -24,7 +24,7 @@ import Queue from threading import Thread, Lock, currentThread from qpid.messaging import Connection, Message, Empty, SendError from uuid import uuid4 -from common import (makeSubject, parseSubject, OpCode, QmfQuery, +from common import (make_subject, parse_subject, OpCode, QmfQuery, SchemaObjectClass, MsgKey, QmfData, QmfAddress, SchemaClass, SchemaClassId, WorkItem, SchemaMethod) @@ -174,7 +174,7 @@ class Agent(Thread): # kick my thread to wake it up try: msg = Message(properties={"method":"request", - "qmf.subject":makeSubject(OpCode.noop)}, + "qmf.subject":make_subject(OpCode.noop)}, subject=self.name, content={"noop":"noop"}) @@ -240,7 +240,7 @@ class Agent(Thread): msg = Message(subject=QmfAddress.SUBJECT_AGENT_EVENT + "." + qmfEvent.get_severity() + "." + self.name, properties={"method":"response", - "qmf.subject":makeSubject(OpCode.event_ind)}, + "qmf.subject":make_subject(OpCode.event_ind)}, content={MsgKey.event:_map}) # TRACE # logging.error("!!! Agent %s sending Event (%s)" % @@ -292,7 +292,7 @@ class Agent(Thread): _map[SchemaMethod.KEY_ERROR] = _error.map_encode() msg = Message( properties={"method":"response", - "qmf.subject":makeSubject(OpCode.response)}, + "qmf.subject":make_subject(OpCode.response)}, content={MsgKey.method:_map}) msg.correlation_id = handle.correlation_id @@ -386,7 +386,7 @@ class Agent(Thread): _map = {"_name": self.get_name(), "_schema_timestamp": self._schema_timestamp} return Message(properties={"method":"response", - "qmf.subject":makeSubject(OpCode.agent_ind)}, + "qmf.subject":make_subject(OpCode.agent_ind)}, content={MsgKey.agent_info: _map}) def _send_reply(self, msg, reply_to): @@ -397,8 +397,7 @@ class Agent(Thread): try: reply_to = QmfAddress.from_string(str(reply_to)) except ValueError: - logging.error("Invalid reply-to address '%s'" % - handle.reply_to) + logging.error("Invalid reply-to address '%s'" % reply_to) msg.subject = reply_to.get_subject() @@ -426,7 +425,7 @@ class Agent(Thread): """ logging.debug( "Message received from Console! [%s]" % msg ) try: - version,opcode = parseSubject(msg.properties.get("qmf.subject")) + version,opcode = parse_subject(msg.properties.get("qmf.subject")) except: logging.warning("Ignoring unrecognized message '%s'" % msg.subject) return @@ -541,7 +540,7 @@ class Agent(Thread): finally: self._lock.release() - m = Message(properties={"qmf.subject":makeSubject(OpCode.data_ind), + m = Message(properties={"qmf.subject":make_subject(OpCode.data_ind), "method":"response"}, content={MsgKey.package_info: pnames} ) if msg.correlation_id != None: @@ -583,7 +582,7 @@ class Agent(Thread): content = {MsgKey.schema:schemas} m = Message(properties={"method":"response", - "qmf.subject":makeSubject(OpCode.data_ind)}, + "qmf.subject":make_subject(OpCode.data_ind)}, content=content ) if msg.correlation_id != None: m.correlation_id = msg.correlation_id @@ -626,7 +625,7 @@ class Agent(Thread): content = {MsgKey.data_obj:data_objs} m = Message(properties={"method":"response", - "qmf.subject":makeSubject(OpCode.data_ind)}, + "qmf.subject":make_subject(OpCode.data_ind)}, content=content ) if msg.correlation_id != None: m.correlation_id = msg.correlation_id @@ -688,8 +687,7 @@ class QmfAgentData(QmfData): if __name__ == '__main__': # static test cases - no message passing, just exercise API - from common import (AgentName, SchemaProperty, qmfTypes, - SchemaMethod, SchemaEventClass) + from common import (AgentName, SchemaProperty, qmfTypes, SchemaEventClass) logging.getLogger().setLevel(logging.INFO) diff --git a/qpid/python/qmf2/common.py b/qpid/python/qmf2/common.py index 3679deeb2e..f050ec87e2 100644 --- a/qpid/python/qmf2/common.py +++ b/qpid/python/qmf2/common.py @@ -74,14 +74,14 @@ class OpCode(object): -def makeSubject(_code): +def make_subject(_code): """ Create a message subject field value. """ return AMQP_QMF_SUBJECT_FMT % (AMQP_QMF_SUBJECT, AMQP_QMF_VERSION, _code) -def parseSubject(_sub): +def parse_subject(_sub): """ Deconstruct a subject field, return version,opcode values """ @@ -1273,7 +1273,7 @@ class qmfDirection(object): -def _toBool( param ): +def _to_bool( param ): """ Helper routine to convert human-readable representations of boolean values to python bool types. @@ -1484,15 +1484,15 @@ class SchemaProperty(_mapEncoder): if value not in self._access_strings: raise TypeError("invalid value for access parameter: '%s':" % value ) self._access = value - elif key == "index" : self._isIndex = _toBool(value) - elif key == "optional": self._isOptional = _toBool(value) + elif key == "index" : self._isIndex = _to_bool(value) + elif key == "optional": self._isOptional = _to_bool(value) elif key == "unit" : self._unit = value elif key == "min" : self._min = value elif key == "max" : self._max = value elif key == "maxlen" : self._maxlen = value elif key == "desc" : self._desc = value elif key == "reference" : self._reference = value - elif key == "parent_ref" : self._isParentRef = _toBool(value) + elif key == "parent_ref" : self._isParentRef = _to_bool(value) elif key == "dir": value = str(value).upper() if value not in self._dir_strings: @@ -1510,27 +1510,27 @@ class SchemaProperty(_mapEncoder): return cls(_map=map_) from_map = classmethod(_from_map) - def getType(self): return self._type + def get_type(self): return self._type - def getAccess(self): return self._access + def get_access(self): return self._access def is_optional(self): return self._isOptional - def isIndex(self): return self._isIndex + def is_index(self): return self._isIndex - def getUnit(self): return self._unit + def get_unit(self): return self._unit - def getMin(self): return self._min + def get_min(self): return self._min - def getMax(self): return self._max + def get_max(self): return self._max - def getMaxLen(self): return self._maxlen + def get_max_len(self): return self._maxlen - def getDesc(self): return self._desc + def get_desc(self): return self._desc - def getReference(self): return self._reference + def get_reference(self): return self._reference - def isParentRef(self): return self._isParentRef + def is_parent_ref(self): return self._isParentRef def get_direction(self): return self._dir @@ -1559,7 +1559,7 @@ class SchemaProperty(_mapEncoder): def __repr__(self): return "SchemaProperty=<<" + str(self.map_encode()) + ">>" - def _updateHash(self, hasher): + def _update_hash(self, hasher): """ Update the given hash object with a hash computed over this schema. """ @@ -1663,13 +1663,13 @@ class SchemaMethod(_mapEncoder): result += ")>>" return result - def _updateHash(self, hasher): + def _update_hash(self, hasher): """ Update the given hash object with a hash computed over this schema. """ for name,val in self._arguments.iteritems(): hasher.update(name) - val._updateHash(hasher) + val._update_hash(hasher) if self._desc: hasher.update(self._desc) @@ -1738,7 +1738,7 @@ class SchemaClass(QmfData): md5Hash.update(self._classId.get_type()) for name,x in self._values.iteritems(): md5Hash.update(name) - x._updateHash( md5Hash ) + x._update_hash( md5Hash ) for name,value in self._subtypes.iteritems(): md5Hash.update(name) md5Hash.update(value) diff --git a/qpid/python/qmf2/console.py b/qpid/python/qmf2/console.py index 6e469a24ac..94d0fd7583 100644 --- a/qpid/python/qmf2/console.py +++ b/qpid/python/qmf2/console.py @@ -30,7 +30,7 @@ from threading import Condition from qpid.messaging import Connection, Message, Empty, SendError -from common import (makeSubject, parseSubject, OpCode, QmfQuery, Notifier, +from common import (make_subject, parse_subject, OpCode, QmfQuery, Notifier, QmfQueryPredicate, MsgKey, QmfData, QmfAddress, SchemaClass, SchemaClassId, SchemaEventClass, SchemaObjectClass, WorkItem, SchemaMethod, QmfEvent) @@ -171,7 +171,7 @@ class SequencedWaiter(object): self.lock.release() - def isValid(self, seq): + def is_valid(self, seq): """ True if seq is in use, else False (seq is unknown) """ @@ -254,7 +254,7 @@ class QmfConsoleData(QmfData): oid = self.get_object_id() query = QmfQuery.create_id(QmfQuery.TARGET_OBJECT, self.get_object_id()) - obj_list = self._agent._console.doQuery(self._agent, query, + obj_list = self._agent._console.do_query(self._agent, query, timeout=_timeout) if obj_list is None or len(obj_list) != 1: return None @@ -314,7 +314,7 @@ class QmfConsoleData(QmfData): logging.debug("Sending method req to Agent (%s)" % time.time()) try: - self._agent._sendMethodReq(_map, handle) + self._agent._send_method_req(_map, handle) except SendError, e: logging.error(str(e)) self._agent._console._req_correlation.release(handle) @@ -392,10 +392,10 @@ class Agent(object): def get_name(self): return self._name - def isActive(self): + def is_active(self): return self._announce_timestamp != None - def _sendMsg(self, msg, correlation_id=None): + def _send_msg(self, msg, correlation_id=None): """ Low-level routine to asynchronously send a message to this agent. """ @@ -486,7 +486,7 @@ class Agent(object): logging.debug("Sending method req to Agent (%s)" % time.time()) try: - self._sendMethodReq(_map, handle) + self._send_method_req(_map, handle) except SendError, e: logging.error(str(e)) self._console._req_correlation.release(handle) @@ -526,22 +526,22 @@ class Agent(object): def __str__(self): return self.__repr__() - def _sendQuery(self, query, correlation_id=None): + def _send_query(self, query, correlation_id=None): """ """ msg = Message(properties={"method":"request", - "qmf.subject":makeSubject(OpCode.get_query)}, + "qmf.subject":make_subject(OpCode.get_query)}, content={MsgKey.query: query.map_encode()}) - self._sendMsg( msg, correlation_id ) + self._send_msg( msg, correlation_id ) - def _sendMethodReq(self, mr_map, correlation_id=None): + def _send_method_req(self, mr_map, correlation_id=None): """ """ msg = Message(properties={"method":"request", - "qmf.subject":makeSubject(OpCode.method_req)}, + "qmf.subject":make_subject(OpCode.method_req)}, content=mr_map) - self._sendMsg( msg, correlation_id ) + self._send_msg( msg, correlation_id ) ##============================================================================== @@ -645,12 +645,12 @@ class Console(Thread): """ logging.debug("Destroying Console...") if self._conn: - self.removeConnection(self._conn, timeout) + self.remove_connection(self._conn, timeout) logging.debug("Console Destroyed") - def addConnection(self, conn): + def add_connection(self, conn): """ Add a AMQP connection to the console. The console will setup a session over the connection. The console will then broadcast an Agent Locate Indication over @@ -707,7 +707,7 @@ class Console(Thread): - def removeConnection(self, conn, timeout=None): + def remove_connection(self, conn, timeout=None): """ Remove an AMQP connection from the console. Un-does the add_connection() operation, and releases any agents and sessions associated with the connection. @@ -725,7 +725,7 @@ class Console(Thread): logging.debug("Sending noop to wake up [%s]" % self._address) try: msg = Message(properties={"method":"request", - "qmf.subject":makeSubject(OpCode.noop)}, + "qmf.subject":make_subject(OpCode.noop)}, subject=self._name, content={"noop":"noop"}) self._direct_sender.send( msg, sync=True ) @@ -752,7 +752,7 @@ class Console(Thread): return self._address - def destroyAgent( self, agent ): + def destroy_agent( self, agent ): """ Undoes create. """ @@ -789,7 +789,7 @@ class Console(Thread): query = QmfQuery.create_id(QmfQuery.TARGET_AGENT, name) msg = Message(subject="console.ind.locate." + name, properties={"method":"request", - "qmf.subject":makeSubject(OpCode.agent_locate)}, + "qmf.subject":make_subject(OpCode.agent_locate)}, content={MsgKey.query: query.map_encode()}) msg.reply_to = str(self._address) msg.correlation_id = str(handle) @@ -844,7 +844,7 @@ class Console(Thread): return agent - def doQuery(self, agent, query, timeout=None ): + def do_query(self, agent, query, timeout=None ): """ """ @@ -854,7 +854,7 @@ class Console(Thread): raise Exception("Can not allocate a correlation id!") try: logging.debug("Sending Query to Agent (%s)" % time.time()) - agent._sendQuery(query, handle) + agent._send_query(query, handle) except SendError, e: logging.error(str(e)) self._req_correlation.release(handle) @@ -953,7 +953,7 @@ class Console(Thread): # (self._name, self._direct_recvr.source, msg)) self._dispatch(msg, _direct=True) - self._expireAgents() # check for expired agents + self._expire_agents() # check for expired agents #if qLen == 0 and self._work_q.qsize() and self._notifier: if self._work_q_put and self._notifier: @@ -1028,7 +1028,7 @@ class Console(Thread): agent_list = _agents # @todo validate this list! - # @todo: fix when async doQuery done - query all agents at once, then + # @todo: fix when async do_query done - query all agents at once, then # wait for replies, instead of per-agent querying.... if _timeout is None: @@ -1037,13 +1037,13 @@ class Console(Thread): obj_list = [] expired = datetime.datetime.utcnow() + datetime.timedelta(seconds=_timeout) for agent in agent_list: - if not agent.isActive(): + if not agent.is_active(): continue now = datetime.datetime.utcnow() if now >= expired: break timeout = ((expired - now) + datetime.timedelta(microseconds=999999)).seconds - reply = self.doQuery(agent, query, timeout) + reply = self.do_query(agent, query, timeout) if reply: obj_list = obj_list + reply @@ -1061,7 +1061,7 @@ class Console(Thread): """ logging.debug( "Message received from Agent! [%s]" % msg ) try: - version,opcode = parseSubject(msg.properties.get("qmf.subject")) + version,opcode = parse_subject(msg.properties.get("qmf.subject")) # @todo: deal with version mismatch!!! except: logging.error("Ignoring unrecognized message '%s'" % msg) @@ -1074,17 +1074,17 @@ class Console(Thread): props = msg.properties if opcode == OpCode.agent_ind: - self._handleAgentIndMsg( msg, cmap, version, _direct ) + self._handle_agent_ind_msg( msg, cmap, version, _direct ) elif opcode == OpCode.data_ind: - self._handleDataIndMsg(msg, cmap, version, _direct) + self._handle_data_ind_msg(msg, cmap, version, _direct) elif opcode == OpCode.event_ind: - self._handleEventIndMsg(msg, cmap, version, _direct) + self._handle_event_ind_msg(msg, cmap, version, _direct) elif opcode == OpCode.managed_object: logging.warning("!!! managed_object TBD !!!") elif opcode == OpCode.object_ind: logging.warning("!!! object_ind TBD !!!") elif opcode == OpCode.response: - self._handleResponseMsg(msg, cmap, version, _direct) + self._handle_response_msg(msg, cmap, version, _direct) elif opcode == OpCode.schema_ind: logging.warning("!!! schema_ind TBD !!!") elif opcode == OpCode.noop: @@ -1093,12 +1093,12 @@ class Console(Thread): logging.warning("Ignoring message with unrecognized 'opcode' value: '%s'" % opcode) - def _handleAgentIndMsg(self, msg, cmap, version, direct): + def _handle_agent_ind_msg(self, msg, cmap, version, direct): """ Process a received agent-ind message. This message may be a response to a agent-locate, or it can be an unsolicited agent announce. """ - logging.debug("_handleAgentIndMsg '%s' (%s)" % (msg, time.time())) + logging.debug("_handle_agent_ind_msg '%s' (%s)" % (msg, time.time())) ai_map = cmap.get(MsgKey.agent_info) if not ai_map or not isinstance(ai_map, type({})): @@ -1116,7 +1116,7 @@ class Console(Thread): agent_query = self._agent_discovery_filter if msg.correlation_id: - correlated = self._req_correlation.isValid(msg.correlation_id) + correlated = self._req_correlation.is_valid(msg.correlation_id) if direct and correlated: ignore = False @@ -1134,7 +1134,7 @@ class Console(Thread): if not agent: # need to create and add a new agent - agent = self._createAgent(name) + agent = self._create_agent(name) if not agent: return # failed to add agent @@ -1160,13 +1160,13 @@ class Console(Thread): - def _handleDataIndMsg(self, msg, cmap, version, direct): + def _handle_data_ind_msg(self, msg, cmap, version, direct): """ Process a received data-ind message. """ - logging.debug("_handleDataIndMsg '%s' (%s)" % (msg, time.time())) + logging.debug("_handle_data_ind_msg '%s' (%s)" % (msg, time.time())) - if not self._req_correlation.isValid(msg.correlation_id): + if not self._req_correlation.is_valid(msg.correlation_id): logging.debug("Data indicate received with unknown correlation_id" " msg='%s'" % str(msg)) return @@ -1176,14 +1176,14 @@ class Console(Thread): self._req_correlation.put_data(msg.correlation_id, msg) - def _handleResponseMsg(self, msg, cmap, version, direct): + def _handle_response_msg(self, msg, cmap, version, direct): """ Process a received data-ind message. """ # @todo code replication - clean me. - logging.debug("_handleResponseMsg '%s' (%s)" % (msg, time.time())) + logging.debug("_handle_response_msg '%s' (%s)" % (msg, time.time())) - if not self._req_correlation.isValid(msg.correlation_id): + if not self._req_correlation.is_valid(msg.correlation_id): logging.debug("Response msg received with unknown correlation_id" " msg='%s'" % str(msg)) return @@ -1192,7 +1192,7 @@ class Console(Thread): logging.debug("waking waiters for correlation id %s" % msg.correlation_id) self._req_correlation.put_data(msg.correlation_id, msg) - def _handleEventIndMsg(self, msg, cmap, version, _direct): + def _handle_event_ind_msg(self, msg, cmap, version, _direct): ei_map = cmap.get(MsgKey.event) if not ei_map or not isinstance(ei_map, type({})): logging.warning("Bad event indication message received: '%s'" % msg) @@ -1233,7 +1233,7 @@ class Console(Thread): self._work_q_put = True - def _expireAgents(self): + def _expire_agents(self): """ Check for expired agents and issue notifications when they expire. """ @@ -1267,7 +1267,7 @@ class Console(Thread): - def _createAgent( self, name ): + def _create_agent( self, name ): """ Factory to create/retrieve an agent for this console """ @@ -1392,8 +1392,8 @@ class Console(Thread): if _agent is None: return None - # note: doQuery will add the new schema to the cache automatically. - slist = self.doQuery(_agent, + # note: do_query will add the new schema to the cache automatically. + slist = self.do_query(_agent, QmfQuery.create_id(QmfQuery.TARGET_SCHEMA, schema_id), _timeout) if slist: @@ -1781,7 +1781,7 @@ class Console(Thread): if __name__ == '__main__': # temp test code - from common import (qmfTypes, QmfEvent, SchemaProperty) + from common import (qmfTypes, SchemaProperty) logging.getLogger().setLevel(logging.INFO) diff --git a/qpid/python/qmf2/tests/agent_discovery.py b/qpid/python/qmf2/tests/agent_discovery.py index 277018f297..ce346d84e6 100644 --- a/qpid/python/qmf2/tests/agent_discovery.py +++ b/qpid/python/qmf2/tests/agent_discovery.py @@ -134,7 +134,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) self.console.enable_agent_discovery() agent1_found = agent2_found = False @@ -177,7 +177,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) query = qmf2.common.QmfQuery.create_predicate( qmf2.common.QmfQuery.TARGET_AGENT, @@ -223,7 +223,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) self.console.enable_agent_discovery() agent1_found = agent2_found = False @@ -316,7 +316,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) agent1 = self.console.find_agent("agent1", timeout=3) self.assertTrue(agent1 and agent1.get_name() == "agent1") @@ -327,7 +327,7 @@ class BaseTest(unittest.TestCase): agent2 = self.console.find_agent("agent2", timeout=3) self.assertTrue(agent2 and agent2.get_name() == "agent2") - self.console.removeConnection(self.conn, 10) + self.console.remove_connection(self.conn, 10) self.console.destroy(10) @@ -349,7 +349,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) conn.connect() - console.addConnection(conn) + console.add_connection(conn) console.enable_agent_discovery() self.consoles.append(console) @@ -453,7 +453,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) conn.connect() - console.addConnection(conn) + console.add_connection(conn) self.consoles.append(console) agent1 = self.consoles[0].find_agent("agent1", timeout=3) diff --git a/qpid/python/qmf2/tests/basic_method.py b/qpid/python/qmf2/tests/basic_method.py index 3db3af1d96..a12bbe7c4a 100644 --- a/qpid/python/qmf2/tests/basic_method.py +++ b/qpid/python/qmf2/tests/basic_method.py @@ -240,7 +240,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) @@ -253,7 +253,7 @@ class BaseTest(unittest.TestCase): {QmfQuery.CMP_EQ: [SchemaClassId.KEY_PACKAGE, "MyPackage"]}]})) - obj_list = self.console.doQuery(agent, query) + 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, @@ -290,7 +290,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) @@ -303,7 +303,7 @@ class BaseTest(unittest.TestCase): {QmfQuery.CMP_EQ: [SchemaClassId.KEY_PACKAGE, "MyPackage"]}]})) - obj_list = self.console.doQuery(agent, query) + obj_list = self.console.do_query(agent, query) self.assertTrue(len(obj_list) == 2) for obj in obj_list: self.failUnlessRaises(ValueError, @@ -327,14 +327,14 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) self.assertTrue(agent and agent.get_name() == aname) query = QmfQuery.create_id(QmfQuery.TARGET_OBJECT, "01545") - obj_list = self.console.doQuery(agent, query) + obj_list = self.console.do_query(agent, query) self.assertTrue(isinstance(obj_list, type([]))) self.assertTrue(len(obj_list) == 1) diff --git a/qpid/python/qmf2/tests/basic_query.py b/qpid/python/qmf2/tests/basic_query.py index 4c55878d2c..61002976a2 100644 --- a/qpid/python/qmf2/tests/basic_query.py +++ b/qpid/python/qmf2/tests/basic_query.py @@ -187,14 +187,14 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) 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_OBJECT_ID) - oid_list = self.console.doQuery(agent, query) + oid_list = self.console.do_query(agent, query) self.assertTrue(isinstance(oid_list, type([])), "Unexpected return type") @@ -219,7 +219,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) @@ -227,7 +227,7 @@ class BaseTest(unittest.TestCase): for oid in ['100a name', '99another name', '01545']: query = QmfQuery.create_id(QmfQuery.TARGET_OBJECT, oid) - obj_list = self.console.doQuery(agent, query) + obj_list = self.console.do_query(agent, query) self.assertTrue(isinstance(obj_list, type([])), "Unexpected return type") @@ -261,14 +261,14 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) 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_PACKAGES) - package_list = self.console.doQuery(agent, query) + package_list = self.console.do_query(agent, query) self.assertTrue(len(package_list) == 1) self.assertTrue('MyPackage' in package_list) @@ -289,7 +289,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) @@ -300,7 +300,7 @@ class BaseTest(unittest.TestCase): {QmfQuery.CMP_EQ: [SchemaClassId.KEY_PACKAGE, "MyPackage"]})) - schema_list = self.console.doQuery(agent, query) + schema_list = self.console.do_query(agent, query) self.assertTrue(len(schema_list)) for schema in schema_list: self.assertTrue(schema.get_class_id().get_package_name() == @@ -323,7 +323,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for aname in ["agent1", "agent2"]: agent = self.console.find_agent(aname, timeout=3) @@ -334,7 +334,7 @@ class BaseTest(unittest.TestCase): {QmfQuery.CMP_EQ: [SchemaClassId.KEY_PACKAGE, "No-Such-Package"]})) - schema_list = self.console.doQuery(agent, query) + schema_list = self.console.do_query(agent, query) self.assertTrue(len(schema_list) == 0) self.console.destroy(10) diff --git a/qpid/python/qmf2/tests/events.py b/qpid/python/qmf2/tests/events.py index 25c749cffa..9ee6b6af8d 100644 --- a/qpid/python/qmf2/tests/events.py +++ b/qpid/python/qmf2/tests/events.py @@ -168,7 +168,7 @@ class BaseTest(unittest.TestCase): except qpid.messaging.ConnectError, e: raise Skipped(e) - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) # find the agents for aname in ["agent1", "agent2"]: diff --git a/qpid/python/qmf2/tests/obj_gets.py b/qpid/python/qmf2/tests/obj_gets.py index f9be25409f..50d585a718 100644 --- a/qpid/python/qmf2/tests/obj_gets.py +++ b/qpid/python/qmf2/tests/obj_gets.py @@ -213,7 +213,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) for agent_app in self.agents: aname = agent_app.agent.get_name() @@ -271,7 +271,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) agent_list = [] for agent_app in self.agents: @@ -343,7 +343,7 @@ class BaseTest(unittest.TestCase): self.broker.user, self.broker.password) self.conn.connect() - self.console.addConnection(self.conn) + self.console.add_connection(self.conn) agent_list = [] for agent_app in self.agents: |