groonga-command 1.4.8 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db7a5707522535c4fa87ad7160ef88d7e565955966ffcd2a2095ee002ae5ebf8
4
- data.tar.gz: 422962c60a3e33d66c6348c6e39054d9389a3b645886bc627cb6d88bd377e8d6
3
+ metadata.gz: 1cf6a57f9110c2d5d3367cff7c2d787e4ef439a067428a276c4f7fc1894797a2
4
+ data.tar.gz: b0c455cbf9b6f90d6f92a4323a29ccdc3b63e06ebeb7712b2cdaf6cb51d25139
5
5
  SHA512:
6
- metadata.gz: b2ddb7d2c79f215b1f41d9806782352aca990c954844b54af486b37c71cbeb0f8a80e34046dc919133b66f9f0e28726f61af325145e233edd74cfabc967c57aa
7
- data.tar.gz: d13d857186cccf9ca8cda06d400a1955d7c3d416f149610c22a7f0d784e7a9e5c9e56150074e38fabf9ecef5977394a6b9a4700e16041b44cf6e67045cf3f859
6
+ metadata.gz: 6cd5e31a78862c2c934041de95e3a34be83d4db7caba059fbc0d10cb579c978d3f430abf845f239d0cc24d898c202ef22c1f6331ccb1141de3556a31a22c9d45
7
+ data.tar.gz: c811309bb82936ed586847ed631e5efff2398ca9b10f2b9cb2d849fc6bfb385bf4d463d139bc71de0be4fd964da36608266f887d1c7d1076387db0a4cc77cb86
data/doc/text/news.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # News
2
2
 
3
+ ## 1.5.2: 2021-08-25
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::ColumnCreateSimilar}: Added.
8
+
9
+ ## 1.5.1: 2021-08-24
10
+
11
+ ### Improvements
12
+
13
+ * {Groonga::Command::TableCreateSimilar}: Added.
14
+
15
+ ## 1.5.0: 2020-09-09
16
+
17
+ ### Improvements
18
+
19
+ * {Groonga::Command::TableCreate}: Added support for `path`.
20
+
21
+ * {Groonga::Command::ColumnCreate}: Added support for `path`.
22
+
23
+ ## 1.4.9: 2020-06-14
24
+
25
+ ### Improvements
26
+
27
+ * {Groonga::Command::ReferenceAcquire}: Added support for
28
+ `reference_acquire`.
29
+
30
+ * {Groonga::Command::ReferenceRelease}: Added support for
31
+ `reference_release`.
32
+
33
+ * {Groonga::Command::IOFlush#recursive}: Added.
34
+
35
+ * {Groonga::Command::IOFlush#recursive_dependent?}: Added.
36
+
3
37
  ## 1.4.8: 2020-05-03
4
38
 
5
39
  ### Improvements
@@ -0,0 +1,60 @@
1
+ # Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ class ColumnCreateSimilar < Base
22
+ class << self
23
+ def command_name
24
+ "column_create_similar"
25
+ end
26
+
27
+ def parameter_names
28
+ [
29
+ :table,
30
+ :name,
31
+ :base_column,
32
+ ]
33
+ end
34
+ end
35
+
36
+ Command.register(command_name, self)
37
+
38
+ # @return [String] table name.
39
+ #
40
+ # @since 1.5.2
41
+ def table
42
+ self[:table]
43
+ end
44
+
45
+ # @return [String] The column name.
46
+ #
47
+ # @since 1.5.2
48
+ def name
49
+ self[:name]
50
+ end
51
+
52
+ # @return [String] The base column name.
53
+ #
54
+ # @since 1.5.2
55
+ def base_column
56
+ self[:base_column]
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -31,6 +31,7 @@ module Groonga
31
31
  :flags,
32
32
  :type,
33
33
  :source,
34
+ :path,
34
35
  ]
35
36
  end
36
37
  end
@@ -110,6 +111,12 @@ module Groonga
110
111
  def sources
111
112
  @sources ||= array_value(:source)
112
113
  end
114
+
115
+ # @return [String, nil] Path or nil
116
+ # @since 1.5.0
117
+ def path
118
+ self[:path]
119
+ end
113
120
  end
114
121
  end
115
122
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -44,11 +44,25 @@ module Groonga
44
44
  self[:target_name]
45
45
  end
46
46
 
47
- # @return [Boolean] `recursive` parameter value.
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
48
55
  #
49
56
  # @since 1.1.3
50
57
  def recursive?
51
- self[:recursive] != "no"
58
+ recursive != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ recursive == "dependent"
52
66
  end
53
67
  end
54
68
  end
@@ -0,0 +1,69 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ # A command class that represents `reference_acquire` command.
22
+ #
23
+ # @since 1.4.9
24
+ class ReferenceAcquire < Base
25
+ class << self
26
+ def command_name
27
+ "reference_acquire"
28
+ end
29
+
30
+ def parameter_names
31
+ [
32
+ :target_name,
33
+ :recursive,
34
+ ]
35
+ end
36
+ end
37
+
38
+ Command.register(command_name, self)
39
+
40
+ # @return [String] `target_name` parameter value.
41
+ #
42
+ # @since 1.4.9
43
+ def target_name
44
+ self[:target_name]
45
+ end
46
+
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
55
+ #
56
+ # @since 1.4.9
57
+ def recursive?
58
+ recursive != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ recursive == "dependent"
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ # A command class that represents `reference_release` command.
22
+ #
23
+ # @since 1.4.9
24
+ class ReferenceRelease < Base
25
+ class << self
26
+ def command_name
27
+ "reference_release"
28
+ end
29
+
30
+ def parameter_names
31
+ [
32
+ :target_name,
33
+ :recursive,
34
+ ]
35
+ end
36
+ end
37
+
38
+ Command.register(command_name, self)
39
+
40
+ # @return [String] `target_name` parameter value.
41
+ #
42
+ # @since 1.4.9
43
+ def target_name
44
+ self[:target_name]
45
+ end
46
+
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
55
+ #
56
+ # @since 1.4.9
57
+ def recursive?
58
+ self[:recursive] != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ self[:recursive] == "dependent"
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ class TableCreateSimilar < Base
22
+ class << self
23
+ def command_name
24
+ "table_create_similar"
25
+ end
26
+
27
+ def parameter_names
28
+ [
29
+ :name,
30
+ :base_table,
31
+ ]
32
+ end
33
+ end
34
+
35
+ Command.register(command_name, self)
36
+
37
+ # @return [String] The new table name.
38
+ #
39
+ # @since 1.5.1
40
+ def name
41
+ self[:name]
42
+ end
43
+
44
+ # @return [String] The base table name.
45
+ #
46
+ # @since 1.5.1
47
+ def base_table
48
+ self[:base_table]
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -33,6 +33,7 @@ module Groonga
33
33
  :default_tokenizer,
34
34
  :normalizer,
35
35
  :token_filters,
36
+ :path,
36
37
  ]
37
38
  end
38
39
  end
@@ -117,6 +118,12 @@ module Groonga
117
118
  def token_filters
118
119
  @token_filters ||= array_value(:token_filters)
119
120
  end
121
+
122
+ # @return [String, nil] Path or nil
123
+ # @since 1.5.0
124
+ def path
125
+ self[:path]
126
+ end
120
127
  end
121
128
  end
122
129
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
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
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  module Command
19
- VERSION = "1.4.8"
19
+ VERSION = "1.5.2"
20
20
  end
21
21
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
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
@@ -20,6 +20,7 @@ require "groonga/command/error"
20
20
 
21
21
  require "groonga/command/column-copy"
22
22
  require "groonga/command/column-create"
23
+ require "groonga/command/column-create-similar"
23
24
  require "groonga/command/column-list"
24
25
  require "groonga/command/column-remove"
25
26
  require "groonga/command/column-rename"
@@ -51,6 +52,8 @@ require "groonga/command/query-log-flags-get"
51
52
  require "groonga/command/query-log-flags-remove"
52
53
  require "groonga/command/query-log-flags-set"
53
54
  require "groonga/command/range-filter"
55
+ require "groonga/command/reference-acquire"
56
+ require "groonga/command/reference-release"
54
57
  require "groonga/command/register"
55
58
  require "groonga/command/reindex"
56
59
  require "groonga/command/request-cancel"
@@ -63,6 +66,7 @@ require "groonga/command/status"
63
66
  require "groonga/command/suggest"
64
67
  require "groonga/command/table-copy"
65
68
  require "groonga/command/table-create"
69
+ require "groonga/command/table-create-similar"
66
70
  require "groonga/command/table-list"
67
71
  require "groonga/command/table-remove"
68
72
  require "groonga/command/table-rename"
@@ -0,0 +1,65 @@
1
+ # Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class ColumnCreateSimilarCommandTest < Test::Unit::TestCase
18
+ private
19
+ def column_create_similar_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::ColumnCreateSimilar.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ table = "LexiconSimilar"
27
+ name = "content_index"
28
+ base_column = "Lexicon.content_index"
29
+
30
+ command = column_create_similar_command({},
31
+ [
32
+ table,
33
+ name,
34
+ base_column,
35
+ ])
36
+ assert_equal({
37
+ table: table,
38
+ name: name,
39
+ base_column: base_column,
40
+ },
41
+ command.arguments)
42
+ end
43
+ end
44
+
45
+ class TableTest < self
46
+ def test_reader
47
+ command = column_create_similar_command({"table" => "LogsSimilar"})
48
+ assert_equal("LogsSimilar", command.table)
49
+ end
50
+ end
51
+
52
+ class NameTest < self
53
+ def test_reader
54
+ command = column_create_similar_command({"name" => "message"})
55
+ assert_equal("message", command.name)
56
+ end
57
+ end
58
+
59
+ class BaseColumnTest < self
60
+ def test_reader
61
+ command = column_create_similar_command({"base_column" => "Logs.message"})
62
+ assert_equal("Logs.message", command.base_column)
63
+ end
64
+ end
65
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -28,14 +28,24 @@ class ColumnCreateCommandTest < Test::Unit::TestCase
28
28
  flags = "COLUMN_INDEX"
29
29
  type = "Posts"
30
30
  source = "content"
31
-
32
- command = column_create_command({}, [table, name, flags, type, source])
31
+ path = "Lexicon.content_index"
32
+
33
+ command = column_create_command({},
34
+ [
35
+ table,
36
+ name,
37
+ flags,
38
+ type,
39
+ source,
40
+ path,
41
+ ])
33
42
  assert_equal({
34
43
  :table => table,
35
44
  :name => name,
36
45
  :flags => flags,
37
46
  :type => type,
38
47
  :source => source,
48
+ :path => path,
39
49
  },
40
50
  command.arguments)
41
51
  end
@@ -198,4 +208,16 @@ class ColumnCreateCommandTest < Test::Unit::TestCase
198
208
  command.sources)
199
209
  end
200
210
  end
211
+
212
+ class PathTest < self
213
+ def test_specified
214
+ command = column_create_command({"path" => "Lexicon.content_index"})
215
+ assert_equal("Lexicon.content_index", command.path)
216
+ end
217
+
218
+ def test_omitted
219
+ command = column_create_command
220
+ assert_nil(command.path)
221
+ end
222
+ end
201
223
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -53,6 +53,9 @@ class IOFlushCommandTest < Test::Unit::TestCase
53
53
  assert do
54
54
  command.recursive?
55
55
  end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
56
59
  end
57
60
 
58
61
  def test_no
@@ -60,6 +63,19 @@ class IOFlushCommandTest < Test::Unit::TestCase
60
63
  assert do
61
64
  not command.recursive?
62
65
  end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = io_flush_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
63
79
  end
64
80
  end
65
81
  end
@@ -0,0 +1,82 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class ReferenceAcquireCommandTest < Test::Unit::TestCase
18
+ private
19
+ def reference_acquire_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::ReferenceAcquire.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ target_name = "Users"
27
+ recursive = "no"
28
+
29
+ ordered_arguments = [
30
+ target_name,
31
+ recursive,
32
+ ]
33
+ command = reference_acquire_command({}, ordered_arguments)
34
+ assert_equal({
35
+ :target_name => target_name,
36
+ :recursive => recursive,
37
+ },
38
+ command.arguments)
39
+ end
40
+ end
41
+
42
+ class TargetNameTest < self
43
+ def test_reader
44
+ command = reference_acquire_command(:target_name => "Users")
45
+ assert_equal("Users", command.target_name)
46
+ end
47
+ end
48
+
49
+ class RecursiveTest < self
50
+ class ReaderTest < self
51
+ def test_default
52
+ command = reference_acquire_command
53
+ assert do
54
+ command.recursive?
55
+ end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
59
+ end
60
+
61
+ def test_no
62
+ command = reference_acquire_command(:recursive => "no")
63
+ assert do
64
+ not command.recursive?
65
+ end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = reference_acquire_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,82 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class ReferenceReleaseCommandTest < Test::Unit::TestCase
18
+ private
19
+ def reference_release_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::ReferenceRelease.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ target_name = "Users"
27
+ recursive = "no"
28
+
29
+ ordered_arguments = [
30
+ target_name,
31
+ recursive,
32
+ ]
33
+ command = reference_release_command({}, ordered_arguments)
34
+ assert_equal({
35
+ :target_name => target_name,
36
+ :recursive => recursive,
37
+ },
38
+ command.arguments)
39
+ end
40
+ end
41
+
42
+ class TargetNameTest < self
43
+ def test_reader
44
+ command = reference_release_command(:target_name => "Users")
45
+ assert_equal("Users", command.target_name)
46
+ end
47
+ end
48
+
49
+ class RecursiveTest < self
50
+ class ReaderTest < self
51
+ def test_default
52
+ command = reference_release_command
53
+ assert do
54
+ command.recursive?
55
+ end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
59
+ end
60
+
61
+ def test_no
62
+ command = reference_release_command(:recursive => "no")
63
+ assert do
64
+ not command.recursive?
65
+ end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = reference_release_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,55 @@
1
+ # Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TableCreateSimilarCommandTest < Test::Unit::TestCase
18
+ private
19
+ def table_create_similar_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::TableCreateSimilar.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ name = "UsersSimilar"
27
+ base_table = "Users"
28
+
29
+ ordered_arguments = [
30
+ name,
31
+ base_table,
32
+ ]
33
+ command = table_create_similar_command({}, ordered_arguments)
34
+ assert_equal({
35
+ name: name,
36
+ base_table: base_table,
37
+ },
38
+ command.arguments)
39
+ end
40
+ end
41
+
42
+ class NameTest < self
43
+ def test_reader
44
+ command = table_create_similar_command({"name" => "UsersSimilar"})
45
+ assert_equal("UsersSimilar", command.name)
46
+ end
47
+ end
48
+
49
+ class BaseTableTest < self
50
+ def test_reader
51
+ command = table_create_similar_command({"base_table" => "Users"})
52
+ assert_equal("Users", command.base_table)
53
+ end
54
+ end
55
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
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
@@ -30,6 +30,7 @@ class TableCreateCommandTest < Test::Unit::TestCase
30
30
  default_tokenizer = "TokenBigram"
31
31
  normalizer = "NormalizerAuto"
32
32
  token_filters = "TokenFilterStopWord|TokenFilterStem"
33
+ path = "tables.users"
33
34
 
34
35
  ordered_arguments = [
35
36
  name,
@@ -39,6 +40,7 @@ class TableCreateCommandTest < Test::Unit::TestCase
39
40
  default_tokenizer,
40
41
  normalizer,
41
42
  token_filters,
43
+ path,
42
44
  ]
43
45
  command = table_create_command({}, ordered_arguments)
44
46
  assert_equal({
@@ -49,6 +51,7 @@ class TableCreateCommandTest < Test::Unit::TestCase
49
51
  :default_tokenizer => default_tokenizer,
50
52
  :normalizer => normalizer,
51
53
  :token_filters => token_filters,
54
+ :path => path,
52
55
  },
53
56
  command.arguments)
54
57
  end
@@ -230,4 +233,16 @@ class TableCreateCommandTest < Test::Unit::TestCase
230
233
  assert_equal([], command.token_filters)
231
234
  end
232
235
  end
236
+
237
+ class PathTest < self
238
+ def test_specified
239
+ command = table_create_command({"path" => "tables.users"})
240
+ assert_equal("tables.users", command.path)
241
+ end
242
+
243
+ def test_omitted
244
+ command = table_create_command
245
+ assert_nil(command.path)
246
+ end
247
+ end
233
248
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-03 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -153,6 +153,7 @@ files:
153
153
  - lib/groonga/command.rb
154
154
  - lib/groonga/command/base.rb
155
155
  - lib/groonga/command/column-copy.rb
156
+ - lib/groonga/command/column-create-similar.rb
156
157
  - lib/groonga/command/column-create.rb
157
158
  - lib/groonga/command/column-list.rb
158
159
  - lib/groonga/command/column-remove.rb
@@ -190,6 +191,8 @@ files:
190
191
  - lib/groonga/command/query-log-flags-remove.rb
191
192
  - lib/groonga/command/query-log-flags-set.rb
192
193
  - lib/groonga/command/range-filter.rb
194
+ - lib/groonga/command/reference-acquire.rb
195
+ - lib/groonga/command/reference-release.rb
193
196
  - lib/groonga/command/register.rb
194
197
  - lib/groonga/command/reindex.rb
195
198
  - lib/groonga/command/request-cancel.rb
@@ -203,6 +206,7 @@ files:
203
206
  - lib/groonga/command/status.rb
204
207
  - lib/groonga/command/suggest.rb
205
208
  - lib/groonga/command/table-copy.rb
209
+ - lib/groonga/command/table-create-similar.rb
206
210
  - lib/groonga/command/table-create.rb
207
211
  - lib/groonga/command/table-list.rb
208
212
  - lib/groonga/command/table-remove.rb
@@ -215,6 +219,7 @@ files:
215
219
  - test/command/format/test-command.rb
216
220
  - test/command/test-base.rb
217
221
  - test/command/test-column-copy.rb
222
+ - test/command/test-column-create-similar.rb
218
223
  - test/command/test-column-create.rb
219
224
  - test/command/test-column-list.rb
220
225
  - test/command/test-column-remove.rb
@@ -247,6 +252,8 @@ files:
247
252
  - test/command/test-query-log-flags-remove.rb
248
253
  - test/command/test-query-log-flags-set.rb
249
254
  - test/command/test-range-filter.rb
255
+ - test/command/test-reference-acquire.rb
256
+ - test/command/test-reference-release.rb
250
257
  - test/command/test-register.rb
251
258
  - test/command/test-reindex.rb
252
259
  - test/command/test-request-cancel.rb
@@ -258,6 +265,7 @@ files:
258
265
  - test/command/test-status.rb
259
266
  - test/command/test-suggest.rb
260
267
  - test/command/test-table-copy.rb
268
+ - test/command/test-table-create-similar.rb
261
269
  - test/command/test-table-create.rb
262
270
  - test/command/test-table-list.rb
263
271
  - test/command/test-table-remove.rb
@@ -287,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
295
  - !ruby/object:Gem::Version
288
296
  version: '0'
289
297
  requirements: []
290
- rubygems_version: 3.2.0.pre1
298
+ rubygems_version: 3.3.0.dev
291
299
  signing_key:
292
300
  specification_version: 4
293
301
  summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
@@ -296,6 +304,7 @@ test_files:
296
304
  - test/command/format/test-command.rb
297
305
  - test/command/test-base.rb
298
306
  - test/command/test-column-copy.rb
307
+ - test/command/test-column-create-similar.rb
299
308
  - test/command/test-column-create.rb
300
309
  - test/command/test-column-list.rb
301
310
  - test/command/test-column-remove.rb
@@ -328,6 +337,8 @@ test_files:
328
337
  - test/command/test-query-log-flags-remove.rb
329
338
  - test/command/test-query-log-flags-set.rb
330
339
  - test/command/test-range-filter.rb
340
+ - test/command/test-reference-acquire.rb
341
+ - test/command/test-reference-release.rb
331
342
  - test/command/test-register.rb
332
343
  - test/command/test-reindex.rb
333
344
  - test/command/test-request-cancel.rb
@@ -339,6 +350,7 @@ test_files:
339
350
  - test/command/test-status.rb
340
351
  - test/command/test-suggest.rb
341
352
  - test/command/test-table-copy.rb
353
+ - test/command/test-table-create-similar.rb
342
354
  - test/command/test-table-create.rb
343
355
  - test/command/test-table-list.rb
344
356
  - test/command/test-table-remove.rb