anthill_ruby 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +21 -0
- data/README +22 -0
- data/anthill_ruby.gemspec +17 -0
- data/changelog +21 -0
- data/examples/data_converter.rb +1 -0
- data/knownbugs +19 -0
- data/lib/anthill_constants.rb +44 -0
- data/lib/anthill_ruby.rb +36 -0
- data/lib/binary_decoder.rb +227 -0
- data/lib/binary_encoder.rb +131 -0
- data/lib/byte_buffer.rb +88 -0
- data/lib/decoder_base.rb +23 -0
- data/lib/encoder_base.rb +24 -0
- data/lib/outputter_base.rb +31 -0
- data/lib/txt_outputter.rb +29 -0
- data/lib/validator_base.rb +26 -0
- data/lib/xml_outputter.rb +29 -0
- data/roadmap +18 -0
- data/setup.rb +1585 -0
- data/test/anthill_test.rb +27 -0
- data/test/binary_decoder_test.rb +30 -0
- data/test/binary_encoder_test.rb +30 -0
- data/test/byte_buffer_test.rb +117 -0
- data/test/decoder_base_test.rb +30 -0
- data/test/encoder_base_test.rb +30 -0
- data/test/outputter_base_test.rb +30 -0
- metadata +76 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
require "byte_buffer_test"
|
|
23
|
+
require "encoder_base_test"
|
|
24
|
+
require "decoder_base_test"
|
|
25
|
+
require "binary_encoder_test"
|
|
26
|
+
require "binary_decoder_test"
|
|
27
|
+
require "outputter_base_test"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
|
|
23
|
+
class BinaryDecoderTest < Test::Unit::TestCase
|
|
24
|
+
def test_001
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_002
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
|
|
23
|
+
class BinaryEncoderTest < Test::Unit::TestCase
|
|
24
|
+
def test_001
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_002
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
require "test/unit"
|
|
22
|
+
require "anthill"
|
|
23
|
+
|
|
24
|
+
class ByteBufferTest < Test::Unit::TestCase
|
|
25
|
+
|
|
26
|
+
def test_read_dump
|
|
27
|
+
buffer = ""
|
|
28
|
+
file = ["61", "62", "63", "a"]
|
|
29
|
+
byte_buffer = Majoron::AntHill::ByteBuffer.new(buffer)
|
|
30
|
+
byte_buffer.read_dump(file)
|
|
31
|
+
assert_equal "abc\n", buffer
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_read_dump_invalid_hex
|
|
36
|
+
file = File.new(__FILE__, "r")
|
|
37
|
+
assert_not_nil file
|
|
38
|
+
buffer = ""
|
|
39
|
+
begin
|
|
40
|
+
byte_buffer = Majoron::AntHill::ByteBuffer.new(buffer)
|
|
41
|
+
byte_buffer.read_dump(file)
|
|
42
|
+
file.close()
|
|
43
|
+
# Not OK
|
|
44
|
+
assert false
|
|
45
|
+
rescue RangeError => e
|
|
46
|
+
file.close()
|
|
47
|
+
# OK
|
|
48
|
+
assert true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_write_dump
|
|
54
|
+
hex = "61 62 63"
|
|
55
|
+
ostream = String.new()
|
|
56
|
+
data = Majoron::AntHill::ByteBuffer.decode_hex(hex)
|
|
57
|
+
buffer = Majoron::AntHill::ByteBuffer.new(data)
|
|
58
|
+
buffer.write_dump(ostream)
|
|
59
|
+
assert_equal hex, ostream
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_encode_hex
|
|
64
|
+
hex = Majoron::AntHill::ByteBuffer.encode_hex("abc")
|
|
65
|
+
assert_equal "61 62 63", hex
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_encode_hex_with_empty_buffer
|
|
69
|
+
hex = Majoron::AntHill::ByteBuffer.encode_hex([])
|
|
70
|
+
assert_equal "", hex
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_decode_hex
|
|
75
|
+
pattern = "test"
|
|
76
|
+
hex = Majoron::AntHill::ByteBuffer.encode_hex(pattern)
|
|
77
|
+
data = Majoron::AntHill::ByteBuffer.decode_hex(hex)
|
|
78
|
+
assert_equal pattern, data
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_decode_hex
|
|
82
|
+
pattern = "test"
|
|
83
|
+
hex = Majoron::AntHill::ByteBuffer.encode_hex(pattern)
|
|
84
|
+
data = Majoron::AntHill::ByteBuffer.decode_hex(hex)
|
|
85
|
+
assert_equal pattern, data
|
|
86
|
+
# fuck
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_decode_hex_different_formats
|
|
90
|
+
dump1 = String.new()
|
|
91
|
+
dump1 << "0 0 0 d7 0 0 0 4 0 0 0 0 0 0 0 1 53 4d 53 31 32 0 1 1 31 32 "
|
|
92
|
+
dump1 << "33 0 1 1 31 32 33 0 1 1 1 66 61 6b 65 0 66 61 6b 65 0 1 1 1 "
|
|
93
|
+
dump1 << "1 7 6d 65 73 73 61 67 65 2 4 0 2 0 1 2 a 0 2 0 1 0 d 0 1 1 2 "
|
|
94
|
+
dump1 << "b 0 2 0 1 0 5 0 1 1 2 c 0 2 0 1 2 e 0 1 1 2 f 0 1 1 4 26 0 1 "
|
|
95
|
+
dump1 << "1 0 19 0 1 1 4 24 0 3 1 2 3 2 1 0 1 1 3 81 0 3 1 2 3 3 2 0 1 "
|
|
96
|
+
dump1 << "1 3 3 0 3 1 2 3 2 2 0 3 1 2 3 2 3 0 3 1 2 3 2 5 0 1 1 12 1 0 "
|
|
97
|
+
dump1 << "1 1 12 3 0 2 0 1 12 4 0 1 1 0 30 0 1 1 3 4 0 1 1 13 c 0 1 1 2 "
|
|
98
|
+
dump1 << "d 0 1 1 13 80 0 1 1 13 83 0 2 0 1 5 1 0 1 1"
|
|
99
|
+
data1 = Majoron::AntHill::ByteBuffer.decode_hex(dump1)
|
|
100
|
+
|
|
101
|
+
dump2 = String.new()
|
|
102
|
+
dump2 << "00 00 00 d7 00 00 00 04 00 00 00 00 00 00 00 01 53 4d 53 31 32 00 01 01 31 32 "
|
|
103
|
+
dump2 << "33 00 01 01 31 32 33 00 01 01 01 66 61 6b 65 00 66 61 6b 65 00 01 01 01 "
|
|
104
|
+
dump2 << "01 07 6d 65 73 73 61 67 65 02 04 00 02 00 01 02 0a 00 02 00 01 00 0d 00 01 01 02 "
|
|
105
|
+
dump2 << "0b 00 02 00 01 00 05 00 01 01 02 0c 00 02 00 01 02 0e 00 01 01 02 0f 00 01 01 04 26 00 01 "
|
|
106
|
+
dump2 << "01 00 19 00 01 01 04 24 00 03 01 02 03 02 01 00 01 01 03 81 00 03 01 02 03 03 02 00 01 "
|
|
107
|
+
dump2 << "01 03 03 00 03 01 02 03 02 02 00 03 01 02 03 02 03 00 03 01 02 03 02 05 00 01 01 12 01 00 "
|
|
108
|
+
dump2 << "01 01 12 03 00 02 00 01 12 04 00 01 01 00 30 00 01 01 03 04 00 01 01 13 0c 00 01 01 02 "
|
|
109
|
+
dump2 << "0d 00 01 01 13 80 00 01 01 13 83 00 02 00 01 05 01 00 01 01"
|
|
110
|
+
data2 = Majoron::AntHill::ByteBuffer.decode_hex(dump2)
|
|
111
|
+
|
|
112
|
+
assert_equal data1, data2
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
|
|
23
|
+
class DecoderBaseTest < Test::Unit::TestCase
|
|
24
|
+
def test_001
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_002
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
|
|
23
|
+
class EncoderBaseTest < Test::Unit::TestCase
|
|
24
|
+
def test_001
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_002
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/'
|
|
19
|
+
|
|
20
|
+
require "test/unit"
|
|
21
|
+
require "anthill"
|
|
22
|
+
|
|
23
|
+
class OutputterBaseTest < Test::Unit::TestCase
|
|
24
|
+
def test_001
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_002
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: anthill_ruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.2
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Artem Rufanov
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: The AntHill is a powerful networking library which implements network
|
|
15
|
+
fail-over and scaling functionality for any user applications.
|
|
16
|
+
email: developers@majoron.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- changelog
|
|
22
|
+
- knownbugs
|
|
23
|
+
- test/encoder_base_test.rb
|
|
24
|
+
- test/byte_buffer_test.rb
|
|
25
|
+
- test/decoder_base_test.rb
|
|
26
|
+
- test/binary_decoder_test.rb
|
|
27
|
+
- test/binary_encoder_test.rb
|
|
28
|
+
- test/outputter_base_test.rb
|
|
29
|
+
- test/anthill_test.rb
|
|
30
|
+
- examples/data_converter.rb
|
|
31
|
+
- roadmap
|
|
32
|
+
- lib/validator_base.rb
|
|
33
|
+
- lib/byte_buffer.rb
|
|
34
|
+
- lib/anthill_constants.rb
|
|
35
|
+
- lib/encoder_base.rb
|
|
36
|
+
- lib/outputter_base.rb
|
|
37
|
+
- lib/txt_outputter.rb
|
|
38
|
+
- lib/anthill_ruby.rb
|
|
39
|
+
- lib/binary_decoder.rb
|
|
40
|
+
- lib/binary_encoder.rb
|
|
41
|
+
- lib/xml_outputter.rb
|
|
42
|
+
- lib/decoder_base.rb
|
|
43
|
+
- MIT-LICENSE
|
|
44
|
+
- README
|
|
45
|
+
- setup.rb
|
|
46
|
+
- anthill_ruby.gemspec
|
|
47
|
+
homepage: http://www.majoron.com/project/anthill/ruby
|
|
48
|
+
licenses: []
|
|
49
|
+
post_install_message:
|
|
50
|
+
rdoc_options: []
|
|
51
|
+
require_paths:
|
|
52
|
+
- lib
|
|
53
|
+
- doc
|
|
54
|
+
- examples
|
|
55
|
+
- lib
|
|
56
|
+
- test
|
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - ! '>='
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 1.8.6
|
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
65
|
+
requirements:
|
|
66
|
+
- - ! '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
requirements: []
|
|
70
|
+
rubyforge_project:
|
|
71
|
+
rubygems_version: 1.8.23
|
|
72
|
+
signing_key:
|
|
73
|
+
specification_version: 3
|
|
74
|
+
summary: The AntHill is a powerful networking library which implements network fail-over
|
|
75
|
+
and scaling functionality for any user applications.
|
|
76
|
+
test_files: []
|