diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-08-16 05:45:03 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-08-16 05:45:03 +0000 |
commit | 9d79880e81a035c96ca70d7e342549236ed1f242 (patch) | |
tree | b73f49f050a35fd24db52bb591efe9c629ce032b /actionwebservice/test | |
parent | 2eba7134455863f936d0b1e8e88284c08ef6b083 (diff) | |
download | rails-9d79880e81a035c96ca70d7e342549236ed1f242.tar.gz rails-9d79880e81a035c96ca70d7e342549236ed1f242.tar.bz2 rails-9d79880e81a035c96ca70d7e342549236ed1f242.zip |
add 'system.multicall' support to XML-RPC. boxcarred methods must still exist
on the target service(s), value casting will still be performed, and recursive
'system.multicall' calls are not allowed.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2021 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/test')
-rw-r--r-- | actionwebservice/test/abstract_dispatcher.rb | 27 | ||||
-rw-r--r-- | actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb | 19 |
2 files changed, 44 insertions, 2 deletions
diff --git a/actionwebservice/test/abstract_dispatcher.rb b/actionwebservice/test/abstract_dispatcher.rb index 4f8cd1fb4c..94edb213fa 100644 --- a/actionwebservice/test/abstract_dispatcher.rb +++ b/actionwebservice/test/abstract_dispatcher.rb @@ -107,11 +107,15 @@ module DispatcherTest class MTAPI < ActionWebService::API::Base inflect_names false api_method :getCategories, :returns => [[:string]] + api_method :bool, :returns => [:bool] + api_method :alwaysFail end class BloggerAPI < ActionWebService::API::Base inflect_names false api_method :getCategories, :returns => [[:string]] + api_method :str, :expects => [:int], :returns => [:string] + api_method :alwaysFail end class MTService < ActionWebService::Base @@ -120,6 +124,14 @@ module DispatcherTest def getCategories ["mtCat1", "mtCat2"] end + + def bool + 'y' + end + + def alwaysFail + raise "MT AlwaysFail" + end end class BloggerService < ActionWebService::Base @@ -128,6 +140,17 @@ module DispatcherTest def getCategories ["bloggerCat1", "bloggerCat2"] end + + def str(int) + unless int.is_a?(Integer) + raise "Not an integer!" + end + 500 + int + end + + def alwaysFail + raise "Blogger AlwaysFail" + end end class AbstractController < ActionController::Base @@ -439,8 +462,8 @@ module DispatcherCommonTests public_method_name = real_method_name request_env['HTTP_SOAPACTION'] = "/soap/#{service_name}/#{real_method_name}" end - api = container.web_service_object(service_name.to_sym).class.web_service_api - method = api.public_api_method_instance(real_method_name) + api = container.web_service_object(service_name.to_sym).class.web_service_api rescue nil + method = api.public_api_method_instance(real_method_name) rescue nil service_name = self.service_name(container) end protocol.register_api(api) diff --git a/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb b/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb index be8d553fc9..8309b0e16d 100644 --- a/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +++ b/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb @@ -19,6 +19,25 @@ class TC_DispatcherActionControllerXmlRpc < Test::Unit::TestCase assert_equal(["bloggerCat1", "bloggerCat2"], blogger_cats) end + def test_multicall + response = do_method_call(@layered_controller, 'system.multicall', [ + {'methodName' => 'mt.getCategories'}, + {'methodName' => 'blogger.getCategories'}, + {'methodName' => 'mt.bool'}, + {'methodName' => 'blogger.str', 'params' => ['2000']}, + {'methodName' => 'mt.alwaysFail'}, + {'methodName' => 'blogger.alwaysFail'} + ]) + assert_equal [ + [["mtCat1", "mtCat2"]], + [["bloggerCat1", "bloggerCat2"]], + [true], + ["2500"], + {"faultCode" => 3, "faultString" => "MT AlwaysFail"}, + {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"} + ], response + end + protected def exception_message(xmlrpc_fault_exception) xmlrpc_fault_exception.faultString |