[Groonga-commit] groonga/fluent-plugin-droonga at 2a6f49d [master] adapter: implement #post that posts a adapted request to the next adapter/worker

Back to archive index

Kosuke Asami null+****@clear*****
Mon Jul 22 15:55:48 JST 2013


Kosuke Asami	2013-07-22 15:55:48 +0900 (Mon, 22 Jul 2013)

  New Revision: 2a6f49d0d24d88fb17ce089f34422d4d6d51d667
  https://github.com/groonga/fluent-plugin-droonga/commit/2a6f49d0d24d88fb17ce089f34422d4d6d51d667

  Message:
    adapter: implement #post that posts a adapted request to the next adapter/worker

  Modified files:
    lib/droonga/adapter.rb
    test/test_adapter.rb

  Modified: lib/droonga/adapter.rb (+8 -0)
===================================================================
--- lib/droonga/adapter.rb    2013-07-22 15:54:40 +0900 (456a416)
+++ lib/droonga/adapter.rb    2013-07-22 15:55:48 +0900 (ed779c8)
@@ -41,8 +41,16 @@ module Droonga
       end
     end
 
+    def initialize(proxy)
+      @proxy = proxy
+    end
+
     def adapt(command, request)
       __send__(self.class.method_name(command), request)
     end
+
+    def post(request)
+      @proxy.post(request)
+    end
   end
 end

  Modified: test/test_adapter.rb (+12 -1)
===================================================================
--- test/test_adapter.rb    2013-07-22 15:54:40 +0900 (e17812e)
+++ test/test_adapter.rb    2013-07-22 15:55:48 +0900 (9a6b4e5)
@@ -20,17 +20,28 @@ class AdapterTest < Test::Unit::TestCase
     class GroongaAdapter < Droonga::Adapter
       command :select
       def select(request)
+        post(:search) do |response|
+          # do nothing
+        end
         :selected
       end
     end
 
     def setup
-      @groonga_adapter = GroongaAdapter.new
+      @proxy = Object.new
+      @groonga_adapter = GroongaAdapter.new(@proxy)
     end
 
     def test_called
       request = nil
+      stub(@proxy).post
       assert_equal(:selected, @groonga_adapter.adapt(:select, request))
     end
+
+    def test_post
+      request = nil
+      mock(@proxy).post(:search)
+      @groonga_adapter.adapt(:select, request)
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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