|
From: <bov...@us...> - 2008-01-11 00:47:11
|
Revision: 1439
http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1439&view=rev
Author: boverhof
Date: 2008-01-10 16:47:15 -0800 (Thu, 10 Jan 2008)
Log Message:
-----------
M test/wsdl2py/config.txt
A test/wsdl2py/wsdl/test_Unqualified.xsd
A test/wsdl2py/test_Unqualified.py
M ZSI/twisted/WSresource.py
-- [ 1853368 ] "elementFormDefault='unqualified'" mishandled
unittest for this bug, currently fails
Modified Paths:
--------------
trunk/zsi/ZSI/twisted/WSresource.py
trunk/zsi/test/wsdl2py/config.txt
Added Paths:
-----------
trunk/zsi/test/wsdl2py/test_Unqualified.py
trunk/zsi/test/wsdl2py/wsdl/test_Unqualified.xsd
Modified: trunk/zsi/ZSI/twisted/WSresource.py
===================================================================
--- trunk/zsi/ZSI/twisted/WSresource.py 2007-11-01 22:58:39 UTC (rev 1438)
+++ trunk/zsi/ZSI/twisted/WSresource.py 2008-01-11 00:47:15 UTC (rev 1439)
@@ -253,6 +253,41 @@
return cls.protocol(DefaultCallbackHandler, DataHandler)
+class DefaultHandlerChain:
+
+ @CheckInputArgs(CallbackChainInterface, HandlerChainInterface)
+ def __init__(self, cb, *handlers):
+ self.handlercb = cb
+ self.handlers = handlers
+ self.debug = len(log.theLogPublisher.observers) > 0
+
+ def processRequest(self, arg, **kw):
+ debug = self.debug
+ if debug: log.msg('--->PROCESS REQUEST: %s' %arg, debug=1)
+
+ for h in self.handlers:
+ if debug: log.msg('\t%s handler: %s' %(arg, h), debug=1)
+ arg = h.processRequest(arg, **kw)
+
+ return self.handlercb.processRequest(arg, **kw)
+
+ def processResponse(self, arg, **kw):
+ debug = self.debug
+ if debug: log.msg('===>PROCESS RESPONSE: %s' %str(arg), debug=1)
+
+ if arg is None:
+ return
+
+ for h in self.handlers:
+ if debug: log.msg('\t%s handler: %s' %(arg, h), debug=1)
+ arg = h.processResponse(arg, **kw)
+
+ s = str(arg)
+ if debug: log.msg(s, debug=1)
+
+ return s
+
+
class WSAddressHandlerChainFactory:
protocol = DefaultHandlerChain
@@ -321,40 +356,3 @@
return NOT_DONE_YET
-
-
-
-class DefaultHandlerChain:
-
- @CheckInputArgs(CallbackChainInterface, HandlerChainInterface)
- def __init__(self, cb, *handlers):
- self.handlercb = cb
- self.handlers = handlers
- self.debug = len(log.theLogPublisher.observers) > 0
-
- def processRequest(self, arg, **kw):
- debug = self.debug
- if debug: log.msg('--->PROCESS REQUEST: %s' %arg, debug=1)
-
- for h in self.handlers:
- if debug: log.msg('\t%s handler: %s' %(arg, h), debug=1)
- arg = h.processRequest(arg, **kw)
-
- return self.handlercb.processRequest(arg, **kw)
-
- def processResponse(self, arg, **kw):
- debug = self.debug
- if debug: log.msg('===>PROCESS RESPONSE: %s' %str(arg), debug=1)
-
- if arg is None:
- return
-
- for h in self.handlers:
- if debug: log.msg('\t%s handler: %s' %(arg, h), debug=1)
- arg = h.processResponse(arg, **kw)
-
- s = str(arg)
- if debug: log.msg(s, debug=1)
-
- return s
-
Modified: trunk/zsi/test/wsdl2py/config.txt
===================================================================
--- trunk/zsi/test/wsdl2py/config.txt 2007-11-01 22:58:39 UTC (rev 1438)
+++ trunk/zsi/test/wsdl2py/config.txt 2008-01-11 00:47:15 UTC (rev 1439)
@@ -159,6 +159,7 @@
test_DerivedTypes = wsdl/test_DerivedTypes.xsd
test_SubstitutionGroup = wsdl/test_SubstitutionGroup.xsd
test_WSDLImport = wsdl/test_WSDLImport.wsdl
+test_Unqualified = wsdl/test_Unqualified.xsd
test_SquareService = wsdl/SquareService.wsdl
test_DateService = wsdl/DateService.wsdl
@@ -183,5 +184,3 @@
test_NVOAdmin = wsdl/nvo-admin.wsdl
test_Clearspace = http://eval.jivesoftware.com/clearspace/rpc/soap/BlogService?wsdl
test_VIM = wsdl/vim.wsdl
-
-
Added: trunk/zsi/test/wsdl2py/test_Unqualified.py
===================================================================
--- trunk/zsi/test/wsdl2py/test_Unqualified.py (rev 0)
+++ trunk/zsi/test/wsdl2py/test_Unqualified.py 2008-01-11 00:47:15 UTC (rev 1439)
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+############################################################################
+# Joshua R. Boverhof, LBNL
+# See LBNLCopyright for copyright notice!
+###########################################################################
+import os, sys, unittest
+from ServiceTest import main, ServiceTestCase, ServiceTestSuite
+from ZSI import FaultException
+from ZSI.TC import _get_global_element_declaration as GED
+from ZSI.writer import SoapWriter
+
+from xml.etree import ElementTree
+
+"""
+Unittest for Bug Report
+[ 1853368 ] "elementFormDefault='unqualified'" mishandled
+
+WSDL:
+"""
+
+# General targets
+def dispatch():
+ """Run all dispatch tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(UnqualifiedTestCase, 'test_dispatch'))
+ return suite
+
+def local():
+ """Run all local tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(UnqualifiedTestCase, 'test_local'))
+ return suite
+
+def net():
+ """Run all network tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(UnqualifiedTestCase, 'test_net'))
+ return suite
+
+def all():
+ """Run all tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(UnqualifiedTestCase, 'test_'))
+ return suite
+
+
+class UnqualifiedTestCase(ServiceTestCase):
+ name = "test_Unqualified"
+ types_file_name = "test_Unqualified_xsd_types.py"
+
+ def __init__(self, methodName):
+ ServiceTestCase.__init__(self, methodName)
+ self.wsdl2py_args.append('-b')
+ self.wsdl2py_args.append('-x')
+
+ def test_local_serialize1(self):
+ _test_local_serialize1()
+
+def _test_local_serialize1():
+ """
+ <element name="GlobalElementLocalType">
+ <complexType>
+ <sequence>
+ <element name="Unqualified1">
+ <complexType/>
+ </element>
+ <element name="Unqualified2" type="xsd:int"/>
+ <element name="Unqualified3" type="tns:GlobalType"/>
+ </sequence>
+ </complexType>
+ </element>
+ """
+ tns = "urn:test"
+ pyobj = GED(tns, "GlobalElementLocalType").pyclass()
+ pyobj.Unqualified1 = pyobj.new_Unqualified1()
+ pyobj.Unqualified2 = 2
+
+ pyobj.Unqualified3 = pyobj.new_Unqualified3()
+ pyobj.Unqualified3.Unqualified1 = pyobj.Unqualified3.new_Unqualified1()
+ pyobj.Unqualified3.Unqualified2 = 32
+
+ sw = SoapWriter(envelope=False)
+ sw.serialize(pyobj)
+ xml = str(sw)
+ print xml
+
+ et = ElementTree.fromstring(xml)
+
+ # GlobalElementLocalType
+ assert(et.tag == '{urn:test}GlobalElementLocalType'), "root GED"
+
+ for i,j in zip([ 'Unqualified1', 'Unqualified2', 'Unqualified3',],
+ map(lambda c: c.tag, et.getchildren())):
+
+ assert(i == j), 'Match Failed: expected "%s" not "%s"' %(i,j)
+
+
+
+if __name__ == "__main__" :
+ main()
+
Added: trunk/zsi/test/wsdl2py/wsdl/test_Unqualified.xsd
===================================================================
--- trunk/zsi/test/wsdl2py/wsdl/test_Unqualified.xsd (rev 0)
+++ trunk/zsi/test/wsdl2py/wsdl/test_Unqualified.xsd 2008-01-11 00:47:15 UTC (rev 1439)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsd:schema targetNamespace="urn:test"
+ xmlns:tns="urn:test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="GlobalElementLocalType">
+ <complexType>
+ <sequence>
+ <element name="Unqualified1">
+ <complexType/>
+ </element>
+ <element name="Unqualified2" type="xsd:int"/>
+ <element name="Unqualified3" type="tns:GlobalType"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="GlobalElementGlobalType" type="tns:GlobalType"/>
+
+ <complexType name="GlobalType">
+ <sequence>
+ <element name="Unqualified1">
+ <complexType/>
+ </element>
+ <element name="Unqualified2" type="xsd:int"/>
+ </sequence>
+ </complexType>
+
+</xsd:schema>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|