[Groonga-commit] groonga/groonga-command at 5f6b23a [fix-travis-ci-error] Support logical_table_remove

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 13 17:34:42 JST 2016


Kouhei Sutou	2015-06-16 16:39:47 +0900 (Tue, 16 Jun 2015)

  New Revision: 5f6b23a1135a26e61029f81c3f59bddc530f8310
  https://github.com/groonga/groonga-command/commit/5f6b23a1135a26e61029f81c3f59bddc530f8310

  Message:
    Support logical_table_remove

  Added files:
    lib/groonga/command/logical-table-remove.rb
    test/command/test-logical-table-remove.rb
  Modified files:
    lib/groonga/command.rb

  Modified: lib/groonga/command.rb (+1 -0)
===================================================================
--- lib/groonga/command.rb    2015-06-16 16:37:27 +0900 (767f619)
+++ lib/groonga/command.rb    2015-06-16 16:39:47 +0900 (95adf33)
@@ -31,6 +31,7 @@ require "groonga/command/io-flush"
 require "groonga/command/load"
 require "groonga/command/logical-count"
 require "groonga/command/logical-range-filter"
+require "groonga/command/logical-table-remove"
 require "groonga/command/normalize"
 require "groonga/command/plugin-register"
 require "groonga/command/plugin-unregister"

  Added: lib/groonga/command/logical-table-remove.rb (+83 -0) 100644
===================================================================
--- /dev/null
+++ lib/groonga/command/logical-table-remove.rb    2015-06-16 16:39:47 +0900 (6f552b5)
@@ -0,0 +1,83 @@
+# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+require "groonga/command/base"
+
+module Groonga
+  module Command
+    # A command class that represents `logical_table_remove` command.
+    #
+    # @since 1.1.3
+    class LogicalTableRemove < Base
+      Command.register("logical_table_remove", self)
+
+      class << self
+        def parameter_names
+          [
+            :logical_table,
+            :shard_key,
+            :min,
+            :min_border,
+            :max,
+            :max_border,
+          ]
+        end
+      end
+
+      # @return [String] `logical_table` parameter value.
+      #
+      # @since 1.1.3
+      def logical_table
+        self[:logical_table]
+      end
+
+      # @return [String] `shard_key` parameter value.
+      #
+      # @since 1.1.3
+      def shard_key
+        self[:shard_key]
+      end
+
+      # @return [String] `min` parameter value.
+      #
+      # @since 1.1.3
+      def min
+        self[:min]
+      end
+
+      # @return [String] `min_border` parameter value.
+      #
+      # @since 1.1.3
+      def min_border
+        self[:min_border]
+      end
+
+      # @return [String] `max` parameter value.
+      #
+      # @since 1.1.3
+      def max
+        self[:max]
+      end
+
+      # @return [String] `max_border` parameter value.
+      #
+      # @since 1.1.3
+      def max_border
+        self[:max_border]
+      end
+    end
+  end
+end

  Added: test/command/test-logical-table-remove.rb (+89 -0) 100644
===================================================================
--- /dev/null
+++ test/command/test-logical-table-remove.rb    2015-06-16 16:39:47 +0900 (644db37)
@@ -0,0 +1,89 @@
+# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+class LogicalTableRemoveCommandTest < Test::Unit::TestCase
+  private
+  def logical_table_remove_command(pair_arguments={}, ordered_arguments=[])
+    Groonga::Command::LogicalTableRemove.new("logical_table_remove",
+                                             pair_arguments,
+                                             ordered_arguments)
+  end
+
+  class ConstructorTest < self
+    def test_ordered_arguments
+      logical_table  = "Logs"
+      shard_key      = "timestamp",
+      min            = "2015-02-12 00:00:00"
+      min_border     = "include"
+      max            = "2015-02-13 00:00:00"
+      max_border     = "exclude"
+
+      ordered_arguments = [
+        logical_table,
+        shard_key,
+        min,
+        min_border,
+        max,
+        max_border,
+      ]
+      command = logical_table_remove_command({}, ordered_arguments)
+      assert_equal({
+                     :logical_table  => logical_table,
+                     :shard_key      => shard_key,
+                     :min            => min,
+                     :min_border     => min_border,
+                     :max            => max,
+                     :max_border     => max_border,
+                   },
+                   command.arguments)
+    end
+  end
+
+  class LogicalTableTest < self
+    def test_reader
+      command = logical_table_remove_command(:logical_table => "Logs")
+      assert_equal("Logs", command.logical_table)
+    end
+  end
+
+  class ShardKeyTest < self
+    def test_reader
+      command = logical_table_remove_command(:shard_key => "timestamp")
+      assert_equal("timestamp", command.shard_key)
+    end
+  end
+
+  class MinTest < self
+    def test_reader
+      command = logical_table_remove_command(:min => "2015-02-13 00:00:00")
+      assert_equal("2015-02-13 00:00:00", command.min)
+    end
+  end
+
+  class MaxTest < self
+    def test_reader
+      command = logical_table_remove_command(:max => "2015-01-26 00:00:00")
+      assert_equal("2015-01-26 00:00:00", command.max)
+    end
+  end
+
+  class MaxBorderTest < self
+    def test_reader
+      command = logical_table_remove_command(:max_border => "include")
+      assert_equal("include", command.max_border)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index