This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch MDEP-935 in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 053841de6379df82928288bc4c6609050466d796 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Fri May 31 08:48:41 2024 +0200 [MDEP-935] Improvement ITs for dependency:tree - add tests for excludes and scope --- pom.xml | 12 +---- src/it/projects/tree-excluded/expected.txt | 13 +++++ src/it/projects/tree-excluded/invoker.properties | 18 +++++++ src/it/projects/tree-excluded/pom.xml | 47 ++++++++++++++++ src/it/projects/tree-excluded/test.properties | 19 +++++++ .../verify.bsh => tree-excluded/verify.groovy} | 20 ++----- .../tree-includes/{verify.bsh => verify.groovy} | 20 ++----- src/it/projects/tree-multimodule/verify.bsh | 63 ---------------------- .../verify.bsh => tree-multimodule/verify.groovy} | 20 +++---- src/it/projects/tree-scope/expected1.txt | 37 +++++++++++++ src/it/projects/tree-scope/expected2.txt | 39 ++++++++++++++ src/it/projects/tree-scope/invoker.properties | 22 ++++++++ src/it/projects/tree-scope/pom.xml | 55 +++++++++++++++++++ src/it/projects/tree-scope/test1.properties | 19 +++++++ src/it/projects/tree-scope/test2.properties | 19 +++++++ .../verify.bsh => tree-scope/verify.groovy} | 18 +++---- .../projects/tree-verbose-multimodule/verify.bsh | 57 -------------------- .../verify.groovy} | 19 +++---- .../verify.groovy} | 20 ++----- .../verify.bsh => tree-verbose/verify.groovy} | 20 ++----- 20 files changed, 326 insertions(+), 231 deletions(-) diff --git a/pom.xml b/pom.xml index b7caf1b0..b447742a 100644 --- a/pom.xml +++ b/pom.xml @@ -445,16 +445,7 @@ under the License. These files contain results for integration tests which can't contain license header otherwise the IT's will fail. --> - <exclude>src/it/projects/tree/expected.txt</exclude> - <exclude>src/it/projects/tree-includes/expected.txt</exclude> - <exclude>src/it/projects/tree-multimodule/expected.txt</exclude> - <exclude>src/it/projects/tree-multimodule/module-a/expected.txt</exclude> - <exclude>src/it/projects/tree-multimodule/module-b/expected.txt</exclude> - <exclude>src/it/projects/tree-verbose-multimodule/expected.txt</exclude> - <exclude>src/it/projects/tree-verbose-multimodule/module-a/expected.txt</exclude> - <exclude>src/it/projects/tree-verbose-multimodule/module-b/expected.txt</exclude> - <exclude>src/it/projects/tree-verbose/expected*.txt</exclude> - <exclude>src/it/projects/tree-verbose-small/expected.txt</exclude> + <exclude>src/it/projects/**/expected*.txt</exclude> <!-- These files contain expected versions for unit tests --> <exclude>src/test/resources/unit/verbose-serializer-test/*</exclude> <!-- @@ -513,6 +504,7 @@ under the License. <filterProperties> <compilerPluginVersion>3.11.0</compilerPluginVersion> </filterProperties> + <addTestClassPath>true</addTestClassPath> </configuration> <dependencies> <!-- dependencies used only in verification scripts --> diff --git a/src/it/projects/tree-excluded/expected.txt b/src/it/projects/tree-excluded/expected.txt new file mode 100644 index 00000000..38be1dd0 --- /dev/null +++ b/src/it/projects/tree-excluded/expected.txt @@ -0,0 +1,13 @@ +org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT +\- org.apache.maven:maven-project:jar:2.0.6:compile + +- org.apache.maven:maven-settings:jar:2.0.6:compile + +- org.apache.maven:maven-profile:jar:2.0.6:compile + +- org.apache.maven:maven-model:jar:2.0.6:compile + +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile + | +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile + | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile + +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile + +- org.apache.maven:maven-artifact:jar:2.0.6:compile + \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile + +- junit:junit:jar:3.8.1:compile + \- classworlds:classworlds:jar:1.1-alpha-2:compile diff --git a/src/it/projects/tree-excluded/invoker.properties b/src/it/projects/tree-excluded/invoker.properties new file mode 100644 index 00000000..afb73d25 --- /dev/null +++ b/src/it/projects/tree-excluded/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:tree diff --git a/src/it/projects/tree-excluded/pom.xml b/src/it/projects/tree-excluded/pom.xml new file mode 100644 index 00000000..dac11a5b --- /dev/null +++ b/src/it/projects/tree-excluded/pom.xml @@ -0,0 +1,47 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.dependency</groupId> + <artifactId>test</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>dependency:tree -Dexcludes</name> + <description> + Test dependency:tree -Dexcludes=... + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0.6</version> + </dependency> + </dependencies> + +</project> diff --git a/src/it/projects/tree-excluded/test.properties b/src/it/projects/tree-excluded/test.properties new file mode 100644 index 00000000..42a01ce2 --- /dev/null +++ b/src/it/projects/tree-excluded/test.properties @@ -0,0 +1,19 @@ +# 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. + +outputFile = target/tree.txt +excludes = org.codehaus.plexus:* diff --git a/src/it/projects/tree-includes/verify.bsh b/src/it/projects/tree-excluded/verify.groovy similarity index 63% copy from src/it/projects/tree-includes/verify.bsh copy to src/it/projects/tree-excluded/verify.groovy index 39689aba..b79d25ba 100644 --- a/src/it/projects/tree-includes/verify.bsh +++ b/src/it/projects/tree-excluded/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree" ); -} - -return true; +return true diff --git a/src/it/projects/tree-includes/verify.bsh b/src/it/projects/tree-includes/verify.groovy similarity index 63% copy from src/it/projects/tree-includes/verify.bsh copy to src/it/projects/tree-includes/verify.groovy index 39689aba..b79d25ba 100644 --- a/src/it/projects/tree-includes/verify.bsh +++ b/src/it/projects/tree-includes/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree" ); -} - -return true; +return true diff --git a/src/it/projects/tree-multimodule/verify.bsh b/src/it/projects/tree-multimodule/verify.bsh deleted file mode 100644 index a4fce7ed..00000000 --- a/src/it/projects/tree-multimodule/verify.bsh +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -import java.io.*; - -import org.codehaus.plexus.util.*; - -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking root dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected root dependency tree" ); -} - -actual = FileUtils.fileRead( new File( basedir, "module-a/target/tree.txt" ) ); -expected = FileUtils.fileRead( new File( basedir, "module-a/expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking module-a dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected module-a dependency tree" ); -} - -actual = FileUtils.fileRead( new File( basedir, "module-b/target/tree.txt" ) ); -expected = FileUtils.fileRead( new File( basedir, "module-b/expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking module-b dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected module-b dependency tree" ); -} - -return true; diff --git a/src/it/projects/tree-includes/verify.bsh b/src/it/projects/tree-multimodule/verify.groovy similarity index 64% copy from src/it/projects/tree-includes/verify.bsh copy to src/it/projects/tree-multimodule/verify.groovy index 39689aba..868ac9d9 100644 --- a/src/it/projects/tree-includes/verify.bsh +++ b/src/it/projects/tree-multimodule/verify.groovy @@ -17,21 +17,15 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); +assertThat(new File(basedir, "module-a/target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "module-a/expected.txt")) -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree" ); -} +assertThat(new File(basedir, "module-b/target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "module-b/expected.txt")) return true; diff --git a/src/it/projects/tree-scope/expected1.txt b/src/it/projects/tree-scope/expected1.txt new file mode 100644 index 00000000..cbec48bd --- /dev/null +++ b/src/it/projects/tree-scope/expected1.txt @@ -0,0 +1,37 @@ +org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT +\- org.apache.maven:maven-core:jar:3.6.3:compile + +- org.apache.maven:maven-model:jar:3.6.3:compile + +- org.apache.maven:maven-settings:jar:3.6.3:compile + +- org.apache.maven:maven-settings-builder:jar:3.6.3:compile + | +- org.codehaus.plexus:plexus-interpolation:jar:1.25:compile + | \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:compile + | \- org.sonatype.plexus:plexus-cipher:jar:1.7:compile + +- org.apache.maven:maven-builder-support:jar:3.6.3:compile + +- org.apache.maven:maven-repository-metadata:jar:3.6.3:compile + +- org.apache.maven:maven-artifact:jar:3.6.3:compile + +- org.apache.maven:maven-plugin-api:jar:3.6.3:compile + +- org.apache.maven:maven-model-builder:jar:3.6.3:compile + +- org.apache.maven:maven-resolver-provider:jar:3.6.3:compile + +- org.apache.maven.resolver:maven-resolver-impl:jar:1.4.1:compile + +- org.apache.maven.resolver:maven-resolver-api:jar:1.4.1:compile + +- org.apache.maven.resolver:maven-resolver-spi:jar:1.4.1:compile + +- org.apache.maven.resolver:maven-resolver-util:jar:1.4.1:compile + +- org.apache.maven.shared:maven-shared-utils:jar:3.2.1:compile + | \- commons-io:commons-io:jar:2.5:compile + +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.4:compile + | \- javax.enterprise:cdi-api:jar:1.0:compile + | \- javax.annotation:jsr250-api:jar:1.0:compile + +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.4:compile + +- com.google.inject:guice:jar:no_aop:4.2.1:compile + | +- aopalliance:aopalliance:jar:1.0:compile + | \- com.google.guava:guava:jar:25.1-android:compile + | +- com.google.code.findbugs:jsr305:jar:3.0.1:compile + | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile + | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile + | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile + | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile + +- javax.inject:javax.inject:jar:1:compile + +- org.codehaus.plexus:plexus-utils:jar:3.2.1:compile + +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile + +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile + \- org.apache.commons:commons-lang3:jar:3.8.1:compile diff --git a/src/it/projects/tree-scope/expected2.txt b/src/it/projects/tree-scope/expected2.txt new file mode 100644 index 00000000..1b7e59ae --- /dev/null +++ b/src/it/projects/tree-scope/expected2.txt @@ -0,0 +1,39 @@ +org.apache.maven.its.dependency:test:jar:1.0-SNAPSHOT ++- org.apache.maven:maven-core:jar:3.6.3:compile +| +- org.apache.maven:maven-model:jar:3.6.3:compile +| +- org.apache.maven:maven-settings:jar:3.6.3:compile +| +- org.apache.maven:maven-settings-builder:jar:3.6.3:compile +| | +- org.codehaus.plexus:plexus-interpolation:jar:1.25:compile +| | \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:compile +| | \- org.sonatype.plexus:plexus-cipher:jar:1.7:compile +| +- org.apache.maven:maven-builder-support:jar:3.6.3:compile +| +- org.apache.maven:maven-repository-metadata:jar:3.6.3:compile +| +- org.apache.maven:maven-artifact:jar:3.6.3:compile +| +- org.apache.maven:maven-plugin-api:jar:3.6.3:compile +| +- org.apache.maven:maven-model-builder:jar:3.6.3:compile +| +- org.apache.maven:maven-resolver-provider:jar:3.6.3:compile +| +- org.apache.maven.resolver:maven-resolver-impl:jar:1.4.1:compile +| +- org.apache.maven.resolver:maven-resolver-api:jar:1.4.1:compile +| +- org.apache.maven.resolver:maven-resolver-spi:jar:1.4.1:compile +| +- org.apache.maven.resolver:maven-resolver-util:jar:1.4.1:compile +| +- org.apache.maven.shared:maven-shared-utils:jar:3.2.1:compile +| | \- commons-io:commons-io:jar:2.5:compile +| +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.4:compile +| | \- javax.enterprise:cdi-api:jar:1.0:compile +| | \- javax.annotation:jsr250-api:jar:1.0:compile +| +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.4:compile +| +- com.google.inject:guice:jar:no_aop:4.2.1:compile +| | +- aopalliance:aopalliance:jar:1.0:compile +| | \- com.google.guava:guava:jar:25.1-android:compile +| | +- com.google.code.findbugs:jsr305:jar:3.0.1:compile +| | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile +| | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile +| | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile +| | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile +| +- javax.inject:javax.inject:jar:1:compile +| +- org.codehaus.plexus:plexus-utils:jar:3.2.1:compile +| +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile +| +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile +| \- org.apache.commons:commons-lang3:jar:3.8.1:compile +\- org.slf4j:slf4j-simple:jar:2.0.13:test + \- org.slf4j:slf4j-api:jar:2.0.13:compile diff --git a/src/it/projects/tree-scope/invoker.properties b/src/it/projects/tree-scope/invoker.properties new file mode 100644 index 00000000..2535673a --- /dev/null +++ b/src/it/projects/tree-scope/invoker.properties @@ -0,0 +1,22 @@ +# 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. + +invoker.goals.1 = ${project.groupId}:${project.artifactId}:${project.version}:tree +invoker.systemPropertiesFile.1 = test1.properties + +invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:tree +invoker.systemPropertiesFile.2 = test2.properties diff --git a/src/it/projects/tree-scope/pom.xml b/src/it/projects/tree-scope/pom.xml new file mode 100644 index 00000000..6b915596 --- /dev/null +++ b/src/it/projects/tree-scope/pom.xml @@ -0,0 +1,55 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.dependency</groupId> + <artifactId>test</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>Test</name> + <description> + Test dependency:tree with scope + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>3.6.3</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>2.0.13</version> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/src/it/projects/tree-scope/test1.properties b/src/it/projects/tree-scope/test1.properties new file mode 100644 index 00000000..42b6c429 --- /dev/null +++ b/src/it/projects/tree-scope/test1.properties @@ -0,0 +1,19 @@ +# 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. + +outputFile = target/tree1.txt +scope = compile diff --git a/src/it/projects/tree-scope/test2.properties b/src/it/projects/tree-scope/test2.properties new file mode 100644 index 00000000..784d605e --- /dev/null +++ b/src/it/projects/tree-scope/test2.properties @@ -0,0 +1,19 @@ +# 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. + +outputFile = target/tree2.txt +scope = test diff --git a/src/it/projects/tree-verbose-small/verify.bsh b/src/it/projects/tree-scope/verify.groovy similarity index 58% rename from src/it/projects/tree-verbose-small/verify.bsh rename to src/it/projects/tree-scope/verify.groovy index cf0ab8f6..c6ed2242 100644 --- a/src/it/projects/tree-verbose-small/verify.bsh +++ b/src/it/projects/tree-scope/verify.groovy @@ -17,19 +17,13 @@ * under the License. */ -import java.io.*; -import org.codehaus.plexus.util.*; -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); +import static org.assertj.core.api.Assertions.assertThat -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); +assertThat(new File(basedir, "target/tree1.txt")) + .hasSameTextualContentAs(new File(basedir, "expected1.txt")) -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree." + System.lineSeparator() + "Expected:" + System.lineSeparator() - + expected + System.lineSeparator() + "Actual:" + System.lineSeparator() + actual ); -} +assertThat(new File(basedir, "target/tree2.txt")) + .hasSameTextualContentAs(new File(basedir, "expected2.txt")) -return true; +return true \ No newline at end of file diff --git a/src/it/projects/tree-verbose-multimodule/verify.bsh b/src/it/projects/tree-verbose-multimodule/verify.bsh deleted file mode 100644 index fcbece71..00000000 --- a/src/it/projects/tree-verbose-multimodule/verify.bsh +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ - -import java.io.*; - -import org.codehaus.plexus.util.*; - -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected root dependency tree" ); -} - -actual = FileUtils.fileRead( new File( basedir, "module-a/target/tree.txt" ) ); -expected = FileUtils.fileRead( new File( basedir, "module-a/expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected module-a dependency tree" ); -} - -actual = FileUtils.fileRead( new File( basedir, "module-b/target/tree.txt" ) ); -expected = FileUtils.fileRead( new File( basedir, "module-b/expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected module-b dependency tree" ); -} - -return true; diff --git a/src/it/projects/tree-verbose/verify.bsh b/src/it/projects/tree-verbose-multimodule/verify.groovy similarity index 59% rename from src/it/projects/tree-verbose/verify.bsh rename to src/it/projects/tree-verbose-multimodule/verify.groovy index 26391a48..868ac9d9 100644 --- a/src/it/projects/tree-verbose/verify.bsh +++ b/src/it/projects/tree-verbose-multimodule/verify.groovy @@ -17,20 +17,15 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); +assertThat(new File(basedir, "module-a/target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "module-a/expected.txt")) -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree." + System.lineSeparator() + "Expected:" + System.lineSeparator() - + expected + System.lineSeparator() + "Actual:" + System.lineSeparator() + actual ); -} +assertThat(new File(basedir, "module-b/target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "module-b/expected.txt")) return true; diff --git a/src/it/projects/tree-includes/verify.bsh b/src/it/projects/tree-verbose-small/verify.groovy similarity index 63% copy from src/it/projects/tree-includes/verify.bsh copy to src/it/projects/tree-verbose-small/verify.groovy index 39689aba..0da3382c 100644 --- a/src/it/projects/tree-includes/verify.bsh +++ b/src/it/projects/tree-verbose-small/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree" ); -} - -return true; +return true \ No newline at end of file diff --git a/src/it/projects/tree-includes/verify.bsh b/src/it/projects/tree-verbose/verify.groovy similarity index 63% rename from src/it/projects/tree-includes/verify.bsh rename to src/it/projects/tree-verbose/verify.groovy index 39689aba..b79d25ba 100644 --- a/src/it/projects/tree-includes/verify.bsh +++ b/src/it/projects/tree-verbose/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; +import static org.assertj.core.api.Assertions.assertThat -import org.codehaus.plexus.util.*; +assertThat(new File(basedir, "target/tree.txt")) + .hasSameTextualContentAs(new File(basedir, "expected.txt")) -String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) ); -String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) ); - -actual = actual.replaceAll( "[\n\r]+", "\n" ); -expected = expected.replaceAll( "[\n\r]+", "\n" ); - -System.out.println( "Checking dependency tree..." ); - -if ( !actual.equals( expected ) ) -{ - throw new Exception( "Unexpected dependency tree" ); -} - -return true; +return true