avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r908260 - in /hadoop/avro/trunk: CHANGES.txt lang/ruby/interop/ lang/ruby/interop/test_interop.rb
Date Tue, 09 Feb 2010 22:37:52 GMT
Author: cutting
Date: Tue Feb  9 22:37:52 2010
New Revision: 908260

URL: http://svn.apache.org/viewvc?rev=908260&view=rev
Log:
AVRO-413.  Finish adding Ruby data file interop tests.  Contributed by Jeff Hodges.

Added:
    hadoop/avro/trunk/lang/ruby/interop/
    hadoop/avro/trunk/lang/ruby/interop/test_interop.rb
Modified:
    hadoop/avro/trunk/CHANGES.txt

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=908260&r1=908259&r2=908260&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Tue Feb  9 22:37:52 2010
@@ -346,7 +346,8 @@
 
     AVRO-383. Optimizing ResolvingDecoder for default values (thiru)
 
-    AVRO-411. Add Ruby data file interop tests. (Jeff Hodges via cutting) 
+    AVRO-411, AVRO-413. Add Ruby data file interop tests. (Jeff Hodges
+    via cutting)
 
   BUG FIXES
  

Added: hadoop/avro/trunk/lang/ruby/interop/test_interop.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/interop/test_interop.rb?rev=908260&view=auto
==============================================================================
--- hadoop/avro/trunk/lang/ruby/interop/test_interop.rb (added)
+++ hadoop/avro/trunk/lang/ruby/interop/test_interop.rb Tue Feb  9 22:37:52 2010
@@ -0,0 +1,24 @@
+require 'rubygems'
+require 'test/unit'
+require 'avro'
+
+class TestInterop < Test::Unit::TestCase
+  HERE = File.expand_path(File.dirname(__FILE__))
+  SHARE = HERE + '/../../../share'
+  SCHEMAS = SHARE + '/test/schemas'
+  Dir[HERE + '/../../../build/interop/data/*'].each do |fn|  
+    define_method("test_read_#{File.basename(fn, 'avro')}") do
+      projection = Avro::Schema.parse(File.read(SCHEMAS+'/interop.avsc'))
+
+      File.open(fn) do |f|
+        r = Avro::DataFile::Reader.new(f, Avro::IO::DatumReader.new(projection))
+        i = 0
+        r.each do |datum|
+          i += 1
+          assert_not_nil datum, "nil datum from #{fn}"
+        end
+        assert_not_equal 0, i, "no data read in from #{fn}"
+      end
+    end
+  end
+end



Mime
View raw message