RocketAMF-ouvrages 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +47 -0
- data/Rakefile +59 -0
- data/RocketAMF.gemspec +20 -0
- data/benchmark.rb +74 -0
- data/ext/rocketamf_ext/class_mapping.c +484 -0
- data/ext/rocketamf_ext/constants.h +52 -0
- data/ext/rocketamf_ext/deserializer.c +770 -0
- data/ext/rocketamf_ext/deserializer.h +27 -0
- data/ext/rocketamf_ext/extconf.rb +18 -0
- data/ext/rocketamf_ext/remoting.c +184 -0
- data/ext/rocketamf_ext/rocketamf_ext.c +38 -0
- data/ext/rocketamf_ext/serializer.c +834 -0
- data/ext/rocketamf_ext/serializer.h +29 -0
- data/ext/rocketamf_ext/utility.h +4 -0
- data/lib/rocketamf.rb +216 -0
- data/lib/rocketamf/class_mapping.rb +237 -0
- data/lib/rocketamf/constants.rb +50 -0
- data/lib/rocketamf/ext.rb +28 -0
- data/lib/rocketamf/extensions.rb +22 -0
- data/lib/rocketamf/pure.rb +24 -0
- data/lib/rocketamf/pure/deserializer.rb +455 -0
- data/lib/rocketamf/pure/io_helpers.rb +94 -0
- data/lib/rocketamf/pure/remoting.rb +117 -0
- data/lib/rocketamf/pure/serializer.rb +474 -0
- data/lib/rocketamf/remoting.rb +196 -0
- data/lib/rocketamf/values/messages.rb +214 -0
- data/lib/rocketamf/values/typed_hash.rb +13 -0
- data/spec/class_mapping_spec.rb +110 -0
- data/spec/deserializer_spec.rb +449 -0
- data/spec/fast_class_mapping_spec.rb +144 -0
- data/spec/fixtures/objects/amf0-boolean.bin +1 -0
- data/spec/fixtures/objects/amf0-complex-encoded-string.bin +0 -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-time.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/amf0-xml-doc.bin +0 -0
- data/spec/fixtures/objects/amf3-0.bin +0 -0
- data/spec/fixtures/objects/amf3-array-collection.bin +2 -0
- data/spec/fixtures/objects/amf3-array-ref.bin +1 -0
- data/spec/fixtures/objects/amf3-associative-array.bin +1 -0
- data/spec/fixtures/objects/amf3-bigNum.bin +0 -0
- data/spec/fixtures/objects/amf3-byte-array-ref.bin +1 -0
- data/spec/fixtures/objects/amf3-byte-array.bin +0 -0
- data/spec/fixtures/objects/amf3-complex-array-collection.bin +6 -0
- data/spec/fixtures/objects/amf3-complex-encoded-string-array.bin +1 -0
- data/spec/fixtures/objects/amf3-date-ref.bin +0 -0
- data/spec/fixtures/objects/amf3-date.bin +0 -0
- data/spec/fixtures/objects/amf3-dictionary.bin +0 -0
- data/spec/fixtures/objects/amf3-dynamic-object.bin +2 -0
- data/spec/fixtures/objects/amf3-empty-array-ref.bin +1 -0
- data/spec/fixtures/objects/amf3-empty-array.bin +1 -0
- data/spec/fixtures/objects/amf3-empty-dictionary.bin +0 -0
- data/spec/fixtures/objects/amf3-empty-string-ref.bin +1 -0
- data/spec/fixtures/objects/amf3-encoded-string-ref.bin +0 -0
- data/spec/fixtures/objects/amf3-externalizable.bin +0 -0
- data/spec/fixtures/objects/amf3-false.bin +1 -0
- data/spec/fixtures/objects/amf3-float.bin +0 -0
- data/spec/fixtures/objects/amf3-graph-member.bin +0 -0
- data/spec/fixtures/objects/amf3-hash.bin +2 -0
- data/spec/fixtures/objects/amf3-large-max.bin +0 -0
- data/spec/fixtures/objects/amf3-large-min.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-mixed-array.bin +10 -0
- data/spec/fixtures/objects/amf3-null.bin +1 -0
- data/spec/fixtures/objects/amf3-object-ref.bin +0 -0
- data/spec/fixtures/objects/amf3-primitive-array.bin +1 -0
- data/spec/fixtures/objects/amf3-string-ref.bin +0 -0
- data/spec/fixtures/objects/amf3-string.bin +1 -0
- data/spec/fixtures/objects/amf3-symbol.bin +1 -0
- data/spec/fixtures/objects/amf3-trait-ref.bin +3 -0
- data/spec/fixtures/objects/amf3-true.bin +1 -0
- data/spec/fixtures/objects/amf3-typed-object.bin +2 -0
- data/spec/fixtures/objects/amf3-vector-double.bin +0 -0
- data/spec/fixtures/objects/amf3-vector-int.bin +0 -0
- data/spec/fixtures/objects/amf3-vector-object.bin +0 -0
- data/spec/fixtures/objects/amf3-vector-uint.bin +0 -0
- data/spec/fixtures/objects/amf3-xml-doc.bin +1 -0
- data/spec/fixtures/objects/amf3-xml-ref.bin +1 -0
- data/spec/fixtures/objects/amf3-xml.bin +1 -0
- data/spec/fixtures/request/acknowledge-response.bin +0 -0
- data/spec/fixtures/request/amf0-error-response.bin +0 -0
- data/spec/fixtures/request/blaze-response.bin +0 -0
- data/spec/fixtures/request/commandMessage.bin +0 -0
- data/spec/fixtures/request/flex-request.bin +0 -0
- data/spec/fixtures/request/multiple-simple-request.bin +0 -0
- data/spec/fixtures/request/remotingMessage.bin +0 -0
- data/spec/fixtures/request/simple-request.bin +0 -0
- data/spec/fixtures/request/simple-response.bin +0 -0
- data/spec/fixtures/request/unsupportedCommandMessage.bin +0 -0
- data/spec/messages_spec.rb +39 -0
- data/spec/remoting_spec.rb +196 -0
- data/spec/serializer_spec.rb +503 -0
- data/spec/spec_helper.rb +55 -0
- metadata +167 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/autorun'
|
4
|
+
|
5
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
6
|
+
require 'rocketamf'
|
7
|
+
require 'rocketamf/pure/io_helpers' # Just to make sure they get loaded
|
8
|
+
|
9
|
+
def request_fixture(binary_path)
|
10
|
+
data = File.open(File.dirname(__FILE__) + '/fixtures/request/' + binary_path, "rb").read
|
11
|
+
data.force_encoding("ASCII-8BIT") if data.respond_to?(:force_encoding)
|
12
|
+
data
|
13
|
+
end
|
14
|
+
|
15
|
+
def object_fixture(binary_path)
|
16
|
+
data = File.open(File.dirname(__FILE__) + '/fixtures/objects/' + binary_path, "rb").read
|
17
|
+
data.force_encoding("ASCII-8BIT") if data.respond_to?(:force_encoding)
|
18
|
+
data
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_envelope(binary_path)
|
22
|
+
RocketAMF::Envelope.new.populate_from_stream(StringIO.new(request_fixture(binary_path)))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Helper classes
|
26
|
+
class RubyClass; attr_accessor :baz, :foo; end;
|
27
|
+
class OtherClass; attr_accessor :bar, :foo; end;
|
28
|
+
class ClassMappingTest
|
29
|
+
attr_accessor :prop_a
|
30
|
+
attr_accessor :prop_b
|
31
|
+
end
|
32
|
+
class ClassMappingTest2 < ClassMappingTest
|
33
|
+
attr_accessor :prop_c
|
34
|
+
end
|
35
|
+
module ANamespace; class TestRubyClass; end; end
|
36
|
+
class ExternalizableTest
|
37
|
+
include RocketAMF::Pure::ReadIOHelpers
|
38
|
+
include RocketAMF::Pure::WriteIOHelpers
|
39
|
+
|
40
|
+
attr_accessor :one, :two
|
41
|
+
|
42
|
+
def encode_amf serializer
|
43
|
+
serializer.write_object(self, nil, {:class_name => 'ExternalizableTest', :dynamic => false, :externalizable => true, :members => []})
|
44
|
+
end
|
45
|
+
|
46
|
+
def read_external des
|
47
|
+
@one = read_double(des.source)
|
48
|
+
@two = read_double(des.source)
|
49
|
+
end
|
50
|
+
|
51
|
+
def write_external ser
|
52
|
+
ser.stream << pack_double(@one)
|
53
|
+
ser.stream << pack_double(@two)
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: RocketAMF-ouvrages
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jacob Henry
|
9
|
+
- Stephen Augenstein
|
10
|
+
- Joc O'Connor
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
|
15
|
+
date: 2013-05-03 00:00:00 Z
|
16
|
+
dependencies: []
|
17
|
+
|
18
|
+
description:
|
19
|
+
email:
|
20
|
+
- perl.programmer@gmail.com
|
21
|
+
executables: []
|
22
|
+
|
23
|
+
extensions:
|
24
|
+
- ext/rocketamf_ext/extconf.rb
|
25
|
+
extra_rdoc_files:
|
26
|
+
- README.rdoc
|
27
|
+
files:
|
28
|
+
- README.rdoc
|
29
|
+
- benchmark.rb
|
30
|
+
- RocketAMF.gemspec
|
31
|
+
- Rakefile
|
32
|
+
- lib/rocketamf/extensions.rb
|
33
|
+
- lib/rocketamf/pure.rb
|
34
|
+
- lib/rocketamf/values/typed_hash.rb
|
35
|
+
- lib/rocketamf/values/messages.rb
|
36
|
+
- lib/rocketamf/ext.rb
|
37
|
+
- lib/rocketamf/constants.rb
|
38
|
+
- lib/rocketamf/class_mapping.rb
|
39
|
+
- lib/rocketamf/remoting.rb
|
40
|
+
- lib/rocketamf/pure/io_helpers.rb
|
41
|
+
- lib/rocketamf/pure/serializer.rb
|
42
|
+
- lib/rocketamf/pure/deserializer.rb
|
43
|
+
- lib/rocketamf/pure/remoting.rb
|
44
|
+
- lib/rocketamf.rb
|
45
|
+
- spec/fast_class_mapping_spec.rb
|
46
|
+
- spec/serializer_spec.rb
|
47
|
+
- spec/messages_spec.rb
|
48
|
+
- spec/remoting_spec.rb
|
49
|
+
- spec/spec_helper.rb
|
50
|
+
- spec/class_mapping_spec.rb
|
51
|
+
- spec/deserializer_spec.rb
|
52
|
+
- spec/fixtures/request/simple-request.bin
|
53
|
+
- spec/fixtures/request/commandMessage.bin
|
54
|
+
- spec/fixtures/request/amf0-error-response.bin
|
55
|
+
- spec/fixtures/request/blaze-response.bin
|
56
|
+
- spec/fixtures/request/simple-response.bin
|
57
|
+
- spec/fixtures/request/multiple-simple-request.bin
|
58
|
+
- spec/fixtures/request/remotingMessage.bin
|
59
|
+
- spec/fixtures/request/unsupportedCommandMessage.bin
|
60
|
+
- spec/fixtures/request/flex-request.bin
|
61
|
+
- spec/fixtures/request/acknowledge-response.bin
|
62
|
+
- spec/fixtures/objects/amf0-undefined.bin
|
63
|
+
- spec/fixtures/objects/amf0-string.bin
|
64
|
+
- spec/fixtures/objects/amf3-complex-encoded-string-array.bin
|
65
|
+
- spec/fixtures/objects/amf3-null.bin
|
66
|
+
- spec/fixtures/objects/amf3-trait-ref.bin
|
67
|
+
- spec/fixtures/objects/amf0-hash.bin
|
68
|
+
- spec/fixtures/objects/amf3-typed-object.bin
|
69
|
+
- spec/fixtures/objects/amf3-xml.bin
|
70
|
+
- spec/fixtures/objects/amf3-object-ref.bin
|
71
|
+
- spec/fixtures/objects/amf3-externalizable.bin
|
72
|
+
- spec/fixtures/objects/amf3-bigNum.bin
|
73
|
+
- spec/fixtures/objects/amf3-date.bin
|
74
|
+
- spec/fixtures/objects/amf3-encoded-string-ref.bin
|
75
|
+
- spec/fixtures/objects/amf3-xml-doc.bin
|
76
|
+
- spec/fixtures/objects/amf3-string-ref.bin
|
77
|
+
- spec/fixtures/objects/amf3-mixed-array.bin
|
78
|
+
- spec/fixtures/objects/amf3-associative-array.bin
|
79
|
+
- spec/fixtures/objects/amf0-complex-encoded-string.bin
|
80
|
+
- spec/fixtures/objects/amf3-hash.bin
|
81
|
+
- spec/fixtures/objects/amf3-large-max.bin
|
82
|
+
- spec/fixtures/objects/amf3-date-ref.bin
|
83
|
+
- spec/fixtures/objects/amf3-large-min.bin
|
84
|
+
- spec/fixtures/objects/amf3-symbol.bin
|
85
|
+
- spec/fixtures/objects/amf0-time.bin
|
86
|
+
- spec/fixtures/objects/amf0-ecma-ordinal-array.bin
|
87
|
+
- spec/fixtures/objects/amf3-true.bin
|
88
|
+
- spec/fixtures/objects/amf3-empty-array-ref.bin
|
89
|
+
- spec/fixtures/objects/amf3-empty-string-ref.bin
|
90
|
+
- spec/fixtures/objects/amf0-untyped-object.bin
|
91
|
+
- spec/fixtures/objects/amf3-byte-array-ref.bin
|
92
|
+
- spec/fixtures/objects/amf3-min.bin
|
93
|
+
- spec/fixtures/objects/amf3-dictionary.bin
|
94
|
+
- spec/fixtures/objects/amf0-ref-test.bin
|
95
|
+
- spec/fixtures/objects/amf3-dynamic-object.bin
|
96
|
+
- spec/fixtures/objects/amf3-vector-uint.bin
|
97
|
+
- spec/fixtures/objects/amf0-xml-doc.bin
|
98
|
+
- spec/fixtures/objects/amf3-string.bin
|
99
|
+
- spec/fixtures/objects/amf3-complex-array-collection.bin
|
100
|
+
- spec/fixtures/objects/amf3-false.bin
|
101
|
+
- spec/fixtures/objects/amf0-null.bin
|
102
|
+
- spec/fixtures/objects/amf3-empty-array.bin
|
103
|
+
- spec/fixtures/objects/amf0-object.bin
|
104
|
+
- spec/fixtures/objects/amf0-boolean.bin
|
105
|
+
- spec/fixtures/objects/amf0-typed-object.bin
|
106
|
+
- spec/fixtures/objects/amf3-array-collection.bin
|
107
|
+
- spec/fixtures/objects/amf3-graph-member.bin
|
108
|
+
- spec/fixtures/objects/amf3-byte-array.bin
|
109
|
+
- spec/fixtures/objects/amf3-xml-ref.bin
|
110
|
+
- spec/fixtures/objects/amf0-number.bin
|
111
|
+
- spec/fixtures/objects/amf3-max.bin
|
112
|
+
- spec/fixtures/objects/amf3-float.bin
|
113
|
+
- spec/fixtures/objects/amf3-0.bin
|
114
|
+
- spec/fixtures/objects/amf3-vector-int.bin
|
115
|
+
- spec/fixtures/objects/amf0-strict-array.bin
|
116
|
+
- spec/fixtures/objects/amf3-empty-dictionary.bin
|
117
|
+
- spec/fixtures/objects/amf3-vector-object.bin
|
118
|
+
- spec/fixtures/objects/amf3-vector-double.bin
|
119
|
+
- spec/fixtures/objects/amf3-array-ref.bin
|
120
|
+
- spec/fixtures/objects/amf0-date.bin
|
121
|
+
- spec/fixtures/objects/amf3-primitive-array.bin
|
122
|
+
- ext/rocketamf_ext/serializer.c
|
123
|
+
- ext/rocketamf_ext/rocketamf_ext.c
|
124
|
+
- ext/rocketamf_ext/remoting.c
|
125
|
+
- ext/rocketamf_ext/class_mapping.c
|
126
|
+
- ext/rocketamf_ext/deserializer.c
|
127
|
+
- ext/rocketamf_ext/serializer.h
|
128
|
+
- ext/rocketamf_ext/constants.h
|
129
|
+
- ext/rocketamf_ext/deserializer.h
|
130
|
+
- ext/rocketamf_ext/utility.h
|
131
|
+
- ext/rocketamf_ext/extconf.rb
|
132
|
+
homepage: http://github.com/rubyamf/rocketamf
|
133
|
+
licenses: []
|
134
|
+
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options:
|
137
|
+
- --line-numbers
|
138
|
+
- --main
|
139
|
+
- README.rdoc
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: "0"
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: "0"
|
154
|
+
requirements: []
|
155
|
+
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 1.8.23
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Fast AMF serializer/deserializer with remoting request/response wrappers to simplify integration
|
161
|
+
test_files:
|
162
|
+
- spec/fast_class_mapping_spec.rb
|
163
|
+
- spec/serializer_spec.rb
|
164
|
+
- spec/messages_spec.rb
|
165
|
+
- spec/remoting_spec.rb
|
166
|
+
- spec/class_mapping_spec.rb
|
167
|
+
- spec/deserializer_spec.rb
|