aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/test/ws/soap_marshaling_test.rb
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-04-02 21:03:36 +0000
committerLeon Breedt <bitserf@gmail.com>2005-04-02 21:03:36 +0000
commitaaea48fe9826b9e5d2d5b92795a297b8f238c58d (patch)
treee7c01c7f95d467f837c1f96d58dac74c3c902610 /actionwebservice/test/ws/soap_marshaling_test.rb
parentaa09c770e9b5400683be11952673017295246de7 (diff)
downloadrails-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/soap_marshaling_test.rb')
-rw-r--r--actionwebservice/test/ws/soap_marshaling_test.rb97
1 files changed, 0 insertions, 97 deletions
diff --git a/actionwebservice/test/ws/soap_marshaling_test.rb b/actionwebservice/test/ws/soap_marshaling_test.rb
deleted file mode 100644
index f350ad1124..0000000000
--- a/actionwebservice/test/ws/soap_marshaling_test.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-require File.dirname(__FILE__) + '/abstract_unit'
-
-module Nested
- class MyClass
- attr_accessor :id
- attr_accessor :name
-
- def initialize(id, name)
- @id = id
- @name = name
- end
-
- def ==(other)
- @id == other.id && @name == other.name
- end
- end
-end
-
-class SoapMarshalingTest < Test::Unit::TestCase
- def setup
- @marshaler = WS::Marshaling::SoapMarshaler.new
- end
-
- def test_abstract
- marshaler = WS::Marshaling::AbstractMarshaler.new
- assert_raises(NotImplementedError) do
- marshaler.marshal(nil)
- end
- assert_raises(NotImplementedError) do
- marshaler.unmarshal(nil)
- end
- assert_equal(nil, marshaler.register_type(nil))
- assert_raises(NotImplementedError) do
- marshaler.cast_inbound_recursive(nil, nil)
- end
- assert_raises(NotImplementedError) do
- marshaler.cast_outbound_recursive(nil, nil)
- end
- end
-
- def test_marshaling
- info = WS::ParamInfo.create(Nested::MyClass, @marshaler.register_type(Nested::MyClass))
- param = WS::Param.new(Nested::MyClass.new(2, "name"), info)
- new_param = @marshaler.unmarshal(@marshaler.marshal(param))
- assert(param == new_param)
- end
-
- def test_exception_marshaling
- info = WS::ParamInfo.create(RuntimeError, @marshaler.register_type(RuntimeError))
- param = WS::Param.new(RuntimeError.new("hello, world"), info)
- new_param = @marshaler.unmarshal(@marshaler.marshal(param))
- assert_equal("hello, world", new_param.value.detail.cause.message)
- end
-
- def test_registration
- type_binding1 = @marshaler.register_type(:int)
- type_binding2 = @marshaler.register_type(:int)
- assert(type_binding1.equal?(type_binding2))
- end
-
- def test_active_record
- if Object.const_defined?('ActiveRecord')
- node_class = Class.new(ActiveRecord::Base) do
- def initialize(*args)
- super(*args)
- @new_record = false
- end
-
- class << self
- def name
- "Node"
- end
-
- def columns(*args)
- [
- ActiveRecord::ConnectionAdapters::Column.new('id', 0, 'int'),
- ActiveRecord::ConnectionAdapters::Column.new('name', nil, 'string'),
- ActiveRecord::ConnectionAdapters::Column.new('email', nil, 'string'),
- ]
- end
-
- def connection
- self
- end
- end
- end
- info = WS::ParamInfo.create(node_class, @marshaler.register_type(node_class), 0)
- ar_obj = node_class.new('name' => 'hello', 'email' => 'test@test.com')
- param = WS::Param.new(ar_obj, info)
- obj = @marshaler.marshal(param)
- param = @marshaler.unmarshal(obj)
- new_ar_obj = param.value
- assert_equal(ar_obj, new_ar_obj)
- assert(!ar_obj.equal?(new_ar_obj))
- end
- end
-end