summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-08-11 15:43:59 +0000
committerRafael H. Schloming <rhs@apache.org>2009-08-11 15:43:59 +0000
commit50dfb0697c6a080fe216eade8bc011c6c8094000 (patch)
treedab22b8b0b00af920542448a7838b1c0cea5ac4a /python
parentd22ac4bbbd52fc8cbf80f864c49c904b0b24a529 (diff)
downloadqpid-python-50dfb0697c6a080fe216eade8bc011c6c8094000.tar.gz
removed more dead code and files
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@803171 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/cpp_failing_0-10.txt0
-rw-r--r--python/cpp_failing_0-8.txt0
-rw-r--r--python/cpp_failing_0-9.txt4
-rw-r--r--python/java_failing_0-8.txt2
-rw-r--r--python/java_failing_0-9.txt18
-rwxr-xr-xpython/pal2py274
-rwxr-xr-xpython/perftest113
-rwxr-xr-xpython/rule2test108
8 files changed, 0 insertions, 519 deletions
diff --git a/python/cpp_failing_0-10.txt b/python/cpp_failing_0-10.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/python/cpp_failing_0-10.txt
+++ /dev/null
diff --git a/python/cpp_failing_0-8.txt b/python/cpp_failing_0-8.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/python/cpp_failing_0-8.txt
+++ /dev/null
diff --git a/python/cpp_failing_0-9.txt b/python/cpp_failing_0-9.txt
deleted file mode 100644
index 06c31080fb..0000000000
--- a/python/cpp_failing_0-9.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-tests_0-9.message.MessageTests.test_checkpoint
-tests_0-9.message.MessageTests.test_reject
-tests_0-9.basic.BasicTests.test_get
-
diff --git a/python/java_failing_0-8.txt b/python/java_failing_0-8.txt
deleted file mode 100644
index c13b40a42c..0000000000
--- a/python/java_failing_0-8.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-tests_0-8.exchange.RecommendedTypesRuleTests.testTopic
-tests_0-8.exchange.RequiredInstancesRuleTests.testAmqTopic
diff --git a/python/java_failing_0-9.txt b/python/java_failing_0-9.txt
deleted file mode 100644
index 7252d0f496..0000000000
--- a/python/java_failing_0-9.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-ntests.basic.BasicTests.test_qos_prefetch_count
-tests.basic.BasicTests.test_ack
-tests.basic.BasicTests.test_cancel
-tests.basic.BasicTests.test_consume_exclusive
-tests.basic.BasicTests.test_consume_no_local
-tests.basic.BasicTests.test_consume_queue_errors
-tests.basic.BasicTests.test_consume_unique_consumers
-tests.basic.BasicTests.test_get
-tests.basic.BasicTests.test_qos_prefetch_size
-tests.basic.BasicTests.test_recover_requeue
-
-tests.exchange.RecommendedTypesRuleTests.testTopic
-tests.exchange.RequiredInstancesRuleTests.testAmqTopic
-
-tests.message.MessageTests.test_checkpoint
-tests.message.MessageTests.test_reject
-
-tests.broker.BrokerTests.test_ping_pong
diff --git a/python/pal2py b/python/pal2py
deleted file mode 100755
index 544151bf76..0000000000
--- a/python/pal2py
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-import sys, os, xml
-
-from qpid.spec import load, pythonize
-from textwrap import TextWrapper
-from xml.sax.handler import ContentHandler
-
-class Block:
-
- def __init__(self, children):
- self.children = children
-
- def emit(self, out):
- for child in self.children:
- if not hasattr(child, "emit"):
- raise ValueError(child)
- child.emit(out)
-
- if not self.children:
- out.line("pass")
-
-class If:
-
- def __init__(self, expr, cons, alt = None):
- self.expr = expr
- self.cons = cons
- self.alt = alt
-
- def emit(self, out):
- out.line("if ")
- self.expr.emit(out)
- out.write(":")
- out.level += 1
- self.cons.emit(out)
- out.level -= 1
- if self.alt:
- out.line("else:")
- out.level += 1
- self.alt.emit(out)
- out.level -= 1
-
-class Stmt:
-
- def __init__(self, code):
- self.code = code
-
- def emit(self, out):
- out.line(self.code)
-
-class Expr:
-
- def __init__(self, code):
- self.code = code
-
- def emit(self, out):
- out.write(self.code)
-
-class Abort:
-
- def __init__(self, expr):
- self.expr = expr
-
- def emit(self, out):
- out.line("assert False, ")
- self.expr.emit(out)
-
-WRAPPER = TextWrapper()
-
-def wrap(text):
- return WRAPPER.wrap(" ".join(text.split()))
-
-class Doc:
-
- def __init__(self, text):
- self.text = text
-
- def emit(self, out):
- out.line('"""')
- for line in wrap(self.text):
- out.line(line)
- out.line('"""')
-
-class Frame:
-
- def __init__(self, attrs):
- self.attrs = attrs
- self.children = []
- self.text = None
-
- def __getattr__(self, attr):
- return self.attrs[attr]
-
-def isunicode(s):
- if isinstance(s, str):
- return False
- for ch in s:
- if ord(ch) > 127:
- return True
- return False
-
-def string_literal(s):
- if s == None:
- return None
- if isunicode(s):
- return "%r" % s
- else:
- return "%r" % str(s)
-
-TRUTH = {
- "1": True,
- "0": False,
- "true": True,
- "false": False
- }
-
-LITERAL = {
- "shortstr": string_literal,
- "longstr": string_literal,
- "bit": lambda s: TRUTH[s.lower()],
- "longlong": lambda s: "%r" % long(s)
- }
-
-def literal(s, field):
- return LITERAL[field.type](s)
-
-def palexpr(s, field):
- if s.startswith("$"):
- return "msg.%s" % s[1:]
- else:
- return literal(s, field)
-
-class Translator(ContentHandler):
-
- def __init__(self, spec):
- self.spec = spec
- self.stack = []
- self.content = None
- self.root = Frame(None)
- self.push(self.root)
-
- def emit(self, out):
- blk = Block(self.root.children)
- blk.emit(out)
- out.write("\n")
-
- def peek(self):
- return self.stack[-1]
-
- def pop(self):
- return self.stack.pop()
-
- def push(self, frame):
- self.stack.append(frame)
-
- def startElement(self, name, attrs):
- self.push(Frame(attrs))
-
- def endElement(self, name):
- frame = self.pop()
- if hasattr(self, name):
- child = getattr(self, name)(frame)
- else:
- child = self.handle(name, frame)
-
- if child:
- self.peek().children.append(child)
-
- def characters(self, text):
- frame = self.peek()
- if frame.text:
- frame.text += text
- else:
- frame.text = text
-
- def handle(self, name, frame):
- for klass in self.spec.classes:
- pyklass = pythonize(klass.name)
- if name.startswith(pyklass):
- name = name[len(pyklass) + 1:]
- break
- else:
- raise ValueError("unknown class: %s" % name)
-
- for method in klass.methods:
- pymethod = pythonize(method.name)
- if name == pymethod:
- break
- else:
- raise ValueError("unknown method: %s" % name)
-
- args = ["%s = %s" % (key, palexpr(val, method.fields.bypyname[key]))
- for key, val in frame.attrs.items()]
- if method.content and self.content:
- args.append("content = %r" % string_literal(self.content))
- code = "ssn.%s_%s(%s)" % (pyklass, pymethod, ", ".join(args))
- if pymethod == "consume":
- code = "consumer_tag = %s.consumer_tag" % code
- return Stmt(code)
-
- def pal(self, frame):
- return Block([Doc(frame.text)] + frame.children)
-
- def include(self, frame):
- base, ext = os.path.splitext(frame.filename)
- return Stmt("from %s import *" % base)
-
- def session(self, frame):
- return Block([Stmt("cli = open()"), Stmt("ssn = cli.channel(0)"),
- Stmt("ssn.channel_open()")] + frame.children)
-
- def empty(self, frame):
- return If(Expr("msg == None"), Block(frame.children))
-
- def abort(self, frame):
- return Abort(Expr(string_literal(frame.text)))
-
- def wait(self, frame):
- return Stmt("msg = ssn.queue(consumer_tag).get(timeout=%r)" %
- (int(frame.timeout)/1000))
-
- def basic_arrived(self, frame):
- if frame.children:
- return If(Expr("msg != None"), Block(frame.children))
-
- def basic_content(self, frame):
- self.content = frame.text
-
-class Emitter:
-
- def __init__(self, out):
- self.out = out
- self.level = 0
-
- def write(self, code):
- self.out.write(code)
-
- def line(self, code):
- self.write("\n%s%s" % (" "*self.level, code))
-
- def flush(self):
- self.out.flush()
-
- def close(self):
- self.out.close()
-
-
-for f in sys.argv[2:]:
- base, ext = os.path.splitext(f)
- spec = load(sys.argv[1])
- t = Translator(spec)
- xml.sax.parse(f, t)
-# out = Emitter(open("%s.py" % base))
- out = Emitter(sys.stdout)
- t.emit(out)
- out.close()
diff --git a/python/perftest b/python/perftest
deleted file mode 100755
index f867566fd0..0000000000
--- a/python/perftest
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-def publisher(n):
- import qpid
- import sys
- from qpid.client import Client
- from qpid.content import Content
- if len(sys.argv) >= 3:
- n = int(sys.argv[2])
- client = Client("127.0.0.1", 5672)
- client.start({"LOGIN": "guest", "PASSWORD": "guest"})
- channel = client.channel(1)
- channel.session_open()
- message = Content("message")
- message["routing_key"] = "message_queue"
- print "producing ", n, " messages"
- for i in range(n):
- channel.message_transfer(destination="amq.direct", content=message)
-
- print "producing final message"
- message = Content("That's done")
- message["routing_key"] = "message_queue"
- channel.message_transfer(destination="amq.direct", content=message)
-
- print "consuming sync message"
- consumer = "consumer"
- queue = client.queue(consumer)
- channel.message_subscribe(queue="sync_queue", destination=consumer)
- channel.message_flow(consumer, 0, 0xFFFFFFFFL)
- channel.message_flow(consumer, 1, 0xFFFFFFFFL)
- queue.get(block = True)
- print "done"
- channel.session_close()
-
-def consumer():
- import sys
- import qpid
- from qpid.client import Client
- from qpid.content import Content
- client = Client("127.0.0.1", 5672)
- client.start({"LOGIN": "guest", "PASSWORD": "guest"})
- channel = client.channel(1)
- channel.session_open()
- consumer = "consumer"
- queue = client.queue(consumer)
- channel.message_subscribe(queue="message_queue", destination=consumer)
- channel.message_flow(consumer, 0, 0xFFFFFFFFL)
- channel.message_flow(consumer, 1, 0xFFFFFFFFL)
- final = "That's done"
- content = ""
- message = None
- print "getting messages"
- while content != final:
- message = queue.get(block = True)
- content = message.content.body
- message.complete(cumulative=True)
-
- print "consumed all messages"
- message = Content("message")
- message["routing_key"] = "sync_queue"
- channel.message_transfer(destination="amq.direct", content=message)
- print "done"
- channel.session_close()
-
-if __name__=='__main__':
- import sys
- import qpid
- from timeit import Timer
- from qpid.client import Client
- from qpid.content import Content
- client = Client("127.0.0.1", 5672)
- client.start({"LOGIN": "guest", "PASSWORD": "guest"})
- channel = client.channel(1)
- channel.session_open()
- channel.queue_declare(queue="message_queue")
- channel.queue_bind(exchange="amq.direct", queue="message_queue", routing_key="message_queue")
- channel.queue_declare(queue="sync_queue")
- channel.queue_bind(exchange="amq.direct", queue="sync_queue", routing_key="sync_queue")
- channel.session_close()
-
- numMess = 100
- if len(sys.argv) >= 3:
- numMess = int(sys.argv[2])
- if len(sys.argv) == 1:
- print "error: please specify prod or cons"
- elif sys.argv[1] == 'prod':
- tprod = Timer("publisher(100)", "from __main__ import publisher")
- tp = tprod.timeit(1)
- print "produced and consumed" , numMess + 2 ,"messages in: ", tp
- elif sys.argv[1] == 'cons':
- tcons = Timer("consumer()", "from __main__ import consumer")
- tc = tcons.timeit(1)
- print "consumed " , numMess ," in: ", tc
- else:
- print "please specify prod or cons"
diff --git a/python/rule2test b/python/rule2test
deleted file mode 100755
index 10f151366e..0000000000
--- a/python/rule2test
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#
-# Convert rules to tests
-#
-import sys, re, os.path
-from getopt import getopt, GetoptError
-from string import capitalize
-from xml import dom
-from xml.dom.minidom import parse
-
-def camelcase(s):
- """Convert 'string like this' to 'StringLikeThis'"""
- return "".join([capitalize(w) for w in re.split(re.compile("\W*"), s)])
-
-def uncapitalize(s): return s[0].lower()+s[1:]
-
-def ancestors(node):
- "Return iterator of ancestors from top-level element to node"
- def generator(node):
- while node and node.parentNode:
- yield node
- node = node.parentNode
- return reversed(list(generator(node)))
-
-def tagAndName(element):
- nameAttr = element.getAttribute("name");
- if (nameAttr) : return camelcase(nameAttr) + camelcase(element.tagName)
- else: return camelcase(element.tagName)
-
-def nodeText(n):
- """Recursively collect text from all text nodes under n"""
- if n.nodeType == dom.Node.TEXT_NODE:
- return n.data
- if n.childNodes:
- return reduce(lambda t, c: t + nodeText(c), n.childNodes, "")
- return ""
-
-def cleanup(docString, level=8):
- unindent = re.sub("\n[ \t]*", "\n", docString.strip())
- emptyLines = re.sub("\n\n\n", "\n\n", unindent)
- indented = re.sub("\n", "\n"+level*" ", emptyLines)
- return level*" " + indented
-
-def printTest(test, docstring):
- print "class %s(TestBase):" % test
- print ' """'
- print docstring
- print ' """'
- print
- print
-
-def printTests(doc, module):
- """Returns dictionary { classname : [ (methodname, docstring)* ] * }"""
- tests = {}
- rules = doc.getElementsByTagName("rule")
- for r in rules:
- path = list(ancestors(r))
- if module == path[1].getAttribute("name").lower():
- test = "".join(map(tagAndName, path[2:])) + "Tests"
- docstring = cleanup(nodeText(r), 4)
- printTest(test, docstring)
-
-def usage(message=None):
- if message: print >>sys.stderr, message
- print >>sys.stderr, """
-rule2test [options] <amqpclass>
-
-Print test classes for each rule for the amqpclass in amqp.xml.
-
-Options:
- -?/-h/--help : this message
- -s/--spec <spec.xml> : file containing amqp XML spec
-"""
- return 1
-
-def main(argv):
- try: opts, args = getopt(argv[1:], "h?s:", ["help", "spec="])
- except GetoptError, e: return usage(e)
- spec = "../specs/amqp.xml" # Default
- for opt, val in opts:
- if (opt in ("-h", "-?", "--help")): return usage()
- if (opt in ("-s", "--spec")): spec = val
- doc = parse(spec)
- if len(args) == 0: return usage()
- printTests(doc, args[0])
- return 0
-
-if (__name__ == "__main__"): sys.exit(main(sys.argv))