Files
maven-plugins/ant/src/plugin-test/maven.xml
T

51 lines
3.0 KiB
XML

<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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 xmlns:util="jelly:util" xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:assert="assert" xmlns:x="jelly:xml">
<goal name="testPlugin">
<attainGoal name="clean"/>
<attainGoal name="test-ant"/>
</goal>
<goal name="test-ant">
<delete file="${basedir}/build.xml" failonerror="false"/>
<attainGoal name="ant"/>
<assert:assertFileExists file="${basedir}/build.xml"/>
<ant:ant/>
<!-- load build.xml file and check that 'target' property is relative -->
<u:file name="${basedir}/build.xml" var="buildFile"/>
<x:parse var="buildXml" xml="${buildFile.toURL()}"/>
<x:set var="properties" select="$buildXml/project/property"/>
<j:set var="defaulttargetdirName" value="${properties[2].attribute('name').value}"/>
<j:set var="defaulttargetdirValue" value="${properties[2].attribute('value').value}"/>
<assert:assertEquals expected="defaulttargetdir" value="${defaulttargetdirName}" msg="first target is not defaulttargetdir"/>
<assert:assertEquals expected="$${basedir}/target" value="${defaulttargetdirValue}" msg="defaulttargetdir property is not relative"/>
<!-- check obey jar override -->
<x:set var="countJarsDownload" select="count($buildXml/project/target[starts-with(@name,'get-dep')]/get)"/>
<assert:assertEquals expected="2" value="${countJarsDownload.intValue().toString()}" msg="Should only download JUnit and maven-jaxb-plugin jars"/>
<x:set var="countJarsCopy" select="count($buildXml/project/target[starts-with(@name,'get-dep')]/copy)"/>
<assert:assertEquals expected="1" value="${countJarsCopy.intValue().toString()}" msg="Should only copy the activation jar"/>
<!-- check test filesets -->
<x:set var="testFilesetDirs" select="$buildXml/project/target[@name = 'compile-tests']/copy/fileset/@dir"/>
<assert:assertEquals expected="$${basedir}/src/test" value="${testFilesetDirs[0].value}" msg="test fileset dirs are not relative"/>
<assert:assertFileExists file="${maven.build.dest}/directory-1/file1.properties"/>
<assert:assertFileExists file="${maven.build.dest}/file2.properties"/>
<!-- there are no unit test sources present, so the resources wont be copied either
<assert:assertFileExists file="${maven.test.dest}/directory-1/file1.properties"/>
<assert:assertFileExists file="${maven.test.dest}/file2.properties"/-->
</goal>
</project>