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/07 21:33:05 UTC

svn commit: r1370543 - in /incubator/easyant/plugins/trunk/webstart/src: main/resources/webstart.ant test/antunit/common/test-utils.ant test/antunit/foobar.jnlp test/antunit/webstart-test.xml

Author: jlboudart
Date: Tue Aug  7 21:33:04 2012
New Revision: 1370543

URL: http://svn.apache.org/viewvc?rev=1370543&view=rev
Log:
Update webstart plugin with tests and new conventions, tests doesn't works yet through

Added:
    incubator/easyant/plugins/trunk/webstart/src/test/antunit/foobar.jnlp
Removed:
    incubator/easyant/plugins/trunk/webstart/src/test/antunit/common/test-utils.ant
Modified:
    incubator/easyant/plugins/trunk/webstart/src/main/resources/webstart.ant
    incubator/easyant/plugins/trunk/webstart/src/test/antunit/webstart-test.xml

Modified: incubator/easyant/plugins/trunk/webstart/src/main/resources/webstart.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/webstart/src/main/resources/webstart.ant?rev=1370543&r1=1370542&r2=1370543&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/webstart/src/main/resources/webstart.ant (original)
+++ incubator/easyant/plugins/trunk/webstart/src/main/resources/webstart.ant Tue Aug  7 21:33:04 2012
@@ -16,6 +16,7 @@
 -->
 <project name="org.apache.easyant.plugins;webstart" 
         xmlns:ivy="antlib:org.apache.ivy.ant" 
+        xmlns:ac="antlib:net.sf.antcontrib"
         xmlns:ea="antlib:org.apache.easyant">
 
     <ea:core-version requiredrevision="[0.9,+]" />
@@ -31,21 +32,19 @@
        <element name="signFolder" optional="yes"/>
        <sequential>
         <echo>Sign...</echo>
-        <if>
+        <ac:if>
             <isset property="@{keystore}"/>
-            <then>
+            <ac:then>
                 <signjar alias="@{alias}" keypass="@{keypass}" keystore="@{keystore}" storepass="@{storepass}" lazy="@{replaceSign}">
-                    <path>
-                    	<signFolder/>
-                    </path>
+                   <signFolder/>
                 </signjar>
-            </then>
-            <else>
+            </ac:then>
+            <ac:else>
                 <signjar alias="@{alias}" keypass="@{keypass}" storepass="@{storepass}" lazy="@{replaceSign}">
                     <signFolder/>
                 </signjar>
-            </else>
-        </if>
+            </ac:else>
+        </ac:if>
         <echo>Sign done !</echo>
        </sequential>
     </macrodef>
@@ -62,33 +61,31 @@
     <target name="webstart:edit-jnlp" depends="webstart:init" description="edit an existing jnlp file">
         <echo message="[Library directory]: ${lib.main}" level="debug"/>
         <echo message="[libArtifact]: ${target.main.artifact}" level="debug"/>
-        <if>
+        <ac:if>
             <isset property="webstart.flat.path" />
-            <then>
+            <ac:then>
                 <partial-jnlp mainJar="${target.main.artifact}" jnlpFile="${webstart.jnlp.file}">
                     <fileset refid="lib.main.fileset"/>
                 </partial-jnlp>
-            </then>
-            <else>
+            </ac:then>
+            <ac:else>
                 <partial-jnlp mainJar="${target.main.artifact}" jnlpFile="${webstart.jnlp.file}" flatPathResources="${webstart.flat.path}">
                     <fileset refid="lib.main.fileset"/>
                 </partial-jnlp>
-            </else>
-        </if>
+            </ac:else>
+        </ac:if>
     </target>
 
     <target name="webstart:sign" depends="abstract-package:package-finished" if="webstart.sign.jar">
-        <ea:parameter property="webstart.alias" description="the alias signer" />
-        <ea:parameter property="webstart.storepass" description="the keystore password" />
+        <ea:parameter property="webstart.alias" required="true" description="the alias signer" />
+        <ea:parameter property="webstart.storepass" required="true" description="the keystore password" />
         <ea:parameter property="webstart.keypass" default="${webstart.storepass}" description="the key password" />
-        <ea:parameter property="keystore" default=" " description="the path to the keystore" />
+        <ea:parameter property="keystore" default="" description="the path to the keystore" />
         <ea:parameter property="lazy" default="false" description="tell if the already signed jars have to be signed a second time" />
         <signJars alias="${webstart.alias}" storepass="${webstart.storepass}" keypass="${webstart.keypass}" keystore="${webstart.keystore}" lazy="${webstart.lazy}" >
              <signfolder>
                  <fileset refid="lib.main.fileset"/>
-                 <filelist>
-                    <file name="${target.main.artifact}" />
-                 </filelist>
+                 <fileset file="${target.main.artifact}" />
              </signfolder>
         </signJars>
     </target>

Added: incubator/easyant/plugins/trunk/webstart/src/test/antunit/foobar.jnlp
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/webstart/src/test/antunit/foobar.jnlp?rev=1370543&view=auto
==============================================================================
--- incubator/easyant/plugins/trunk/webstart/src/test/antunit/foobar.jnlp (added)
+++ incubator/easyant/plugins/trunk/webstart/src/test/antunit/foobar.jnlp Tue Aug  7 21:33:04 2012
@@ -0,0 +1 @@
+

Modified: incubator/easyant/plugins/trunk/webstart/src/test/antunit/webstart-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/webstart/src/test/antunit/webstart-test.xml?rev=1370543&r1=1370542&r2=1370543&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/webstart/src/test/antunit/webstart-test.xml (original)
+++ incubator/easyant/plugins/trunk/webstart/src/test/antunit/webstart-test.xml Tue Aug  7 21:33:04 2012
@@ -14,14 +14,18 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<project name="org.apache.easyant.plugins;webstart-test" xmlns:au="antlib:org.apache.ant.antunit">
-
-    <!-- disable corerevision checker -->
-    <property name="skip.corerevision.checker" value="true"/>
-
+<project name="org.apache.easyant.plugins;webstart-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/webstart.ant"/>
-
+    <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">
@@ -29,26 +33,58 @@
             <include name="**/lib/**"/>
         </delete>
     </target>
+    
+    <target name="setUp" depends="clean">
+       <property name="target.main.artifact" value="${target}/artifacts/foobar.jar"/>
+       <property name="webstart.jnlp.file" value="${basedir}/foobar.jnlp"/>
+       <property name="skip.register.main.artifact" value="true"/>
+       <property name="webstart.sign.jar" value="true"/>
+       <property name="webstart.alias" value="myalias"/>
+       <property name="webstart.storepass" value="mypass"/>
+
+       <mkdir dir="${target}/artifacts"/>
+       <jar destfile="${target.main.artifact}"/>
+       <mkdir dir="lib/main"/>
+       <echo file="${webstart.jnlp.file}"/>
+    </target>
 
-    <target name="setUp" depends="clean"/>
     <target name="tearDown" depends="clean"/>
+    
+    <target name="test-webstart:init" depends="webstart:init">
+        <au:assertPropertyEquals name="webstart.jnlp.file" value="${basedir}/foobar.jnlp"/>
+        <au:assertPropertyEquals name="webstart.sign.jar" value="true"/>
+<!--TODO: test property not set
+        <au:assertPropertyEquals name="webstart.flat.path" value=""/>
+-->
+        <au:assertPropertyEquals name="target.main.artifact" value="${target}/artifacts/foobar.jar"/>
+        <au:assertReferenceSet refid="lib.main.fileset"/>
+    </target>
+
+    <target name="test-webstart:edit-jnlp" depends="webstart:edit-jnlp">
+        <au:assertLogContains text="[Library directory]: ${lib.main}" level="debug"/>
+        <au:assertLogContains text="[libArtifact]: ${target.main.artifact}" level="debug"/>
+        <!--TODO: test partialjnlp's job -->
+    </target>
+    
+    <target name="test-webstart:sign" depends="webstart:sign">
+        <au:assertPropertyEquals name="webstart.alias" value="myalias"/>
+        <au:assertPropertyEquals name="webstart.storepass" value="mypass"/>
+        <au:assertPropertyEquals name="webstart.keypass" value=""/>
+        <au:assertPropertyEquals name="webstart.keystore" value=""/>
+        <au:assertPropertyEquals name="webstart.lazy" value="false"/>
+        <au:assertLogContains text="Sign..." />
+        <au:assertTrue>
+            <issigned file="${target.main.artifact}"/>
+        </au:assertTrue> 
+        <au:assertLogContains text="Sign done !"/>
+    </target>
+    
+    <target name="test-webstart:prepare" depends="webstart:prepare">
+    </target>
+
+    <target name="test-webstart:run" depends="webstart:run">
+        <!-- TODO: Don't know how to test it yet :) -->
+    </target>
 
-    <!-- init test case -->
-    <target name="testInit">
-        <au:expectfailure expectedMessage="expected property 'jnlp.file': the jnlp to modify">
-            <antcall target="webstart:init"/>
-        </au:expectfailure>
-    </target>
-
-    <!--
-        A sample ant unit test case, 
-        see the antunit official documentation for more informations
-        
-        <target name="testSample" description="a sample of ant unit test case">
-            <au:assertTrue>
-                <matches string="abc" pattern="abc"/>
-            </au:assertTrue>
-        </target>
-    -->
 
 </project>