summaryrefslogtreecommitdiffstats
path: root/test/wsdl/map/test_map.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 13:50:15 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 13:50:15 +0000
commit7d163a29ec5458eb8e02ef3de8d7aece2be1f59e (patch)
treeb56a6e784df74331c28e4a94901b96837f214e35 /test/wsdl/map/test_map.rb
parent1d25ffca9e45da9bcd4eeef08a4594d6ad47d69b (diff)
downloadruby-7d163a29ec5458eb8e02ef3de8d7aece2be1f59e.tar.gz
ruby-7d163a29ec5458eb8e02ef3de8d7aece2be1f59e.tar.xz
ruby-7d163a29ec5458eb8e02ef3de8d7aece2be1f59e.zip
* 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/* * 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: http://svn.ruby-lang.org/repos/ruby/trunk@7612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/wsdl/map/test_map.rb')
-rw-r--r--test/wsdl/map/test_map.rb75
1 files changed, 71 insertions, 4 deletions
diff --git a/test/wsdl/map/test_map.rb b/test/wsdl/map/test_map.rb
index b0f2fb5a5..bee3a7589 100644
--- a/test/wsdl/map/test_map.rb
+++ b/test/wsdl/map/test_map.rb
@@ -1,15 +1,75 @@
require 'test/unit'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/rpc/element'
-require 'wsdl/importer'
+require 'soap/rpc/httpserver'
+require 'soap/wsdlDriver'
module WSDL
class TestMap < Test::Unit::TestCase
+ Port = 17171
+ DIR = File.dirname(File.expand_path(__FILE__))
+
+ class Server < ::SOAP::RPC::HTTPServer
+ def on_init
+ add_method(self, 'map')
+ add_method(self, 'map2', 'arg')
+ end
+
+ def map
+ {1 => "a", 2 => "b"}
+ end
+
+ def map2(arg)
+ arg
+ end
+ end
+
def setup
+ setup_server
+ setup_client
+ end
+
+ def setup_server
+ @server = Server.new(
+ :Port => Port,
+ :AccessLog => [],
+ :SOAPDefaultNamespace => "urn:map"
+ )
+ @server.level = Logger::Severity::ERROR
+ @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
+ end
+
+ def setup_client
+ wsdl = File.join(DIR, 'map.wsdl')
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client.endpoint_url = "http://localhost:#{Port}/"
+ @client.generate_explicit_type = true
+ end
+
+ def teardown
+ teardown_server
+ teardown_client
+ end
+
+ def teardown_server
+ @server.shutdown
+ @t.kill
+ @t.join
+ end
+
+ def teardown_client
+ @client.reset_stream
end
def test_by_wsdl
@@ -31,6 +91,13 @@ class TestMap < Test::Unit::TestCase
assert_equal(["b1"], map["b"]["b1"])
assert_equal(["b2"], map["b"]["b2"])
end
+
+ def test_wsdldriver
+ assert_equal({1 => "a", 2 => "b"}, @client.map)
+ assert_equal({1 => 2}, @client.map2({1 => 2}))
+ assert_equal({1 => {2 => 3}}, @client.map2({1 => {2 => 3}}))
+ assert_equal({["a", 2] => {2 => 3}}, @client.map2({["a", 2] => {2 => 3}}))
+ end
end