summaryrefslogtreecommitdiff
path: root/test/soap
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 14:41:10 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 14:41:10 +0000
commite8ed175fe02aecab21ce50e85e27fe79137d8c31 (patch)
tree8a6d14560604b592f177ffaaa0c146c756edb2e9 /test/soap
parent330a8e51c56f5386753f55ba8e656a62471a36ba (diff)
* added files:
* lib/soap/mapping/wsdl*.rb * lib/wsdl/soap/element.rb * lib/wsdl/xmlSchema/simpleContent.rb * modified files: * lib/soap/* * lib/wsdl/* * lib/xsd/* * test/soap/* * test/wsdl/* * test/xsd/* * sample/soap/* * sample/sdl/* * summary * imported from the soap4r repository. Version: 1.5.3-ruby1.8.2 * added several XSD basetype support: nonPositiveInteger, negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger * HTTP client connection/send/receive timeout support. * HTTP client/server gzipped content encoding support. * improved WSDL schema definition support; still is far from complete, but is making step by step improovement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/soap')
-rw-r--r--test/soap/ssl/sslsvr.rb16
-rw-r--r--test/soap/ssl/test_ssl.rb13
-rw-r--r--test/soap/test_property.rb46
-rw-r--r--test/soap/test_streamhandler.rb8
4 files changed, 49 insertions, 34 deletions
diff --git a/test/soap/ssl/sslsvr.rb b/test/soap/ssl/sslsvr.rb
index 281c1a1..52a8d68 100644
--- a/test/soap/ssl/sslsvr.rb
+++ b/test/soap/ssl/sslsvr.rb
@@ -47,10 +47,18 @@ if $0 == __FILE__
:SSLClientCA => cert('ca.cert'),
:SSLCertName => nil
)
- trap(:INT) do
- $server.shutdown if $server
+ t = Thread.new {
+ Thread.current.abort_on_exception = true
+ $server.start
+ }
+ while $server.status != :Running
+ sleep 0.1
+ unless t.alive?
+ t.join
+ raise
+ end
end
STDOUT.sync = true
- STDOUT.puts $$
- $server.start
+ puts $$
+ t.join
end
diff --git a/test/soap/ssl/test_ssl.rb b/test/soap/ssl/test_ssl.rb
index 6678c77..82bb890 100644
--- a/test/soap/ssl/test_ssl.rb
+++ b/test/soap/ssl/test_ssl.rb
@@ -33,12 +33,8 @@ class TestSSL < Test::Unit::TestCase
teardown_server
end
- def streamhandler
- @client.instance_eval("@servant").instance_eval("@streamhandler").client
- end
-
def test_options
- cfg = streamhandler.ssl_config
+ cfg = @client.streamhandler.client.ssl_config
assert_nil(cfg.client_cert)
assert_nil(cfg.client_key)
assert_nil(cfg.client_ca)
@@ -192,11 +188,14 @@ private
end
def teardown_server
- Process.kill('INT', @serverpid)
+ if @serverpid
+ Process.kill('KILL', @serverpid)
+ Process.waitpid(@serverpid)
+ end
end
def teardown_client
- @client.reset_stream
+ @client.reset_stream if @client
end
def verify_callback(ok, cert)
diff --git a/test/soap/test_property.rb b/test/soap/test_property.rb
index 1cc8266..7acd2c8 100644
--- a/test/soap/test_property.rb
+++ b/test/soap/test_property.rb
@@ -6,6 +6,8 @@ module SOAP
class TestProperty < Test::Unit::TestCase
+ FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
+
def setup
@prop = ::SOAP::Property.new
end
@@ -67,7 +69,7 @@ __EOP__
prop["foo.bar"].lock
prop.load("foo.bar.baz = 123")
assert(hooked)
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
prop.load("foo.bar.qux = 123")
end
prop.load("foo.baz = 456")
@@ -130,7 +132,7 @@ __EOP__
tag = Object.new
tested = false
@prop.add_hook("foo.bar") do |key, value|
- assert_raise(TypeError) do
+ assert_raise(FrozenError) do
key << "baz"
end
tested = true
@@ -266,37 +268,37 @@ __EOP__
@prop.lock
assert(@prop.locked?)
assert_instance_of(::SOAP::Property, @prop["a"])
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["b"]
end
#
@prop["a"].lock
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a"]
end
assert_instance_of(::SOAP::Property, @prop["a.b"])
#
@prop["a.b"].lock
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b"]
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a"]
end
#
@prop["a.b.c.d"].lock
assert_instance_of(::SOAP::Property, @prop["a.b.c"])
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.c.d"]
end
assert_instance_of(::SOAP::Property, @prop["a.b.d"])
#
branch["e"].lock
assert_instance_of(::SOAP::Property, @prop["a.b.d"])
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.d.e"]
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
branch["e"]
end
end
@@ -310,26 +312,26 @@ __EOP__
assert_equal(nil, @prop["a.a"])
assert_equal(1, @prop["a.b.c"])
assert_equal(false, @prop["b"])
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["c"]
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["c"] = 2
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.R"]
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop.add_hook do
assert(false)
end
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop.add_hook("c") do
assert(false)
end
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop.add_hook("a.c") do
assert(false)
end
@@ -364,7 +366,7 @@ __EOP__
@prop["a.b.c"] = 5
assert(tested)
assert_equal(5, @prop["a.b.c"])
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.d"] = 5
end
end
@@ -383,28 +385,28 @@ __EOP__
assert_equal(branch, @prop[:a][:b][:d])
@prop.lock(true)
# split error 1
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b"]
end
# split error 2
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a"]
end
@prop["a.b.c"] = 2
assert_equal(2, @prop["a.b.c"])
# replace error
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.c"] = ::SOAP::Property.new
end
# override error
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b"] = 1
end
#
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
@prop["a.b.d"] << 1
end
- assert_raises(TypeError) do
+ assert_raises(FrozenError) do
branch << 1
end
branch.unlock(true)
diff --git a/test/soap/test_streamhandler.rb b/test/soap/test_streamhandler.rb
index e5b578d..fa0080e 100644
--- a/test/soap/test_streamhandler.rb
+++ b/test/soap/test_streamhandler.rb
@@ -143,7 +143,9 @@ __EOX__
def test_basic_auth
unless Object.const_defined?('HTTPAccess2')
- STDERR.puts("basic_auth is not supported under soap4r + net/http for now.")
+ # soap4r + net/http + basic_auth is not supported.
+ # use http-access2 instead.
+ assert(true)
return
end
str = ""
@@ -169,6 +171,10 @@ __EOX__
assert_nil(@client.do_server_proc)
r, h = parse_req_header(str)
assert_match(%r"POST http://localhost:17171/ HTTP/1.", r)
+ # illegal proxy uri
+ assert_raise(ArgumentError) do
+ @client.options["protocol.http.proxy"] = 'ftp://foo:8080'
+ end
ensure
if Object.const_defined?('HTTPAccess2')
HTTPAccess2::Client::NO_PROXY_HOSTS.replace(backup)