From 42bca643c3ec41782d519c7676383f8f71e67a7a Mon Sep 17 00:00:00 2001 From: nahi Date: Fri, 28 Nov 2003 05:53:16 +0000 Subject: * lib/soap/streamHandler.rb: drop unused http parameters. * lib/soap/encodingstyle/soapHandler.rb, lib/soap/mapping/factory.rb, lib/soap/mapping/mapping.rb, lib/soap/mapping/registry.rb, lib/wsdl/soap/complexType.rb: ApacheSOAP's map support was broken under WSDL dynanic client environment. fixed. * test/wsdl/raa/*: add tests. * lib/xsd/datatypes.rb: dateTime precision bug fix (at least, I hope.) bug of soap4r. XSDDateTimeImple.to_time passed a Float to Time.local/Time.gm as an usec, and NUM2LONG(rb_num2long for Float) causes rounding error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/soap/marshal/test_marshal.rb | 2 +- test/soap/test_basetype.rb | 4 ++ test/wsdl/raa/RAA.rb | 15 +----- test/wsdl/raa/RAAServant.rb | 99 ++++++++++++++++++++++++++++++++++++ test/wsdl/raa/RAAService.rb | 101 ++++++++++++++++++++++++++++++++++++ test/wsdl/raa/README.txt | 5 +- test/wsdl/raa/server.rb | 104 -------------------------------------- test/wsdl/raa/test_raa.rb | 6 ++- test/xsd/test_xsd.rb | 5 ++ 9 files changed, 220 insertions(+), 121 deletions(-) create mode 100644 test/wsdl/raa/RAAServant.rb create mode 100644 test/wsdl/raa/RAAService.rb delete mode 100644 test/wsdl/raa/server.rb (limited to 'test') diff --git a/test/soap/marshal/test_marshal.rb b/test/soap/marshal/test_marshal.rb index 9ae08c68d8..9d5b706d41 100644 --- a/test/soap/marshal/test_marshal.rb +++ b/test/soap/marshal/test_marshal.rb @@ -369,7 +369,7 @@ module MarshalTestLib class MyTime < Time; def initialize(v, *args) super(*args); @v = v; end end def test_time # once there was a bug caused by usec overflow. try a little harder. - 10.times do + 100.times do t = Time.now marshal_equal(t, t.usec.to_s) end diff --git a/test/soap/test_basetype.rb b/test/soap/test_basetype.rb index 0125f80505..a00f0f549c 100644 --- a/test/soap/test_basetype.rb +++ b/test/soap/test_basetype.rb @@ -351,6 +351,8 @@ class TestSOAP < Test::Unit::TestCase "2002-12-31T23:59:59-00:01", "2002-12-31T23:59:59-23:59", "2002-12-31T23:59:59.00000000000000000001+13:30", + "2002-12-31T23:59:59.51375Z", + "2002-12-31T23:59:59.51345+12:34", "-2002-05-18T16:52:20Z", "-4711-12-31T23:59:59Z", "-4713-01-01T12:00:00Z", @@ -414,6 +416,8 @@ class TestSOAP < Test::Unit::TestCase "23:59:59-00:01", "23:59:59-23:59", "23:59:59.00000000000000000001+13:30", + "23:59:59.51375Z", + "23:59:59.51375+12:34", "23:59:59+00:01", ] targets.each do |str| diff --git a/test/wsdl/raa/RAA.rb b/test/wsdl/raa/RAA.rb index 32b88bd26a..aff0525480 100644 --- a/test/wsdl/raa/RAA.rb +++ b/test/wsdl/raa/RAA.rb @@ -235,20 +235,9 @@ class StringArray < Array end # http://xml.apache.org/xml-soap -class Map +class Map < Array + # Contents type should be dumped here... @@schema_type = "Map" @@schema_ns = "http://xml.apache.org/xml-soap" - - def item - @item - end - - def item=(value) - @item = value - end - - def initialize(item = nil) - @item = item - end end diff --git a/test/wsdl/raa/RAAServant.rb b/test/wsdl/raa/RAAServant.rb new file mode 100644 index 0000000000..68380f8e48 --- /dev/null +++ b/test/wsdl/raa/RAAServant.rb @@ -0,0 +1,99 @@ +class RAABaseServicePortType + # SYNOPSIS + # getAllListings + # + # ARGS + # N/A + # + # RETURNS + # return StringArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}StringArray + # + # RAISES + # (undefined) + # + def getAllListings + #raise NotImplementedError.new + ["ruby", "soap4r"] + end + + # SYNOPSIS + # getProductTree + # + # ARGS + # N/A + # + # RETURNS + # return Map - {http://xml.apache.org/xml-soap}Map + # + # RAISES + # (undefined) + # + def getProductTree + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromCategory(category) + # + # ARGS + # category Category - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Category + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getInfoFromCategory(category) + raise NotImplementedError.new + end + + # SYNOPSIS + # getModifiedInfoSince(timeInstant) + # + # ARGS + # timeInstant - {http://www.w3.org/2001/XMLSchema}dateTime + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getModifiedInfoSince(timeInstant) + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromName(productName) + # + # ARGS + # productName - {http://www.w3.org/2001/XMLSchema}string + # + # RETURNS + # return Info - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Info + # + # RAISES + # (undefined) + # + def getInfoFromName(productName) + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromOwnerId(ownerId) + # + # ARGS + # ownerId - {http://www.w3.org/2001/XMLSchema}int + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getInfoFromOwnerId(ownerId) + raise NotImplementedError.new + end +end + diff --git a/test/wsdl/raa/RAAService.rb b/test/wsdl/raa/RAAService.rb new file mode 100644 index 0000000000..42cdfaea47 --- /dev/null +++ b/test/wsdl/raa/RAAService.rb @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby +require 'RAAServant.rb' + +require 'soap/rpc/standaloneServer' + +class RAABaseServicePortType + MappingRegistry = SOAP::Mapping::Registry.new + + MappingRegistry.set( + StringArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + MappingRegistry.set( + Map, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType") } + ) + MappingRegistry.set( + Category, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") } + ) + MappingRegistry.set( + InfoArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Info, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Product, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") } + ) + MappingRegistry.set( + Owner, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") } + ) + + + Methods = [ + ["getAllListings", "getAllListings", [ + ["retval", "return", + [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getProductTree", "getProductTree", [ + ["retval", "return", + [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromCategory", "getInfoFromCategory", [ + ["in", "category", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getModifiedInfoSince", "getModifiedInfoSince", [ + ["in", "timeInstant", + [SOAP::SOAPDateTime]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromName", "getInfoFromName", [ + ["in", "productName", + [SOAP::SOAPString]], + ["retval", "return", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromOwnerId", "getInfoFromOwnerId", [ + ["in", "ownerId", + [SOAP::SOAPInt]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"] + ] +end + +class App < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + + servant = RAABaseServicePortType.new + RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace| + qname = XSD::QName.new(namespace, name_as) + @soaplet.app_scope_router.add_method(servant, qname, soapaction, + name, params) + end + + self.mapping_registry = RAABaseServicePortType::MappingRegistry + end +end + +# Change listen port. +if $0 == __FILE__ + App.new('app', nil, '0.0.0.0', 10080).start +end diff --git a/test/wsdl/raa/README.txt b/test/wsdl/raa/README.txt index e884db9bb4..efbaf9d87c 100644 --- a/test/wsdl/raa/README.txt +++ b/test/wsdl/raa/README.txt @@ -1,4 +1,7 @@ -server.rb: based on RAAService.rb which is generated with the following command; +RAAServant.rb: based on the file which is generated with the following command; + bin/wsdl2ruby.rb --wsdl raa.wsdl --servant_skelton --force + +RAAService.rb: generated with the following command; bin/wsdl2ruby.rb --wsdl raa.wsdl --standalone_server_stub --force RAA.rb: generated with the following command; diff --git a/test/wsdl/raa/server.rb b/test/wsdl/raa/server.rb deleted file mode 100644 index 95e63dcd31..0000000000 --- a/test/wsdl/raa/server.rb +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env ruby -require 'soap/rpc/standaloneServer' -require 'RAA.rb' - -class RAABaseServicePortType - MappingRegistry = SOAP::Mapping::Registry.new - - MappingRegistry.set( - StringArray, - ::SOAP::SOAPArray, - ::SOAP::Mapping::Registry::TypedArrayFactory, - { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } - ) - MappingRegistry.set( - Map, - ::SOAP::SOAPStruct, - ::SOAP::Mapping::Registry::TypedStructFactory, - { :type => XSD::QName.new("http://xml.apache.org/xml-soap", "Map") } - ) - MappingRegistry.set( - Category, - ::SOAP::SOAPStruct, - ::SOAP::Mapping::Registry::TypedStructFactory, - { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") } - ) - MappingRegistry.set( - InfoArray, - ::SOAP::SOAPArray, - ::SOAP::Mapping::Registry::TypedArrayFactory, - { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } - ) - MappingRegistry.set( - Info, - ::SOAP::SOAPStruct, - ::SOAP::Mapping::Registry::TypedStructFactory, - { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } - ) - MappingRegistry.set( - Product, - ::SOAP::SOAPStruct, - ::SOAP::Mapping::Registry::TypedStructFactory, - { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") } - ) - MappingRegistry.set( - Owner, - ::SOAP::SOAPStruct, - ::SOAP::Mapping::Registry::TypedStructFactory, - { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") } - ) - - Methods = [ - ["getAllListings", "getAllListings", [ - ["retval", "return", - [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], - ["getProductTree", "getProductTree", [ - ["retval", "return", - [::SOAP::SOAPStruct, "http://xml.apache.org/xml-soap", "Map"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], - ["getInfoFromCategory", "getInfoFromCategory", [ - ["in", "category", - [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], - ["retval", "return", - [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], - ["getModifiedInfoSince", "getModifiedInfoSince", [ - ["in", "timeInstant", - [SOAP::SOAPDateTime]], - ["retval", "return", - [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], - ["getInfoFromName", "getInfoFromName", [ - ["in", "productName", - [SOAP::SOAPString]], - ["retval", "return", - [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], - ["getInfoFromOwnerId", "getInfoFromOwnerId", [ - ["in", "ownerId", - [SOAP::SOAPInt]], - ["retval", "return", - [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], - "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"] - ] - - def getAllListings - ["ruby", "soap4r"] - end -end - -class RAABaseServiceServer < SOAP::RPC::StandaloneServer - def initialize(*arg) - super - - servant = RAABaseServicePortType.new - RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace| - qname = XSD::QName.new(namespace, name_as) - @soaplet.app_scope_router.add_method(servant, qname, soapaction, - name, params) - end - - self.mapping_registry = RAABaseServicePortType::MappingRegistry - end -end diff --git a/test/wsdl/raa/test_raa.rb b/test/wsdl/raa/test_raa.rb index f90c6222f4..86452a0b40 100644 --- a/test/wsdl/raa/test_raa.rb +++ b/test/wsdl/raa/test_raa.rb @@ -18,9 +18,11 @@ class TestRAA < Test::Unit::TestCase def setup_server $:.push(DIR) - require File.join(DIR, 'server.rb') + require File.join(DIR, 'RAA.rb') + require File.join(DIR, 'RAAServant.rb') + require File.join(DIR, 'RAAService.rb') $:.delete(DIR) - @server = RAABaseServiceServer.new('RAA server', nil, '0.0.0.0', Port) + @server = App.new('RAA server', nil, '0.0.0.0', Port) @server.level = Logger::Severity::ERROR @t = Thread.new { Thread.current.abort_on_exception = true diff --git a/test/xsd/test_xsd.rb b/test/xsd/test_xsd.rb index 88191bb7f1..9b3a7f0f1f 100644 --- a/test/xsd/test_xsd.rb +++ b/test/xsd/test_xsd.rb @@ -384,6 +384,9 @@ class TestXSD < Test::Unit::TestCase "2002-12-31T23:59:59-00:01", "2002-12-31T23:59:59-23:59", "2002-12-31T23:59:59.00000000000000000001+13:30", + "2002-12-31T23:59:59.5137Z", + "2002-12-31T23:59:59.51375Z", # 411/800 + "2002-12-31T23:59:59.51375+12:34", "-2002-05-18T16:52:20Z", "-4713-01-01T12:00:00Z", "-2002-12-31T23:59:59+00:01", @@ -445,6 +448,8 @@ class TestXSD < Test::Unit::TestCase "23:59:59-00:01", "23:59:59-23:59", "23:59:59.00000000000000000001+13:30", + "23:59:59.51345Z", + "23:59:59.51345+12:34", "23:59:59+00:01", ] targets.each do |str| -- cgit v1.2.3