rocketamf_pure 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 +9 -0
- data/benchmark.rb +73 -0
- data/lib/rocketamf.rb +212 -0
- data/lib/rocketamf/class_mapping.rb +237 -0
- data/lib/rocketamf/constants.rb +46 -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 +417 -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 +212 -0
- data/lib/rocketamf/values/typed_hash.rb +13 -0
- data/lib/rocketamf_pure.rb +1 -0
- data/spec/class_mapping_spec.rb +110 -0
- data/spec/deserializer_spec.rb +423 -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-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 +148 -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,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rocketamf_pure
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jacob Henry
|
9
|
+
- Stephen Augenstein
|
10
|
+
- Joc O'Connor
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
15
|
+
dependencies: []
|
16
|
+
description:
|
17
|
+
email:
|
18
|
+
- perl.programmer@gmail.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files:
|
22
|
+
- README.rdoc
|
23
|
+
files:
|
24
|
+
- README.rdoc
|
25
|
+
- benchmark.rb
|
26
|
+
- Rakefile
|
27
|
+
- lib/rocketamf/class_mapping.rb
|
28
|
+
- lib/rocketamf/constants.rb
|
29
|
+
- lib/rocketamf/ext.rb
|
30
|
+
- lib/rocketamf/extensions.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/messages.rb
|
38
|
+
- lib/rocketamf/values/typed_hash.rb
|
39
|
+
- lib/rocketamf.rb
|
40
|
+
- lib/rocketamf_pure.rb
|
41
|
+
- spec/class_mapping_spec.rb
|
42
|
+
- spec/deserializer_spec.rb
|
43
|
+
- spec/fast_class_mapping_spec.rb
|
44
|
+
- spec/messages_spec.rb
|
45
|
+
- spec/remoting_spec.rb
|
46
|
+
- spec/serializer_spec.rb
|
47
|
+
- spec/spec_helper.rb
|
48
|
+
- spec/fixtures/objects/amf0-boolean.bin
|
49
|
+
- spec/fixtures/objects/amf0-complex-encoded-string.bin
|
50
|
+
- spec/fixtures/objects/amf0-date.bin
|
51
|
+
- spec/fixtures/objects/amf0-ecma-ordinal-array.bin
|
52
|
+
- spec/fixtures/objects/amf0-hash.bin
|
53
|
+
- spec/fixtures/objects/amf0-null.bin
|
54
|
+
- spec/fixtures/objects/amf0-number.bin
|
55
|
+
- spec/fixtures/objects/amf0-object.bin
|
56
|
+
- spec/fixtures/objects/amf0-ref-test.bin
|
57
|
+
- spec/fixtures/objects/amf0-strict-array.bin
|
58
|
+
- spec/fixtures/objects/amf0-string.bin
|
59
|
+
- spec/fixtures/objects/amf0-time.bin
|
60
|
+
- spec/fixtures/objects/amf0-typed-object.bin
|
61
|
+
- spec/fixtures/objects/amf0-undefined.bin
|
62
|
+
- spec/fixtures/objects/amf0-untyped-object.bin
|
63
|
+
- spec/fixtures/objects/amf0-xml-doc.bin
|
64
|
+
- spec/fixtures/objects/amf3-0.bin
|
65
|
+
- spec/fixtures/objects/amf3-array-collection.bin
|
66
|
+
- spec/fixtures/objects/amf3-array-ref.bin
|
67
|
+
- spec/fixtures/objects/amf3-associative-array.bin
|
68
|
+
- spec/fixtures/objects/amf3-bigNum.bin
|
69
|
+
- spec/fixtures/objects/amf3-byte-array-ref.bin
|
70
|
+
- spec/fixtures/objects/amf3-byte-array.bin
|
71
|
+
- spec/fixtures/objects/amf3-complex-array-collection.bin
|
72
|
+
- spec/fixtures/objects/amf3-complex-encoded-string-array.bin
|
73
|
+
- spec/fixtures/objects/amf3-date-ref.bin
|
74
|
+
- spec/fixtures/objects/amf3-date.bin
|
75
|
+
- spec/fixtures/objects/amf3-dictionary.bin
|
76
|
+
- spec/fixtures/objects/amf3-dynamic-object.bin
|
77
|
+
- spec/fixtures/objects/amf3-empty-array-ref.bin
|
78
|
+
- spec/fixtures/objects/amf3-empty-array.bin
|
79
|
+
- spec/fixtures/objects/amf3-empty-dictionary.bin
|
80
|
+
- spec/fixtures/objects/amf3-empty-string-ref.bin
|
81
|
+
- spec/fixtures/objects/amf3-encoded-string-ref.bin
|
82
|
+
- spec/fixtures/objects/amf3-externalizable.bin
|
83
|
+
- spec/fixtures/objects/amf3-false.bin
|
84
|
+
- spec/fixtures/objects/amf3-float.bin
|
85
|
+
- spec/fixtures/objects/amf3-graph-member.bin
|
86
|
+
- spec/fixtures/objects/amf3-hash.bin
|
87
|
+
- spec/fixtures/objects/amf3-large-max.bin
|
88
|
+
- spec/fixtures/objects/amf3-large-min.bin
|
89
|
+
- spec/fixtures/objects/amf3-max.bin
|
90
|
+
- spec/fixtures/objects/amf3-min.bin
|
91
|
+
- spec/fixtures/objects/amf3-mixed-array.bin
|
92
|
+
- spec/fixtures/objects/amf3-null.bin
|
93
|
+
- spec/fixtures/objects/amf3-object-ref.bin
|
94
|
+
- spec/fixtures/objects/amf3-primitive-array.bin
|
95
|
+
- spec/fixtures/objects/amf3-string-ref.bin
|
96
|
+
- spec/fixtures/objects/amf3-string.bin
|
97
|
+
- spec/fixtures/objects/amf3-symbol.bin
|
98
|
+
- spec/fixtures/objects/amf3-trait-ref.bin
|
99
|
+
- spec/fixtures/objects/amf3-true.bin
|
100
|
+
- spec/fixtures/objects/amf3-typed-object.bin
|
101
|
+
- spec/fixtures/objects/amf3-xml-doc.bin
|
102
|
+
- spec/fixtures/objects/amf3-xml-ref.bin
|
103
|
+
- spec/fixtures/objects/amf3-xml.bin
|
104
|
+
- spec/fixtures/request/acknowledge-response.bin
|
105
|
+
- spec/fixtures/request/amf0-error-response.bin
|
106
|
+
- spec/fixtures/request/blaze-response.bin
|
107
|
+
- spec/fixtures/request/commandMessage.bin
|
108
|
+
- spec/fixtures/request/flex-request.bin
|
109
|
+
- spec/fixtures/request/multiple-simple-request.bin
|
110
|
+
- spec/fixtures/request/remotingMessage.bin
|
111
|
+
- spec/fixtures/request/simple-request.bin
|
112
|
+
- spec/fixtures/request/simple-response.bin
|
113
|
+
- spec/fixtures/request/unsupportedCommandMessage.bin
|
114
|
+
homepage: http://github.com/rubyamf/rocketamf
|
115
|
+
licenses: []
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options:
|
118
|
+
- --line-numbers
|
119
|
+
- --main
|
120
|
+
- README.rdoc
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.8.23
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Fast AMF serializer/deserializer with remoting request/response wrappers
|
141
|
+
to simplify integration
|
142
|
+
test_files:
|
143
|
+
- spec/class_mapping_spec.rb
|
144
|
+
- spec/deserializer_spec.rb
|
145
|
+
- spec/fast_class_mapping_spec.rb
|
146
|
+
- spec/messages_spec.rb
|
147
|
+
- spec/remoting_spec.rb
|
148
|
+
- spec/serializer_spec.rb
|