mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
42bca643c3
* 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
80 lines
1.5 KiB
Ruby
80 lines
1.5 KiB
Ruby
require 'test/unit'
|
|
require 'soap/wsdlDriver'
|
|
|
|
|
|
module WSDL
|
|
module RAA
|
|
|
|
|
|
class TestRAA < Test::Unit::TestCase
|
|
DIR = File.dirname(File.expand_path(__FILE__))
|
|
|
|
Port = 17171
|
|
|
|
def setup
|
|
setup_server
|
|
setup_client
|
|
end
|
|
|
|
def setup_server
|
|
$:.push(DIR)
|
|
require File.join(DIR, 'RAA.rb')
|
|
require File.join(DIR, 'RAAServant.rb')
|
|
require File.join(DIR, 'RAAService.rb')
|
|
$:.delete(DIR)
|
|
@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
|
|
@server.start
|
|
}
|
|
while @server.server.nil? or @server.server.status != :Running
|
|
sleep 0.1
|
|
unless @t.alive?
|
|
@t.join
|
|
raise
|
|
end
|
|
end
|
|
end
|
|
|
|
def setup_client
|
|
wsdl = File.join(DIR, 'raa.wsdl')
|
|
@raa = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
|
|
@raa.endpoint_url = "http://localhost:#{Port}/"
|
|
end
|
|
|
|
def teardown
|
|
teardown_server
|
|
teardown_client
|
|
end
|
|
|
|
def teardown_server
|
|
@server.server.shutdown
|
|
@t.kill
|
|
@t.join
|
|
end
|
|
|
|
def teardown_client
|
|
@raa.reset_stream
|
|
end
|
|
|
|
def test_raa
|
|
assert_equal(["ruby", "soap4r"], @raa.getAllListings)
|
|
end
|
|
|
|
def foo
|
|
p @raa.getProductTree()
|
|
p @raa.getInfoFromCategory(Category.new("Library", "XML"))
|
|
t = Time.at(Time.now.to_i - 24 * 3600)
|
|
p @raa.getModifiedInfoSince(t)
|
|
p @raa.getModifiedInfoSince(DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec))
|
|
o = @raa.getInfoFromName("SOAP4R")
|
|
p o.type
|
|
p o.owner.name
|
|
p o
|
|
end
|
|
end
|
|
|
|
|
|
end
|
|
end
|