summaryrefslogtreecommitdiff
path: root/test/soap
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-03 15:29:32 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-03 15:29:32 +0000
commitab31bf0d4d44942e46d98d8848b788ac6df32a46 (patch)
tree303d964b43831f02c94f3970c9df2aca6e851edc /test/soap
parentdf2066555d03b919be6f25fb7569abde8296d2f5 (diff)
* added files
* lib/soap/attachment.rb * lib/soap/header * lib/soap/mimemessage.rb * lib/soap/rpc/httpserver.rb * lib/wsdl/soap/cgiStubCreator.rb * lib/wsdl/soap/classDefCreator.rb * lib/wsdl/soap/classDefCreatorSupport.rb * lib/wsdl/soap/clientSkeltonCreator.rb * lib/wsdl/soap/driverCreator.rb * lib/wsdl/soap/mappingRegistryCreator.rb * lib/wsdl/soap/methodDefCreator.rb * lib/wsdl/soap/servantSkeltonCreator.rb * lib/wsdl/soap/standaloneServerStubCreator.rb * lib/wsdl/xmlSchema/enumeration.rb * lib/wsdl/xmlSchema/simpleRestriction.rb * lib/wsdl/xmlSchema/simpleType.rb * lib/xsd/codegen * lib/xsd/codegen.rb * sample/soap/authheader * sample/soap/raa2.4 * sample/soap/ssl * sample/soap/swa * sample/soap/whois.rb * sample/soap/calc/samplehttpd.conf * sample/soap/exchange/samplehttpd.conf * sample/soap/sampleStruct/samplehttpd.conf * sample/wsdl/raa2.4 * sample/wsdl/googleSearch/samplehttpd.conf * test/openssl/_test_ssl.rb * test/soap/header * test/soap/ssl * test/soap/struct * test/soap/swa * test/soap/wsdlDriver * test/wsdl/multiplefault.wsdl * test/wsdl/simpletype * test/wsdl/test_multiplefault.rb * modified files * lib/soap/baseData.rb * lib/soap/element.rb * lib/soap/generator.rb * lib/soap/marshal.rb * lib/soap/netHttpClient.rb * lib/soap/parser.rb * lib/soap/processor.rb * lib/soap/property.rb * lib/soap/soap.rb * lib/soap/streamHandler.rb * lib/soap/wsdlDriver.rb * lib/soap/encodingstyle/handler.rb * lib/soap/encodingstyle/literalHandler.rb * lib/soap/encodingstyle/soapHandler.rb * lib/soap/mapping/factory.rb * lib/soap/mapping/mapping.rb * lib/soap/mapping/registry.rb * lib/soap/mapping/rubytypeFactory.rb * lib/soap/mapping/wsdlRegistry.rb * lib/soap/rpc/cgistub.rb * lib/soap/rpc/driver.rb * lib/soap/rpc/element.rb * lib/soap/rpc/proxy.rb * lib/soap/rpc/router.rb * lib/soap/rpc/soaplet.rb * lib/soap/rpc/standaloneServer.rb * lib/wsdl/data.rb * lib/wsdl/definitions.rb * lib/wsdl/operation.rb * lib/wsdl/parser.rb * lib/wsdl/soap/definitions.rb * lib/wsdl/xmlSchema/complexContent.rb * lib/wsdl/xmlSchema/complexType.rb * lib/wsdl/xmlSchema/data.rb * lib/wsdl/xmlSchema/parser.rb * lib/wsdl/xmlSchema/schema.rb * lib/xsd/datatypes.rb * lib/xsd/qname.rb * sample/soap/calc/httpd.rb * sample/soap/exchange/httpd.rb * sample/soap/sampleStruct/httpd.rb * sample/soap/sampleStruct/server.rb * sample/wsdl/amazon/AmazonSearch.rb * sample/wsdl/amazon/AmazonSearchDriver.rb * sample/wsdl/googleSearch/httpd.rb * test/soap/test_basetype.rb * test/soap/test_property.rb * test/soap/test_streamhandler.rb * test/soap/calc/test_calc.rb * test/soap/calc/test_calc2.rb * test/soap/calc/test_calc_cgi.rb * test/soap/helloworld/test_helloworld.rb * test/wsdl/test_emptycomplextype.rb * test/wsdl/axisArray/test_axisarray.rb * test/wsdl/datetime/test_datetime.rb * test/wsdl/raa/test_raa.rb * test/xsd/test_xmlschemaparser.rb * test/xsd/test_xsd.rb * summary * add SOAP Header mustUnderstand support. * add HTTP client SSL configuration and Cookies support (works completely with http-access2). * add header handler for handling sending/receiving SOAP Header. * map Ruby's anonymous Struct to common SOAP Struct in SOAP Object Model. it caused error. * add WSDL simpleType support to restrict lexical value space. * add SOAP with Attachment support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/soap')
-rw-r--r--test/soap/calc/test_calc.rb4
-rw-r--r--test/soap/calc/test_calc2.rb5
-rw-r--r--test/soap/calc/test_calc_cgi.rb1
-rw-r--r--test/soap/helloworld/test_helloworld.rb4
-rw-r--r--test/soap/test_basetype.rb40
-rw-r--r--test/soap/test_property.rb70
-rw-r--r--test/soap/test_streamhandler.rb13
7 files changed, 90 insertions, 47 deletions
diff --git a/test/soap/calc/test_calc.rb b/test/soap/calc/test_calc.rb
index c917ddc..4210c65 100644
--- a/test/soap/calc/test_calc.rb
+++ b/test/soap/calc/test_calc.rb
@@ -1,10 +1,6 @@
require 'test/unit'
require 'soap/rpc/driver'
-
-dir = File.dirname(__FILE__)
-$:.push(dir)
require 'server.rb'
-$:.delete(dir)
module SOAP
diff --git a/test/soap/calc/test_calc2.rb b/test/soap/calc/test_calc2.rb
index b7fee71..d15cfe9 100644
--- a/test/soap/calc/test_calc2.rb
+++ b/test/soap/calc/test_calc2.rb
@@ -1,10 +1,6 @@
require 'test/unit'
require 'soap/rpc/driver'
-
-dir = File.dirname(__FILE__)
-$:.push(dir)
require 'server2.rb'
-$:.delete(dir)
module SOAP
@@ -30,6 +26,7 @@ class TestCalc2 < Test::Unit::TestCase
end
@endpoint = "http://localhost:#{Port}/"
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
+ @var.wiredump_dev = STDERR if $DEBUG
@var.add_method('set', 'newValue')
@var.add_method('get')
@var.add_method_as('+', 'add', 'rhs')
diff --git a/test/soap/calc/test_calc_cgi.rb b/test/soap/calc/test_calc_cgi.rb
index 523379f..d1655b0 100644
--- a/test/soap/calc/test_calc_cgi.rb
+++ b/test/soap/calc/test_calc_cgi.rb
@@ -44,6 +44,7 @@ class TestCalcCGI < Test::Unit::TestCase
end
@endpoint = "http://localhost:#{Port}/server.cgi"
@calc = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
+ @calc.wiredump_dev = STDERR if $DEBUG
@calc.add_method('add', 'lhs', 'rhs')
@calc.add_method('sub', 'lhs', 'rhs')
@calc.add_method('multi', 'lhs', 'rhs')
diff --git a/test/soap/helloworld/test_helloworld.rb b/test/soap/helloworld/test_helloworld.rb
index 7261e42..cd78d9f 100644
--- a/test/soap/helloworld/test_helloworld.rb
+++ b/test/soap/helloworld/test_helloworld.rb
@@ -1,10 +1,6 @@
require 'test/unit'
require 'soap/rpc/driver'
-
-dir = File.dirname(__FILE__)
-$:.push(dir)
require 'hw_s.rb'
-$:.delete(dir)
module SOAP
diff --git a/test/soap/test_basetype.rb b/test/soap/test_basetype.rb
index 7a77946..afd550f 100644
--- a/test/soap/test_basetype.rb
+++ b/test/soap/test_basetype.rb
@@ -156,8 +156,8 @@ class TestSOAP < Test::Unit::TestCase
targets = [
3.14159265358979,
12.34e36,
- 1.4e-45,
- -1.4e-45,
+ 1.402e-45,
+ -1.402e-45,
]
targets.each do |f|
assert_equal(f, SOAP::SOAPFloat.new(f).data)
@@ -166,8 +166,8 @@ class TestSOAP < Test::Unit::TestCase
targets = [
"+3.141592654",
"+1.234e+37",
- "+1.4e-45",
- "-1.4e-45",
+ "+1.402e-45",
+ "-1.402e-45",
]
targets.each do |f|
assert_equal(f, SOAP::SOAPFloat.new(f).to_s)
@@ -178,13 +178,13 @@ class TestSOAP < Test::Unit::TestCase
[-2, "-2"], # ditto
[3.14159265358979, "+3.141592654"],
[12.34e36, "+1.234e+37"],
- [1.4e-45, "+1.4e-45"],
- [-1.4e-45, "-1.4e-45"],
- ["1.4e", "+1.4"],
+ [1.402e-45, "+1.402e-45"],
+ [-1.402e-45, "-1.402e-45"],
+ ["1.402e", "+1.402"],
["12.34E36", "+1.234e+37"],
- ["1.4E-45", "+1.4e-45"],
- ["-1.4E-45", "-1.4e-45"],
- ["1.4E", "+1.4"],
+ ["1.402E-45", "+1.402e-45"],
+ ["-1.402E-45", "-1.402e-45"],
+ ["1.402E", "+1.402"],
]
targets.each do |f, str|
assert_equal(str, SOAP::SOAPFloat.new(f).to_s)
@@ -221,8 +221,8 @@ class TestSOAP < Test::Unit::TestCase
targets = [
3.14159265358979,
12.34e36,
- 1.4e-45,
- -1.4e-45,
+ 1.402e-45,
+ -1.402e-45,
]
targets.each do |f|
assert_equal(f, SOAP::SOAPDouble.new(f).data)
@@ -231,8 +231,8 @@ class TestSOAP < Test::Unit::TestCase
targets = [
"+3.14159265358979",
"+1.234e+37",
- "+1.4e-45",
- "-1.4e-45",
+ "+1.402e-45",
+ "-1.402e-45",
]
targets.each do |f|
assert_equal(f, SOAP::SOAPDouble.new(f).to_s)
@@ -243,13 +243,13 @@ class TestSOAP < Test::Unit::TestCase
[-2, "-2"], # ditto.
[3.14159265358979, "+3.14159265358979"],
[12.34e36, "+1.234e+37"],
- [1.4e-45, "+1.4e-45"],
- [-1.4e-45, "-1.4e-45"],
- ["1.4e", "+1.4"],
+ [1.402e-45, "+1.402e-45"],
+ [-1.402e-45, "-1.402e-45"],
+ ["1.402e", "+1.402"],
["12.34E36", "+1.234e+37"],
- ["1.4E-45", "+1.4e-45"],
- ["-1.4E-45", "-1.4e-45"],
- ["1.4E", "+1.4"],
+ ["1.402E-45", "+1.402e-45"],
+ ["-1.402E-45", "-1.402e-45"],
+ ["1.402E", "+1.402"],
]
targets.each do |f, str|
assert_equal(str, SOAP::SOAPDouble.new(f).to_s)
diff --git a/test/soap/test_property.rb b/test/soap/test_property.rb
index 82363a8..1cc8266 100644
--- a/test/soap/test_property.rb
+++ b/test/soap/test_property.rb
@@ -59,7 +59,7 @@ __EOP__
prop = Property.new
hooked = false
prop.add_hook("foo.bar.baz") do |name, value|
- assert_equal("foo.bar.baz", name)
+ assert_equal(["foo", "bar", "baz"], name)
assert_equal("123", value)
hooked = true
end
@@ -126,11 +126,24 @@ __EOP__
end
end
+ def test_hook_name
+ tag = Object.new
+ tested = false
+ @prop.add_hook("foo.bar") do |key, value|
+ assert_raise(TypeError) do
+ key << "baz"
+ end
+ tested = true
+ end
+ @prop["foo.bar"] = tag
+ assert(tested)
+ end
+
def test_value_hook
tag = Object.new
tested = false
@prop.add_hook("FOO.BAR.BAZ") do |key, value|
- assert_equal("foo.bar.baz", key)
+ assert_equal(["Foo", "baR", "baZ"], key)
assert_equal(tag, value)
tested = true
end
@@ -141,32 +154,65 @@ __EOP__
assert_equal(1, @prop["foo.bar"])
end
- def test_key_hook
+ def test_key_hook_no_cascade
tag = Object.new
tested = 0
+ @prop.add_hook do |key, value|
+ assert(false)
+ end
+ @prop.add_hook(false) do |key, value|
+ assert(false)
+ end
@prop.add_hook("foo") do |key, value|
- assert_equal("foo.bar.baz.qux", key)
+ assert(false)
+ end
+ @prop.add_hook("foo.bar", false) do |key, value|
+ assert(false)
+ end
+ @prop.add_hook("foo.bar.baz") do |key, value|
+ assert(false)
+ end
+ @prop.add_hook("foo.bar.baz.qux", false) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
assert_equal(tag, value)
tested += 1
end
- @prop.add_hook("foo.bar") do |key, value|
- assert_equal("foo.bar.baz.qux", key)
+ @prop["foo.bar.baz.qux"] = tag
+ assert_equal(tag, @prop["foo.bar.baz.qux"])
+ assert_equal(1, tested)
+ end
+
+ def test_key_hook_cascade
+ tag = Object.new
+ tested = 0
+ @prop.add_hook(true) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
assert_equal(tag, value)
tested += 1
end
- @prop.add_hook("foo.bar.baz") do |key, value|
- assert_equal("foo.bar.baz.qux", key)
+ @prop.add_hook("foo", true) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
assert_equal(tag, value)
tested += 1
end
- @prop.add_hook("foo.bar.baz.qux") do |key, value|
- assert_equal("foo.bar.baz.qux", key)
+ @prop.add_hook("foo.bar", true) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
+ assert_equal(tag, value)
+ tested += 1
+ end
+ @prop.add_hook("foo.bar.baz", true) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
+ assert_equal(tag, value)
+ tested += 1
+ end
+ @prop.add_hook("foo.bar.baz.qux", true) do |key, value|
+ assert_equal(["foo", "bar", "baz", "qux"], key)
assert_equal(tag, value)
tested += 1
end
@prop["foo.bar.baz.qux"] = tag
assert_equal(tag, @prop["foo.bar.baz.qux"])
- assert_equal(4, tested)
+ assert_equal(5, tested)
end
def test_keys
@@ -310,7 +356,7 @@ __EOP__
def test_hook_then_lock
tested = false
@prop.add_hook("a.b.c") do |name, value|
- assert_equal("a.b.c", name)
+ assert_equal(["a", "b", "c"], name)
tested = true
end
@prop["a.b"].lock
diff --git a/test/soap/test_streamhandler.rb b/test/soap/test_streamhandler.rb
index d38b84e..e5b578d 100644
--- a/test/soap/test_streamhandler.rb
+++ b/test/soap/test_streamhandler.rb
@@ -142,9 +142,16 @@ __EOX__
end
def test_basic_auth
- # soap4r + basic_auth is not officially supported in ruby/1.8.1 even though
- # soap4r + basic_auth + http-access2 should run fine.
- return
+ unless Object.const_defined?('HTTPAccess2')
+ STDERR.puts("basic_auth is not supported under soap4r + net/http for now.")
+ return
+ end
+ str = ""
+ @client.wiredump_dev = str
+ @client.options["protocol.http.basic_auth"] << [@url, "foo", "bar"]
+ assert_nil(@client.do_server_proc)
+ r, h = parse_req_header(str)
+ assert_equal("Basic Zm9vOmJhcg==", h["authorization"])
end
def test_proxy