Added new <code>assert:assertFileContains</code> tag that verifies if a file contains a specific string.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@156960 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:plugin="plugin"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:x="jelly:xml">
|
||||
xmlns:x="jelly:xml"
|
||||
xmlns:assert="assert">
|
||||
|
||||
<j:if test="${bootstrapping == null}">
|
||||
<!-- Poor mans version check - plugin dependencies still suck for multiple versions -->
|
||||
@@ -379,6 +380,16 @@
|
||||
<ant:fail>${file} does not exist.${msg}</ant:fail>
|
||||
</j:if>
|
||||
</define:tag>
|
||||
<define:tag name="assertFileContains">
|
||||
<!-- @file : Full file path -->
|
||||
<!-- @match: the matching value expected -->
|
||||
<!-- @msg : optional message to be displayed -->
|
||||
<assert:assertFileExists file="${file}" msg="${msg}"/>
|
||||
<u:loadText var="fileContent" file="${file}"/>
|
||||
<j:if test="${fileContent.indexOf(match) lt 0}">
|
||||
<ant:fail>${file} does not contain string [${match}].${msg}</ant:fail>
|
||||
</j:if>
|
||||
</define:tag>
|
||||
<define:tag name="assertFileNotFound">
|
||||
<!-- @file : Full file path -->
|
||||
<!-- @msg : optional message to be displayed -->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
* 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.
|
||||
@@ -94,6 +94,15 @@
|
||||
<role>Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Vincent Massol</name>
|
||||
<id>vmassol</id>
|
||||
<email>vmassol@apache.org</email>
|
||||
<organization>Apache Software Foundation</organization>
|
||||
<roles>
|
||||
<role>Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -17,12 +17,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<project xmlns:assert="assert"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util">
|
||||
<project default="testPlugin"
|
||||
xmlns:assert="assert"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:ant="jelly:ant">
|
||||
|
||||
<goal name="testPlugin" prereqs="test-generate-docs">
|
||||
<attainGoal name="clean"/>
|
||||
<goal name="testPlugin" prereqs="clean">
|
||||
<attainGoal name="test-assertFileContains"/>
|
||||
<attainGoal name="test-generate-docs"/>
|
||||
</goal>
|
||||
|
||||
<goal name="test-generate-docs">
|
||||
@@ -30,11 +33,20 @@
|
||||
|
||||
<assert:assertFileExists file="${maven.docs.src}"/>
|
||||
|
||||
<u:tokenize var="fileList" delim=",">navigation.xml,goals.xml,properties.xml,tags.xml</u:tokenize>
|
||||
<u:tokenize var="fileList" delim=",">navigation.xml,goals.xml,properties.xml,tags.xml</u:tokenize>
|
||||
|
||||
<j:forEach var="file" items="${fileList}">
|
||||
<assert:assertFileExists file="${maven.docs.src}/${file}"/>
|
||||
<j:forEach var="file" items="${fileList}">
|
||||
<assert:assertFileExists file="${maven.docs.src}/${file}"/>
|
||||
</j:forEach>
|
||||
<delete dir="${maven.docs.src}"/>
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="test-assertFileContains">
|
||||
<ant:mkdir dir="${maven.build.dir}"/>
|
||||
<j:file name="${maven.build.dir}/testAssertFileContains.txt">This is a test blah blah...</j:file>
|
||||
<assert:assertFileContains file="${maven.build.dir}/testAssertFileContains.txt"
|
||||
match="a test"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
@@ -24,7 +24,11 @@
|
||||
<author email="evenisse@ifrance.com">Emmanuel Venisse</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.6-SNAPSHOT" date="in CVS">
|
||||
<release version="1.6-SNAPSHOT" date="in SVN">
|
||||
<action dev="vmassol" type="add">
|
||||
Added new <code>assert:assertFileContains</code> tag that verifies if a
|
||||
file contains a specific string.
|
||||
</action>
|
||||
<action dev="dion" type="add">Add plugin:generate-tags goal</action>
|
||||
<action dev="dion" type="add">Mention in docs for the plugin:repository-deploy that it uses the artifact plugin</action>
|
||||
</release>
|
||||
|
||||
Reference in New Issue
Block a user