aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/test
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-04-05 21:37:48 +0000
committerLeon Breedt <bitserf@gmail.com>2005-04-05 21:37:48 +0000
commit1155ea0aa3c25b4683c6343162cd49dbe0fec094 (patch)
tree3f51d6a8bb7d64cc71c8546055ca03c906cd3d7a /actionwebservice/test
parent81014da84c9ae4dacb70287ff6f509d7a40cc0ae (diff)
downloadrails-1155ea0aa3c25b4683c6343162cd49dbe0fec094.tar.gz
rails-1155ea0aa3c25b4683c6343162cd49dbe0fec094.tar.bz2
rails-1155ea0aa3c25b4683c6343162cd49dbe0fec094.zip
initial go at making :layered dispatching generate WSDL for SOAP, and have
:layered process SOAP method calls correctly as well, may be unstable git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1097 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/test')
-rw-r--r--actionwebservice/test/abstract_dispatcher.rb12
-rw-r--r--actionwebservice/test/dispatcher_action_controller_soap_test.rb8
2 files changed, 19 insertions, 1 deletions
diff --git a/actionwebservice/test/abstract_dispatcher.rb b/actionwebservice/test/abstract_dispatcher.rb
index 4784180518..c3d256d71a 100644
--- a/actionwebservice/test/abstract_dispatcher.rb
+++ b/actionwebservice/test/abstract_dispatcher.rb
@@ -371,24 +371,33 @@ module DispatcherCommonTests
end
def do_method_call(container, public_method_name, *params)
+ request_env = {}
mode = container.web_service_dispatching_mode
case mode
when :direct
service_name = service_name(container)
api = container.class.web_service_api
+ method = api.public_api_method_instance(public_method_name)
when :delegated
service_name = service_name(container)
api = container.web_service_object(service_name).class.web_service_api
+ method = api.public_api_method_instance(public_method_name)
when :layered
service_name = nil
+ real_method_name = nil
if public_method_name =~ /^([^\.]+)\.(.*)$/
service_name = $1
+ real_method_name = $2
+ end
+ if @protocol.is_a? ActionWebService::Protocol::Soap::SoapProtocol
+ 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)
service_name = self.service_name(container)
end
@protocol.register_api(api)
- method = api.public_api_method_instance(public_method_name)
virtual = false
unless method
virtual = true
@@ -397,6 +406,7 @@ module DispatcherCommonTests
body = @protocol.encode_request(public_method_name, params.dup, method.expects)
# puts body
ap_request = @protocol.encode_action_pack_request(service_name, public_method_name, body, :request_class => ActionController::TestRequest)
+ ap_request.env.update(request_env)
ap_response = ActionController::TestResponse.new
container.process(ap_request, ap_response)
# puts ap_response.body
diff --git a/actionwebservice/test/dispatcher_action_controller_soap_test.rb b/actionwebservice/test/dispatcher_action_controller_soap_test.rb
index 3d7327be02..731185f398 100644
--- a/actionwebservice/test/dispatcher_action_controller_soap_test.rb
+++ b/actionwebservice/test/dispatcher_action_controller_soap_test.rb
@@ -26,6 +26,7 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase
@direct_controller = DirectController.new
@delegated_controller = DelegatedController.new
@virtual_controller = VirtualController.new
+ @layered_controller = LayeredController.new
@protocol = ActionWebService::Protocol::Soap::SoapProtocol.new
end
@@ -59,6 +60,13 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase
assert(BrokenAutoLoadController.web_service_api.nil?)
end
+ def test_layered_dispatching
+ mt_cats = do_method_call(@layered_controller, 'mt.getCategories')
+ assert_equal(["mtCat1", "mtCat2"], mt_cats)
+ blogger_cats = do_method_call(@layered_controller, 'blogger.getCategories')
+ assert_equal(["bloggerCat1", "bloggerCat2"], blogger_cats)
+ end
+
protected
def exception_message(soap_fault_exception)
soap_fault_exception.detail.cause.message