incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1366313 - in /incubator/easyant/plugins/trunk/distribution/src: main/resources/distribution.ant test/ test/antunit/ test/antunit/distribution-test.xml
Date Fri, 27 Jul 2012 09:10:40 GMT
Author: jlboudart
Date: Fri Jul 27 09:10:40 2012
New Revision: 1366313

URL: http://svn.apache.org/viewvc?rev=1366313&view=rev
Log:
add distribution test case

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

Modified: incubator/easyant/plugins/trunk/distribution/src/main/resources/distribution.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/distribution/src/main/resources/distribution.ant?rev=1366313&r1=1366312&r2=1366313&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/distribution/src/main/resources/distribution.ant (original)
+++ incubator/easyant/plugins/trunk/distribution/src/main/resources/distribution.ant Fri Jul
27 09:10:40 2012
@@ -86,7 +86,7 @@
         <ea:parameter property="target.distributions" default="${target}/distributions"
description="directory where distribution packages will be generated" />
         <ea:parameter property="project.basedir" default="${basedir}" description="defines
the project base directory" />
         <ea:parameter property="project.prefix" default="" description="defines the project
prefix, used as distribution root directory" />
-        <ea:parameter property="target.artifacts" default="${basedir}/target/artifacts"
description="destination directory for target artifacts"/>
+        <ea:parameter property="target.artifacts" default="${target}/artifacts" description="destination
directory for target artifacts"/>
         <ea:parameter property="project.bin.dir" default="${basedir}/bin" description="directory
of project binaries (scripts, executables, etc...)"/>
         <ea:parameter property="lib.main" default="${basedir}/lib/main" description="directory
where main libraries are picked up" />       
 
@@ -142,22 +142,16 @@
     </target>
 
     <target name="distribution:jar-with-dependencies" depends="distribution:init,-distribution:force-retrieve"
description="create a jar archive which contains the binary output of your project, along
its the unpacked dependencies (only works on jar projects)">
+        <ea:parameter property="target.main.artifact" required="true" description="location
of main artifact"/>
         <condition property="target.main.artifact.exist">
-            <and>
-                <isset property="target.main.artifact"/>
-                <available file="${target.main.artifact}"/>
-            </and>
+            <available file="${target.main.artifact}"/>
         </condition>
         <fail unless="${target.main.artifact.exist}" message="${target.main.artifact}
not found"/>
         <ea:parameter property="bundle.withdependencies.excludes.pattern" default="META-INF/MANIFEST.MF"

                     description="Pattern describing files excluded in the bundle jar with
dependencies" />
         <bundle destfile="${target.distributions}/${module.name}-with-dependencies" archivetype="jar">
-            <zipfileset excludes="${bundle.withdependencies.excludes.pattern}" >
-                <fileset dir="${lib.main}" includes="**/*.jar"/>
-            </zipfileset>
-            <zipfileset>
-                <fileset file="${target.main.artifact}"/>
-            </zipfileset>
+            <zipgroupfileset dir="${lib.main}" includes="**/*.jar"/>
+            <zipgroupfileset file="${target.main.artifact}"/>
         </bundle>
     </target>
 

Added: incubator/easyant/plugins/trunk/distribution/src/test/antunit/distribution-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/distribution/src/test/antunit/distribution-test.xml?rev=1366313&view=auto
==============================================================================
--- incubator/easyant/plugins/trunk/distribution/src/test/antunit/distribution-test.xml (added)
+++ incubator/easyant/plugins/trunk/distribution/src/test/antunit/distribution-test.xml Fri
Jul 27 09:10:40 2012
@@ -0,0 +1,90 @@
+<!--
+   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.
+-->
+<project name="org.apache.easyant.plugins;distribution-test" 
+    xmlns:au="antlib:org.apache.ant.antunit" 
+    xmlns:ivy="antlib:org.apache.ivy.ant"
+    xmlns:ea="antlib:org.apache.easyant">
+    
+    <!-- Import your plugin --> 
+    <property name="target" value="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">
+            <include name="**/target/**"/>
+            <include name="**/lib/**"/>
+        </delete>
+    </target>
+    
+    <target name="setUp" depends="clean">
+       <property name="target.main.artifact" value="${target}/artifacts/foobar.jar"/>
+       <mkdir dir="${target}/artifacts"/>
+       <jar destfile="${target.main.artifact}"/>
+       <mkdir dir="lib/main"/>
+    </target>
+
+    <target name="tearDown" depends="clean"/>
+    
+    <target name="test-distribution:init" depends="distribution:init">
+        <au:assertPropertyEquals name="target.distributions" value="${target}/distributions"/>
+        <au:assertPropertyEquals name="project.basedir" value="${basedir}"/>
+        <au:assertPropertyEquals name="project.prefix" value=""/>
+        <au:assertPropertyEquals name="target.artifacts" value="${target}/artifacts"/>
+        <au:assertPropertyEquals name="project.bin.dir" value="${basedir}/bin"/>
+        <au:assertPropertyEquals name="lib.main" value="${basedir}/lib/main"/>
+        <au:assertReferenceSet refid="project.artifacts.zipfileset"/>
+        <au:assertReferenceSet refid="project.dependencies.zipfileset"/>
+        <au:assertReferenceSet refid="project.executables.zipfileset"/>
+        <au:assertReferenceSet refid="project.documentation.zipfileset"/>
+        <au:assertReferenceSet refid="project.additionalfiles.zipfileset"/>
+        <au:assertReferenceSet refid="project.allfiles.zipfileset"/>
+        <au:assertFileExists file="${target.distributions}"/>
+    </target>
+
+    <target name="prepare-clean" depends="distribution:init">
+        <mkdir dir="${target.distributions}"/>
+    </target>
+
+    <target name="test-distribution:clean" depends="prepare-clean,distribution:clean">
+        <au:assertFileDoesntExist file="${target.distributions}"/>
+    </target>
+    
+    <target name="test-distribution:force-retrieve" depends="-distribution:force-retrieve">
+        <au:assertPropertyEquals name="retrieve.dependencies" value="true"/>
+    </target>
+    
+    <target name="test-distribution:bin" depends="distribution:bin">
+        <au:assertFileExists file="${target.distributions}/${module.name}-bin.zip"/>
+        <au:assertFileExists file="${target.distributions}/${module.name}-bin.zip.MD5"/>
+    </target>
+
+    <target name="test-distribution:jar-with-dependencies" depends="distribution:jar-with-dependencies">
+        <au:assertFileExists file="${target.distributions}/${module.name}-with-dependencies.jar"/>
+        <au:assertFileExists file="${target.distributions}/${module.name}-with-dependencies.jar.MD5"/>
+ 
+    </target>
+
+    <target name="test-distribution:source" depends="distribution:source">
+        <au:assertFileExists file="${target.distributions}/${module.name}-source.zip"/>
+        <au:assertFileExists file="${target.distributions}/${module.name}-source.zip.MD5"/>
+    </target>
+
+</project>



Mime
View raw message