You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/03/19 20:15:12 UTC
svn commit: r520050 - in /incubator/qpid/trunk/qpid: ./ python/hello-world
python/qpid/spec.py python/qpid/testlib.py specs/amqp-errata.0-9.xml
specs/amqp-nogen.0-9.xml
Author: aconway
Date: Mon Mar 19 12:15:11 2007
New Revision: 520050
URL: http://svn.apache.org/viewvc?view=rev&rev=520050
Log:
* python/testlib.py: -s (spec) option now also takes abbreviations "0-8" and "0-9"
to load default 0-8 or 0-9 XML respectively. Default is still 0-8.
Merged revisions 501586 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9
........
r501586 | rhs | 2007-01-30 16:44:41 -0500 (Tue, 30 Jan 2007) | 1 line
updated python spec parse to load from multiple files, changed default specs to include errata
........
Added:
incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml (with props)
incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml (with props)
Modified:
incubator/qpid/trunk/qpid/ (props changed)
incubator/qpid/trunk/qpid/python/hello-world
incubator/qpid/trunk/qpid/python/qpid/spec.py
incubator/qpid/trunk/qpid/python/qpid/testlib.py
Propchange: incubator/qpid/trunk/qpid/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 19 12:15:11 2007
@@ -1 +1 @@
-/incubator/qpid/branches/M2:0-519912,519933 /incubator/qpid/branches/qpid.0-9:1-492620,496593,497277,500305,501022,501025,501082,501143
+/incubator/qpid/branches/M2:0-519912,519933 /incubator/qpid/branches/qpid.0-9:1-492620,496593,497277,500305,501022,501025,501082,501143,501586
Modified: incubator/qpid/trunk/qpid/python/hello-world
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/hello-world?view=diff&rev=520050&r1=520049&r2=520050
==============================================================================
--- incubator/qpid/trunk/qpid/python/hello-world (original)
+++ incubator/qpid/trunk/qpid/python/hello-world Mon Mar 19 12:15:11 2007
@@ -3,7 +3,8 @@
from qpid.client import Client
from qpid.content import Content
-client = Client("127.0.0.1", 5672, qpid.spec.load("../specs/amqp.0-9.xml"))
+client = Client("127.0.0.1", 5672, qpid.spec.load("../specs/amqp.0-9.xml",
+ "../specs/amqp-errata.0-9.xml"))
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
ch = client.channel(1)
ch.channel_open()
Modified: incubator/qpid/trunk/qpid/python/qpid/spec.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/spec.py?view=diff&rev=520050&r1=520049&r2=520050
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/spec.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/spec.py Mon Mar 19 12:15:11 2007
@@ -79,11 +79,12 @@
PRINT=["major", "minor", "file"]
- def __init__(self, major, minor, file):
+ def __init__(self, major, minor, file, errata):
Metadata.__init__(self)
self.major = major
self.minor = minor
self.file = file
+ self.errata = errata
self.constants = SpecContainer()
self.classes = SpecContainer()
# methods indexed by classname_methname
@@ -267,43 +268,56 @@
type = domains[type]
l.add(Field(pythonize(f_nd["@name"]), f_nd.index(), type, get_docs(f_nd)))
-def load(specfile):
+def load(specfile, *errata):
doc = xmlutil.parse(specfile)
- root = doc["amqp"][0]
- spec = Spec(int(root["@major"]), int(root["@minor"]), specfile)
+ spec_root = doc["amqp"][0]
+ spec = Spec(int(spec_root["@major"]), int(spec_root["@minor"]), specfile, errata)
+
+ for root in [spec_root] + map(lambda x: xmlutil.parse(x)["amqp"][0], errata):
+ # constants
+ for nd in root["constant"]:
+ const = Constant(spec, pythonize(nd["@name"]), int(nd["@value"]),
+ nd.get("@class"), get_docs(nd))
+ spec.constants.add(const)
+
+ # domains are typedefs
+ domains = {}
+ for nd in root["domain"]:
+ domains[nd["@name"]] = nd["@type"]
+
+ # classes
+ for c_nd in root["class"]:
+ cname = pythonize(c_nd["@name"])
+ if root == spec_root:
+ klass = Class(spec, cname, int(c_nd["@index"]), c_nd["@handler"],
+ get_docs(c_nd))
+ spec.classes.add(klass)
+ else:
+ klass = spec.classes.byname[cname]
+
+ added_methods = []
+ load_fields(c_nd, klass.fields, domains)
+ for m_nd in c_nd["method"]:
+ mname = pythonize(m_nd["@name"])
+ if root == spec_root:
+ meth = Method(klass, mname,
+ int(m_nd["@index"]),
+ m_nd.get_bool("@content", False),
+ [pythonize(nd["@name"]) for nd in m_nd["response"]],
+ m_nd.get_bool("@synchronous", False),
+ m_nd.text,
+ get_docs(m_nd))
+ klass.methods.add(meth)
+ added_methods.append(meth)
+ else:
+ meth = klass.methods.byname[mname]
+ load_fields(m_nd, meth.fields, domains)
+ # resolve the responses
+ for m in added_methods:
+ m.responses = [klass.methods.byname[r] for r in m.responses]
+ for resp in m.responses:
+ resp.response = True
- # constants
- for nd in root["constant"]:
- const = Constant(spec, pythonize(nd["@name"]), int(nd["@value"]),
- nd.get("@class"), get_docs(nd))
- spec.constants.add(const)
-
- # domains are typedefs
- domains = {}
- for nd in root["domain"]:
- domains[nd["@name"]] = nd["@type"]
-
- # classes
- for c_nd in root["class"]:
- klass = Class(spec, pythonize(c_nd["@name"]), int(c_nd["@index"]),
- c_nd["@handler"], get_docs(c_nd))
- load_fields(c_nd, klass.fields, domains)
- for m_nd in c_nd["method"]:
- meth = Method(klass, pythonize(m_nd["@name"]),
- int(m_nd["@index"]),
- m_nd.get_bool("@content", False),
- [pythonize(nd["@name"]) for nd in m_nd["response"]],
- m_nd.get_bool("@synchronous", False),
- m_nd.text,
- get_docs(m_nd))
- load_fields(m_nd, meth.fields, domains)
- klass.methods.add(meth)
- # resolve the responses
- for m in klass.methods:
- m.responses = [klass.methods.byname[r] for r in m.responses]
- for resp in m.responses:
- resp.response = True
- spec.classes.add(klass)
spec.post_load()
return spec
Modified: incubator/qpid/trunk/qpid/python/qpid/testlib.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/testlib.py?view=diff&rev=520050&r1=520049&r2=520050
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/testlib.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/testlib.py Mon Mar 19 12:15:11 2007
@@ -57,7 +57,9 @@
The name of a test is package.module.ClassName.testMethod
Options:
-?/-h/--help : this message
- -s/--spec <spec.xml> : file containing amqp XML spec
+ -s/--spec <spec.xml> : URL of AMQP XML specification or one of these abbreviations:
+ 0-8 - use the default 0-8 specification.
+ 0-9 - use the default 0-9 specification.
-b/--broker [<user>[/<password>]@]<host>[:<port>] : broker to connect to
-v/--verbose : verbose - lists tests as they are run.
-d/--debug : enable debug logging.
@@ -77,13 +79,6 @@
self.user = default(self.user, "guest")
self.password = default(self.password, "guest")
- def __init__(self):
- # Defaults
- self.setBroker("localhost")
- self.specfile = "../specs/amqp.0-8.xml"
- self.verbose = 1
- self.ignore = []
-
def ignoreFile(self, filename):
f = file(filename)
for line in f.readlines(): self.ignore.append(line.strip())
@@ -95,6 +90,12 @@
return self.spec.major==8 and self.spec.minor==0
def _parseargs(self, args):
+ # Defaults
+ self.setBroker("localhost")
+ self.verbose = 1
+ self.ignore = []
+ self.specfile = "0-8"
+ self.errata = []
try:
opts, self.tests = getopt(args, "s:b:h?dvi:I:", ["help", "spec", "server", "verbose", "ignore", "ignore-file"])
except GetoptError, e:
@@ -107,8 +108,13 @@
if opt in ("-d", "--debug"): logging.basicConfig(level=logging.DEBUG)
if opt in ("-i", "--ignore"): self.ignore.append(value)
if opt in ("-I", "--ignore-file"): self.ignoreFile(value)
-
- self.spec = qpid.spec.load(self.specfile)
+ if (self.specfile == "0-8"):
+ self.specfile = "../specs/amqp.0-8.xml"
+ if (self.specfile == "0-9"):
+ self.specfile = "../specs/amqp.0-9.xml"
+ self.errata = ["../specs/amqp-errata.0-9.xml"]
+ print "Using specification from:", self.specfile
+ self.spec = qpid.spec.load(self.specfile, *self.errata)
if len(self.tests) == 0:
if self.use08spec():
testdir="tests_0-8"
Added: incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml?view=auto&rev=520050
==============================================================================
--- incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml (added)
+++ incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml Mon Mar 19 12:15:11 2007
@@ -0,0 +1,44 @@
+<?xml version = "1.0"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<amqp major = "0" minor = "9" port = "5672" comment = "AMQ Protocol version 0-9">
+
+ <constant name = "frame-request" value = "9" />
+ <constant name = "frame-response" value = "10" />
+
+ <!-- == MESSAGE =========================================================== -->
+
+ <class name = "message" index = "120">
+ <method name = "transfer" index = "10">
+ <chassis name = "server" implement = "MUST" />
+ <chassis name = "client" implement = "MUST" />
+ <field name = "mandatory" type = "bit" label = "indicate mandatory routing">
+ <doc>
+ This flag tells the server how to react if the message cannot be
+ routed to a queue. If this flag is set, the server will return an
+ unroutable message with a Return method. If this flag is zero, the
+ server silently drops the message.
+ </doc>
+ </field>
+ </method>
+ </class>
+
+</amqp>
Propchange: incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/qpid/trunk/qpid/specs/amqp-errata.0-9.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml?view=auto&rev=520050
==============================================================================
--- incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml (added)
+++ incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml Mon Mar 19 12:15:11 2007
@@ -0,0 +1,42 @@
+<?xml version = "1.0"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<amqp major = "0" minor = "9" port = "5672" comment = "AMQ Protocol version 0-9">
+
+ <!-- == BASIC ============================================================ -->
+
+ <class name = "basic" index = "60">
+ <codegen value="no-gen" />
+ </class>
+
+ <!-- == FILE ============================================================= -->
+
+ <class name = "file" index = "70">
+ <codegen value="no-gen" />
+ </class>
+
+ <!-- == STREAM =========================================================== -->
+
+ <class name = "stream" index = "80">
+ <codegen value="no-gen" />
+ </class>
+
+</amqp>
Propchange: incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/qpid/trunk/qpid/specs/amqp-nogen.0-9.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml