diff options
Diffstat (limited to 'ruby_1_8_6/test/soap/swa/test_file.rb')
-rw-r--r-- | ruby_1_8_6/test/soap/swa/test_file.rb | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/ruby_1_8_6/test/soap/swa/test_file.rb b/ruby_1_8_6/test/soap/swa/test_file.rb deleted file mode 100644 index 1ec7aa92a7..0000000000 --- a/ruby_1_8_6/test/soap/swa/test_file.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'test/unit' -require 'soap/rpc/driver' -require 'soap/rpc/standaloneServer' -require 'soap/attachment' - - -module SOAP -module SWA - - -class TestFile < Test::Unit::TestCase - Port = 17171 - THIS_FILE = File.expand_path(__FILE__) - - class SwAService - def get_file - return { - 'name' => $0, - 'file' => SOAP::Attachment.new(File.open(THIS_FILE)) # closed when GCed. - } - end - - def put_file(name, file) - "File '#{name}' was received ok." - end - end - - def setup - @server = SOAP::RPC::StandaloneServer.new('SwAServer', - 'http://www.acmetron.com/soap', '0.0.0.0', Port) - @server.add_servant(SwAService.new) - @server.level = Logger::Severity::ERROR - @t = Thread.new { - @server.start - } - @endpoint = "http://localhost:#{Port}/" - @client = SOAP::RPC::Driver.new(@endpoint, 'http://www.acmetron.com/soap') - @client.add_method('get_file') - @client.add_method('put_file', 'name', 'file') - @client.wiredump_dev = STDERR if $DEBUG - end - - def teardown - @server.shutdown - @t.kill - @t.join - @client.reset_stream - end - - def test_get_file - assert_equal( - File.open(THIS_FILE) { |f| f.read }, - @client.get_file['file'].content - ) - end - - def test_put_file - assert_equal( - "File 'foo' was received ok.", - @client.put_file('foo', - SOAP::Attachment.new(File.open(THIS_FILE))) - ) - assert_equal( - "File 'bar' was received ok.", - @client.put_file('bar', - SOAP::Attachment.new(File.open(THIS_FILE) { |f| f.read })) - ) - end -end - - -end -end |