git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116069 13f79535-47bb-0310-9956-ffa450edef68
133 lines
6.2 KiB
XML
133 lines
6.2 KiB
XML
<!--
|
|
/*
|
|
* Copyright 2001-2004 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:j="jelly:core"
|
|
xmlns:assert="assert"
|
|
xmlns:u="jelly:util"
|
|
xmlns:x="jelly:xml">
|
|
|
|
<goal name="testPlugin" prereqs="test-eclipse,test-natures,test-builders,test-natures-and-builders,test-classpath-has-generated-source,test-classpath-has-overridden-jar">
|
|
</goal>
|
|
|
|
<goal name="test-init">
|
|
<j:set var="dotProject" value="${basedir}/.project"/>
|
|
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
|
|
<attainGoal name="eclipse:clean"/>
|
|
</goal>
|
|
|
|
<goal name="test-eclipse">
|
|
<attainGoal name="test-init"/>
|
|
<attainGoal name="eclipse"/>
|
|
|
|
<assert:assertFileExists file="${dotProject}" />
|
|
<assert:assertFileExists file="${dotClasspath}" />
|
|
|
|
<u:file var="classpathFile" name="${dotClasspath}"/>
|
|
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
|
|
<x:set var="countJUnit" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/junit\jars\junit-3.8.1.jar')])"/>
|
|
<assert:assertEquals expected="1" value="${countJUnit.intValue().toString()}" msg="JUnit dependency not found"/>
|
|
<x:set var="countCactus" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/cactus/jars/cactus-13-1.6.1.jar')])"/>
|
|
<assert:assertEquals expected="1" value="${countCactus.intValue().toString()}" msg="More than one Cactus dependencies found"/>
|
|
|
|
</goal>
|
|
|
|
<goal name="test-natures">
|
|
<attainGoal name="test-init"/>
|
|
<j:set var="maven.eclipse.projectnatures" value="n1,a.b.c.n2"/>
|
|
<attainGoal name="eclipse:generate-project"/>
|
|
|
|
<assert:assertFileExists file="${dotProject}" />
|
|
|
|
<u:file var="projectFile" name="${dotProject}"/>
|
|
<x:parse var="projectDoc" xml="${projectFile.toURL()}" />
|
|
<x:set var="natures" select="$projectDoc/projectDescription/natures/nature"/>
|
|
<assert:assertEquals expected="n1" value="${natures[1].text}" msg="n1 is not the second nature"/>
|
|
<assert:assertEquals expected="a.b.c.n2" value="${natures[2].text}" msg="a.b.c.n2 is not the third nature"/>
|
|
</goal>
|
|
|
|
<goal name="test-builders">
|
|
<attainGoal name="test-init"/>
|
|
<j:set var="maven.eclipse.buildcommands" value="c1,c2,c3"/>
|
|
|
|
<attainGoal name="eclipse:generate-project"/>
|
|
|
|
<assert:assertFileExists file="${dotProject}" />
|
|
<u:file var="projectFile" name="${dotProject}"/>
|
|
<x:parse var="projectDoc" xml="${projectFile.toURL()}" />
|
|
<x:set var="builders" select="$projectDoc/projectDescription/buildSpec/buildCommand/name"/>
|
|
|
|
<assert:assertEquals expected="c1" value="${builders[1].text}" msg="c1 is not the second build command name"/>
|
|
<assert:assertEquals expected="c2" value="${builders[2].text}" msg="c2 is not the third build command name"/>
|
|
<assert:assertEquals expected="c3" value="${builders[3].text}" msg="c3 is not the fourth build command name"/>
|
|
</goal>
|
|
|
|
|
|
<goal name="test-natures-and-builders">
|
|
<attainGoal name="test-init"/>
|
|
<j:set var="maven.eclipse.projectnatures" value="n7,n9,n11"/>
|
|
<j:set var="maven.eclipse.buildcommands" value="c11,c21,c31"/>
|
|
<attainGoal name="eclipse:generate-project"/>
|
|
|
|
<assert:assertFileExists file="${dotProject}" />
|
|
<u:file var="projectFile" name="${dotProject}"/>
|
|
<x:parse var="projectDoc" xml="${projectFile.toURL()}" />
|
|
<x:set var="natures" select="$projectDoc/projectDescription/natures/nature"/>
|
|
<x:set var="builders" select="$projectDoc/projectDescription/buildSpec/buildCommand/name"/>
|
|
|
|
<!-- check natures -->
|
|
<assert:assertEquals expected="n7" value="${natures[1].text}" msg="n7 is not the second nature"/>
|
|
<assert:assertEquals expected="n9" value="${natures[2].text}" msg="n9 is not the second nature"/>
|
|
<assert:assertEquals expected="n11" value="${natures[3].text}" msg="n11 is not the second nature"/>
|
|
|
|
<!-- check builders -->
|
|
<assert:assertEquals expected="c11" value="${builders[1].text}" msg="c11 is not the second build command name"/>
|
|
<assert:assertEquals expected="c21" value="${builders[2].text}" msg="c21 is not the second build command name"/>
|
|
<assert:assertEquals expected="c31" value="${builders[3].text}" msg="c31 is not the second build command name"/>
|
|
</goal>
|
|
|
|
<goal name="test-classpath-has-generated-source">
|
|
<attainGoal name="test-init"/>
|
|
<mkdir dir="${maven.gen.src}/gensrc1"/>
|
|
<mkdir dir="${maven.gen.src}/gensrc2"/>
|
|
<attainGoal name="eclipse"/>
|
|
|
|
<assert:assertFileExists file="${dotProject}" />
|
|
<assert:assertFileExists file="${dotClasspath}" />
|
|
|
|
<u:file var="classpathFile" name="${dotClasspath}"/>
|
|
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
|
|
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@kind,'src')])"/>
|
|
<assert:assertEquals expected="3" value="${count.intValue().toString()}" msg="Not enough generated src directories found"/>
|
|
|
|
</goal>
|
|
|
|
<goal name="test-classpath-has-overridden-jar">
|
|
<attainGoal name="test-init"/>
|
|
<attainGoal name="eclipse"/>
|
|
|
|
<assert:assertFileExists file="${dotClasspath}" />
|
|
|
|
<u:file var="classpathFile" name="${dotClasspath}"/>
|
|
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
|
|
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/maven\jars\maven.jar')])"/>
|
|
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="override by jar tag not found"/>
|
|
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/commons-logging\jars\commons-logging-1.0.3.jar')])"/>
|
|
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="maven.jar.override didn't work"/>
|
|
|
|
</goal>
|
|
|
|
</project> |