diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-07 07:36:34 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-07 07:36:34 +0000 |
commit | 441546edcfbb1b346c87b69c5f578d1a0e522e06 (patch) | |
tree | 04f606a008baebc445f38944ad37e87468da29ea /ruby_1_8_6/test/wsdl/ref | |
parent | fa93611c0f9a6db146341c792bfe3b7322ec00e2 (diff) |
add tag v1_8_6_269
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_6_269@17937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_1_8_6/test/wsdl/ref')
-rw-r--r-- | ruby_1_8_6/test/wsdl/ref/expectedProduct.rb | 90 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/ref/product.wsdl | 86 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/ref/test_ref.rb | 54 |
3 files changed, 230 insertions, 0 deletions
diff --git a/ruby_1_8_6/test/wsdl/ref/expectedProduct.rb b/ruby_1_8_6/test/wsdl/ref/expectedProduct.rb new file mode 100644 index 0000000000..91c6e4c566 --- /dev/null +++ b/ruby_1_8_6/test/wsdl/ref/expectedProduct.rb @@ -0,0 +1,90 @@ +require 'xsd/qname' + +# {urn:product}Rating +module Rating + C_0 = "0" + C_1 = "+1" + C_1_2 = "-1" +end + +# {urn:product}Product-Bag +class ProductBag + @@schema_type = "Product-Bag" + @@schema_ns = "urn:product" + @@schema_attribute = {XSD::QName.new("urn:product", "version") => "SOAP::SOAPString", XSD::QName.new("urn:product", "yesno") => "SOAP::SOAPString"} + @@schema_element = [["bag", ["Product[]", XSD::QName.new(nil, "bag")]], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", [nil, XSD::QName.new(nil, "comment_1")]], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]] + + attr_accessor :bag + attr_accessor :product_Bag + attr_accessor :comment_1 + attr_accessor :comment_2 + + def Rating + @rating + end + + def Rating=(value) + @rating = value + end + + def xmlattr_version + (@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")] + end + + def xmlattr_version=(value) + (@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")] = value + end + + def xmlattr_yesno + (@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")] + end + + def xmlattr_yesno=(value) + (@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")] = value + end + + def initialize(bag = [], rating = [], product_Bag = nil, comment_1 = [], comment_2 = []) + @bag = bag + @rating = rating + @product_Bag = product_Bag + @comment_1 = comment_1 + @comment_2 = comment_2 + @__xmlattr = {} + end +end + +# {urn:product}Creator +class Creator + @@schema_type = "Creator" + @@schema_ns = "urn:product" + @@schema_element = [] + + def initialize + end +end + +# {urn:product}Product +class Product + @@schema_type = "Product" + @@schema_ns = "urn:product" + @@schema_element = [["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]] + + attr_accessor :name + + def Rating + @rating + end + + def Rating=(value) + @rating = value + end + + def initialize(name = nil, rating = nil) + @name = name + @rating = rating + end +end + +# {urn:product}Comment +class Comment < String +end diff --git a/ruby_1_8_6/test/wsdl/ref/product.wsdl b/ruby_1_8_6/test/wsdl/ref/product.wsdl new file mode 100644 index 0000000000..993fe217aa --- /dev/null +++ b/ruby_1_8_6/test/wsdl/ref/product.wsdl @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<definitions name="product" + targetNamespace="urn:product" + xmlns:tns="urn:product" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + <types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="urn:product"> + <simpleType name="non-empty-string"> + <restriction base="xsd:string"> + <minLength value="1"/> + </restriction> + </simpleType> + + <complexType name="Product"> + <all> + <element name="name" type="xsd:string"/> + <element ref="tns:Rating"/> + </all> + </complexType> + + <complexType name="Comment"> + <simpleContent> + <extension base="xsd:string"> + <attribute name="msgid" type="xsd:string" use="required"/> + </extension> + </simpleContent> + </complexType> + + <attribute name="version" type="tns:non-empty-string"/> + + <attribute default="Y" name="yesno"> + <simpleType> + <restriction base="xsd:string"> + <enumeration value="Y"/> + <enumeration value="N"/> + </restriction> + </simpleType> + </attribute> + + <element name="Rating"> + <simpleType> + <restriction base="xsd:string"> + <enumeration value="+1"/> + <enumeration value="0"/> + <enumeration value="-1"/> + </restriction> + </simpleType> + </element> + + <element name="Product-Bag"> + <complexType> + <sequence> + <element name="bag" type="tns:Product" minOccurs="0" maxOccurs="unbounded"/> + <element ref="tns:Rating" minOccurs="0" maxOccurs="unbounded"/> + <element ref="tns:Product-Bag"/> + <element name="comment_1" minOccurs="0" maxOccurs="unbounded"> + <complexType> + <simpleContent> + <extension base="xsd:string"> + <attribute name="msgid" type="xsd:string" use="required"/> + </extension> + </simpleContent> + </complexType> + </element> + <element name="comment-2" type="tns:Comment" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute ref="tns:version"/> + <attribute ref="tns:yesno"/> + </complexType> + </element> + + <element name="Creator" minOccurs="0" maxOccurs="unbounded"> + <complexType> + <simpleContent> + <extension base="xsd:string"> + <attribute name="Role" type="xs:string" use="required"/> + </extension> + </simpleContent> + </complexType> + </element> + </xsd:schema> + </types> +</definitions> diff --git a/ruby_1_8_6/test/wsdl/ref/test_ref.rb b/ruby_1_8_6/test/wsdl/ref/test_ref.rb new file mode 100644 index 0000000000..9e29fa31e0 --- /dev/null +++ b/ruby_1_8_6/test/wsdl/ref/test_ref.rb @@ -0,0 +1,54 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require 'wsdl/soap/wsdl2ruby' + + +module WSDL +module Ref + + +class TestRef < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def test_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("product.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + suppress_warning do + gen.run + end + compare("expectedProduct.rb", "product.rb") + File.unlink(pathname('product.rb')) + end + + def compare(expected, actual) + assert_equal(loadfile(expected), loadfile(actual), actual) + end + + def loadfile(file) + File.open(pathname(file)) { |f| f.read } + end + + def pathname(filename) + File.join(DIR, filename) + end + + def suppress_warning + back = $VERBOSE + $VERBOSE = nil + begin + yield + ensure + $VERBOSE = back + end + end +end + + +end +end |