Commit b8ae36ac authored by aikchar's avatar aikchar

Fixes to purge queue

parent 1f756c05
......@@ -15,7 +15,7 @@ class RequestCmd:
self.query_properties = {"x-amqp-0-10.app-id": "qmf2", "qmf.opcode": "_query_request", "method": "request"}
logger.debug("Message properties -> {0}".format(self.query_properties))
def create_queue(self, name, strict=True, auto_delete=False, auto_delete_timeout=10):
def create_queue(self, name, strict=True, auto_delete=False, auto_delete_timeout=0):
"""Create message content and properties to create queue with QMFv2
:param name: Name of queue to create
......@@ -118,7 +118,7 @@ class RequestCmd:
"_method_name": "delete",
"_arguments": {"type": "queue",
"name": name,
"options": dict()}}
"options": dict()}} # "A nested map with the key options. This is presently unused."
logger.debug("Message content -> {0}".format(content))
return content, self.method_properties
......@@ -133,7 +133,8 @@ class RequestCmd:
"""
content = {"_object_id": {"_object_name": self.object_name},
"_method_name": "delete",
"_arguments": {"type": "exchange", "name": name, "options": dict()}}
"_arguments": {"type": "exchange", "name": name,
"options": dict()}} # "A nested map with the key options. This is presently unused."
logger.debug("Message content -> {0}".format(content))
return content, self.method_properties
......@@ -183,10 +184,11 @@ class RequestCmd:
:returns: Tuple containing content and method properties
"""
content = {"_object_id": {"_object_name": self.object_name},
content = {"_object_id": {"_object_name": "org.apache.qpid.broker:queue:{0}".format(name)},
"_method_name": "purge",
"_arguments": {"type": "queue",
"name": name}}
"name": name,
"filter": dict()}}
logger.debug("Message content -> {0}".format(content))
return content, self.method_properties
......@@ -32,14 +32,20 @@ class Example1(MessagingHandler):
logger.debug("url {0}".format(self.url))
reqcmd = RequestCmd()
self.request_messages = [reqcmd.list_queues(),
reqcmd.create_queue("MYFIRSTQUEUE"),
reqcmd.list_queues(),
reqcmd.delete_queue("MYFIRSTQUEUE"),
reqcmd.list_exchanges(),
reqcmd.create_exchange("MYFIRSTEXCAHNGE"),
reqcmd.list_exchanges(),
reqcmd.delete_exchange("MYFIRSTEXCAHNGE")]
myfirstqueue = "MYFIRSTQUEUE"
myfirstexchange = "MYFIRSTEXCAHNGE"
self.request_messages = [
reqcmd.list_queues(),
reqcmd.create_queue(myfirstqueue),
reqcmd.list_queues(),
reqcmd.purge_queue(myfirstqueue),
reqcmd.list_queues(),
reqcmd.delete_queue(myfirstqueue),
reqcmd.list_exchanges(),
reqcmd.create_exchange(myfirstexchange),
reqcmd.list_exchanges(),
reqcmd.delete_exchange(myfirstexchange),
]
logger.debug("requests {0}".format(self.request_messages))
def on_start(self, event):
......
......@@ -26,7 +26,7 @@ class TestRequestQueue:
"name": queue,
"strict": True,
"properties": {"auto-delete": False,
"qpid.auto_delete_timeout": 10}}}
"qpid.auto_delete_timeout": 0}}}
logger.debug("Expected content -> {0}".format(expected_content))
expected_properties = {"x-amqp-0-10.app-id": "qmf2", "qmf.opcode": "_method_request", "method": "request"}
......@@ -81,10 +81,11 @@ class TestRequestQueue:
logger.debug("Content -> {0}".format(content))
logger.debug("Properties -> {0}".format(properties))
expected_content = {"_object_id": {"_object_name": "org.apache.qpid.broker:broker:amqp-broker"},
expected_content = {"_object_id": {"_object_name": "org.apache.qpid.broker:queue:{0}".format(queue)},
"_method_name": "purge",
"_arguments": {"type": "queue",
"name": queue}}
"name": queue,
"filter": dict()}}
logger.debug("Expected content -> {0}".format(expected_content))
expected_properties = {"x-amqp-0-10.app-id": "qmf2", "qmf.opcode": "_method_request", "method": "request"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment