summaryrefslogtreecommitdiff
path: root/ruby_1_8_5/test/soap/fault/test_customfault.rb
blob: 2f7bc2be6ed0c7087b6647cbafd009443a5b0417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'


module SOAP
module Fault


class TestCustomFault < Test::Unit::TestCase
  Port = 17171

  class CustomFaultServer < SOAP::RPC::StandaloneServer
    def on_init
      add_method(self, 'fault', 'msg')
    end

    def fault(msg)
      SOAPFault.new(SOAPString.new("mycustom"),
        SOAPString.new("error: #{msg}"),
        SOAPString.new(self.class.name))
    end
  end

  def setup
    @server = CustomFaultServer.new('customfault', 'urn:customfault', '0.0.0.0', Port)
    @server.level = Logger::Severity::ERROR
    @t = Thread.new {
      Thread.current.abort_on_exception = true
      @server.start
    }
    @endpoint = "http://localhost:#{Port}/"
    @client = SOAP::RPC::Driver.new(@endpoint, 'urn:customfault')
    @client.wiredump_dev = STDERR if $DEBUG
    @client.add_method("fault", "msg")
  end

  def teardown
    @server.shutdown
    @t.kill
    @t.join
    @client.reset_stream
  end

  def test_custom_fault
    begin
      @client.fault("message")
      assert(false, 'exception not raised')
    rescue SOAP::FaultError => e
      assert(true, 'exception raised')
      assert_equal('error: message', e.message)
    end
  end
end


end
end
t/tk/sample/tkmultilistbox.rb: bug fixnagai 2003-12-17* bug fixnagai 2003-12-09* overrided instance methods, which are private methods on the supernagai 2003-12-09* typonagai 2003-12-08* new sample scriptnagai 2003-11-22* ext/tk/lib/tk.rb: add Tk.grab_release and fix bug of TkCompositenagai 2003-11-20* ext/tk/sample/tkballoonhelp.rb: new sample scriptnagai 2003-10-21bug fixnagai 2003-10-17modify the message and comments on the sourcenagai 2003-10-16Add Tk::EncodedString and Tk::UTF8_String class to support charactersnagai 2003-10-14ext/tk/sample/demos-en/entry3.rb, ext/tk/sample/demos-jp/entry3.rb :nagai 2003-09-07* tcltklib.c (lib_mainloop_core): fixed signal-trap bugnagai 2003-09-02* ext/tcltklib/tcltklib.c (ip_invoke): fixed bug on passing a exceptionnagai 2003-08-03* ready to use 'validatecommand' option of TkEntry/TkSpinbox widgetnagai 2003-08-03* additional messagenagai 2003-08-03* add widget demo scriptsnagai 2003-08-02* add or modify some widget demo scriptsnagai 2003-08-02* (bug fix) forgot to entry a widget class name of 'labelframe' widgetnagai 2003-08-02* (bug fix) TkEntry#deletenagai 2003-08-01* forgot to commit a sample scriptnagai 2003-07-31* bug fix : wrong resource file format (resource.{en,jp})nagai 2003-07-31* (IMPORTANT BUG FIX) scan of event keywords doesn't work on recentnagai 2003-07-31* wrap the command-proc of TkScale : pass the numeric object to the procnagai 2003-07-30* bug fixnagai 2003-07-30* additional check of Tk interpreters' status for a little more safetynagai 2003-07-29* fix a bug of the procedure for 'Delete' button on the safe-Tk frmaenagai 2003-07-29* bug fix ( tested with Ruby/Tk widget demo )nagai 2003-07-29tcltklib.c : bug fixnagai 2003-07-27multi-tk.rb : (new) library to support multiple Tk interpreters (high level)nagai 2003-06-25tk.rb :nagai 2003-06-24tk.rb :nagai 2003-06-22tk.rb :nagai 2003-06-21tk.rb :nagai 2003-06-19tcltklib.c :nagai