skydb 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +165 -1
  3. data/lib/skydb.rb +18 -61
  4. data/lib/skydb/client.rb +186 -186
  5. data/lib/skydb/event.rb +47 -76
  6. data/lib/skydb/property.rb +34 -67
  7. data/lib/skydb/table.rb +121 -41
  8. data/lib/skydb/version.rb +1 -1
  9. data/test/integration/client_test.rb +88 -0
  10. data/test/test_helper.rb +3 -51
  11. data/test/unit/client_test.rb +135 -32
  12. metadata +17 -278
  13. data/bin/sky +0 -89
  14. data/lib/ext/hash.rb +0 -11
  15. data/lib/ext/string.rb +0 -11
  16. data/lib/ext/treetop.rb +0 -19
  17. data/lib/skydb/action.rb +0 -76
  18. data/lib/skydb/import.rb +0 -7
  19. data/lib/skydb/import/importer.rb +0 -435
  20. data/lib/skydb/import/transforms/apache.yml +0 -4
  21. data/lib/skydb/import/transforms/sky.yml +0 -28
  22. data/lib/skydb/import/transforms/snowplow.yml +0 -1
  23. data/lib/skydb/import/translator.rb +0 -119
  24. data/lib/skydb/message.rb +0 -146
  25. data/lib/skydb/message/add_action.rb +0 -53
  26. data/lib/skydb/message/add_event.rb +0 -72
  27. data/lib/skydb/message/add_property.rb +0 -55
  28. data/lib/skydb/message/create_table.rb +0 -64
  29. data/lib/skydb/message/delete_table.rb +0 -66
  30. data/lib/skydb/message/get_action.rb +0 -55
  31. data/lib/skydb/message/get_actions.rb +0 -38
  32. data/lib/skydb/message/get_properties.rb +0 -38
  33. data/lib/skydb/message/get_property.rb +0 -55
  34. data/lib/skydb/message/get_table.rb +0 -74
  35. data/lib/skydb/message/get_tables.rb +0 -43
  36. data/lib/skydb/message/lookup.rb +0 -79
  37. data/lib/skydb/message/lua/aggregate.rb +0 -63
  38. data/lib/skydb/message/multi.rb +0 -57
  39. data/lib/skydb/message/next_actions.rb +0 -55
  40. data/lib/skydb/message/ping.rb +0 -32
  41. data/lib/skydb/property/type.rb +0 -40
  42. data/lib/skydb/query.rb +0 -183
  43. data/lib/skydb/query/after_condition.rb +0 -104
  44. data/lib/skydb/query/ast/selection_field_syntax_node.rb +0 -26
  45. data/lib/skydb/query/ast/selection_fields_syntax_node.rb +0 -16
  46. data/lib/skydb/query/ast/selection_group_syntax_node.rb +0 -16
  47. data/lib/skydb/query/ast/selection_groups_syntax_node.rb +0 -16
  48. data/lib/skydb/query/condition.rb +0 -113
  49. data/lib/skydb/query/on_condition.rb +0 -53
  50. data/lib/skydb/query/selection.rb +0 -398
  51. data/lib/skydb/query/selection_field.rb +0 -99
  52. data/lib/skydb/query/selection_fields_grammar.treetop +0 -46
  53. data/lib/skydb/query/selection_fields_parse_error.rb +0 -30
  54. data/lib/skydb/query/selection_group.rb +0 -78
  55. data/lib/skydb/query/selection_groups_grammar.treetop +0 -31
  56. data/lib/skydb/query/selection_groups_parse_error.rb +0 -30
  57. data/lib/skydb/query/validation_error.rb +0 -8
  58. data/lib/skydb/timestamp.rb +0 -22
  59. data/test/integration/query_test.rb +0 -102
  60. data/test/unit/event_test.rb +0 -32
  61. data/test/unit/import/importer_test.rb +0 -208
  62. data/test/unit/import/translator_test.rb +0 -88
  63. data/test/unit/message/add_action_message_test.rb +0 -34
  64. data/test/unit/message/add_event_message_test.rb +0 -35
  65. data/test/unit/message/add_property_message_test.rb +0 -41
  66. data/test/unit/message/create_table_message_test.rb +0 -34
  67. data/test/unit/message/delete_table_message_test.rb +0 -34
  68. data/test/unit/message/get_action_message_test.rb +0 -34
  69. data/test/unit/message/get_actions_message_test.rb +0 -18
  70. data/test/unit/message/get_properties_message_test.rb +0 -18
  71. data/test/unit/message/get_property_message_test.rb +0 -34
  72. data/test/unit/message/get_table_message_test.rb +0 -19
  73. data/test/unit/message/get_tables_message_test.rb +0 -18
  74. data/test/unit/message/lookup_message_test.rb +0 -27
  75. data/test/unit/message/lua_aggregate_message_test.rb +0 -19
  76. data/test/unit/message/multi_message_test.rb +0 -22
  77. data/test/unit/message/next_action_message_test.rb +0 -34
  78. data/test/unit/message/ping_message_test.rb +0 -18
  79. data/test/unit/message_test.rb +0 -15
  80. data/test/unit/query/after_test.rb +0 -89
  81. data/test/unit/query/on_test.rb +0 -71
  82. data/test/unit/query/selection_test.rb +0 -273
  83. data/test/unit/query_test.rb +0 -182
  84. data/test/unit/skydb_test.rb +0 -20
@@ -1,32 +0,0 @@
1
- # encoding: binary
2
- require 'test_helper'
3
-
4
- class TestEvent < MiniTest::Unit::TestCase
5
- def setup
6
- @event = SkyDB::Event.new()
7
- end
8
-
9
- ######################################
10
- # Object ID
11
- ######################################
12
-
13
- def test_object_id
14
- @event.object_id = 12
15
- assert_equal 12, @event.object_id
16
- end
17
-
18
-
19
- ######################################
20
- # Timestamp
21
- ######################################
22
-
23
- def test_timestamp_with_time
24
- @event.timestamp = Time.now
25
- refute_nil @event.timestamp
26
- end
27
-
28
- def test_invalid_timestamp
29
- @event.object_id = "foo"
30
- assert_nil @event.timestamp
31
- end
32
- end
@@ -1,208 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestImporter < MiniTest::Unit::TestCase
4
- def setup
5
- @importer = SkyDB::Import::Importer.new(:table_name => 'test')
6
- @input = {
7
- 'myString' => 'Hello',
8
- 'foo' => 100
9
- }
10
- @output = {}
11
- end
12
-
13
-
14
- ######################################
15
- # Transform File
16
- ######################################
17
-
18
- def test_load_simple_transform
19
- @importer.load_transform(
20
- <<-BLOCK.unindent
21
- fields:
22
- name: myString
23
- BLOCK
24
- )
25
-
26
- assert_equal "myString", @importer.translators.first.input_field
27
- assert_equal "name", @importer.translators.first.output_field
28
- assert_equal "string", @importer.translators.first.format
29
- end
30
-
31
- def test_load_simple_proc
32
- @importer.load_transform(
33
- <<-BLOCK.unindent
34
- fields:
35
- name: "{ output['foo'] * 10 }"
36
- BLOCK
37
- )
38
-
39
- assert_equal "name", @importer.translators.first.output_field
40
- assert !@importer.translators.first.translate_function.nil?
41
- end
42
-
43
-
44
- ######################################
45
- # Import
46
- ######################################
47
-
48
- def test_import_csv
49
- out, err = capture_io do
50
- events = [mock(), mock(), mock(), mock()]
51
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:00:00Z"), :action => {:name => '/index.html'}).returns(events[0])
52
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:01:00Z"), :action => {:name => '/signup.html'}).returns(events[1])
53
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:02:00Z"), :action => {:name => '/buy.html'}).returns(events[2])
54
- SkyDB::Event.expects(:new).with(:object_id => '101', :timestamp => Chronic.parse("2000-01-02T12:00:00Z"), :action => {:name => '/index.html'}).returns(events[3])
55
- SkyDB.expects(:add_event).with(events[0])
56
- SkyDB.expects(:add_event).with(events[1])
57
- SkyDB.expects(:add_event).with(events[2])
58
- SkyDB.expects(:add_event).with(events[3])
59
- @importer.load_transform_file('sky')
60
- @importer.import(['fixtures/unit/importer/simple.csv'], :progress_bar => false)
61
- end
62
- assert_equal '', out
63
- assert_equal '[import] Determining file type: csv', err.chomp
64
- end
65
-
66
- def test_import_tsv
67
- out, err = capture_io do
68
- events = [mock(), mock(), mock(), mock()]
69
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:00:00Z"), :action => {:name => '/index.html'}).returns(events[0])
70
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:01:00Z"), :action => {:name => '/signup.html'}).returns(events[1])
71
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:02:00Z"), :action => {:name => '/buy.html'}).returns(events[2])
72
- SkyDB::Event.expects(:new).with(:object_id => '101', :timestamp => Chronic.parse("2000-01-02T12:00:00Z"), :action => {:name => '/index.html'}).returns(events[3])
73
- SkyDB.expects(:add_event).with(events[0])
74
- SkyDB.expects(:add_event).with(events[1])
75
- SkyDB.expects(:add_event).with(events[2])
76
- SkyDB.expects(:add_event).with(events[3])
77
- @importer.load_transform_file('sky')
78
- @importer.import(['fixtures/unit/importer/simple.tsv'], :progress_bar => false)
79
- end
80
- assert_equal '', out
81
- assert_equal '[import] Determining file type: tsv', err.chomp
82
- end
83
-
84
- def test_import_json
85
- out, err = capture_io do
86
- events = [mock(), mock(), mock(), mock()]
87
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:00:00Z"), :action => {:name => '/index.html'}).returns(events[0])
88
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:01:00Z"), :action => {:name => '/signup.html'}).returns(events[1])
89
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:02:00Z"), :action => {:name => '/buy.html'}).returns(events[2])
90
- SkyDB::Event.expects(:new).with(:object_id => '101', :timestamp => Chronic.parse("2000-01-02T12:00:00Z"), :action => {:name => '/index.html'}).returns(events[3])
91
- SkyDB.expects(:add_event).with(events[0])
92
- SkyDB.expects(:add_event).with(events[1])
93
- SkyDB.expects(:add_event).with(events[2])
94
- SkyDB.expects(:add_event).with(events[3])
95
- @importer.load_transform_file('sky')
96
- @importer.import(['fixtures/unit/importer/simple.json'], :progress_bar => false)
97
- end
98
- assert_equal '', out
99
- assert_equal '[import] Determining file type: json', err.chomp
100
- end
101
-
102
- def test_import_apache_log
103
- out, err = capture_io do
104
- events = [mock(), mock(), mock(), mock(), mock()]
105
- SkyDB::Event.expects(:new).with(:object_id => '66.29.187.16', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/users/1"}).returns(events[0])
106
- SkyDB::Event.expects(:new).with(:object_id => '70.193.12.4', :timestamp => DateTime.parse("2013-01-13T04:05:09+00:00"), :action => {:name => "/tweets/new"}).returns(events[1])
107
- SkyDB::Event.expects(:new).with(:object_id => '67.228.32.10', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/tweets"}).returns(events[2])
108
- SkyDB::Event.expects(:new).with(:object_id => '157.55.35.85', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/index.html"}).returns(events[3])
109
- SkyDB::Event.expects(:new).with(:object_id => '66.29.187.16', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/messages/1840832/open"}).returns(events[4])
110
- SkyDB.expects(:add_event).with(events[0])
111
- SkyDB.expects(:add_event).with(events[1])
112
- SkyDB.expects(:add_event).with(events[2])
113
- SkyDB.expects(:add_event).with(events[3])
114
- SkyDB.expects(:add_event).with(events[4])
115
- @importer.load_transform_file('apache')
116
- @importer.import(['fixtures/unit/importer/simple.log'], :progress_bar => false)
117
- end
118
- assert_equal '', out
119
- assert_equal '[import] Determining file type: apache_log', err.chomp
120
- end
121
-
122
- def test_import_bzip2_apache_log
123
- out, err = capture_io do
124
- event = mock()
125
- SkyDB::Event.expects(:new).with(:object_id => '66.29.187.16', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/users/1"}).returns(event)
126
- SkyDB.expects(:add_event).with(event)
127
- @importer.load_transform_file('apache')
128
- @importer.file_type = :apache_log
129
- @importer.import(['fixtures/unit/importer/simple.log.bz2'])
130
- end
131
- assert_equal '', out
132
- assert_equal '', err
133
- end
134
-
135
- def test_import_gzip_apache_log
136
- out, err = capture_io do
137
- event = mock()
138
- SkyDB::Event.expects(:new).with(:object_id => '66.29.187.16', :timestamp => DateTime.parse("2013-01-13T04:05:07+00:00"), :action => {:name => "/users/1"}).returns(event)
139
- SkyDB.expects(:add_event).with(event)
140
- @importer.load_transform_file('apache')
141
- @importer.file_type = :apache_log
142
- @importer.import(['fixtures/unit/importer/simple.log.gz'])
143
- end
144
- assert_equal '', out
145
- assert_equal '', err
146
- end
147
-
148
- def test_import_override_file_type
149
- out, err = capture_io do
150
- event = mock()
151
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:00:00Z"), :action => {:name => '/index.html'}).returns(event)
152
- SkyDB.expects(:add_event).with(event)
153
- @importer.load_transform_file('sky')
154
- @importer.file_type = :csv
155
- @importer.import(['fixtures/unit/importer/simple'], :progress_bar => false)
156
- end
157
- assert_equal '', out
158
- assert_equal '', err
159
- end
160
-
161
- def test_import_csv_no_headers
162
- out, err = capture_io do
163
- events = [mock(), mock(), mock(), mock()]
164
- SkyDB::Event.expects(:new).with(:object_id => '100', :timestamp => Chronic.parse("2000-01-01T00:00:00Z"), :action => {:name => '/index.html'}).returns(events[0])
165
- SkyDB.expects(:add_event).with(events[0])
166
- @importer.headers = ['object_id', 'timestamp', 'action.name']
167
- @importer.load_transform_file('sky')
168
- @importer.import(['fixtures/unit/importer/no_headers.csv'], :progress_bar => false)
169
- end
170
- assert_equal '', out
171
- assert_equal '[import] Determining file type: csv', err.chomp
172
- end
173
-
174
- def test_import_bad_timestamp
175
- out, err = capture_io do
176
- events = mock()
177
- SkyDB::Event.expects(:new).never
178
- SkyDB.expects(:add_event).never
179
- @importer.load_transform_file('sky')
180
- @importer.import(['fixtures/unit/importer/bad_timestamp.csv'], :progress_bar => false)
181
- end
182
- assert_equal '', out
183
- assert_equal(
184
- "[import] Determining file type: csv\n" +
185
- "[ERROR] Invalid timestamp on line 2",
186
- err.chomp
187
- )
188
- end
189
-
190
- def test_import_unsupported_file_type
191
- e = nil
192
- out, err = capture_io do
193
- e = assert_raises(SkyDB::Import::Importer::UnsupportedFileType) do
194
- @importer.import(['fixtures/unit/importer/unsupported.xxx'], :progress_bar => false)
195
- end
196
- end
197
- assert_equal 'File type not supported by importer: .xxx', e.message
198
- assert_equal '', out
199
- assert_equal "[import] Determining file type: ???", err.chomp
200
- end
201
-
202
- def test_import_transform_not_found
203
- e = assert_raises(SkyDB::Import::Importer::TransformNotFound) do
204
- @importer.load_transform_file('no_such_transform.yml')
205
- end
206
- assert_equal 'Transform file not found: no_such_transform.yml', e.message
207
- end
208
- end
@@ -1,88 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestTranslator < MiniTest::Unit::TestCase
4
- def setup
5
- @translator = SkyDB::Import::Translator.new()
6
-
7
- @input = {
8
- 'myString' => 'hello world',
9
- 'myInt' => '100',
10
- 'myFloat' => '20.21',
11
- 'myTrue' => 'true',
12
- 'myFalse' => 'false',
13
- 'myDate' => '10/26/1982 12:00 AM',
14
- 'foo' => '1000',
15
- }
16
- @output = {}
17
- end
18
-
19
-
20
- ######################################
21
- # Simple Translation
22
- ######################################
23
-
24
- def test_string_translation
25
- SkyDB::Import::Translator.new(:input_field => 'myString', :output_field => 'data')
26
- .translate(@input, @output)
27
- assert_equal 'hello world', @output['data']
28
- end
29
-
30
- def test_int_translation
31
- SkyDB::Import::Translator.new(:input_field => 'myInt', :output_field => 'data', :format => 'Int')
32
- .translate(@input, @output)
33
- assert_equal 100, @output['data']
34
- end
35
-
36
- def test_float_translation
37
- SkyDB::Import::Translator.new(:input_field => 'myFloat', :output_field => 'data', :format => 'Float')
38
- .translate(@input, @output)
39
- assert_equal 20.21, @output['data']
40
- end
41
-
42
- def test_boolean_true_translation
43
- SkyDB::Import::Translator.new(:input_field => 'myTrue', :output_field => 'data', :format => 'Boolean')
44
- .translate(@input, @output)
45
- assert_equal true, @output['data']
46
- end
47
-
48
- def test_boolean_false_translation
49
- SkyDB::Import::Translator.new(:input_field => 'myFalse', :output_field => 'data', :format => 'Boolean')
50
- .translate(@input, @output)
51
- assert_equal false, @output['data']
52
- end
53
-
54
- def test_date_translation
55
- SkyDB::Import::Translator.new(:input_field => 'myDate', :output_field => 'data', :format => 'Date')
56
- .translate(@input, @output)
57
- assert_equal Time.parse('1982-10-26'), @output['data']
58
- end
59
-
60
-
61
- ######################################
62
- # Nested Translation
63
- ######################################
64
-
65
- def test_nested_translation
66
- SkyDB::Import::Translator.new(:input_field => 'myString', :output_field => ['action', 'data'])
67
- .translate(@input, @output)
68
- assert_equal 'hello world', @output['action']['data']
69
- end
70
-
71
-
72
- ######################################
73
- # Dynamic Translation
74
- ######################################
75
-
76
- def test_translate_function_proc
77
- SkyDB::Import::Translator.new(:translate_function => lambda {|input, output| output['data'] = input['foo'].to_i + 10})
78
- .translate(@input, @output)
79
- assert_equal 1010, @output['data']
80
- end
81
-
82
-
83
- def test_translate_function_string
84
- SkyDB::Import::Translator.new(:output_field => 'data', :translate_function => "input['foo'].to_i * 2")
85
- .translate(@input, @output)
86
- assert_equal 2000, @output['data']
87
- end
88
- end
@@ -1,34 +0,0 @@
1
- # encoding: binary
2
- require 'test_helper'
3
-
4
- class TestMessageAddAction < MiniTest::Unit::TestCase
5
- def setup
6
- @message = SkyDB::Message::AddAction.new()
7
- end
8
-
9
- ######################################
10
- # Action
11
- ######################################
12
-
13
- def test_action
14
- @message.action = SkyDB::Action.new
15
- refute_nil @message.action
16
- end
17
-
18
- def test_invalid_action
19
- @message.action = "foo"
20
- assert_nil @message.action
21
- end
22
-
23
-
24
- ######################################
25
- # Encoding
26
- ######################################
27
-
28
- def test_encode
29
- buffer = StringIO.new
30
- @message.action = SkyDB::Action.new(:id => 0, :name => "foo")
31
- @message.encode(buffer)
32
- assert_bytes "\x93\x01\xaaadd_action\xa0\x82\xa2id\x00\xa4name\xa3foo", buffer
33
- end
34
- end
@@ -1,35 +0,0 @@
1
- # encoding: binary
2
- require 'test_helper'
3
-
4
- class TestMessageAddEvent < MiniTest::Unit::TestCase
5
- def setup
6
- @message = SkyDB::Message::AddEvent.new()
7
- end
8
-
9
- ######################################
10
- # Encoding
11
- ######################################
12
-
13
- def test_encode
14
- buffer = StringIO.new
15
- @message.table_name = "users"
16
- @message.event = SkyDB::Event.new(
17
- object_id: "12",
18
- timestamp:DateTime.parse('2010-01-02T10:30:20Z'),
19
- action: {
20
- name:"/index.html",
21
- astring:"foo",
22
- aint:20
23
- },
24
- data: {
25
- ostring: "bar",
26
- oint: 10,
27
- odouble: 100.1,
28
- otrue: true,
29
- ofalse: false
30
- }
31
- )
32
- @message.encode(buffer)
33
- assert_bytes "\x93\x01\xa9add_event\xa5users\x84\xa8objectId\xa3\xa212\xa9timestamp\xcf\x00\x04\x7c\x2b\xf9\x9b\x87\x00\xa6action\x83\xa4name\xab\x2findex\x2ehtml\xa7astring\xa3foo\xa4aint\x14\xa4data\x85\xa7ostring\xa3bar\xa4oint\x0a\xa7odouble\xcb\x40Y\x06fffff\xa5otrue\xc3\xa6ofalse\xc2", buffer
34
- end
35
- end
@@ -1,41 +0,0 @@
1
- # encoding: binary
2
- require 'test_helper'
3
-
4
- class TestMessageAddProperty < MiniTest::Unit::TestCase
5
- def setup
6
- @message = SkyDB::Message::AddProperty.new()
7
- end
8
-
9
- ######################################
10
- # Property
11
- ######################################
12
-
13
- def test_property
14
- @message.property = SkyDB::Property.new
15
- refute_nil @message.property
16
- end
17
-
18
- def test_invalid_property
19
- @message.property = "foo"
20
- assert_nil @message.property
21
- end
22
-
23
-
24
- ######################################
25
- # Encoding
26
- ######################################
27
-
28
- def test_encode_object_property
29
- buffer = StringIO.new
30
- @message.property = SkyDB::Property.new(:type => :object, :data_type => 'Int', :name => 'foo')
31
- @message.encode(buffer)
32
- assert_bytes "\x93\x01\xacadd_property\xa0\x84\xa2id\x00\xa4type\x01\xa8dataType\xa3Int\xa4name\xa3foo", buffer
33
- end
34
-
35
- def test_encode_action_property
36
- buffer = StringIO.new
37
- @message.property = SkyDB::Property.new(:type => :action, :data_type => 'Boolean', :name => 'foo')
38
- @message.encode(buffer)
39
- assert_bytes "\x93\x01\xacadd_property\xa0\x84\xa2id\x00\xa4type\x02\xa8dataType\xa7Boolean\xa4name\xa3foo", buffer
40
- end
41
- end
@@ -1,34 +0,0 @@
1
- # encoding: binary
2
- require 'test_helper'
3
-
4
- class TestMessageCreateTable < MiniTest::Unit::TestCase
5
- def setup
6
- @message = SkyDB::Message::CreateTable.new()
7
- end
8
-
9
- ######################################
10
- # Action
11
- ######################################
12
-
13
- def test_table
14
- @message.table = SkyDB::Table.new('foo')
15
- refute_nil @message.table
16
- end
17
-
18
- def test_invalid_table
19
- @message.table = "foo"
20
- assert_nil @message.table
21
- end
22
-
23
-
24
- ######################################
25
- # Encoding
26
- ######################################
27
-
28
- def test_encode
29
- buffer = StringIO.new
30
- @message.table = SkyDB::Table.new("foo", :tablet_count => 8)
31
- @message.encode(buffer)
32
- assert_bytes "\x93\x01\xaccreate_table\xa0\x82\xa4name\xa3foo\xactablet_count\x08", buffer
33
- end
34
- end