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 2009/05/18 20:36:56 UTC

svn commit: r776049 - in /hadoop/avro/trunk: ./ lib/ src/test/java/org/apache/avro/ src/test/java/org/apache/avro/io/ src/test/java/org/apache/avro/test/ src/test/py/ src/test/schemata/

Author: cutting
Date: Mon May 18 18:36:55 2009
New Revision: 776049

URL: http://svn.apache.org/viewvc?rev=776049&view=rev
Log:
AVRO-26.  Switch tests from JUnit to TestNG.  Contributed by Konstantin Boudnik.

Added:
    hadoop/avro/trunk/lib/testng-5.9-jdk15.jar   (with props)
    hadoop/avro/trunk/src/test/java/org/apache/avro/test/
    hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestInvocationReporter.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestOutputInterceptor.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestSuiteInterceptor.java
    hadoop/avro/trunk/src/test/schemata/simple.js   (contents, props changed)
      - copied, changed from r776036, hadoop/avro/trunk/src/test/schemata/test.js
Removed:
    hadoop/avro/trunk/lib/junit-4.5.jar
    hadoop/avro/trunk/src/test/schemata/test.js
Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/build.xml
    hadoop/avro/trunk/src/test/java/org/apache/avro/RandomData.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestDataFile.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestFsData.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolGeneric.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolReflect.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestReflect.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/TestSchema.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/io/TestValueReader.java
    hadoop/avro/trunk/src/test/py/testipc.py

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Mon May 18 18:36:55 2009
@@ -34,6 +34,9 @@
     AVRO-15. Override __eq__() and __hash__() in Schema classes.
     (sharad)
 
+    AVRO-26. Switch tests from JUnit to TestNG.  (Konstantin Boudnik
+    via cutting)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/avro/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/build.xml?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/build.xml (original)
+++ hadoop/avro/trunk/build.xml Mon May 18 18:36:55 2009
@@ -49,6 +49,7 @@
             value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
 
   <property name="test.count" value="100"/>
+  <property name="testcase" value="Test*"/>
   <property name="test.java.src.dir" value="${basedir}/src/test/java"/>
   <property name="test.schemata.dir" value="${basedir}/src/test/schemata"/>
   <property name="test.java.build.dir" value="${build.dir}/test"/>
@@ -130,7 +131,7 @@
     </jar>
   </target>
   
-  <target name="compile-java-test" depends="compile-java,compile-test-schemata">
+  <target name="compile-test-java" depends="compile-java,compile-test-schemata">
     <javac 
      encoding="${javac.encoding}" 
      srcdir="${test.java.src.dir}"
@@ -162,7 +163,7 @@
     <mkdir dir="${test.java.generated.dir}"/>
     <protocol destdir="${test.java.generated.dir}">
       <fileset dir="${test.schemata.dir}">
-	<include name="test.js" />
+	<include name="simple.js" />
       </fileset>
     </protocol>
     <schema destdir="${test.java.generated.dir}">
@@ -187,29 +188,28 @@
 	       outputDirectory="${test.java.classes}"/>
   </target>
 
-  <target name="test-java" depends="compile-java-test"
-	  description="Run java unit tests">
+  <!-- Define TestNG task for all targets that might need it-->
+  <taskdef resource="testngtasks" classpathref="java.classpath"/>
 
-    <junit showoutput="yes"
-      printsummary="withOutAndErr"
-      haltonfailure="no"
-      errorProperty="tests.failed" failureProperty="tests.failed">
+  <target name="test-java" depends="compile-test-java"
+          description="Run java unit tests with TestNG">
+
+    <testng classpathref="test.java.classpath"
+            sourcedir="${test.java.src.dir}"
+            outputdir="${build.dir}/test-output"
+            suitename="AvroTestNG"
+            listeners="org.apache.avro.test.TestOutputInterceptor, org.apache.avro.test.TestSuiteInterceptor"
+            haltOnfailure="true">
       <sysproperty key="test.count" value="${test.count}"/>
       <sysproperty key="test.dir" value="${test.java.build.dir}"/>
       <sysproperty key="test.validate" value="${test.validate}"/>
+      <sysproperty key="testcase" value="${testcase}"/>
+
       <classpath refid="test.java.classpath"/>
-      <formatter type="plain" />
-      <batchtest todir="${test.java.build.dir}" unless="testcase">
-        <fileset dir="${test.java.src.dir}"
-	         includes="**/${test.java.include}.java"
-		 excludes="**/${test.java.exclude}.java" />
-      </batchtest>
-      <batchtest todir="${test.java.build.dir}" if="testcase">
-        <fileset dir="${test.java.src.dir}" includes="**/${testcase}.java"/>
-      </batchtest>
-    </junit>
-    <fail if="tests.failed">Tests failed!</fail>
-  </target>   
+
+      <classfileset dir="${test.java.classes}" includes="**/${testcase}.class" excludes="**/*$*.class"/>
+    </testng>
+  </target>
 
   <path id="test.py.path">
     <pathelement location="${basedir}/src/py"/>
@@ -217,7 +217,7 @@
     <pathelement location="${basedir}/lib/py"/>
   </path>
 
-  <target name="generate-test-data" depends="compile-java-test">
+  <target name="generate-test-data" depends="compile-test-java">
     <mkdir dir="${test.java.build.dir}/data-files"/>
     <java classname="org.apache.avro.RandomData"
       classpathref="test.java.classpath">
@@ -252,7 +252,7 @@
    description="Run multiple languages interoperability tests">
   </target>
 
-  <target name="test-interop-java" 
+  <target name="test-interop-java"
     depends="test-interop-data-java,test-interop-rpc-java"
    description="Run java interoperability tests">
   </target>
@@ -262,21 +262,23 @@
    description="Run python interoperability tests">
   </target>
 
-  <target name="test-interop-data-java" depends="generate-test-data" 
+  <target name="test-interop-data-java" depends="generate-test-data"
     description="Run java data file interoperability tests">
-    <junit showoutput="yes" 
-      printsummary="withOutAndErr"
-      haltonfailure="no"
-      errorProperty="tests.failed" failureProperty="tests.failed">
+
+    <testng classpathref="test.java.classpath"
+            sourcedir="${test.java.src.dir}"
+            outputdir="${build.dir}/test-output"
+            suitename="AvroTest"
+            testname="InteropDataTest"
+            haltOnfailure="true">
       <sysproperty key="test.count" value="${test.count}"/>
       <sysproperty key="test.dir" value="${test.java.build.dir}"/>
       <sysproperty key="test.validate" value="${test.validate}"/>
+
       <classpath refid="test.java.classpath"/>
-      <formatter type="plain" />
-      <test name="org.apache.avro.TestDataFile$InteropTest" 
-        todir="${test.java.build.dir}"/>
-    </junit>
-    <fail if="tests.failed">Tests failed!</fail>
+
+      <classfileset dir="${test.java.classes}" includes="**/TestDataFile$InteropTest.class"/>
+    </testng>
   </target>
 
   <target name="test-interop-data-py" depends="generate-test-data" 
@@ -291,7 +293,7 @@
     </py-test>
   </target>
 
-  <target name="start-rpc-daemons" depends="compile-java-test"
+  <target name="start-rpc-daemons" 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"/>
@@ -321,19 +323,32 @@
 
   <target name="test-interop-rpc-java" depends="start-rpc-daemons"
     description="Run java rpc interoperability tests">
-    <junit showoutput="yes" 
-      printsummary="withOutAndErr"
-      haltonfailure="no"
-      errorProperty="tests.failed" failureProperty="tests.failed">
+
+    <testng classpathref="test.java.classpath"
+            sourcedir="${test.java.src.dir}"
+            outputdir="${build.dir}/test-output"
+            suitename="AvroTestNG"
+            testname="InteropRPCTest"
+            haltOnfailure="true">
       <sysproperty key="test.count" value="${test.count}"/>
       <sysproperty key="test.dir" value="${test.java.build.dir}"/>
       <sysproperty key="test.validate" value="${test.validate}"/>
+
       <classpath refid="test.java.classpath"/>
-      <formatter type="plain" />
-      <test name="org.apache.avro.TestProtocolSpecific$InteropTest" 
-        todir="${test.java.build.dir}"/>
-    </junit>
-    <fail if="tests.failed">Tests failed!</fail>
+
+      <classfileset dir="${test.java.classes}" includes="**/TestProtocolSpecific$InteropTest.class"/>
+    </testng>
+  </target>
+
+  <target name="test-reports" depends="test-java" description="This target produce reports in JUnit format">
+    <mkdir  dir="${build.dir}/test-report"/>
+    <junitreport todir="${build.dir}/test-report">
+      <fileset dir="${build.dir}/test-output">
+        <include name="**/*.xml"/>
+      </fileset>
+
+      <report format="noframes" todir="${build.dir}/test-report"/>
+    </junitreport>
   </target>
 
   <target name="test-interop-rpc-py" depends="start-rpc-daemons"

Added: hadoop/avro/trunk/lib/testng-5.9-jdk15.jar
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lib/testng-5.9-jdk15.jar?rev=776049&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/avro/trunk/lib/testng-5.9-jdk15.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/RandomData.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/RandomData.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/RandomData.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/RandomData.java Mon May 18 18:36:55 2009
@@ -17,15 +17,6 @@
  */
 package org.apache.avro;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
 import org.apache.avro.file.DataFileWriter;
 import org.apache.avro.generic.GenericArray;
 import org.apache.avro.generic.GenericData;
@@ -33,6 +24,11 @@
 import org.apache.avro.generic.GenericRecord;
 import org.apache.avro.util.Utf8;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.ByteBuffer;
+import java.util.*;
+
 /** Generates schema data as Java objects with random values. */
 public class RandomData implements Iterable<Object> {
   private final Schema root;

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestDataFile.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestDataFile.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestDataFile.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestDataFile.java Mon May 18 18:36:55 2009
@@ -17,12 +17,6 @@
  */
 package org.apache.avro;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
 import org.apache.avro.file.DataFileReader;
 import org.apache.avro.file.DataFileWriter;
 import org.apache.avro.file.SeekableFileInput;
@@ -31,8 +25,15 @@
 import org.apache.avro.io.DatumReader;
 import org.apache.avro.reflect.ReflectDatumReader;
 import org.apache.avro.specific.SpecificDatumReader;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 
-public class TestDataFile extends TestCase {
+public class TestDataFile {
   private static final int COUNT =
     Integer.parseInt(System.getProperty("test.count", "10"));
   private static final boolean VALIDATE = 
@@ -50,6 +51,7 @@
     +"{\"name\":\"longField\", \"type\":\"long\"}]}";
   private static final Schema SCHEMA = Schema.parse(SCHEMA_JSON);
 
+  @Test
   public void testGenericWrite() throws IOException {
     DataFileWriter<Object> writer =
       new DataFileWriter<Object>(SCHEMA,
@@ -64,6 +66,7 @@
     }
   }
 
+  @Test
   public void testGenericRead() throws IOException {
     DataFileReader<Object> reader =
       new DataFileReader<Object>(new SeekableFileInput(FILE),
@@ -112,16 +115,19 @@
     System.out.println("Time: "+(System.currentTimeMillis()-start));
   }
 
-  public static class InteropTest extends TestCase {
+  public static class InteropTest {
 
+  @Test
     public void testGeneratedGeneric() throws IOException {
       readFiles(new GenericDatumReader<Object>());
     }
 
+  @Test
     public void testGeneratedSpecific() throws IOException {
       readFiles(new SpecificDatumReader("org.apache.avro."));
     }
 
+  @Test
     public void testGeneratedReflect() throws IOException {
       readFiles(new ReflectDatumReader("org.apache.avro."));
     }

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestFsData.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestFsData.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestFsData.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestFsData.java Mon May 18 18:36:55 2009
@@ -17,24 +17,29 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import junit.framework.TestCase;
-import org.codehaus.jackson.map.JsonNode;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import org.apache.avro.Protocol.Message;
-import org.apache.avro.io.*;
+import org.apache.avro.generic.GenericData;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.avro.generic.GenericRequestor;
+import org.apache.avro.generic.GenericResponder;
 import org.apache.avro.ipc.*;
-import org.apache.avro.generic.*;
-import org.apache.avro.util.*;
+import org.apache.avro.util.Utf8;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.Random;
 
-public class TestFsData extends TestCase {
+public class TestFsData {
   private static final Logger LOG
     = LoggerFactory.getLogger(TestProtocolGeneric.class);
 
@@ -90,6 +95,7 @@
   private static Requestor requestor;
   private static FileChannel fileChannel;
 
+  @BeforeMethod
   public void testStartServer() throws Exception {
     // create a file that has COUNT * BUFFER_SIZE bytes of random data
     Random rand = new Random();
@@ -114,6 +120,7 @@
 
   }
 
+  @Test
   public void testFsRead() throws IOException {
     for (int i = 0; i < COUNT; i++) {
       GenericRecord params =
@@ -125,6 +132,7 @@
     }
   }
 
+  @AfterMethod
   public void testStopServer() throws Exception {
     server.close();
     fileChannel.close();

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolGeneric.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolGeneric.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolGeneric.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolGeneric.java Mon May 18 18:36:55 2009
@@ -17,27 +17,33 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import junit.framework.TestCase;
-import org.codehaus.jackson.map.JsonNode;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import org.apache.avro.Protocol.Message;
-import org.apache.avro.io.*;
+import org.apache.avro.generic.GenericData;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.avro.generic.GenericRequestor;
+import org.apache.avro.generic.GenericResponder;
 import org.apache.avro.ipc.*;
-import org.apache.avro.generic.*;
-import org.apache.avro.util.*;
+import org.apache.avro.util.Utf8;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.util.Map;
+import java.util.Random;
 
-public class TestProtocolGeneric extends TestCase {
+public class TestProtocolGeneric {
   private static final Logger LOG
     = LoggerFactory.getLogger(TestProtocolGeneric.class);
 
-  private static final File FILE = new File("src/test/schemata/test.js");
+  private static final File FILE = new File("src/test/schemata/simple.js");
   private static final Protocol PROTOCOL;
   static {
     try {
@@ -87,12 +93,14 @@
   private static Transceiver client;
   private static Requestor requestor;
 
+  @BeforeMethod
   public void testStartServer() throws Exception {
     server = new SocketServer(new TestResponder(), new InetSocketAddress(0));
     client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
     requestor = new GenericRequestor(PROTOCOL, client);
   }
 
+  @Test
   public void testHello() throws IOException {
     GenericRecord params = 
       new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest());
@@ -101,6 +109,7 @@
     assertEquals(new Utf8("goodbye"), response);
   }
 
+  @Test
   public void testEcho() throws IOException {
     GenericRecord record =
       new GenericData.Record(PROTOCOL.getTypes().get("TestRecord"));
@@ -112,6 +121,7 @@
     assertEquals(record, echoed);
   }
 
+  @Test
   public void testEchoBytes() throws IOException {
     Random random = new Random();
     int length = random.nextInt(1024*16);
@@ -125,6 +135,7 @@
     assertEquals(data, echoed);
   }
 
+  @Test
   public void testError() throws IOException {
     GenericRecord params =
       new GenericData.Record(PROTOCOL.getMessages().get("error").getRequest());
@@ -138,6 +149,7 @@
     assertEquals("an error", ((Map)error.getValue()).get("message").toString());
   }
 
+  @AfterMethod
   public void testStopServer() {
     server.close();
   }

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolReflect.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolReflect.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolReflect.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolReflect.java Mon May 18 18:36:55 2009
@@ -17,35 +17,23 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import junit.framework.TestCase;
-import org.codehaus.jackson.map.JsonNode;
+import org.apache.avro.ipc.SocketServer;
+import org.apache.avro.ipc.SocketTransceiver;
+import org.apache.avro.reflect.ReflectRequestor;
+import org.apache.avro.reflect.ReflectResponder;
+import org.apache.avro.test.Simple;
+import org.testng.annotations.BeforeMethod;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.avro.*;
-import org.apache.avro.Protocol.Message;
-import org.apache.avro.io.*;
-import org.apache.avro.ipc.*;
-import org.apache.avro.generic.*;
-import org.apache.avro.specific.*;
-import org.apache.avro.reflect.*;
-import org.apache.avro.util.*;
-
-import org.apache.avro.test.Test.TestRecord;
-import org.apache.avro.test.*;
+import java.net.InetSocketAddress;
 
 public class TestProtocolReflect extends TestProtocolSpecific {
 
+  @BeforeMethod
   public void testStartServer() throws Exception {
-    server = new SocketServer(new ReflectResponder(Test.class, new TestImpl()),
+    server = new SocketServer(new ReflectResponder(Simple.class, new TestImpl()),
                               new InetSocketAddress(0));
     client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
-    proxy = (Test)ReflectRequestor.getClient(Test.class, client);
+    proxy = (Simple)ReflectRequestor.getClient(Simple.class, client);
   }
 
 }

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java Mon May 18 18:36:55 2009
@@ -17,36 +17,38 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import junit.framework.TestCase;
-import org.codehaus.jackson.map.JsonNode;
-
+import org.apache.avro.ipc.AvroRemoteException;
+import org.apache.avro.ipc.SocketServer;
+import org.apache.avro.ipc.SocketTransceiver;
+import org.apache.avro.ipc.Transceiver;
+import org.apache.avro.specific.SpecificRequestor;
+import org.apache.avro.specific.SpecificResponder;
+import org.apache.avro.test.Simple;
+import org.apache.avro.test.Simple.TestError;
+import org.apache.avro.test.Simple.TestRecord;
+import org.apache.avro.util.Utf8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.util.Random;
 
-import org.apache.avro.*;
-import org.apache.avro.Protocol.Message;
-import org.apache.avro.io.*;
-import org.apache.avro.ipc.*;
-import org.apache.avro.generic.*;
-import org.apache.avro.specific.*;
-import org.apache.avro.util.*;
-
-import org.apache.avro.test.Test.TestRecord;
-import org.apache.avro.test.Test.TestError;
-import org.apache.avro.test.*;
 
-public class TestProtocolSpecific extends TestCase {
+public class TestProtocolSpecific {
   private static final Logger LOG
     = LoggerFactory.getLogger(TestProtocolSpecific.class);
 
   private static final File SERVER_PORTS_DIR
   = new File(System.getProperty("test.dir", "/tmp")+"/server-ports/");
 
-  private static final File FILE = new File("src/test/schemata/test.js");
+  private static final File FILE = new File("src/test/schemata/simple.js");
   private static final Protocol PROTOCOL;
   static {
     try {
@@ -56,7 +58,7 @@
     }
   }
 
-  public static class TestImpl implements Test {
+  public static class TestImpl implements Simple {
     public Utf8 hello(Utf8 greeting) { return new Utf8("goodbye"); }
     public TestRecord echo(TestRecord record) { return record; }
     public ByteBuffer echoBytes(ByteBuffer data) { return data; }
@@ -69,20 +71,23 @@
 
   protected static SocketServer server;
   protected static Transceiver client;
-  protected static Test proxy;
+  protected static Simple proxy;
 
+  @BeforeMethod
   public void testStartServer() throws Exception {
-    server = new SocketServer(new SpecificResponder(Test.class, new TestImpl()),
+    server = new SocketServer(new SpecificResponder(Simple.class, new TestImpl()),
                               new InetSocketAddress(0));
     client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
-    proxy = (Test)SpecificRequestor.getClient(Test.class, client);
+    proxy = (Simple)SpecificRequestor.getClient(Simple.class, client);
   }
 
+  @Test
   public void testHello() throws IOException {
     Utf8 response = proxy.hello(new Utf8("bob"));
     assertEquals(new Utf8("goodbye"), response);
   }
 
+  @Test
   public void testEcho() throws IOException {
     TestRecord record = new TestRecord();
     record.name = new Utf8("foo");
@@ -90,6 +95,7 @@
     assertEquals(record.name, echoed.name);
   }
 
+  @Test
   public void testEchoBytes() throws IOException {
     Random random = new Random();
     int length = random.nextInt(1024*16);
@@ -100,6 +106,7 @@
     assertEquals(data, echoed);
   }
 
+  @Test
   public void testEmptyEchoBytes() throws IOException {
     ByteBuffer data = ByteBuffer.allocate(0);
     ByteBuffer echoed = proxy.echoBytes(data);
@@ -107,6 +114,7 @@
     assertEquals(data, echoed);
   }
 
+  @Test
   public void testError() throws IOException {
     TestError error = null;
     try {
@@ -118,12 +126,14 @@
     assertEquals("an error", error.message.toString());
   }
 
+  @AfterMethod
   public void testStopServer() {
     server.close();
   }
 
-  public static class InteropTest extends TestCase{
+  public static class InteropTest {
 
+  @Test
     public void testClient() throws Exception {
       for (File f : SERVER_PORTS_DIR.listFiles()) {
         LineNumberReader reader = new LineNumberReader(new FileReader(f));
@@ -132,7 +142,7 @@
             f.getName()+" - " + port);
         Transceiver client = new SocketTransceiver(
             new InetSocketAddress("localhost", port));
-        proxy = (Test)SpecificRequestor.getClient(Test.class, client);
+        proxy = (Simple)SpecificRequestor.getClient(Simple.class, client);
         TestProtocolSpecific proto = new TestProtocolSpecific();
         proto.testHello();
         proto.testEcho();
@@ -148,7 +158,7 @@
      */
     public static void main(String[] args) throws Exception {
       SocketServer server = new SocketServer(
-          new SpecificResponder(Test.class, new TestImpl()),
+          new SpecificResponder(Simple.class, new TestImpl()),
           new InetSocketAddress(0));
       File portFile = new File(SERVER_PORTS_DIR, "java-port");
       FileWriter w = new FileWriter(portFile);

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestReflect.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestReflect.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestReflect.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestReflect.java Mon May 18 18:36:55 2009
@@ -17,33 +17,22 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import junit.framework.TestCase;
-import org.codehaus.jackson.map.JsonNode;
-
+import org.apache.avro.reflect.ReflectData;
+import org.apache.avro.test.Simple;
+import org.apache.avro.test.Simple.TestRecord;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
 
-import org.apache.avro.*;
-import org.apache.avro.Protocol.Message;
-import org.apache.avro.io.*;
-import org.apache.avro.ipc.*;
-import org.apache.avro.generic.*;
-import org.apache.avro.specific.*;
-import org.apache.avro.reflect.*;
-import org.apache.avro.util.*;
-
-import org.apache.avro.test.Test.TestRecord;
-import org.apache.avro.test.*;
+import java.io.File;
+import java.io.IOException;
 
-public class TestReflect extends TestCase {
+public class TestReflect {
   private static final Logger LOG
     = LoggerFactory.getLogger(TestProtocolSpecific.class);
 
-  private static final File FILE = new File("src/test/schemata/test.js");
+  private static final File FILE = new File("src/test/schemata/simple.js");
   private static final Protocol PROTOCOL;
   static {
     try {
@@ -53,12 +42,14 @@
     }
   }
 
+  @Test
   public void testRecord() throws IOException {
     assertEquals(PROTOCOL.getTypes().get("TestRecord"),
                  ReflectData.getSchema(TestRecord.class));
   }
 
+  @Test
   public void testProtocol() throws IOException {
-    assertEquals(PROTOCOL, ReflectData.getProtocol(Test.class));
+    assertEquals(PROTOCOL, ReflectData.getProtocol(Simple.class));
   }
 }

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/TestSchema.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestSchema.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestSchema.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestSchema.java Mon May 18 18:36:55 2009
@@ -17,66 +17,87 @@
  */
 package org.apache.avro;
 
-import java.io.*;
-import java.util.*;
-import java.nio.ByteBuffer;
-import org.codehaus.jackson.map.JsonNode;
-import junit.framework.TestCase;
-
-import org.apache.avro.io.*;
+import org.apache.avro.Schema.Field;
+import org.apache.avro.generic.GenericArray;
+import org.apache.avro.generic.GenericData;
+import org.apache.avro.generic.GenericDatumReader;
+import org.apache.avro.generic.GenericDatumWriter;
+import org.apache.avro.io.DatumReader;
+import org.apache.avro.io.DatumWriter;
+import org.apache.avro.io.ValueReader;
+import org.apache.avro.io.ValueWriter;
 import org.apache.avro.util.Utf8;
-import org.apache.avro.generic.*;
-import org.apache.avro.Schema.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
 
-public class TestSchema extends TestCase {
+public class TestSchema {
 
   private static final int COUNT =
     Integer.parseInt(System.getProperty("test.count", "10"));
 
+  @Test
   public void testNull() throws Exception {
     check("\"null\"", "null", null);
   }
 
+  @Test
   public void testBoolean() throws Exception {
     check("\"boolean\"", "true", Boolean.TRUE);
   }
 
+  @Test
   public void testString() throws Exception {
     check("\"string\"", "\"foo\"", new Utf8("foo"));
   }
 
+  @Test
   public void testBytes() throws Exception {
     check("\"bytes\"", "\"\"", ByteBuffer.allocate(0));
   }
 
+  @Test
   public void testInt() throws Exception {
     check("\"int\"", "9", new Integer(9));
   }
 
+  @Test
   public void testLong() throws Exception {
     check("\"long\"", "11", new Long(11));
   }
 
+  @Test
   public void testFloat() throws Exception {
     check("\"float\"", "1.1", new Float(1.1));
   }
 
+  @Test
   public void testDouble() throws Exception {
     check("\"double\"", "1.2", new Double(1.2));
   }
 
+  @Test
   public void testArray() throws Exception {
     GenericArray<Long> array = new GenericData.Array<Long>(1);
     array.add(1L);
     check("{\"type\":\"array\", \"items\": \"long\"}", "[1]", array);
   }
 
+  @Test
   public void testMap() throws Exception {
     HashMap<Utf8,Long> map = new HashMap<Utf8,Long>();
     map.put(new Utf8("a"), 1L);
     check("{\"type\":\"map\", \"values\":\"long\"}", "{\"a\":1}", map);
   }
 
+  @Test
   public void testRecord() throws Exception {
     String recordJson = 
       "{\"type\":\"record\",\"fields\":[{\"name\":\"f\", \"type\":\"long\"}]}";
@@ -86,6 +107,7 @@
     check(recordJson, "{\"f\":11}", record);
   }
 
+  @Test
   public void testRecursive() throws Exception {
     check("{\"type\": \"record\", \"name\": \"Node\", \"fields\": ["
           +"{\"name\":\"label\", \"type\":\"string\"},"
@@ -94,6 +116,7 @@
           false);
   }
 
+  @Test
   public void testLisp() throws Exception {
     check("{\"type\": \"record\", \"name\": \"Lisp\", \"fields\": ["
           +"{\"name\":\"value\", \"type\":[\"null\", \"string\","
@@ -103,6 +126,7 @@
           false);
   }
 
+  @Test
   public void testUnion() throws Exception {
     check("[\"string\", \"long\"]", false);
     checkDefault("[\"double\", \"long\"]", "1.1", new Double(1.1));

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/io/TestValueReader.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/io/TestValueReader.java?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/io/TestValueReader.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/io/TestValueReader.java Mon May 18 18:36:55 2009
@@ -17,18 +17,20 @@
  */
 package org.apache.avro.io;
 
+import org.apache.avro.util.Utf8;
+import static org.testng.AssertJUnit.fail;
+import org.testng.annotations.Test;
+
 import java.io.ByteArrayInputStream;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 
-import junit.framework.TestCase;
-
-import org.apache.avro.util.Utf8;
-
 
-public class TestValueReader extends TestCase {
+public class TestValueReader {
   /** Verify EOFException throw at EOF */
+
+  @Test
   public void testEOFHandling() throws IOException {
     InputStream is = new ByteArrayInputStream(new byte[0]);
     ValueReader vr = new ValueReader(is);

Added: hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestInvocationReporter.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestInvocationReporter.java?rev=776049&view=auto
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestInvocationReporter.java (added)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestInvocationReporter.java Mon May 18 18:36:55 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
+package org.apache.avro.test;
+
+import org.testng.IInvokedMethod;
+import org.testng.IInvokedMethodListener;
+import org.testng.ITestResult;
+
+public class TestInvocationReporter implements IInvokedMethodListener {
+
+  public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
+    System.out.println("STARTING " + iInvokedMethod.getTestMethod().getMethodName());
+
+  }
+
+  public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
+    System.out.println("FINISHED " + iInvokedMethod.getTestMethod().getMethodName());
+  }
+}

Added: hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestOutputInterceptor.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestOutputInterceptor.java?rev=776049&view=auto
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestOutputInterceptor.java (added)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestOutputInterceptor.java Mon May 18 18:36:55 2009
@@ -0,0 +1,39 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance+ * with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* 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.
+*/
+
+package org.apache.avro.test;
+
+import org.testng.ITestResult;
+import org.testng.TestListenerAdapter;
+
+public class TestOutputInterceptor extends TestListenerAdapter {
+
+    static String format = "%1$-65s%2$8s ( %3$5s ms)\n";
+
+    @Override
+    public void onTestStart(ITestResult result) {
+    }
+
+    @Override
+    public void onTestSuccess(ITestResult result) {
+        System.out.format(format, result.getMethod().getTestClass().getName() + "." + result.getMethod().getMethodName(), " Pass", (result.getEndMillis() - result.getStartMillis()));
+    }
+
+    @Override
+    public void onTestFailure(ITestResult result) {
+        System.out.format(format, result.getMethod().getTestClass().getName() + "." + result.getMethod().getMethodName(), " Fail", (result.getEndMillis() - result.getStartMillis()));
+    }
+}

Added: hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestSuiteInterceptor.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestSuiteInterceptor.java?rev=776049&view=auto
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestSuiteInterceptor.java (added)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/test/TestSuiteInterceptor.java Mon May 18 18:36:55 2009
@@ -0,0 +1,39 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance+ * with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* 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.
+*/
+
+package org.apache.avro.test;
+
+import org.testng.ISuite;
+import org.testng.ISuiteListener;
+
+public class TestSuiteInterceptor implements ISuiteListener {
+
+    public void onStart(ISuite iSuite) {
+    }
+
+    public void onFinish(ISuite iSuite) {
+        System.out.println("Suite " + iSuite.getName());
+        System.out.print ("Total tests run:");
+        for (String key : iSuite.getResults().keySet()) {
+            System.out.print(" passed " + iSuite.getResults().get(key).getTestContext().getPassedTests().size());
+            System.out.print("; failed " + iSuite.getResults().get(key).getTestContext().getFailedTests().size());
+            System.out.print("; skipped " + iSuite.getResults().get(key).getTestContext().getSkippedTests().size());
+            System.out.println(" in " + (iSuite.getResults().get(key).getTestContext().getEndDate().getSeconds() -
+                    iSuite.getResults().get(key).getTestContext().getStartDate().getSeconds()) + " s.");
+        }
+        System.out.println();
+    }
+}

Modified: hadoop/avro/trunk/src/test/py/testipc.py
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/py/testipc.py?rev=776049&r1=776048&r2=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/py/testipc.py (original)
+++ hadoop/avro/trunk/src/test/py/testipc.py Mon May 18 18:36:55 2009
@@ -21,7 +21,7 @@
 import avro.protocol as protocol
 import avro.schema as schema
 
-PROTOCOL = protocol.parse(open("src/test/schemata/test.js").read())
+PROTOCOL = protocol.parse(open("src/test/schemata/simple.js").read())
 
 class TestProtocol(unittest.TestCase):
 

Copied: hadoop/avro/trunk/src/test/schemata/simple.js (from r776036, hadoop/avro/trunk/src/test/schemata/test.js)
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/schemata/simple.js?p2=hadoop/avro/trunk/src/test/schemata/simple.js&p1=hadoop/avro/trunk/src/test/schemata/test.js&r1=776036&r2=776049&rev=776049&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/schemata/test.js (original)
+++ hadoop/avro/trunk/src/test/schemata/simple.js Mon May 18 18:36:55 2009
@@ -1,5 +1,5 @@
 {"namespace": "org.apache.avro.test",
- "protocol": "Test",
+ "protocol": "Simple",
 
  "types": [
      {"name": "TestRecord", "type": "record",

Propchange: hadoop/avro/trunk/src/test/schemata/simple.js
------------------------------------------------------------------------------
    svn:mergeinfo =