You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by jm...@apache.org on 2010/04/27 19:34:20 UTC

svn commit: r938577 - in /hadoop/avro/trunk: CHANGES.txt lang/ruby/lib/avro.rb lang/ruby/lib/avro/ipc.rb lang/ruby/test/sample_ipc_http_server.rb lang/ruby/test/sample_ipc_server.rb share/test/interop/bin/test_rpc_interop.sh

Author: jmhodges
Date: Tue Apr 27 17:34:19 2010
New Revision: 938577

URL: http://svn.apache.org/viewvc?rev=938577&view=rev
Log:
AVRO-511. Ruby implementation passes the rpc interop tests.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/ruby/lib/avro.rb
    hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb
    hadoop/avro/trunk/lang/ruby/test/sample_ipc_http_server.rb
    hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb
    hadoop/avro/trunk/share/test/interop/bin/test_rpc_interop.sh

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Tue Apr 27 17:34:19 2010
@@ -29,6 +29,8 @@ Avro 1.4.0 (unreleased)
 
     AVRO-521. Out of memory and other issues with Junit tests for mapreduce (thiru)
 
+    AVRO-511. Ruby implementation passes the rpc interop tests.
+
   BUG FIXES
     AVRO-461. Skipping primitives in the ruby side (jmhodges)
 

Modified: hadoop/avro/trunk/lang/ruby/lib/avro.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/lib/avro.rb?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/lib/avro.rb (original)
+++ hadoop/avro/trunk/lang/ruby/lib/avro.rb Tue Apr 27 17:34:19 2010
@@ -17,6 +17,8 @@
 require 'yajl'
 require 'set'
 require 'md5'
+require 'net/http'
+require 'stringio'
 
 module Avro
   VERSION = "FIXME"

Modified: hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb (original)
+++ hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb Tue Apr 27 17:34:19 2010
@@ -13,7 +13,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-require 'stringio'
 
 module Avro::IPC
 
@@ -239,7 +238,7 @@ module Avro::IPC
     # Called by a server to deserialize a request, compute and serialize
     # a response or error. Compare to 'handle()' in Thrift.
     def respond(call_request)
-      buffer_decoder = Avro::IO::BinaryDecoder.new(call_request)
+      buffer_decoder = Avro::IO::BinaryDecoder.new(StringIO.new(call_request))
       buffer_writer = StringIO.new('', 'w+')
       buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer)
       error = nil
@@ -308,7 +307,7 @@ module Avro::IPC
       remote_protocol = protocol_cache[client_hash]
 
       if !remote_protocol && client_protocol
-        remote_protocol = protocol.parse(client_protocol)
+        remote_protocol = Avro::Protocol.parse(client_protocol)
         protocol_cache[client_hash] = remote_protocol
       end
 

Modified: hadoop/avro/trunk/lang/ruby/test/sample_ipc_http_server.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/test/sample_ipc_http_server.rb?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/test/sample_ipc_http_server.rb (original)
+++ hadoop/avro/trunk/lang/ruby/test/sample_ipc_http_server.rb Tue Apr 27 17:34:19 2010
@@ -68,7 +68,6 @@ class MailHandler < WEBrick::HTTPServlet
     writer = Avro::IPC::FramedWriter.new(StringIO.new)
     writer.write_framed_message(unframed_resp)
     resp.body = writer.to_s
-    raise WEBrick::HTTPStatus::OK
   end
 end
 

Modified: hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb (original)
+++ hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb Tue Apr 27 17:34:19 2010
@@ -81,7 +81,7 @@ class MailHandler < RequestHandler
   def handle(request)
     responder = MailResponder.new()
     transport = Avro::IPC::SocketTransport.new(request)
-    str = StringIO.new(transport.read_framed_message)
+    str = transport.read_framed_message
     transport.write_framed_message(responder.respond(str))
   end
 end

Modified: hadoop/avro/trunk/share/test/interop/bin/test_rpc_interop.sh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/share/test/interop/bin/test_rpc_interop.sh?rev=938577&r1=938576&r2=938577&view=diff
==============================================================================
--- hadoop/avro/trunk/share/test/interop/bin/test_rpc_interop.sh (original)
+++ hadoop/avro/trunk/share/test/interop/bin/test_rpc_interop.sh Tue Apr 27 17:34:19 2010
@@ -29,10 +29,13 @@ java_server="java -jar lang/java/build/a
 py_client="python lang/py/src/avro/tool.py rpcsend"
 py_server="python lang/py/src/avro/tool.py rpcreceive"
 
+ruby_client="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcsend"
+ruby_server="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcreceive"
+
 export PYTHONPATH=lang/py/src                     # path to avro Python module
 
-clients=("$java_client" "$py_client")
-servers=("$java_server" "$py_server")
+clients=("$java_client" "$py_client" "$ruby_client")
+servers=("$java_server" "$py_server" "$ruby_server")
 
 proto=share/test/schemas/simple.avpr