2003-09-24 11:18:44 -04:00
|
|
|
require 'test/unit'
|
|
|
|
require 'soap/rpc/driver'
|
|
|
|
require 'server2.rb'
|
|
|
|
|
2003-09-26 14:34:41 -04:00
|
|
|
|
|
|
|
module SOAP
|
|
|
|
module Calc
|
|
|
|
|
|
|
|
|
2003-09-24 11:18:44 -04:00
|
|
|
class TestCalc2 < Test::Unit::TestCase
|
2003-10-18 11:21:18 -04:00
|
|
|
Port = 17171
|
|
|
|
|
2003-09-24 11:18:44 -04:00
|
|
|
def setup
|
2003-10-18 11:21:18 -04:00
|
|
|
@server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', Port)
|
2003-10-22 11:43:10 -04:00
|
|
|
@server.level = Logger::Severity::ERROR
|
2003-09-24 11:18:44 -04:00
|
|
|
@t = Thread.new {
|
2003-10-20 11:37:11 -04:00
|
|
|
Thread.current.abort_on_exception = true
|
2003-09-24 11:18:44 -04:00
|
|
|
@server.start
|
|
|
|
}
|
2003-10-22 11:43:10 -04:00
|
|
|
@endpoint = "http://localhost:#{Port}/"
|
|
|
|
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
|
* import soap4r/1.5.2;
* lib/soap/{attachment.rb,baseData.rb,encodingstyle/soapHandler.rb}:
introduce SOAPExternalReference class as a referenct to SOAPEnvelope
external content.
* lib/soap/{attachment.rb,mimemessage.rb}: great SwA (SOAP messages
with Attachments) support code by Jamie Herre.
* lib/soap/{element.rb,marshal.rb,parser.rb,processor.rb,
streamHandler.rb,wsdlDriver.rb}: SwA support.
* lib/soap/rpc/{cgistub.rb,driver.rb,element.rb,proxy.rb,router.rb,
soaplet.rb}: SwA support and refactoring.
* lib/soap/generator.rb, lib/soap/mapping/mapping.rb: follow
SOAPReference#initialize signature change.
* lib/soap/mapping/factory.rb: deleted unused methods.
* lib/soap/mapping/rubytypeFactory.rb: do no ignore case while xsi:type
string <-> Ruby class name matching.
* lib/xsd/datatypes.rb: check the smallest positive non-zero
single-precision float exactly instead of packing with "f".
[ruby-talk:88822]
* test/soap/test_basetype.rb, test/xsd/test_xsd.rb: use 1.402e-45, not
1.4e-45. 1.4e-45 is smaller than 2 ** -149...
* test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb,
test/xsd/test_xsd.rb: use "(-1.0 / (1.0 / 0.0))" instead of "-0.0".
* test/soap/test_streamhandler.rb: revert to the previous test that
warns "basic_auth unsupported under net/http".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-05 21:20:51 -05:00
|
|
|
@var.wiredump_dev = STDERR if $DEBUG
|
2005-05-23 11:40:01 -04:00
|
|
|
@var.add_method('set_value', 'newValue')
|
|
|
|
@var.add_method('get_value')
|
2003-09-24 11:18:44 -04:00
|
|
|
@var.add_method_as('+', 'add', 'rhs')
|
|
|
|
@var.add_method_as('-', 'sub', 'rhs')
|
|
|
|
@var.add_method_as('*', 'multi', 'rhs')
|
|
|
|
@var.add_method_as('/', 'div', 'rhs')
|
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
2003-12-08 10:09:49 -05:00
|
|
|
@server.shutdown
|
2003-09-24 11:18:44 -04:00
|
|
|
@t.kill
|
2003-10-20 11:37:11 -04:00
|
|
|
@t.join
|
2003-10-22 11:43:10 -04:00
|
|
|
@var.reset_stream
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_calc2
|
2005-05-23 11:40:01 -04:00
|
|
|
assert_equal(1, @var.set_value(1))
|
2003-09-24 11:18:44 -04:00
|
|
|
assert_equal(3, @var + 2)
|
|
|
|
assert_equal(-1.2, @var - 2.2)
|
|
|
|
assert_equal(2.2, @var * 2.2)
|
|
|
|
assert_equal(0, @var / 2)
|
|
|
|
assert_equal(0.5, @var / 2.0)
|
|
|
|
assert_raises(ZeroDivisionError) do
|
|
|
|
@var / 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2003-09-26 14:34:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|