summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/policies.py
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/src/tests/policies.py')
-rw-r--r--qpid/cpp/src/tests/policies.py75
1 files changed, 1 insertions, 74 deletions
diff --git a/qpid/cpp/src/tests/policies.py b/qpid/cpp/src/tests/policies.py
index ec0191f91e..265a04557f 100644
--- a/qpid/cpp/src/tests/policies.py
+++ b/qpid/cpp/src/tests/policies.py
@@ -19,80 +19,7 @@
from qpid.tests.messaging.implementation import *
from qpid.tests.messaging import VersionTest
-
-class Mgmt:
- """
- Simple QMF management utility (qpidtoollibs uses
- qpid.messaging.Message rather than swigged version)
- """
- def __init__(self, conn):
- self.conn = conn
- self.sess = self.conn.session()
- self.reply_to = "qmf.default.topic/direct.%s;{node:{type:topic}, link:{x-declare:{auto-delete:True,exclusive:True}}}" % \
- str(uuid4())
- self.reply_rx = self.sess.receiver(self.reply_to)
- self.reply_rx.capacity = 10
- self.tx = self.sess.sender("qmf.default.direct/broker")
- self.next_correlator = 1
-
- def list(self, class_name):
- props = {'method' : 'request',
- 'qmf.opcode' : '_query_request',
- 'x-amqp-0-10.app-id' : 'qmf2'}
- correlator = str(self.next_correlator)
- self.next_correlator += 1
-
- content = {'_what' : 'OBJECT',
- '_schema_id' : {'_class_name' : class_name.lower()}}
-
- message = Message(content, reply_to=self.reply_to, correlation_id=correlator,
- properties=props, subject="broker")
- self.tx.send(message)
-
-
- response = self.reply_rx.fetch(10)
- if response.properties['qmf.opcode'] != '_query_response':
- raise Exception("bad response")
- items = []
- done = False
- while not done:
- for item in response.content:
- items.append(item['_values'])
- if 'partial' in response.properties:
- response = self.reply_rx.fetch(10)
- else:
- done = True
- self.sess.acknowledge()
- return items
-
- def do_qmf_method(self, method, arguments, addr="org.apache.qpid.broker:broker:amqp-broker", timeout=10):
- props = {'method' : 'request',
- 'qmf.opcode' : '_method_request',
- 'x-amqp-0-10.app-id' : 'qmf2'}
- correlator = str(self.next_correlator)
- self.next_correlator += 1
-
- content = {'_object_id' : {'_object_name' : addr},
- '_method_name' : method,
- '_arguments' : arguments}
-
- message = Message(content, reply_to=self.reply_to, correlation_id=correlator,
- properties=props, subject="broker")
- self.tx.send(message)
- response = self.reply_rx.fetch(timeout)
- self.sess.acknowledge()
- if response.properties['qmf.opcode'] == '_exception':
- raise Exception("Exception from Agent: %r" % response.content['_values'])
- if response.properties['qmf.opcode'] != '_method_response':
- raise Exception("bad response: %r" % response.properties)
- return response.content['_arguments']
-
- def create(self, _type, name, properties={}):
- return self.do_qmf_method('create', {'type': _type, 'name': name, 'properties': properties})
-
- def delete(self, _type, name):
- return self.do_qmf_method('delete', {'type': _type, 'name': name})
-
+from mgmt_1 import Mgmt
class PoliciesTests (VersionTest):
"""