You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/01/13 21:19:36 UTC

svn commit: r898925 - in /hadoop/avro/trunk: CHANGES.txt build.sh lang/java/build.xml lang/java/src/test/java/org/apache/avro/TestDataFile.java

Author: cutting
Date: Wed Jan 13 20:19:30 2010
New Revision: 898925

URL: http://svn.apache.org/viewvc?rev=898925&view=rev
Log:
AVRO-317.  Restore Java data interop tests.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/build.sh
    hadoop/avro/trunk/lang/java/build.xml
    hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestDataFile.java

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=898925&r1=898924&r2=898925&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Wed Jan 13 20:19:30 2010
@@ -204,6 +204,8 @@
 
     AVRO-310. Improve top-level build.sh. (cutting)
 
+    AVRO-317. Restore Java data interop tests. (cutting)
+
   OPTIMIZATIONS
 
     AVRO-172. More efficient schema processing (massie)

Modified: hadoop/avro/trunk/build.sh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/build.sh?rev=898925&r1=898924&r2=898925&view=diff
==============================================================================
--- hadoop/avro/trunk/build.sh (original)
+++ hadoop/avro/trunk/build.sh Wed Jan 13 20:19:30 2010
@@ -19,11 +19,24 @@
 	(cd lang/py; ant test)
 	# (cd lang/c; make test)
 	# (cd lang/c++; make test)
+
+	# create interop test data
+	(cd lang/java; ant interop-data-generate)
+	#(cd lang/py; ant interop-data-generate)
+	#(cd lang/c; make interop-data-generate)
+	#(cd lang/c++; make interop-data-generate)
+
+	# run interop data tests
+	(cd lang/java; ant interop-data-test)
+	#(cd lang/py; ant interop-data-test)
+	#(cd lang/c; make interop-data-test)
+	#(cd lang/c++; make interop-data-test)
+
 	;;
 
     dist)
 	# build source tarball
-	mkdir build
+	mkdir -p build
 	svn export --force . build/avro-src-$VERSION
 	mkdir -p dist
         tar czf dist/avro-src-$VERSION.tar.gz build/avro-src-$VERSION

Modified: hadoop/avro/trunk/lang/java/build.xml
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/build.xml?rev=898925&r1=898924&r2=898925&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/build.xml (original)
+++ hadoop/avro/trunk/lang/java/build.xml Wed Jan 13 20:19:30 2010
@@ -324,6 +324,7 @@
   <macrodef name="test-runner">
     <attribute name="files.location" />
     <attribute name="tests.pattern" />
+    <attribute name="test.dir" default="${test.java.build.dir}" />
     <sequential>
       <junit showoutput="yes"
              printsummary="withOutAndErr"
@@ -331,7 +332,7 @@
              fork="yes" forkMode="once"
              errorProperty="tests.failed" failureProperty="tests.failed">
         <sysproperty key="test.count" value="${test.count}"/>
-        <sysproperty key="test.dir" value="${test.java.build.dir}"/>
+        <sysproperty key="test.dir" value="@{test.dir}"/>
         <sysproperty key="test.validate" value="${test.validate}"/>
         <sysproperty key="test.genavro.dir" value="${test.genavro.dir}" />
         <sysproperty key="test.genavro.mode" value="${test.genavro.mode}" />
@@ -358,39 +359,35 @@
     <test-runner files.location="${test.java.src.dir}" tests.pattern="**/${test.java.include}.java"/>
   </target>
 
-  <target name="generate-test-data" depends="compile-test-java">
-    <mkdir dir="${test.java.build.dir}/data-files"/>
-  	 <mkdir dir="${test.java.build.dir}/blocking-data-files"/>
+  <target name="interop-data-generate" depends="compile-test-java">
+    <mkdir dir="${top.build}/interop/data"/>
     <java classname="org.apache.avro.RandomData"
       classpathref="test.java.classpath">
-      <arg value="${basedir}/src/test/schemata/interop.avsc"/>
-      <arg value="${test.java.build.dir}/data-files/test.java.avro"/>
+      <arg value="${share.dir}/test/schemas/interop.avsc"/>
+      <arg value="${top.build}/interop/data/java.avro"/>
       <arg value="${test.count}"/>
     </java>
-  	 <java classname="org.apache.avro.GenerateBlockingData"
-  	      classpathref="test.java.classpath">
-  	      <arg value="${basedir}/src/test/schemata/interop.avsc"/>
-  	      <arg value="${test.java.build.dir}/blocking-data-files/test.java.blocking.avro"/>
-  	      <arg value="${test.count}"/>
-  	 </java>
   </target>
 
-  <target name="test-interop-data-java" depends="generate-test-data"
+  <target name="interop-data-test"
     description="Run java data file interoperability tests">
-    <test-runner files.location="${test.java.classes}" tests.pattern="**/TestDataFile$InteropTest.class" />
+    <test-runner files.location="${test.java.classes}"
+		 tests.pattern="**/TestDataFile$InteropTest.class"
+		 test.dir="${top.build}/interop/data" />
   </target>
 
-  <target name="start-rpc-daemons" depends="compile-test-java"
+  <target name="interop-rpc-start" depends="compile-test-java"
     description="Start the daemons for rpc interoperability tests">
-    <delete dir="${test.java.build.dir}/server-ports"/>
-    <mkdir dir="${test.java.build.dir}/server-ports"/>
+    <delete dir="${share.dir}/test/interop/rpc/java"/>
+    <mkdir dir="${share.dir}/test/interop/rpc/java"/>
     <!-- Start the servers. As servers block the ant main thread, these need 
     to be created in parallel threads--> 
     <parallel>
       <daemons>
         <java classname="org.apache.avro.TestProtocolSpecific$InteropTest">
           <classpath refid="test.java.classpath"/>
-          <sysproperty key="test.dir" value="${test.java.build.dir}"/>
+          <sysproperty key="test.dir"
+		       value="${share.dir}/test/interop/rpc/java"/>
         </java>
       </daemons>
 
@@ -401,7 +398,7 @@
     </parallel>
   </target>
 
-  <target name="test-interop-rpc-java" depends="start-rpc-daemons"
+  <target name="interop-rpc-test" 
     description="Run java rpc interoperability tests">
     <test-runner files.location="${test.java.classes}" tests.pattern="**/TestProtocolSpecific$InteropTest.class" />
   </target>

Modified: hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestDataFile.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestDataFile.java?rev=898925&r1=898924&r2=898925&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestDataFile.java (original)
+++ hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestDataFile.java Wed Jan 13 20:19:30 2010
@@ -19,7 +19,6 @@
 
 import org.apache.avro.file.DataFileReader;
 import org.apache.avro.file.DataFileWriter;
-import org.apache.avro.file.SeekableFileInput;
 import org.apache.avro.generic.GenericDatumReader;
 import org.apache.avro.generic.GenericDatumWriter;
 import org.apache.avro.io.DatumReader;
@@ -40,7 +39,7 @@
   private static final File DIR
     = new File(System.getProperty("test.dir", "/tmp"));
   private static final File DATAFILE_DIR
-    = new File(System.getProperty("test.dir", "/tmp")+"/data-files/");
+    = new File(System.getProperty("test.dir", "/tmp"));
   private static final File FILE = new File(DIR, "test.avro");
   private static final long SEED = System.currentTimeMillis();
 
@@ -151,8 +150,7 @@
   protected void readFile(File f, DatumReader<Object> datumReader)
     throws IOException {
     System.out.println("Reading "+ f.getName());
-    DataFileReader<Object> reader =
-      new DataFileReader<Object>(new SeekableFileInput(f), datumReader);
+    DataFileReader<Object> reader = new DataFileReader<Object>(f, datumReader);
     for (Object datum : reader) {
       assertNotNull(datum);
     }
@@ -175,11 +173,13 @@
 
   @Test
     public void testGeneratedGeneric() throws IOException {
+      System.out.println("Reading with generic:");
       readFiles(new GenericDatumReader<Object>());
     }
 
   @Test
     public void testGeneratedSpecific() throws IOException {
+      System.out.println("Reading with specific:");
       readFiles(new SpecificDatumReader<Object>());
     }