diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
commit | aaea48fe9826b9e5d2d5b92795a297b8f238c58d (patch) | |
tree | e7c01c7f95d467f837c1f96d58dac74c3c902610 /actionwebservice/test/ws/abstract_encoding.rb | |
parent | aa09c770e9b5400683be11952673017295246de7 (diff) | |
download | rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.gz rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.bz2 rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.zip |
* collapse 'ws' back into protocols, it just added complexity and indirection, and was hard to extend.
* extract casting into seperate support file
* ensure casting always does the right thing for return values, should fix interoperability issues with Ecto and possibly other XML-RPC clients
* add functional unit tests for scaffolding
* represent signature items with classes instead of symbols/Class objects, much more flexible
* tweak logging to always show casted versions of parameters and return values, if possible.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1072 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/test/ws/abstract_encoding.rb')
-rw-r--r-- | actionwebservice/test/ws/abstract_encoding.rb | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/actionwebservice/test/ws/abstract_encoding.rb b/actionwebservice/test/ws/abstract_encoding.rb deleted file mode 100644 index 6032d94c48..0000000000 --- a/actionwebservice/test/ws/abstract_encoding.rb +++ /dev/null @@ -1,68 +0,0 @@ -require File.dirname(__FILE__) + '/abstract_unit' - -module Nested - class StructClass - attr_accessor :name - attr_accessor :version - - def initialize - @name = 5 - @version = "1.0" - end - - def ==(other) - @name == other.name && @version == other.version - end - end -end - -module EncodingTest - def setup - @call_signature = [:int, :bool, :string, :float, [:time], Nested::StructClass] - @call_params = [1, true, "string", 5.0, [Time.now], Nested::StructClass.new] - @response_signature = [:string] - @response_param = "hello world" - test_setup - end - - def test_abstract - obj = WS::Encoding::AbstractEncoding.new - assert_raises(NotImplementedError) do - obj.encode_rpc_call(nil, nil) - end - assert_raises(NotImplementedError) do - obj.decode_rpc_call(nil) - end - assert_raises(NotImplementedError) do - obj.encode_rpc_response(nil, nil) - end - assert_raises(NotImplementedError) do - obj.decode_rpc_response(nil) - end - end - - def encode_rpc_call(method_name, signature, params) - params = params.dup - (0..(signature.length-1)).each do |i| - type_binding = @marshaler.register_type(signature[i]) - info = WS::ParamInfo.create(signature[i], type_binding, i) - params[i] = @marshaler.marshal(WS::Param.new(params[i], info)) - end - @encoder.encode_rpc_call(method_name, params) - end - - def decode_rpc_call(obj) - @encoder.decode_rpc_call(obj) - end - - def encode_rpc_response(method_name, signature, param) - type_binding = @marshaler.register_type(signature[0]) - info = WS::ParamInfo.create(signature[0], type_binding, 0) - param = @marshaler.marshal(WS::Param.new(param, info)) - @encoder.encode_rpc_response(method_name, param) - end - - def decode_rpc_response(obj) - @encoder.decode_rpc_response(obj) - end -end |