incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1366415 - in /incubator/easyant/plugins/trunk/ivy-repo-management/src: main/resources/ivy-repo-management.ant test/ test/antunit/ test/antunit/ivy-repo-management-test.xml
Date Fri, 27 Jul 2012 15:22:38 GMT
Author: jlboudart
Date: Fri Jul 27 15:22:37 2012
New Revision: 1366415

URL: http://svn.apache.org/viewvc?rev=1366415&view=rev
Log:
Add ivy-repo-management test case

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

Modified: incubator/easyant/plugins/trunk/ivy-repo-management/src/main/resources/ivy-repo-management.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/ivy-repo-management/src/main/resources/ivy-repo-management.ant?rev=1366415&r1=1366414&r2=1366415&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/ivy-repo-management/src/main/resources/ivy-repo-management.ant
(original)
+++ incubator/easyant/plugins/trunk/ivy-repo-management/src/main/resources/ivy-repo-management.ant
Fri Jul 27 15:22:37 2012
@@ -25,7 +25,7 @@
         <ea:parameter property="install.override" default="false" description="specify
if the install targets should override an artifact on a repository if it already exists" />
         <ea:parameter property="install.ivy.template" default="${org.apache.easyant.plugins#ivy-repo-management.ivy.xml.tpl.file}"
description="specify a template ivy file used when you call install-artifact" />
         <ea:parameter property="install.temp.directory" default="${target}/install" description="specify
a temporary directory used to make replacement in the template ivy file" />
-        <ea:parameter property="install.status" default="integration" description="specify
the status of the artifact that will be installed with the install-artifact target" />
+        <ea:parameter property="install.status" default="release" description="specify
the status of the artifact that will be installed with the install-artifact target" />
         <ea:parameter property="install.interactive.mode" default="true" description="specify
if easyant should ask questions instead of using -Dproperties" />
         <condition property="install.is.interactive">
             <istrue value="${install.interactive.mode}"/>
@@ -116,7 +116,7 @@
         <echo message="Creating ivy temp directory in ${install.temp.directory}" />
         <mkdir dir="${install.temp.directory}" />
 
-        <echo message="Copying ${artifact} in  the ivy temp directory" />
+        <echo message="Copying ${artifact} in the ivy temp directory" />
         <copy file="${artifact}" tofile="${install.temp.directory}/${artifact.to.install.file}"
overwrite="true" />
 
         <echo message="Generating ivy file for ${artifact}" />

Added: incubator/easyant/plugins/trunk/ivy-repo-management/src/test/antunit/ivy-repo-management-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/ivy-repo-management/src/test/antunit/ivy-repo-management-test.xml?rev=1366415&view=auto
==============================================================================
--- incubator/easyant/plugins/trunk/ivy-repo-management/src/test/antunit/ivy-repo-management-test.xml
(added)
+++ incubator/easyant/plugins/trunk/ivy-repo-management/src/test/antunit/ivy-repo-management-test.xml
Fri Jul 27 15:22:37 2012
@@ -0,0 +1,98 @@
+<!--
+   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;ivy-repo-management-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="${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">
+            <include name="**/target/**"/>
+            <include name="**/lib/**"/>
+        </delete>
+    </target>
+    
+    <target name="setUp" depends="clean">
+      <property name="ivy.local.default.root" value="${target}/local-repo"/>
+      <property name="ivy.shared.default.root" value="${target}/shared-repo"/>
+      <ivy:settings id="project.ivy.instance"/>
+      <property name="install.interactive.mode" value="false"/>
+    </target>
+    <target name="tearDown" depends="clean"/>
+    
+    <target name="test-ivy-repo-management:init" depends="ivy-repo-management:init">
+        <au:assertPropertyEquals name="project.ivy.instance" value="project.ivy.instance"/>
+        <au:assertPropertyEquals name="default.from.resolver" value="public"/>
+        <au:assertPropertyEquals name="default.to.resolver" value="local"/>
+        <au:assertPropertyEquals name="install.override" value="false"/>
+        <au:assertPropertyEquals name="install.ivy.template" value="${org.apache.easyant.plugins#ivy-repo-management.ivy.xml.tpl.file}"/>
+        <au:assertPropertyEquals name="install.temp.directory" value="${target}/install"/>
+        <au:assertPropertyEquals name="install.status" value="release"/>
+        <au:assertPropertyEquals name="install.interactive.mode" value="false"/>
+        <au:assertPropertyEquals name="is.project.ivy.settings.configured" value="true"/>
+    </target>
+    
+    <target name="test-ivy-repo-management:check-interactive-mode" depends="-ivy-repo-management:check-interactive-mode">
+        <au:assertPropertyEquals name="from.resolver" value="${default.from.resolver}"/>
+        <au:assertPropertyEquals name="to.resolver" value="${default.to.resolver}"/>
+    </target>
+    
+    <target name="prepare-copy-artifact">
+        <property name="org" value="junit"/>
+        <property name="module" value="junit"/>
+        <property name="rev" value="4.4"/>
+    </target>
+
+    <target name="test-ivy-repo-management:copy-artifact" depends="prepare-copy-artifact,
ivy-repo-management:copy-artifact">
+        <au:assertLogContains text=":: installing junit#junit;4.4 ::"/>
+        <au:assertLogContains text=":: installing in local ::"/>
+        <au:assertLogContains text="publish commited"/>
+    </target>
+
+    <target name="prepare-install-artifact">
+        <property name="org" value="junit"/>
+        <property name="module" value="junit"/>
+        <property name="rev" value="4.4"/>
+        <property name="artifact" value="../../../module.ivy"/>
+         
+    </target>
+
+
+    <target name="test-ivy-repo-management:install-artifact" depends="prepare-install-artifact,
ivy-repo-management:install-artifact">
+        <!-- workaround since assertLogContains doesn't seems to support text containing
properties -->
+        <property name="antunit.log" value="${target}/antunit.log"/>
+        <copy tofile="${target}/antunit.log" outputencoding="UTF-8">
+            <au:logcontent/>
+        </copy>
+        <au:assertResourceContains resource="${antunit.log}" value="Creating ivy temp
directory in ${install.temp.directory}"/>
+        <au:assertFileExists file="${install.temp.directory}"/>
+        <au:assertResourceContains resource="${antunit.log}" value="Copying ${artifact}
in the ivy temp directory"/>
+        <au:assertResourceContains resource="${antunit.log}" value="Generating ivy file
for ${artifact}"/>
+        <au:assertResourceContains resource="${antunit.log}" value="Publishing artifact
in ${to.resolver} repository"/>
+        <au:assertResourceContains resource="${antunit.log}" value="Cleaning ${install.temp.directory}"/>
+        <au:assertResourceContains resource="${antunit.log}" value="${artifact.to.install.file}
succefully installed in your ${to.resolver} repository"/>
+
+    </target>
+</project>



Mime
View raw message