You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by co...@apache.org on 2009/11/13 04:58:31 UTC

svn commit: r835728 - in /hadoop/hdfs/trunk: CHANGES.txt build.xml ivy.xml ivy/libraries.properties src/test/unit/

Author: cos
Date: Fri Nov 13 03:58:31 2009
New Revision: 835728

URL: http://svn.apache.org/viewvc?rev=835728&view=rev
Log:
HDFS-669. Add unit tests framework (Mockito). Contributed by Konstantin Boudnik, Eli Collins.

Added:
    hadoop/hdfs/trunk/src/test/unit/
Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/build.xml
    hadoop/hdfs/trunk/ivy.xml
    hadoop/hdfs/trunk/ivy/libraries.properties

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=835728&r1=835727&r2=835728&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Nov 13 03:58:31 2009
@@ -26,6 +26,8 @@
 
     HDFS-754. Reduce ivy console output to ovservable level (cos)
 
+    HDFS-699. Add unit tests framework (Mockito) (cos, Eli Collins)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/hdfs/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/build.xml?rev=835728&r1=835727&r2=835728&view=diff
==============================================================================
--- hadoop/hdfs/trunk/build.xml (original)
+++ hadoop/hdfs/trunk/build.xml Fri Nov 13 03:58:31 2009
@@ -353,7 +353,7 @@
     <mkdir dir="${test.hdfs.build.classes}"/>
     <javac 
       encoding="${build.encoding}" 
-      srcdir="${test.src.dir}/hdfs"
+      srcdir="${test.src.dir}/hdfs;${test.src.dir}/unit"
       includes="org/apache/hadoop/**/*.java"
       destdir="${test.hdfs.build.classes}"
       debug="${javac.debug}"
@@ -489,6 +489,7 @@
   <!-- ================================================================== -->
   <macrodef name="macro-test-runner">
     <attribute name="test.file" />
+    <attribute name="suite.type" />
     <sequential>
       <delete dir="${test.build.data}"/>
       <mkdir dir="${test.build.data}"/>
@@ -520,7 +521,7 @@
         </syspropertyset>
         <formatter type="${test.junit.output.format}" />
         <batchtest todir="${test.build.dir}" if="tests.notestcase">
-          <fileset dir="${test.src.dir}/hdfs" excludes="**/${test.exclude}.java">
+          <fileset dir="${test.src.dir}/@{suite.type}" excludes="**/${test.exclude}.java">
              <patternset>
                <includesfile name="@{test.file}"/>
              </patternset>
@@ -532,7 +533,7 @@
             excludes="**/${test.exclude}.java" />
         </batchtest>
         <batchtest todir="${test.build.dir}" if="tests.testcase">
-          <fileset dir="${test.src.dir}/hdfs" includes="**/${testcase}.java"/>
+          <fileset dir="${test.src.dir}/@{suite.type}" includes="**/${testcase}.java"/>
         </batchtest>
         <batchtest todir="${test.build.dir}" if="tests.testcase.fi">
           <fileset dir="${test.src.dir}/aop" includes="**/${testcase}.java"/>
@@ -548,11 +549,15 @@
   </macrodef>
 
   <target name="run-test-hdfs" depends="compile-hdfs-test" description="Run full set of hdfs unit tests">
-    <macro-test-runner test.file="${test.hdfs.all.tests.file}" />
+    <macro-test-runner test.file="${test.hdfs.all.tests.file}" suite.type="hdfs"/>
   </target>
 
   <target name="run-commit-test" depends="compile-hdfs-test" description="Run approximate 10-minute set of unit tests prior to commiting">
-     <macro-test-runner test.file="${test.hdfs.commit.tests.file}" />
+     <macro-test-runner test.file="${test.hdfs.commit.tests.file}" suite.type="hdfs"/>
+  </target>
+
+  <target name="run-test-unit" depends="compile-hdfs-test" description="Run unit tests">
+    <macro-test-runner test.file="${test.hdfs.all.tests.file}" suite.type="unit"/>
   </target>
 
   <target name="checkfailure" if="tests.failed">
@@ -573,6 +578,7 @@
     <delete file="${test.build.dir}/testsfailed"/>
     <property name="continueOnFailure" value="true"/>
     <antcall target="run-test-hdfs"/>
+    <antcall target="run-test-unit"/>
     <antcall target="run-test-hdfs-fault-inject"/>
     <available file="${test.build.dir}/testsfailed" property="testsfailed"/>
     <fail if="testsfailed">Tests failed!</fail>

Modified: hadoop/hdfs/trunk/ivy.xml
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/ivy.xml?rev=835728&r1=835727&r2=835728&view=diff
==============================================================================
--- hadoop/hdfs/trunk/ivy.xml (original)
+++ hadoop/hdfs/trunk/ivy.xml Fri Nov 13 03:58:31 2009
@@ -76,6 +76,8 @@
 
     <dependency org="org.apache.lucene" name="lucene-core" rev="${lucene-core.version}" conf="javadoc->default"/> 
 
+    <dependency org="org.mockito" name="mockito-all" rev="${mockito-all.version}" conf="common->master"/>
+
    </dependencies>
   
 </ivy-module>

Modified: hadoop/hdfs/trunk/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/ivy/libraries.properties?rev=835728&r1=835727&r2=835728&view=diff
==============================================================================
--- hadoop/hdfs/trunk/ivy/libraries.properties (original)
+++ hadoop/hdfs/trunk/ivy/libraries.properties Fri Nov 13 03:58:31 2009
@@ -76,3 +76,5 @@
 xerces.version=1.4.4
 
 aspectj.version=1.6.4
+
+mockito-all.version=1.8.0