1 require File.dirname(__FILE__) + '/abstract_dispatcher'
3 class TC_DispatcherActionControllerXmlRpc < Test::Unit::TestCase
5 include DispatcherCommonTests
8 @direct_controller = DirectController.new
9 @delegated_controller = DelegatedController.new
10 @layered_controller = LayeredController.new
11 @virtual_controller = VirtualController.new
12 @protocol = ActionWebService::Protocol::XmlRpc::XmlRpcProtocol.create(@direct_controller)
15 def test_layered_dispatching
16 mt_cats = do_method_call(@layered_controller, 'mt.getCategories')
17 assert_equal(["mtCat1", "mtCat2"], mt_cats)
18 blogger_cats = do_method_call(@layered_controller, 'blogger.getCategories')
19 assert_equal(["bloggerCat1", "bloggerCat2"], blogger_cats)
23 response = do_method_call(@layered_controller, 'system.multicall', [
24 {'methodName' => 'mt.getCategories'},
25 {'methodName' => 'blogger.getCategories'},
26 {'methodName' => 'mt.bool'},
27 {'methodName' => 'blogger.str', 'params' => ['2000']},
28 {'methodName' => 'mt.alwaysFail'},
29 {'methodName' => 'blogger.alwaysFail'},
30 {'methodName' => 'mt.blah'},
31 {'methodName' => 'blah.blah'},
32 {'methodName' => 'mt.person'}
35 [["mtCat1", "mtCat2"]],
36 [["bloggerCat1", "bloggerCat2"]],
39 {"faultCode" => 3, "faultString" => "MT AlwaysFail"},
40 {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"},
41 {"faultCode" => 4, "faultMessage" => "no such method 'blah' on API DispatcherTest::MTAPI"},
42 {"faultCode" => 4, "faultMessage" => "no such web service 'blah'"},
43 [{"name"=>"person1", "id"=>1}]
48 def exception_message(xmlrpc_fault_exception)
49 xmlrpc_fault_exception.faultString
52 def is_exception?(obj)
53 obj.is_a?(XMLRPC::FaultException)
56 def service_name(container)
57 container.is_a?(DelegatedController) ? 'test_service' : 'api'