mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
af2dc00300
methods as delegates to WEBrick. * test/soap/calc/{test_calc.rb,test_calc2.rb}, test/soap/helloworld/test_helloworld.rb, test/wsdl/datetime/test_datetime.rb, test/wsdl/raa/test_raa.rb: follow the change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5140 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.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.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
|