You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/08/04 21:16:43 UTC

svn commit: r1369446 - in /incubator/easyant/plugins/trunk/rat/src: main/resources/rat.ant test/antunit/rat-test.xml

Author: jlboudart
Date: Sat Aug  4 21:16:42 2012
New Revision: 1369446

URL: http://svn.apache.org/viewvc?rev=1369446&view=rev
Log:
Add rat test case

Modified:
    incubator/easyant/plugins/trunk/rat/src/main/resources/rat.ant
    incubator/easyant/plugins/trunk/rat/src/test/antunit/rat-test.xml

Modified: incubator/easyant/plugins/trunk/rat/src/main/resources/rat.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/rat/src/main/resources/rat.ant?rev=1369446&r1=1369445&r2=1369446&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/rat/src/main/resources/rat.ant (original)
+++ incubator/easyant/plugins/trunk/rat/src/main/resources/rat.ant Sat Aug  4 21:16:42 2012
@@ -24,7 +24,8 @@
         <typedef resource="org/apache/rat/anttasks/antlib.xml"
                  uri="antlib:org.apache.rat.anttasks"
                  classpathref="org.apache.easyant.plugins#rat.classpath" />
-        <ea:parameter property="rat.report.dir" description="directory where rat report will be generated" default="${target.report}/rat"/>
+        <ea:parameter property="target.reports" default="${target}/reports" description="directory where report will be generated"/>
+        <ea:parameter property="rat.report.dir" description="directory where rat report will be generated" default="${target.reports}/rat"/>
         <ea:parameter property="rat.failOnError" description="specify if rat report should fail build if unknown licenses are found" default="true"/> 
         <fileset id="rat.fileset" dir="${basedir}">
             <exclude name=".classpath" />
@@ -38,9 +39,9 @@
     <target name="rat:rat" description="generate rat report" depends="rat:init">
         <mkdir dir="${rat.report.dir}"/>
         <echo>Generating rat report ...</echo>
-        <property name="rat.report" value="${rat.report.dir}/rat-report.txt"/>
+        <ea:parameter property="rat.report.filename" default="rat-report.txt" description="rat report filename"/>
 
-        <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}">
+        <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report.dir}/${rat.report.filename}">
             <fileset refid="rat.fileset"/>
         </rat:report>
 

Modified: incubator/easyant/plugins/trunk/rat/src/test/antunit/rat-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/rat/src/test/antunit/rat-test.xml?rev=1369446&r1=1369445&r2=1369446&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/rat/src/test/antunit/rat-test.xml (original)
+++ incubator/easyant/plugins/trunk/rat/src/test/antunit/rat-test.xml Sat Aug  4 21:16:42 2012
@@ -14,17 +14,18 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<project name="org.apache.easyant.plugins;rat-test" xmlns:au="antlib:org.apache.ant.antunit" xmlns:ivy="antlib:org.apache.ivy.ant">
-
-    <!-- Mocking required phase --> 
-    <path id="org.apache.easyant.plugins#rat.classpath">
-        <fileset dir="../../../lib/main"/>
-    </path>
-    <property name="target.report" value="${basedir}/target/report"/>
-
+<project name="org.apache.easyant.plugins;rat-test" 
+    xmlns:au="antlib:org.apache.ant.antunit" 
+    xmlns:ivy="antlib:org.apache.ivy.ant"
+    xmlns:ea="antlib:org.apache.easyant">
+    
     <!-- Import your plugin --> 
-    <import file="../../main/resources/rat.ant"/>
-
+    <property name="target" value="${basedir}/target/test-antunit"/>
+    <!-- configure easyant in current project -->
+    <ea:configure-easyant-ivy-instance />
+    <!-- import our local plugin -->
+    <ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources"/>
+   
     <!-- Defines a setUp / tearDown (before each test) that cleans the environnement --> 
     <target name="clean" description="remove stale build artifacts before / after each test">
         <delete dir="${basedir}" includeemptydirs="true">
@@ -32,13 +33,22 @@
             <include name="**/lib/**"/>
         </delete>
     </target>
-
+    
     <target name="setUp" depends="clean"/>
     <target name="tearDown" depends="clean"/>
+    
+    <target name="test-rat:init" depends="rat:init">
+        <au:assertPropertyEquals name="target.reports" value="${target}/.reports/rat"/>
+        <au:assertPropertyEquals name="rat.report.dir" value="${target.reports}/rat"/>
+       <au:assertPropertyEquals name="rat.failOnError" value="true"/>
+       <au:assertReferenceSet refid="rat.fileset"/>
+    </target>
 
-    <target name="testRat">
-        <antcall target=":rat" />
+    <target name="test-rat:rat" depends="rat:rat">
+        <au:assertFileExists file="${rat.report.ivy}"/>
         <au:assertLogContains text="Generating rat report ..."/>
+        <au:assertPropertyEquals name="rat.report.filename" value="rat-report.txt"/>
+        <au:assertFileExists file="${rat.report.dir}/${rat.report.filename}"/>
     </target>
 
 </project>