|
Revision 930, 0.7 kB
(checked in by nahi, 5 years ago)
|
Add tests.
|
- Property svn:eol-style set to
native
- Property svn:executable set to
*
- Property svn:keywords set to
author date id revision
|
| Line | |
|---|
| 1 |
require 'test/unit' |
|---|
| 2 |
require 'soap/rpc/driver' |
|---|
| 3 |
|
|---|
| 4 |
dir = '../sample/HelloWorld/' |
|---|
| 5 |
$:.push(dir) |
|---|
| 6 |
require 'hw_s.rb' |
|---|
| 7 |
$:.delete(dir) |
|---|
| 8 |
|
|---|
| 9 |
class TestHelloWorld < Test::Unit::TestCase |
|---|
| 10 |
def setup |
|---|
| 11 |
@server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', 2000) |
|---|
| 12 |
@t = Thread.new { |
|---|
| 13 |
@server.start |
|---|
| 14 |
} |
|---|
| 15 |
while @server.server.status != :Running |
|---|
| 16 |
sleep 0.1 |
|---|
| 17 |
end |
|---|
| 18 |
@client = SOAP::RPC::Driver.new('http://localhost:2000/', 'urn:hws') |
|---|
| 19 |
@client.add_method("hello_world", "from") |
|---|
| 20 |
end |
|---|
| 21 |
|
|---|
| 22 |
def teardown |
|---|
| 23 |
@server.server.shutdown |
|---|
| 24 |
@t.kill |
|---|
| 25 |
end |
|---|
| 26 |
|
|---|
| 27 |
def test_hello_world |
|---|
| 28 |
assert_equal("Hello World, from NaHi", @client.hello_world("NaHi")) |
|---|
| 29 |
assert_equal("Hello World, from <&>", @client.hello_world("<&>")) |
|---|
| 30 |
end |
|---|
| 31 |
end |
|---|