blob: 7b518e7740628dbcaa47dc9cd3e65627d5fea49c [file] [log] [blame]
<!--
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;offline-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/**" />
<include name="**/offline/**" />
</delete>
</target>
<property name="easyant.file" value="${basedir}/sample-module.ivy" />
<ea:loadmodule buildModule="${easyant.file}" />
<target name="setUp" depends="clean" />
<target name="tearDown" depends="clean" />
<target name="test-offline:init">
<au:assertPropertyEquals name="project.buildscope.resolver" value="project.buildscope.repository" />
<au:assertPropertyEquals name="easyant.buildscope.resolver" value="easyant.buildscope.repository" />
<au:assertPropertyEquals name="easyant.offline" value="false" />
<au:assertPropertyEquals name="offline.base.directory" value="${basedir}/offline/" />
</target>
<target name="test-offline:offline:go-offline" depends="offline:go-offline">
<au:assertPropertyEquals name="project.ivy.instance" value="project.ivy.instance" />
<au:assertLogContains text=":: installing junit#junit;4.4 ::" />
<au:assertLogContains text=":: installing in project.buildscope.repository ::" />
<au:assertLogContains text=":: installing in easyant.buildscope.repository ::" />
<au:assertLogContains text=":: installing org.apache.easyant.plugins#rat;0.9 ::" />
<au:assertLogContains text=":: installing org.apache.rat#apache-rat-tasks;0.7 ::" />
<au:assertLogContains text=":: installing org.mortbay.jetty#jetty;6.1.14 ::" />
<property name="ea.repo" value="${offline.base.directory}/repository/easyant.buildscope.repository" />
<property name="project.repo" value="${offline.base.directory}/repository/project.buildscope.repository" />
<au:assertFileExists file="${ea.repo}" />
<au:assertFileExists file="${project.repo}" />
<au:assertFileExists file="${ea.repo}/org.apache.easyant.plugins/rat/0.9/rat.ant" />
<au:assertFileExists file="${ea.repo}/org.apache.easyant.plugins/rat/0.9/rat.ivy" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-tasks/0.7/apache-rat-tasks.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-tasks/0.7/apache-rat-tasks-javadoc.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-tasks/0.7/apache-rat-tasks-sources.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-tasks/0.7/apache-rat-tasks.ivy" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-core/0.7/apache-rat-core.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-core/0.7/apache-rat-core-javadoc.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-core/0.7/apache-rat-core-sources.jar" />
<au:assertFileExists file="${ea.repo}/org.apache.rat/apache-rat-core/0.7/apache-rat-core.ivy" />
<au:assertFileExists file="${project.repo}/junit/junit/4.4/junit.ivy" />
<au:assertFileExists file="${project.repo}/junit/junit/4.4/junit.jar" />
<au:assertFileExists file="${project.repo}/junit/junit/4.4/junit-javadoc.jar" />
<au:assertFileExists file="${project.repo}/junit/junit/4.4/junit-sources.jar" />
<au:assertFileExists file="${project.repo}/org.mortbay.jetty/jetty/6.1.14/jetty-sources.jar" />
<au:assertFileExists file="${project.repo}/org.mortbay.jetty/jetty/6.1.14/jetty.jar" />
<au:assertFileExists file="${project.repo}/org.mortbay.jetty/jetty/6.1.14/jetty.ivy" />
<!-- Test that transitive dependencies have been installed -->
<au:assertFileExists file="${project.repo}/org.mortbay.jetty/jetty-util/6.1.14/jetty-util.jar" />
<au:assertFileExists file="${project.repo}/org.mortbay.jetty/jetty-util/6.1.14/jetty-util.ivy" />
</target>
<target name="prepare-clean">
<mkdir dir="${offline.base.directory}" />
</target>
<target name="test-offline:clean" depends="prepare-clean,offline:clean">
<au:assertFileDoesntExist file="${offline.base.directory}" />
</target>
</project>