|
From: <lcl...@us...> - 2009-03-31 22:10:21
|
Revision: 1484
http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1484&view=rev
Author: lclement
Date: 2009-03-31 22:10:10 +0000 (Tue, 31 Mar 2009)
Log Message:
-----------
Some preliminary unit test for the Attachment implementation.
Modified Paths:
--------------
trunk/zsi/test/wsdl2py/config.txt
Added Paths:
-----------
trunk/zsi/test/wsdl2py/test_Attachment.py
trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl
Modified: trunk/zsi/test/wsdl2py/config.txt
===================================================================
--- trunk/zsi/test/wsdl2py/config.txt 2009-03-31 18:27:55 UTC (rev 1483)
+++ trunk/zsi/test/wsdl2py/config.txt 2009-03-31 22:10:10 UTC (rev 1484)
@@ -119,7 +119,7 @@
document = True
literal = True
broke = False
-tests = test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified test_NoMessagePart
+tests = test_Attachment test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified test_NoMessagePart
[doc_literal_broke]
document = True
@@ -186,3 +186,6 @@
test_VIM = wsdl/vim.wsdl
test_NoMessagePart = wsdl/NoMessagePart.wsdl
+
+test_Attachment = wsdl/test_Attachment.wsdl
+
Added: trunk/zsi/test/wsdl2py/test_Attachment.py
===================================================================
--- trunk/zsi/test/wsdl2py/test_Attachment.py (rev 0)
+++ trunk/zsi/test/wsdl2py/test_Attachment.py 2009-03-31 22:10:10 UTC (rev 1484)
@@ -0,0 +1,70 @@
+#!/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, ParsedSoap, SoapWriter
+
+"""
+Unittest
+
+WSDL:
+"""
+
+# General targets
+def dispatch():
+ """Run all dispatch tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(TestCase, 'test_dispatch'))
+ return suite
+
+def local():
+ """Run all local tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(TestCase, 'test_local'))
+ return suite
+
+def net():
+ """Run all network tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(TestCase, 'test_net'))
+ return suite
+
+def all():
+ """Run all tests"""
+ suite = ServiceTestSuite()
+ suite.addTest(unittest.makeSuite(TestCase, 'test_'))
+ return suite
+
+
+class TestCase(ServiceTestCase):
+ name = "test_Attachment"
+ client_file_name = "TestService_client.py"
+ types_file_name = "TestService_types.py"
+ server_file_name = "TestService_server.py"
+
+ def __init__(self, methodName):
+ ServiceTestCase.__init__(self, methodName)
+ self.wsdl2py_args.append('-b')
+
+ def test_local_generateMessageAttachment(self):
+ """doc/lit, generating a message using MIME attachment,
+ we don't have the server side implementation so we can
+ really do a full test yet
+ """
+ from TestService_server import uploadFileRequest
+ #stubs were properly generated
+ request = uploadFileRequest()
+ request._name = "TestService_client.py"
+ request._attachment = open("stubs/TestService_client.py", 'r')
+ sw = SoapWriter({}, header=True, outputclass=None, encodingStyle=None)
+ sw.serialize(request)
+ print "the request message is: " + str(sw)
+ #there is not server side, so for the moment we just create the message and print it on screen
+ #TODO add server side implmementation
+
+
+if __name__ == "__main__" :
+ main()
Added: trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl
===================================================================
--- trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl (rev 0)
+++ trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl 2009-03-31 22:10:10 UTC (rev 1484)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://nbcr.sdsc.edu/opal"
+ xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://nbcr.sdsc.edu/opal"
+ xmlns:intf="http://nbcr.sdsc.edu/opal" xmlns:tns1="http://nbcr.sdsc.edu/opal/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <wsdl:types>
+ <schema targetNamespace="http://nbcr.sdsc.edu/opal/types" xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://xml.apache.org/xml-soap"/>
+
+
+ <complexType name="InputFileType">
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ <element maxOccurs="1" minOccurs="0" name="attachment" type="apachesoap:DataHandler"/>
+ </sequence>
+ </complexType>
+
+
+ <element name="uploadFileInput" type="tns1:InputFileType"/>
+ <element name="uploadFileOutput" type="xsd:string"/>
+
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="uploadFileRequest">
+ <wsdl:part element="tns1:uploadFileInput" name="uploadFileInput"/>
+ </wsdl:message>
+
+ <wsdl:message name="uploadFileResponse">
+ <wsdl:part element="tns1:uploadFileOutput" name="uploadFileOutput"/>
+ </wsdl:message>
+
+ <wsdl:portType name="TestServicePortType">
+ <wsdl:operation name="uploadFile" parameterOrder="uploadFileInput">
+ <wsdl:input message="impl:uploadFileRequest" name="uploadFileRequest"/>
+ <wsdl:output message="impl:uploadFileResponse" name="uploadFileResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="TestServicePortSoapBinding" type="impl:TestServicePortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="uploadFile">
+ <wsdlsoap:operation soapAction="http://nbcr.sdsc.edu/opal/uploadFile"/>
+ <wsdl:input name="uploadFileRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="uploadFileResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestService">
+ <wsdl:port binding="impl:TestServicePortSoapBinding" name="TestServicePort">
+ <wsdlsoap:address location="http://localhost:8080/opal2/services/CAT"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|