fluent-plugin-droonga 0.9.0 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/Gemfile +8 -1
  4. data/fluent-plugin-droonga.gemspec +2 -2
  5. data/lib/droonga/adapter.rb +39 -0
  6. data/lib/droonga/adapter_runner.rb +99 -0
  7. data/lib/droonga/catalog/base.rb +11 -11
  8. data/lib/droonga/catalog/dataset.rb +54 -0
  9. data/lib/droonga/catalog/version1.rb +1 -1
  10. data/lib/droonga/collector.rb +5 -7
  11. data/lib/droonga/collector_plugin.rb +7 -7
  12. data/lib/droonga/command.rb +36 -0
  13. data/lib/droonga/{plugin/input_adapter/crud.rb → command_repository.rb} +14 -8
  14. data/lib/droonga/dispatcher.rb +86 -54
  15. data/lib/droonga/distributed_command_planner.rb +183 -0
  16. data/lib/droonga/distributor.rb +43 -17
  17. data/lib/droonga/handler.rb +13 -72
  18. data/lib/droonga/handler_message.rb +5 -5
  19. data/lib/droonga/handler_messenger.rb +4 -1
  20. data/lib/droonga/handler_plugin.rb +2 -2
  21. data/lib/droonga/handler_runner.rb +104 -0
  22. data/lib/droonga/input_message.rb +4 -4
  23. data/lib/droonga/legacy_pluggable.rb +66 -0
  24. data/lib/droonga/{input_adapter.rb → legacy_plugin.rb} +27 -22
  25. data/lib/droonga/{plugin_repository.rb → legacy_plugin_repository.rb} +2 -4
  26. data/lib/droonga/message_matcher.rb +101 -0
  27. data/lib/droonga/{input_adapter_plugin.rb → planner.rb} +14 -10
  28. data/lib/droonga/planner_plugin.rb +54 -0
  29. data/lib/droonga/pluggable.rb +9 -45
  30. data/lib/droonga/plugin.rb +9 -33
  31. data/lib/droonga/plugin/collector/basic.rb +2 -0
  32. data/lib/droonga/plugin/collector/search.rb +31 -37
  33. data/lib/droonga/plugin/{handler/groonga/table_remove.rb → metadata/adapter_message.rb} +23 -18
  34. data/lib/droonga/plugin/{handler/search.rb → metadata/handler_action.rb} +19 -15
  35. data/lib/droonga/plugin/metadata/input_message.rb +39 -0
  36. data/lib/droonga/plugin/planner/crud.rb +49 -0
  37. data/lib/droonga/plugin/{distributor → planner}/distributed_search_planner.rb +62 -70
  38. data/lib/droonga/plugin/{distributor → planner}/groonga.rb +11 -32
  39. data/lib/droonga/plugin/{distributor → planner}/search.rb +5 -5
  40. data/lib/droonga/plugin/{distributor → planner}/watch.rb +15 -6
  41. data/lib/droonga/plugin_loader.rb +10 -0
  42. data/lib/droonga/plugin_registerable.rb +34 -10
  43. data/lib/droonga/plugin_registry.rb +58 -0
  44. data/lib/droonga/plugins/crud.rb +124 -0
  45. data/lib/droonga/plugins/error.rb +50 -0
  46. data/lib/droonga/{output_adapter_plugin.rb → plugins/groonga.rb} +9 -13
  47. data/lib/droonga/plugins/groonga/column_create.rb +123 -0
  48. data/lib/droonga/plugins/groonga/generic_command.rb +65 -0
  49. data/lib/droonga/{plugin/output_adapter/groonga.rb → plugins/groonga/generic_response.rb} +16 -15
  50. data/lib/droonga/plugins/groonga/select.rb +124 -0
  51. data/lib/droonga/plugins/groonga/table_create.rb +106 -0
  52. data/lib/droonga/plugins/groonga/table_remove.rb +57 -0
  53. data/lib/droonga/plugins/search.rb +40 -0
  54. data/lib/droonga/plugins/watch.rb +156 -0
  55. data/lib/droonga/processor.rb +8 -10
  56. data/lib/droonga/searcher.rb +14 -4
  57. data/lib/droonga/searcher/mecab_filter.rb +67 -0
  58. data/lib/droonga/session.rb +5 -5
  59. data/lib/droonga/test.rb +1 -1
  60. data/lib/droonga/test/stub_handler_message.rb +1 -1
  61. data/lib/droonga/test/{stub_distributor.rb → stub_planner.rb} +1 -1
  62. data/lib/droonga/worker.rb +7 -8
  63. data/lib/fluent/plugin/out_droonga.rb +0 -1
  64. data/sample/cluster/catalog.json +2 -4
  65. data/sample/mecab_filter/data.grn +7 -0
  66. data/sample/mecab_filter/ddl.grn +7 -0
  67. data/sample/mecab_filter/search_with_mecab_filter.json +21 -0
  68. data/sample/mecab_filter/search_without_mecab_filter.json +21 -0
  69. data/test/command/config/default/catalog.json +2 -5
  70. data/test/command/suite/search/error/no-query.expected +13 -0
  71. data/test/command/suite/search/error/no-query.test +7 -0
  72. data/test/command/suite/search/error/unknown-source.expected +26 -0
  73. data/test/command/suite/watch/subscribe.expected +3 -3
  74. data/test/command/suite/watch/unsubscribe.expected +3 -3
  75. data/test/unit/catalog/test_dataset.rb +385 -0
  76. data/test/unit/catalog/test_version1.rb +111 -45
  77. data/test/unit/fixtures/catalog/version1.json +0 -3
  78. data/test/unit/helper.rb +2 -1
  79. data/test/unit/helper/distributed_search_planner_helper.rb +83 -0
  80. data/test/unit/plugin/collector/test_basic.rb +233 -376
  81. data/test/unit/plugin/collector/test_search.rb +8 -17
  82. data/test/unit/plugin/planner/search_planner/test_basic.rb +120 -0
  83. data/test/unit/plugin/planner/search_planner/test_group_by.rb +573 -0
  84. data/test/unit/plugin/planner/search_planner/test_output.rb +388 -0
  85. data/test/unit/plugin/planner/search_planner/test_sort_by.rb +938 -0
  86. data/test/unit/plugin/{distributor → planner}/test_search.rb +20 -75
  87. data/test/unit/{plugin/handler → plugins/crud}/test_add.rb +11 -11
  88. data/test/unit/plugins/groonga/select/test_adapter_input.rb +213 -0
  89. data/test/unit/{plugin/output_adapter/groonga/test_select.rb → plugins/groonga/select/test_adapter_output.rb} +12 -13
  90. data/test/unit/{plugin/handler → plugins}/groonga/test_column_create.rb +20 -5
  91. data/test/unit/{plugin/handler → plugins}/groonga/test_table_create.rb +5 -0
  92. data/test/unit/{plugin/handler → plugins}/groonga/test_table_remove.rb +8 -1
  93. data/test/unit/{plugin/handler → plugins}/test_groonga.rb +5 -5
  94. data/test/unit/{plugin/handler → plugins}/test_search.rb +21 -5
  95. data/test/unit/{plugin/handler → plugins}/test_watch.rb +29 -10
  96. data/{lib/droonga/command_mapper.rb → test/unit/test_command_repository.rb} +16 -22
  97. data/test/unit/{test_plugin.rb → test_legacy_plugin.rb} +3 -3
  98. data/test/unit/{test_plugin_repository.rb → test_legacy_plugin_repository.rb} +3 -3
  99. data/test/unit/test_message_matcher.rb +137 -0
  100. metadata +86 -66
  101. data/bin/grn2jsons +0 -82
  102. data/lib/droonga/distribution_planner.rb +0 -76
  103. data/lib/droonga/distributor_plugin.rb +0 -95
  104. data/lib/droonga/output_adapter.rb +0 -53
  105. data/lib/droonga/plugin/collector/groonga.rb +0 -83
  106. data/lib/droonga/plugin/distributor/crud.rb +0 -84
  107. data/lib/droonga/plugin/handler/add.rb +0 -109
  108. data/lib/droonga/plugin/handler/forward.rb +0 -75
  109. data/lib/droonga/plugin/handler/groonga.rb +0 -99
  110. data/lib/droonga/plugin/handler/groonga/column_create.rb +0 -106
  111. data/lib/droonga/plugin/handler/groonga/table_create.rb +0 -91
  112. data/lib/droonga/plugin/handler/watch.rb +0 -108
  113. data/lib/droonga/plugin/input_adapter/groonga.rb +0 -49
  114. data/lib/droonga/plugin/input_adapter/groonga/select.rb +0 -63
  115. data/lib/droonga/plugin/output_adapter/crud.rb +0 -51
  116. data/lib/droonga/plugin/output_adapter/groonga/select.rb +0 -54
  117. data/lib/groonga_command_converter.rb +0 -143
  118. data/sample/fluentd.conf +0 -8
  119. data/test/unit/plugin/distributor/test_search_planner.rb +0 -1102
  120. data/test/unit/plugin/input_adapter/groonga/test_select.rb +0 -248
  121. data/test/unit/test_command_mapper.rb +0 -44
  122. data/test/unit/test_groonga_command_converter.rb +0 -242
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2013-2014 Droonga Project
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -13,13 +13,13 @@
13
13
  # License along with this library; if not, write to the Free Software
14
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
15
 
16
- require "droonga/plugin/distributor/search"
16
+ require "droonga/plugin/planner/search"
17
17
 
18
- class SearchDistributorTest < Test::Unit::TestCase
18
+ class SearchPlannerTest < Test::Unit::TestCase
19
19
  def setup
20
20
  setup_database
21
- @distributor = Droonga::Test::StubDistributor.new
22
- @plugin = Droonga::SearchDistributor.new(@distributor)
21
+ @planner = Droonga::Test::StubPlanner.new
22
+ @plugin = Droonga::SearchPlanner.new(@planner)
23
23
  end
24
24
 
25
25
  def teardown
@@ -52,27 +52,23 @@ class SearchDistributorTest < Test::Unit::TestCase
52
52
  "limit" => 20,
53
53
  },
54
54
  },
55
- "query3" => {
56
- "source" => "User",
57
- "output" => {
58
- "format" => "complex",
59
- "elements" => ["count", "records"],
60
- "attributes" => [],
61
- "offset" => 0,
62
- "limit" => 30,
63
- },
64
- },
65
55
  },
66
56
  },
67
57
  }
68
58
 
69
- @plugin.process("search", envelope)
59
+ @planner.distribute(@plugin.process("search", envelope))
70
60
 
71
61
  message = []
72
62
 
73
63
  message << {
74
64
  "type" => "search_reduce",
75
65
  "body" => {
66
+ "errors" => {
67
+ "errors_reduced" => {
68
+ "limit" => -1,
69
+ "type" => "sum",
70
+ },
71
+ },
76
72
  "query1" => {
77
73
  "query1_reduced" => {
78
74
  "count" => {
@@ -85,13 +81,6 @@ class SearchDistributorTest < Test::Unit::TestCase
85
81
  },
86
82
  },
87
83
  },
88
- },
89
- "inputs" => ["query1"],
90
- "outputs" => ["query1_reduced"],
91
- }
92
- message << {
93
- "type" => "search_reduce",
94
- "body" => {
95
84
  "query2" => {
96
85
  "query2_reduced" => {
97
86
  "count" => {
@@ -105,41 +94,22 @@ class SearchDistributorTest < Test::Unit::TestCase
105
94
  },
106
95
  },
107
96
  },
108
- "inputs" => ["query2"],
109
- "outputs" => ["query2_reduced"],
110
- }
111
- message << {
112
- "type" => "search_reduce",
113
- "body" => {
114
- "query3" => {
115
- "query3_reduced" => {
116
- "count" => {
117
- "type" => "sum",
118
- },
119
- "records" => {
120
- "type" => "sort",
121
- "operators" => [],
122
- "limit" => 30,
123
- },
124
- },
125
- },
126
- },
127
- "inputs" => ["query3"],
128
- "outputs" => ["query3_reduced"],
97
+ "inputs" => ["errors", "query1", "query2"],
98
+ "outputs" => ["errors_reduced", "query1_reduced", "query2_reduced"],
129
99
  }
130
100
 
131
101
  gatherer = {
132
102
  "type" => "search_gather",
133
103
  "body" => {
104
+ "errors_reduced" => {
105
+ "output" => "errors",
106
+ },
134
107
  "query1_reduced" => {
135
108
  "output" => "query1",
136
109
  "elements" => {
137
110
  "records" => {
138
- "type" => "sort",
139
- "offset" => 0,
140
111
  "limit" => 10,
141
112
  "format" => "complex",
142
- "attributes" => [],
143
113
  },
144
114
  },
145
115
  },
@@ -147,31 +117,16 @@ class SearchDistributorTest < Test::Unit::TestCase
147
117
  "output" => "query2",
148
118
  "elements" => {
149
119
  "records" => {
150
- "type" => "sort",
151
- "offset" => 0,
152
120
  "limit" => 20,
153
121
  "format" => "complex",
154
- "attributes" => [],
155
- },
156
- },
157
- },
158
- "query3_reduced" => {
159
- "output" => "query3",
160
- "elements" => {
161
- "records" => {
162
- "type" => "sort",
163
- "offset" => 0,
164
- "limit" => 30,
165
- "format" => "complex",
166
- "attributes" => [],
167
122
  },
168
123
  },
169
124
  },
170
125
  },
171
126
  "inputs" => [
127
+ "errors_reduced",
172
128
  "query1_reduced",
173
129
  "query2_reduced",
174
- "query3_reduced",
175
130
  ],
176
131
  "post" => true,
177
132
  }
@@ -203,27 +158,17 @@ class SearchDistributorTest < Test::Unit::TestCase
203
158
  "limit" => 20,
204
159
  },
205
160
  },
206
- "query3" => {
207
- "source" => "User",
208
- "output" => {
209
- "format" => "simple",
210
- "elements" => ["count", "records"],
211
- "attributes" => [],
212
- "offset" => 0,
213
- "limit" => 30,
214
- },
215
- },
216
161
  },
217
162
  },
218
163
  "outputs" => [
164
+ "errors",
219
165
  "query1",
220
166
  "query2",
221
- "query3",
222
167
  ],
223
168
  "replica" => "random",
224
169
  }
225
170
  message << searcher
226
171
 
227
- assert_equal([message], @distributor.messages)
172
+ assert_equal([message], @planner.messages)
228
173
  end
229
174
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2013-2014 Droonga Project
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -13,9 +13,9 @@
13
13
  # License along with this library; if not, write to the Free Software
14
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
15
 
16
- require "droonga/plugin/handler/add"
16
+ require "droonga/plugins/crud"
17
17
 
18
- class AddHandlerTest < Test::Unit::TestCase
18
+ class CRUDAddHandlerTest < Test::Unit::TestCase
19
19
  SUCCESS_RESPONSE_BODY = {
20
20
  "success" => true,
21
21
  }
@@ -37,7 +37,7 @@ class AddHandlerTest < Test::Unit::TestCase
37
37
 
38
38
  def setup_handler
39
39
  @worker = StubWorker.new
40
- @handler = Droonga::AddHandler.new(@worker)
40
+ @handler = Droonga::Plugins::CRUD::Handler.new("name", @worker.context)
41
41
  @messenger = Droonga::Test::StubHandlerMessenger.new
42
42
  end
43
43
 
@@ -47,7 +47,7 @@ class AddHandlerTest < Test::Unit::TestCase
47
47
 
48
48
  def process(request)
49
49
  message = Droonga::Test::StubHandlerMessage.new(request)
50
- @handler.add(message, @messenger)
50
+ @handler.handle(message, @messenger)
51
51
  end
52
52
 
53
53
  public
@@ -93,7 +93,7 @@ class AddHandlerTest < Test::Unit::TestCase
93
93
  "table" => "Users",
94
94
  "values" => {"country" => "japan"},
95
95
  }
96
- assert_raise(Droonga::AddHandler::MissingPrimaryKeyParameter) do
96
+ assert_raise(Droonga::Plugins::CRUD::Handler::MissingPrimaryKeyParameter) do
97
97
  process(request)
98
98
  end
99
99
  end
@@ -104,7 +104,7 @@ class AddHandlerTest < Test::Unit::TestCase
104
104
  "key" => "mori",
105
105
  "values" => {"age" => "secret"},
106
106
  }
107
- assert_raise(Droonga::AddHandler::InvalidValue) do
107
+ assert_raise(Droonga::Plugins::CRUD::Handler::InvalidValue) do
108
108
  process(request)
109
109
  end
110
110
  end
@@ -115,7 +115,7 @@ class AddHandlerTest < Test::Unit::TestCase
115
115
  "key" => "mori",
116
116
  "values" => {"birthday" => "today"},
117
117
  }
118
- assert_raise(Droonga::AddHandler::InvalidValue) do
118
+ assert_raise(Droonga::Plugins::CRUD::Handler::InvalidValue) do
119
119
  process(request)
120
120
  end
121
121
  end
@@ -126,7 +126,7 @@ class AddHandlerTest < Test::Unit::TestCase
126
126
  "key" => "mori",
127
127
  "values" => {"unknown" => "unknown"},
128
128
  }
129
- assert_raise(Droonga::AddHandler::UnknownColumn) do
129
+ assert_raise(Droonga::Plugins::CRUD::Handler::UnknownColumn) do
130
130
  process(request)
131
131
  end
132
132
  end
@@ -170,7 +170,7 @@ class AddHandlerTest < Test::Unit::TestCase
170
170
  request = {
171
171
  "values" => {},
172
172
  }
173
- assert_raise(Droonga::AddHandler::MissingTableParameter) do
173
+ assert_raise(Droonga::Plugins::CRUD::Handler::MissingTableParameter) do
174
174
  process(request)
175
175
  end
176
176
  end
@@ -180,7 +180,7 @@ class AddHandlerTest < Test::Unit::TestCase
180
180
  "table" => "Nonexistent",
181
181
  "values" => {},
182
182
  }
183
- assert_raise(Droonga::AddHandler::UnknownTable) do
183
+ assert_raise(Droonga::Plugins::CRUD::Handler::UnknownTable) do
184
184
  process(request)
185
185
  end
186
186
  end
@@ -0,0 +1,213 @@
1
+ # Copyright (C) 2013-2014 Droonga Project
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
+
16
+ require "droonga/plugins/groonga/select"
17
+
18
+ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
19
+ private
20
+ def convert(select_request)
21
+ converter = Droonga::Plugins::Groonga::Select::RequestConverter.new
22
+ converter.convert(select_request)
23
+ end
24
+
25
+ class OutputColumnsTest < self
26
+ def assert_attributes(expected_attributes, output_columns)
27
+ select_request = {
28
+ "table" => "EmptyTable",
29
+ "output_columns" => output_columns,
30
+ }
31
+
32
+ expected_search_request = {
33
+ "queries" => {
34
+ "EmptyTable_result" => {
35
+ "source" => "EmptyTable",
36
+ "output" => {
37
+ "elements" => [
38
+ "startTime",
39
+ "elapsedTime",
40
+ "count",
41
+ "attributes",
42
+ "records",
43
+ ],
44
+ "attributes" => expected_attributes,
45
+ "offset" => 0,
46
+ "limit" => 10,
47
+ },
48
+ },
49
+ },
50
+ }
51
+ assert_equal(expected_search_request, convert(select_request))
52
+ end
53
+
54
+ def test_multiple_columns
55
+ assert_attributes(["_id", "_key"], "_id,_key")
56
+ end
57
+
58
+ class FunctionTest < self
59
+ def test_single_argument
60
+ assert_attributes(["snippet_html(content)"], "snippet_html(content)")
61
+ end
62
+
63
+ def test_with_columns
64
+ assert_attributes(["_id","_key","snippet_html(content)"], "_id,_key,snippet_html(content)")
65
+ end
66
+ end
67
+ end
68
+
69
+ class MatchColumnsTest < self
70
+ def assert_matchTo(expected_matchTo, match_columns)
71
+ select_request = {
72
+ "table" => "EmptyTable",
73
+ "match_columns" => match_columns,
74
+ "query" => "QueryTest",
75
+ "output_columns" => "_id",
76
+ }
77
+
78
+ expected_search_request = {
79
+ "queries" => {
80
+ "EmptyTable_result" => {
81
+ "source" => "EmptyTable",
82
+ "condition"=> {
83
+ "query" => "QueryTest",
84
+ "matchTo"=> expected_matchTo,
85
+ "defaultOperator"=> "&&",
86
+ "allowPragma"=> false,
87
+ "allowColumn"=> true,
88
+ },
89
+ "output" => {
90
+ "elements" => [
91
+ "startTime",
92
+ "elapsedTime",
93
+ "count",
94
+ "attributes",
95
+ "records",
96
+ ],
97
+ "attributes" => ["_id"],
98
+ "offset" => 0,
99
+ "limit" => 10,
100
+ },
101
+ },
102
+ },
103
+ }
104
+ assert_equal(expected_search_request, convert(select_request))
105
+ end
106
+
107
+ def test_single_column
108
+ assert_matchTo(["_key"], "_key")
109
+ end
110
+
111
+ def test_multiple_columns
112
+ assert_matchTo(["_key", "content"], "_key || content")
113
+ end
114
+ end
115
+
116
+ class OffsetTest < self
117
+ def assert_offset(expected_offset, offset)
118
+ select_request = {
119
+ "table" => "EmptyTable",
120
+ "output_columns" => "_id",
121
+ }
122
+ select_request["offset"] = offset unless offset.nil?
123
+
124
+ expected_search_request = {
125
+ "queries" => {
126
+ "EmptyTable_result" => {
127
+ "source" => "EmptyTable",
128
+ "output" => {
129
+ "elements" => [
130
+ "startTime",
131
+ "elapsedTime",
132
+ "count",
133
+ "attributes",
134
+ "records",
135
+ ],
136
+ "attributes" => ["_id"],
137
+ "offset" => expected_offset,
138
+ "limit" => 10,
139
+ },
140
+ },
141
+ },
142
+ }
143
+ assert_equal(expected_search_request, convert(select_request))
144
+ end
145
+
146
+ def test_zero
147
+ assert_offset(0, "0")
148
+ end
149
+
150
+ def test_large
151
+ assert_offset(100, "100")
152
+ end
153
+
154
+ def test_integer
155
+ assert_offset(100, 100)
156
+ end
157
+
158
+ def test_default
159
+ assert_offset(0, nil)
160
+ end
161
+ end
162
+
163
+ class LimitTest < self
164
+ def assert_limit(expected_limit, limit)
165
+ select_request = {
166
+ "table" => "EmptyTable",
167
+ "output_columns" => "_id",
168
+ }
169
+ select_request["limit"] = limit unless limit.nil?
170
+
171
+ expected_search_request = {
172
+ "queries" => {
173
+ "EmptyTable_result" => {
174
+ "source" => "EmptyTable",
175
+ "output" => {
176
+ "elements" => [
177
+ "startTime",
178
+ "elapsedTime",
179
+ "count",
180
+ "attributes",
181
+ "records",
182
+ ],
183
+ "attributes" => ["_id"],
184
+ "offset" => 0,
185
+ "limit" => expected_limit,
186
+ },
187
+ },
188
+ },
189
+ }
190
+ assert_equal(expected_search_request, convert(select_request))
191
+ end
192
+
193
+ def test_zero
194
+ assert_limit(0, "0")
195
+ end
196
+
197
+ def test_large
198
+ assert_limit(100, "100")
199
+ end
200
+
201
+ def test_negative
202
+ assert_limit(-1, "-1")
203
+ end
204
+
205
+ def test_integer
206
+ assert_limit(100, 100)
207
+ end
208
+
209
+ def test_default
210
+ assert_limit(10, nil)
211
+ end
212
+ end
213
+ end