Skip to content

Commit 3da6db7

Browse files
[MDEP-935] Improvement ITs for dependency:tree
- add tests for excludes and scope
1 parent bd94ad9 commit 3da6db7

File tree

20 files changed

+412
-167
lines changed

20 files changed

+412
-167
lines changed

pom.xml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,7 @@ under the License.
445445
These files contain results for integration tests which can't contain license header
446446
otherwise the IT's will fail.
447447
-->
448-
<exclude>src/it/projects/tree/expected.txt</exclude>
449-
<exclude>src/it/projects/tree-includes/expected.txt</exclude>
450-
<exclude>src/it/projects/tree-multimodule/expected.txt</exclude>
451-
<exclude>src/it/projects/tree-multimodule/module-a/expected.txt</exclude>
452-
<exclude>src/it/projects/tree-multimodule/module-b/expected.txt</exclude>
453-
<exclude>src/it/projects/tree-verbose-multimodule/expected.txt</exclude>
454-
<exclude>src/it/projects/tree-verbose-multimodule/module-a/expected.txt</exclude>
455-
<exclude>src/it/projects/tree-verbose-multimodule/module-b/expected.txt</exclude>
456-
<exclude>src/it/projects/tree-verbose/expected*.txt</exclude>
457-
<exclude>src/it/projects/tree-verbose-small/expected.txt</exclude>
448+
<exclude>src/it/projects/**/expected*.txt</exclude>
458449
<!-- These files contain expected versions for unit tests -->
459450
<exclude>src/test/resources/unit/verbose-serializer-test/*</exclude>
460451
<!--
@@ -513,6 +504,7 @@ under the License.
513504
<filterProperties>
514505
<compilerPluginVersion>3.11.0</compilerPluginVersion>
515506
</filterProperties>
507+
<addTestClassPath>true</addTestClassPath>
516508
</configuration>
517509
<dependencies>
518510
<!-- dependencies used only in verification scripts -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT
2+
\- org.apache.maven:maven-project:jar:2.0.6:compile
3+
+- org.apache.maven:maven-settings:jar:2.0.6:compile
4+
+- org.apache.maven:maven-profile:jar:2.0.6:compile
5+
+- org.apache.maven:maven-model:jar:2.0.6:compile
6+
+- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
7+
| +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
8+
| \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
9+
+- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
10+
+- org.apache.maven:maven-artifact:jar:2.0.6:compile
11+
\- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
12+
+- junit:junit:jar:3.8.1:compile
13+
\- classworlds:classworlds:jar:1.1-alpha-2:compile
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:tree

src/it/projects/tree-excluded/pom.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project xmlns="http://maven.apache.org/POM/4.0.0"
22+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<groupId>org.apache.maven.its.dependency</groupId>
27+
<artifactId>test</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
30+
<name>dependency:tree -Dexcludes</name>
31+
<description>
32+
Test dependency:tree -Dexcludes=...
33+
</description>
34+
35+
<properties>
36+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37+
</properties>
38+
39+
<dependencies>
40+
<dependency>
41+
<groupId>org.apache.maven</groupId>
42+
<artifactId>maven-project</artifactId>
43+
<version>2.0.6</version>
44+
</dependency>
45+
</dependencies>
46+
47+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
outputFile = target/tree.txt
19+
excludes = org.codehaus.plexus:*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import static org.assertj.core.api.Assertions.assertThat
21+
22+
assertThat(new File(basedir, "target/tree.txt"))
23+
.hasSameTextualContentAs(new File(basedir, "expected.txt"))
24+
25+
return true
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import static org.assertj.core.api.Assertions.assertThat
21+
22+
assertThat(new File(basedir, "target/tree.txt"))
23+
.hasSameTextualContentAs(new File(basedir, "expected.txt"))
24+
25+
return true

src/it/projects/tree-multimodule/verify.bsh

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/it/projects/tree-includes/verify.bsh renamed to src/it/projects/tree-multimodule/verify.groovy

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717
* under the License.
1818
*/
1919

20-
import java.io.*;
20+
import static org.assertj.core.api.Assertions.assertThat
2121

22-
import org.codehaus.plexus.util.*;
22+
assertThat(new File(basedir, "target/tree.txt"))
23+
.hasSameTextualContentAs(new File(basedir, "expected.txt"))
2324

24-
String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) );
25-
String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) );
25+
assertThat(new File(basedir, "module-a/target/tree.txt"))
26+
.hasSameTextualContentAs(new File(basedir, "module-a/expected.txt"))
2627

27-
actual = actual.replaceAll( "[\n\r]+", "\n" );
28-
expected = expected.replaceAll( "[\n\r]+", "\n" );
29-
30-
System.out.println( "Checking dependency tree..." );
31-
32-
if ( !actual.equals( expected ) )
33-
{
34-
throw new Exception( "Unexpected dependency tree" );
35-
}
28+
assertThat(new File(basedir, "module-b/target/tree.txt"))
29+
.hasSameTextualContentAs(new File(basedir, "module-b/expected.txt"))
3630

3731
return true;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT
2+
\- org.apache.maven:maven-core:jar:3.6.3:compile
3+
+- org.apache.maven:maven-model:jar:3.6.3:compile
4+
+- org.apache.maven:maven-settings:jar:3.6.3:compile
5+
+- org.apache.maven:maven-settings-builder:jar:3.6.3:compile
6+
| +- org.codehaus.plexus:plexus-interpolation:jar:1.25:compile
7+
| \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:compile
8+
| \- org.sonatype.plexus:plexus-cipher:jar:1.4:compile
9+
+- org.apache.maven:maven-builder-support:jar:3.6.3:compile
10+
+- org.apache.maven:maven-repository-metadata:jar:3.6.3:compile
11+
+- org.apache.maven:maven-artifact:jar:3.6.3:compile
12+
+- org.apache.maven:maven-plugin-api:jar:3.6.3:compile
13+
+- org.apache.maven:maven-model-builder:jar:3.6.3:compile
14+
+- org.apache.maven:maven-resolver-provider:jar:3.6.3:compile
15+
+- org.apache.maven.resolver:maven-resolver-impl:jar:1.4.1:compile
16+
+- org.apache.maven.resolver:maven-resolver-api:jar:1.4.1:compile
17+
+- org.apache.maven.resolver:maven-resolver-spi:jar:1.4.1:compile
18+
+- org.apache.maven.resolver:maven-resolver-util:jar:1.4.1:compile
19+
+- org.apache.maven.shared:maven-shared-utils:jar:3.2.1:compile
20+
| \- commons-io:commons-io:jar:2.5:compile
21+
+- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.4:compile
22+
| \- javax.enterprise:cdi-api:jar:1.0:compile
23+
| \- javax.annotation:jsr250-api:jar:1.0:compile
24+
+- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.4:compile
25+
+- com.google.inject:guice:jar:no_aop:4.2.1:compile
26+
| +- aopalliance:aopalliance:jar:1.0:compile
27+
| \- com.google.guava:guava:jar:25.1-android:compile
28+
| +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
29+
| +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
30+
| +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
31+
| +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
32+
| \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
33+
+- javax.inject:javax.inject:jar:1:compile
34+
+- org.codehaus.plexus:plexus-utils:jar:3.2.1:compile
35+
+- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
36+
+- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
37+
\- org.apache.commons:commons-lang3:jar:3.8.1:compile
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT
2+
+- org.apache.maven:maven-core:jar:3.6.3:compile
3+
| +- org.apache.maven:maven-model:jar:3.6.3:compile
4+
| +- org.apache.maven:maven-settings:jar:3.6.3:compile
5+
| +- org.apache.maven:maven-settings-builder:jar:3.6.3:compile
6+
| | +- org.codehaus.plexus:plexus-interpolation:jar:1.25:compile
7+
| | \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:compile
8+
| | \- org.sonatype.plexus:plexus-cipher:jar:1.4:compile
9+
| +- org.apache.maven:maven-builder-support:jar:3.6.3:compile
10+
| +- org.apache.maven:maven-repository-metadata:jar:3.6.3:compile
11+
| +- org.apache.maven:maven-artifact:jar:3.6.3:compile
12+
| +- org.apache.maven:maven-plugin-api:jar:3.6.3:compile
13+
| +- org.apache.maven:maven-model-builder:jar:3.6.3:compile
14+
| +- org.apache.maven:maven-resolver-provider:jar:3.6.3:compile
15+
| +- org.apache.maven.resolver:maven-resolver-impl:jar:1.4.1:compile
16+
| +- org.apache.maven.resolver:maven-resolver-api:jar:1.4.1:compile
17+
| +- org.apache.maven.resolver:maven-resolver-spi:jar:1.4.1:compile
18+
| +- org.apache.maven.resolver:maven-resolver-util:jar:1.4.1:compile
19+
| +- org.apache.maven.shared:maven-shared-utils:jar:3.2.1:compile
20+
| | \- commons-io:commons-io:jar:2.5:compile
21+
| +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.4:compile
22+
| | \- javax.enterprise:cdi-api:jar:1.0:compile
23+
| | \- javax.annotation:jsr250-api:jar:1.0:compile
24+
| +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.4:compile
25+
| +- com.google.inject:guice:jar:no_aop:4.2.1:compile
26+
| | +- aopalliance:aopalliance:jar:1.0:compile
27+
| | \- com.google.guava:guava:jar:25.1-android:compile
28+
| | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
29+
| | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
30+
| | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
31+
| | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
32+
| | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
33+
| +- javax.inject:javax.inject:jar:1:compile
34+
| +- org.codehaus.plexus:plexus-utils:jar:3.2.1:compile
35+
| +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
36+
| +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
37+
| \- org.apache.commons:commons-lang3:jar:3.8.1:compile
38+
\- org.slf4j:slf4j-simple:jar:2.0.13:test
39+
\- org.slf4j:slf4j-api:jar:2.0.13:compile
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals.1 = ${project.groupId}:${project.artifactId}:${project.version}:tree
19+
invoker.systemPropertiesFile.1 = test1.properties
20+
21+
invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:tree
22+
invoker.systemPropertiesFile.2 = test2.properties

0 commit comments

Comments
 (0)