RocketAMF 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +36 -0
- data/Rakefile +54 -0
- data/lib/rocketamf.rb +12 -0
- data/lib/rocketamf/class_mapping.rb +211 -0
- data/lib/rocketamf/common.rb +35 -0
- data/lib/rocketamf/constants.rb +47 -0
- data/lib/rocketamf/pure.rb +30 -0
- data/lib/rocketamf/pure/deserializer.rb +361 -0
- data/lib/rocketamf/pure/io_helpers.rb +94 -0
- data/lib/rocketamf/pure/remoting.rb +89 -0
- data/lib/rocketamf/pure/serializer.rb +327 -0
- data/lib/rocketamf/remoting.rb +133 -0
- data/lib/rocketamf/values/array_collection.rb +9 -0
- data/lib/rocketamf/values/messages.rb +133 -0
- data/lib/rocketamf/values/typed_hash.rb +13 -0
- data/lib/rocketamf/version.rb +9 -0
- data/spec/amf/class_mapping_set_spec.rb +34 -0
- data/spec/amf/class_mapping_spec.rb +120 -0
- data/spec/amf/deserializer_spec.rb +311 -0
- data/spec/amf/request_spec.rb +25 -0
- data/spec/amf/response_spec.rb +68 -0
- data/spec/amf/serializer_spec.rb +328 -0
- data/spec/amf/values/array_collection_spec.rb +6 -0
- data/spec/amf/values/messages_spec.rb +31 -0
- data/spec/fixtures/objects/amf0-boolean.bin +1 -0
- data/spec/fixtures/objects/amf0-date.bin +0 -0
- data/spec/fixtures/objects/amf0-ecma-ordinal-array.bin +0 -0
- data/spec/fixtures/objects/amf0-hash.bin +0 -0
- data/spec/fixtures/objects/amf0-null.bin +1 -0
- data/spec/fixtures/objects/amf0-number.bin +0 -0
- data/spec/fixtures/objects/amf0-object.bin +0 -0
- data/spec/fixtures/objects/amf0-ref-test.bin +0 -0
- data/spec/fixtures/objects/amf0-strict-array.bin +0 -0
- data/spec/fixtures/objects/amf0-string.bin +0 -0
- data/spec/fixtures/objects/amf0-typed-object.bin +0 -0
- data/spec/fixtures/objects/amf0-undefined.bin +1 -0
- data/spec/fixtures/objects/amf0-untyped-object.bin +0 -0
- data/spec/fixtures/objects/amf3-0.bin +0 -0
- data/spec/fixtures/objects/amf3-arrayRef.bin +1 -0
- data/spec/fixtures/objects/amf3-bigNum.bin +0 -0
- data/spec/fixtures/objects/amf3-date.bin +0 -0
- data/spec/fixtures/objects/amf3-datesRef.bin +0 -0
- data/spec/fixtures/objects/amf3-dynObject.bin +2 -0
- data/spec/fixtures/objects/amf3-emptyArray.bin +1 -0
- data/spec/fixtures/objects/amf3-emptyArrayRef.bin +1 -0
- data/spec/fixtures/objects/amf3-emptyStringRef.bin +1 -0
- data/spec/fixtures/objects/amf3-false.bin +1 -0
- data/spec/fixtures/objects/amf3-graphMember.bin +0 -0
- data/spec/fixtures/objects/amf3-hash.bin +2 -0
- data/spec/fixtures/objects/amf3-largeMax.bin +0 -0
- data/spec/fixtures/objects/amf3-largeMin.bin +0 -0
- data/spec/fixtures/objects/amf3-max.bin +1 -0
- data/spec/fixtures/objects/amf3-min.bin +0 -0
- data/spec/fixtures/objects/amf3-mixedArray.bin +11 -0
- data/spec/fixtures/objects/amf3-null.bin +1 -0
- data/spec/fixtures/objects/amf3-objRef.bin +0 -0
- data/spec/fixtures/objects/amf3-primArray.bin +1 -0
- data/spec/fixtures/objects/amf3-string.bin +1 -0
- data/spec/fixtures/objects/amf3-stringRef.bin +0 -0
- data/spec/fixtures/objects/amf3-symbol.bin +1 -0
- data/spec/fixtures/objects/amf3-true.bin +1 -0
- data/spec/fixtures/objects/amf3-typedObject.bin +2 -0
- data/spec/fixtures/request/acknowledge-response.bin +0 -0
- data/spec/fixtures/request/amf0-error-response.bin +0 -0
- data/spec/fixtures/request/commandMessage.bin +0 -0
- data/spec/fixtures/request/remotingMessage.bin +0 -0
- data/spec/fixtures/request/simple-response.bin +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +32 -0
- metadata +133 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
|
3
|
+
describe RocketAMF::Values::AbstractMessage do
|
4
|
+
before :each do
|
5
|
+
@message = RocketAMF::Values::AbstractMessage.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should generate conforming uuids" do
|
9
|
+
@message.send(:rand_uuid).should =~ /[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}/i
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe RocketAMF::Values::ErrorMessage do
|
14
|
+
before :each do
|
15
|
+
@e = Exception.new('Error message')
|
16
|
+
@e.set_backtrace(['Backtrace 1', 'Backtrace 2'])
|
17
|
+
@message = RocketAMF::Values::ErrorMessage.new(nil, @e)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should serialize as a hash in AMF0" do
|
21
|
+
response = RocketAMF::Response.new
|
22
|
+
response.messages << RocketAMF::Message.new('1/onStatus', '', @message)
|
23
|
+
response.serialize.should == request_fixture('amf0-error-response.bin')
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should extract exception properties correctly" do
|
27
|
+
@message.faultCode.should == 'Exception'
|
28
|
+
@message.faultString.should == 'Error message'
|
29
|
+
@message.faultDetail.should == "Backtrace 1\nBacktrace 2"
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
abc
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
����
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
String . String
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
foo
|
@@ -0,0 +1 @@
|
|
1
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
require 'spec/autorun'
|
9
|
+
|
10
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
11
|
+
require 'rocketamf'
|
12
|
+
|
13
|
+
def request_fixture(binary_path)
|
14
|
+
File.open(File.dirname(__FILE__) + '/fixtures/request/' + binary_path).read
|
15
|
+
end
|
16
|
+
|
17
|
+
def object_fixture(binary_path)
|
18
|
+
File.open(File.dirname(__FILE__) + '/fixtures/objects/' + binary_path).read
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_request(binary_path)
|
22
|
+
RocketAMF::Request.new.populate_from_stream(StringIO.new(request_fixture(binary_path)))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Add reset support to ClassMapping
|
26
|
+
module RocketAMF
|
27
|
+
class ClassMapping
|
28
|
+
def reset
|
29
|
+
@mappings = nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: RocketAMF
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tony Hillerson
|
8
|
+
- Stephen Augenstein
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-10-29 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description:
|
18
|
+
email: perl.programmer@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- README.rdoc
|
27
|
+
- Rakefile
|
28
|
+
- lib/rocketamf/class_mapping.rb
|
29
|
+
- lib/rocketamf/common.rb
|
30
|
+
- lib/rocketamf/constants.rb
|
31
|
+
- lib/rocketamf/pure/deserializer.rb
|
32
|
+
- lib/rocketamf/pure/io_helpers.rb
|
33
|
+
- lib/rocketamf/pure/remoting.rb
|
34
|
+
- lib/rocketamf/pure/serializer.rb
|
35
|
+
- lib/rocketamf/pure.rb
|
36
|
+
- lib/rocketamf/remoting.rb
|
37
|
+
- lib/rocketamf/values/array_collection.rb
|
38
|
+
- lib/rocketamf/values/messages.rb
|
39
|
+
- lib/rocketamf/values/typed_hash.rb
|
40
|
+
- lib/rocketamf/version.rb
|
41
|
+
- lib/rocketamf.rb
|
42
|
+
- spec/amf/class_mapping_set_spec.rb
|
43
|
+
- spec/amf/class_mapping_spec.rb
|
44
|
+
- spec/amf/deserializer_spec.rb
|
45
|
+
- spec/amf/request_spec.rb
|
46
|
+
- spec/amf/response_spec.rb
|
47
|
+
- spec/amf/serializer_spec.rb
|
48
|
+
- spec/amf/values/array_collection_spec.rb
|
49
|
+
- spec/amf/values/messages_spec.rb
|
50
|
+
- spec/spec_helper.rb
|
51
|
+
- spec/fixtures/objects/amf0-boolean.bin
|
52
|
+
- spec/fixtures/objects/amf0-date.bin
|
53
|
+
- spec/fixtures/objects/amf0-ecma-ordinal-array.bin
|
54
|
+
- spec/fixtures/objects/amf0-hash.bin
|
55
|
+
- spec/fixtures/objects/amf0-null.bin
|
56
|
+
- spec/fixtures/objects/amf0-number.bin
|
57
|
+
- spec/fixtures/objects/amf0-object.bin
|
58
|
+
- spec/fixtures/objects/amf0-ref-test.bin
|
59
|
+
- spec/fixtures/objects/amf0-strict-array.bin
|
60
|
+
- spec/fixtures/objects/amf0-string.bin
|
61
|
+
- spec/fixtures/objects/amf0-typed-object.bin
|
62
|
+
- spec/fixtures/objects/amf0-undefined.bin
|
63
|
+
- spec/fixtures/objects/amf0-untyped-object.bin
|
64
|
+
- spec/fixtures/objects/amf3-0.bin
|
65
|
+
- spec/fixtures/objects/amf3-arrayRef.bin
|
66
|
+
- spec/fixtures/objects/amf3-bigNum.bin
|
67
|
+
- spec/fixtures/objects/amf3-date.bin
|
68
|
+
- spec/fixtures/objects/amf3-datesRef.bin
|
69
|
+
- spec/fixtures/objects/amf3-dynObject.bin
|
70
|
+
- spec/fixtures/objects/amf3-emptyArray.bin
|
71
|
+
- spec/fixtures/objects/amf3-emptyArrayRef.bin
|
72
|
+
- spec/fixtures/objects/amf3-emptyStringRef.bin
|
73
|
+
- spec/fixtures/objects/amf3-false.bin
|
74
|
+
- spec/fixtures/objects/amf3-graphMember.bin
|
75
|
+
- spec/fixtures/objects/amf3-hash.bin
|
76
|
+
- spec/fixtures/objects/amf3-largeMax.bin
|
77
|
+
- spec/fixtures/objects/amf3-largeMin.bin
|
78
|
+
- spec/fixtures/objects/amf3-max.bin
|
79
|
+
- spec/fixtures/objects/amf3-min.bin
|
80
|
+
- spec/fixtures/objects/amf3-mixedArray.bin
|
81
|
+
- spec/fixtures/objects/amf3-null.bin
|
82
|
+
- spec/fixtures/objects/amf3-objRef.bin
|
83
|
+
- spec/fixtures/objects/amf3-primArray.bin
|
84
|
+
- spec/fixtures/objects/amf3-string.bin
|
85
|
+
- spec/fixtures/objects/amf3-stringRef.bin
|
86
|
+
- spec/fixtures/objects/amf3-symbol.bin
|
87
|
+
- spec/fixtures/objects/amf3-true.bin
|
88
|
+
- spec/fixtures/objects/amf3-typedObject.bin
|
89
|
+
- spec/fixtures/request/acknowledge-response.bin
|
90
|
+
- spec/fixtures/request/amf0-error-response.bin
|
91
|
+
- spec/fixtures/request/commandMessage.bin
|
92
|
+
- spec/fixtures/request/remotingMessage.bin
|
93
|
+
- spec/fixtures/request/simple-response.bin
|
94
|
+
- spec/spec.opts
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: http://github.com/warhammerkid/rocket-amf
|
97
|
+
licenses: []
|
98
|
+
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- --line-numbers
|
102
|
+
- --main
|
103
|
+
- README.rdoc
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: "0"
|
111
|
+
version:
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: "0"
|
117
|
+
version:
|
118
|
+
requirements: []
|
119
|
+
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 1.3.5
|
122
|
+
signing_key:
|
123
|
+
specification_version: 3
|
124
|
+
summary: Fast AMF serializer/deserializer and request/response wrappers to simplify remoting implementation
|
125
|
+
test_files:
|
126
|
+
- spec/amf/class_mapping_set_spec.rb
|
127
|
+
- spec/amf/class_mapping_spec.rb
|
128
|
+
- spec/amf/deserializer_spec.rb
|
129
|
+
- spec/amf/request_spec.rb
|
130
|
+
- spec/amf/response_spec.rb
|
131
|
+
- spec/amf/serializer_spec.rb
|
132
|
+
- spec/amf/values/array_collection_spec.rb
|
133
|
+
- spec/amf/values/messages_spec.rb
|