o Strengthened test to check both direct and non-direct optional dependencies

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@961815 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-07-08 15:40:46 +00:00
parent 2786d04a59
commit 2b0eae3e20
6 changed files with 101 additions and 5 deletions

View File

@ -40,7 +40,8 @@ public class MavenITmng0947OptionalDependencyTest
}
/**
* Verify that optional dependencies of a project's direct dependencies are excluded from the project class path.
* Verify that direct optional dependencies are included in the project class paths while transitive optional
* dependencies are excluded.
*/
public void testit()
throws Exception
@ -59,15 +60,21 @@ public class MavenITmng0947OptionalDependencyTest
verifier.resetStreams();
List compile = verifier.loadLines( "target/compile.txt", "UTF-8" );
assertEquals( 0, compile.size() );
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
assertEquals( 2, compile.size() );
List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" );
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) );
assertEquals( 1, runtime.size() );
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
assertEquals( 3, runtime.size() );
List test = verifier.loadLines( "target/test.txt", "UTF-8" );
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) );
assertEquals( 1, test.size() );
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
assertEquals( 3, test.size() );
}
}

View File

@ -28,7 +28,8 @@ under the License.
<name>Maven Integration Test :: MNG-947</name>
<description>
Verify that optional dependencies of a project's direct dependencies are excluded from the project class path.
Verify that direct optional dependencies are included in the project class paths while transitive optional
dependencies are excluded.
</description>
<dependencies>
@ -38,6 +39,13 @@ under the License.
<version>0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng0947</groupId>
<artifactId>e</artifactId>
<version>0.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng0947</groupId>
<artifactId>d</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng0947</groupId>
<artifactId>e</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng0947</groupId>
<artifactId>d</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>