From eeb2c89bd14c3bdd3c90a369b9fd14d0c2902950 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 28 Oct 2023 01:23:11 +0200 Subject: [PATCH] Fixed #379 - Deprecated debug option --- .../release-notes/_release-notes-0.12.0.adoc | 2 + .../release-notes/_release-notes-0.13.0.adoc | 8 ++- .../main/asciidoc/usersguide/usersguide.adoc | 40 +++++++++++---- .../com/soebes/itf/examples/LogoutputIT.java | 4 +- .../itf/examples/MavenIntegrationIT.java | 4 +- .../com/soebes/itf/examples/ProjectIT.java | 6 +-- .../soebes/itf/examples/ProjectSecondIT.java | 6 +-- .../MavenJupiterExtensionWithDefaults.java | 2 +- .../examples/options/OptionsOnClassIT.java | 2 +- .../jupiter/extension/MavenCLIOptions.java | 13 +++++ .../itf/jupiter/extension/MavenDebug.java | 2 + .../itf/jupiter/extension/MavenVerbose.java | 50 +++++++++++++++++++ .../com/soebes/itf/maven/plugin/BasicIT.java | 4 +- .../soebes/itf/maven/plugin/ResourcesIT.java | 4 +- pom.xml | 1 + 15 files changed, 120 insertions(+), 28 deletions(-) create mode 100644 itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenVerbose.java diff --git a/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.12.0.adoc b/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.12.0.adoc index 26b08fe88f..9b3b4c8499 100644 --- a/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.12.0.adoc +++ b/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.12.0.adoc @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. // + [[release-notes-0.12.0]] == Pre-release 0.12.0 @@ -113,6 +114,7 @@ * {issue-297} - Assign @SystemProperty to class / nested class and inherit on all test methods. * {issue-??} - ? +[[release-0.12.0.breaking-changes]] *Breaking Changes* * {issue-276} - Replace File with Path diff --git a/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.13.0.adoc b/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.13.0.adoc index e372791cd7..96ae880d9f 100644 --- a/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.13.0.adoc +++ b/itf-documentation/src/main/asciidoc/release-notes/_release-notes-0.13.0.adoc @@ -40,6 +40,7 @@ :issue-374: https://github.com/khmarbaise/maven-it-extension/issues/374[Fixed #374] :issue-375: https://github.com/khmarbaise/maven-it-extension/issues/375[Fixed #375] :issue-376: https://github.com/khmarbaise/maven-it-extension/issues/376[Fixed #376] +:issue-379: https://github.com/khmarbaise/maven-it-extension/issues/379[Fixed #379] :issue-381: https://github.com/khmarbaise/maven-it-extension/issues/381[Fixed #381] :issue-??: https://github.com/khmarbaise/maven-it-extension/issues/??[Fixed #??] @@ -56,9 +57,14 @@ * {issue-326} - Failing IT's based on Maven 3.8.7 * {issue-329} - Upgrade to smpp 5.3.14 + *Breaking Changes* - * {issue-277} - Remove Deprecated Code. + * {issue-277} - Remove Deprecated Code. Take a look into the release notes of <>. + * If you have used `@MavenDebug` annotation you have to replace that usage with `@MavenVerbose`. You will + get `deprecated warnings` during the compilation. + * {issue-379} - Deprecated `@MavenDebug`; Replace the usage with `@MavenVerbose`. + `@MavenDebug` will be removed with release 0.14.0. *Reporter of this release* diff --git a/itf-documentation/src/main/asciidoc/usersguide/usersguide.adoc b/itf-documentation/src/main/asciidoc/usersguide/usersguide.adoc index 27ea2eae0a..683884e80b 100644 --- a/itf-documentation/src/main/asciidoc/usersguide/usersguide.adoc +++ b/itf-documentation/src/main/asciidoc/usersguide/usersguide.adoc @@ -149,6 +149,7 @@ cause you only need them during the integration tests. ---- include::{itf-examples}/pom.xml[tag=dependencies] ---- + The dependency `com.soebes.itf.jupiter.extension:itf-assertj` contains custom assertions of {assertj}[AssertJ] in case you want to use {assertj}[AssertJ] as your assertion framework. This means you have to include `org.assertj:assertj-core` as well. If you don't want to use AssertJ as assertion framework you can omit them both. @@ -171,6 +172,7 @@ like this: ---- include::{itf-examples}/pom.xml[tag=itf-maven-plugin] ---- + //FIXME: Needed to be changed after itf-maven-plugin will run also the tests. The `itf-maven-plugin` copies the code of your extension/plugin into appropriate directories which are used during the integration tests. Further more it will handle the copying of the structure from @@ -182,6 +184,7 @@ Finally you have to add a configuration for {maven-failsafe-plugin} like the fol ---- include::{itf-examples}/pom.xml[tag=failsafe] ---- + The given properties like `maven.version` transfers the version of Maven which is used within the `itf-jupiter-extension` to run your integration tests and the `maven.home` transfers the information of where to find the current Maven installation. This is needed to start the Maven process @@ -792,7 +795,7 @@ can simply define different options via the appropriate annotations: [source,java] ---- @MavenJupiterExtension -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) class BasicIT { @MavenTest @@ -808,7 +811,7 @@ annotations to your tests like this: ---- @MavenJupiterExtension @MavenOption(MavenCLIOptions.ERRORS) -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) class BasicIT { @MavenTest @@ -823,7 +826,7 @@ The MavenOption annotation can also be used to create a meta annotation like thi @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RUNTIME) @Inherited -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) @MavenOption(MavenCLIOptions.ERRORS) @MavenOption(MavenCLIOptions.FAIL_AT_END) public @interface OptionDebugErrorFailAtEnd { @@ -860,7 +863,7 @@ That is possible by using a custom annotation like this one: @Retention(RUNTIME) @Inherited @MavenJupiterExtension -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) @MavenOption(MavenCLIOptions.ERRORS) @MavenOption(MavenCLIOptions.FAIL_AT_END) @MavenGoal("clean") @@ -1116,13 +1119,13 @@ each test case (`project_001` and `proeject_002`) in this test class. @MavenPredefinedRepository class ProjectIT { - @MavenOption(MavenCLIOptions.DEBUG) + @MavenOption(MavenCLIOptions.VERBOSE) @MavenTest void project_001(MavenExecutionResult result) { assertThat(result).isSuccessful(); } - @MavenOption(MavenCLIOptions.DEBUG) + @MavenOption(MavenCLIOptions.VERBOSE) @MavenTest void project_002(MavenExecutionResult result) { assertThat(result).isSuccessful(); @@ -1161,14 +1164,14 @@ define the `@MavenPredefinedRepository` also on the test method level, which wou @MavenJupiterExtension class ProjectIT { - @MavenOption(MavenCLIOptions.DEBUG) + @MavenOption(MavenCLIOptions.VERBOSE) @MavenTest @MavenPredefinedRepository void project_001(MavenExecutionResult result) { assertThat(result).isSuccessful(); } - @MavenOption(MavenCLIOptions.DEBUG) + @MavenOption(MavenCLIOptions.VERBOSE) @MavenTest @MavenPredefinedRepository void project_002(MavenExecutionResult result) { @@ -1551,24 +1554,40 @@ That will not filter anything. Another example of using the assertions could look like this: +======= +[source,java] +---- include::{itf-examples}/src/test/java/com/soebes/itf/examples/LogoutputIT.java[tag=stdout] +---- This will extract all messages with the prefix `[INFO] ` of the log and check if there is at least one line which contains the given content. We can check for warnings like the following: +======= +[source,java] +---- include::{itf-examples}/src/test/java/com/soebes/itf/examples/LogoutputIT.java[tag=warning] +---- You can access directly the `stdout` and/or the `stderr` of the Maven build and do things yourself if you prefer to go that way. In this case you have to add another injection to the test case (`MavenLog mavenLog` or like this `result.getMavenLog().getStdout()`). -include::{itf-examples}/src/test/java/com/soebes/itf/examples/LogoutputIT.java[tag=selfmade] - The `stderr` output can be accessed as well like this: +[source,java] +---- include::{itf-examples}/src/test/java/com/soebes/itf/examples/LogoutputIT.java[tag=error] +---- + +The `stderr` output can be accessed as well like this: + +[source,java] +---- +include::../../../../../itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java[tag=error] +---- A full-fledged example can be found `itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java` within the itf project. @@ -1711,7 +1730,6 @@ can given via `exception` configuration part as before. include::{itf-failure-plugin}/src/test/resources-its/com/soebes/itf/maven/plugin/failure/FailureIT/fail_with_mojo_failure_exception/pom.xml[tag=configuration] ---- - === Project Not at Root Level Sometimes you have a structure in your version control repository which does not fit with the assumptions which are made by the integration testing framework. diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java b/itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java index b6a3b834af..9fa208a6e0 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/LogoutputIT.java @@ -19,9 +19,9 @@ * under the License. */ -import com.soebes.itf.jupiter.extension.MavenDebug; import com.soebes.itf.jupiter.extension.MavenJupiterExtension; import com.soebes.itf.jupiter.extension.MavenTest; +import com.soebes.itf.jupiter.extension.MavenVerbose; import com.soebes.itf.jupiter.maven.MavenExecutionResult; import com.soebes.itf.jupiter.maven.MavenLog; import org.junit.jupiter.api.condition.EnabledOnOs; @@ -38,7 +38,7 @@ * @author Karl Heinz Marbaise */ @MavenJupiterExtension -@MavenDebug +@MavenVerbose class LogoutputIT { @MavenTest diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/MavenIntegrationIT.java b/itf-examples/src/test/java/com/soebes/itf/examples/MavenIntegrationIT.java index 31f4662af5..575d4f03c7 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/MavenIntegrationIT.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/MavenIntegrationIT.java @@ -19,11 +19,11 @@ * under the License. */ -import com.soebes.itf.jupiter.extension.MavenDebug; import com.soebes.itf.jupiter.extension.MavenGoal; import com.soebes.itf.jupiter.extension.MavenJupiterExtension; import com.soebes.itf.jupiter.extension.MavenRepository; import com.soebes.itf.jupiter.extension.MavenTest; +import com.soebes.itf.jupiter.extension.MavenVerbose; import com.soebes.itf.jupiter.maven.MavenExecutionResult; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @@ -59,7 +59,7 @@ void setup_2(MavenExecutionResult result) { } @MavenTest - @MavenDebug + @MavenVerbose @MavenGoal({"clean", "verify"}) @DisplayName("and the test case tries to check for resultion issue.") void first_integration_test(MavenExecutionResult result) { diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/ProjectIT.java b/itf-examples/src/test/java/com/soebes/itf/examples/ProjectIT.java index d05a88e0bf..29ed21134a 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/ProjectIT.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/ProjectIT.java @@ -19,10 +19,10 @@ * under the License. */ -import com.soebes.itf.jupiter.extension.MavenDebug; import com.soebes.itf.jupiter.extension.MavenJupiterExtension; import com.soebes.itf.jupiter.extension.MavenPredefinedRepository; import com.soebes.itf.jupiter.extension.MavenTest; +import com.soebes.itf.jupiter.extension.MavenVerbose; import com.soebes.itf.jupiter.maven.MavenExecutionResult; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; @@ -35,13 +35,13 @@ class ProjectIT { @MavenTest - @MavenDebug + @MavenVerbose void project_001(MavenExecutionResult result) { assertThat(result).isSuccessful(); } @MavenTest - @MavenDebug + @MavenVerbose void project_002(MavenExecutionResult result) { assertThat(result).isSuccessful(); } diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/ProjectSecondIT.java b/itf-examples/src/test/java/com/soebes/itf/examples/ProjectSecondIT.java index 09e62b9fd6..dc0c915f73 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/ProjectSecondIT.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/ProjectSecondIT.java @@ -19,10 +19,10 @@ * under the License. */ -import com.soebes.itf.jupiter.extension.MavenDebug; import com.soebes.itf.jupiter.extension.MavenJupiterExtension; import com.soebes.itf.jupiter.extension.MavenPredefinedRepository; import com.soebes.itf.jupiter.extension.MavenTest; +import com.soebes.itf.jupiter.extension.MavenVerbose; import com.soebes.itf.jupiter.maven.MavenExecutionResult; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; @@ -33,14 +33,14 @@ @MavenJupiterExtension class ProjectSecondIT { - @MavenDebug + @MavenVerbose @MavenTest @MavenPredefinedRepository void project_001(MavenExecutionResult result) { assertThat(result).isSuccessful(); } - @MavenDebug + @MavenVerbose @MavenTest @MavenPredefinedRepository void project_002(MavenExecutionResult result) { diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/defaults/MavenJupiterExtensionWithDefaults.java b/itf-examples/src/test/java/com/soebes/itf/examples/defaults/MavenJupiterExtensionWithDefaults.java index 881a47ee10..0391d12bff 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/defaults/MavenJupiterExtensionWithDefaults.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/defaults/MavenJupiterExtensionWithDefaults.java @@ -44,7 +44,7 @@ @Retention(RUNTIME) @Inherited @MavenJupiterExtension -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) @MavenOption(MavenCLIOptions.ERRORS) @MavenOption(MavenCLIOptions.FAIL_AT_END) public @interface MavenJupiterExtensionWithDefaults { diff --git a/itf-examples/src/test/java/com/soebes/itf/examples/options/OptionsOnClassIT.java b/itf-examples/src/test/java/com/soebes/itf/examples/options/OptionsOnClassIT.java index c406d8584b..7bd3e813c0 100644 --- a/itf-examples/src/test/java/com/soebes/itf/examples/options/OptionsOnClassIT.java +++ b/itf-examples/src/test/java/com/soebes/itf/examples/options/OptionsOnClassIT.java @@ -28,7 +28,7 @@ import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; @MavenJupiterExtension -@MavenOption(MavenCLIOptions.DEBUG) +@MavenOption(MavenCLIOptions.VERBOSE) class OptionsOnClassIT { @MavenTest diff --git a/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenCLIOptions.java b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenCLIOptions.java index 78f55711fe..53005dab4f 100644 --- a/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenCLIOptions.java +++ b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenCLIOptions.java @@ -52,6 +52,7 @@ * @see MavenCLIOptions#ALSO_MAKE_DEPENDENCIES * @see MavenCLIOptions#ALSO_MAKE * @see MavenCLIOptions#DEBUG + * @see MavenCLIOptions#VERBOSE * @see MavenCLIOptions#NO_TRANSFER_PROGRESS * @see MavenCLIOptions#SHOW_VERSION * @see MavenCLIOptions#BATCH_MODE @@ -193,9 +194,21 @@ public final class MavenCLIOptions { /** * {@code --debug} + * + * @apiNote use {@link #VERBOSE} instead. + * @deprecated Will be removed with 0.14.0 */ + @Deprecated public static final String DEBUG = "--debug"; + /** + * {@code -X} + * + * @since 0.13.0 + * @implNote With Maven 4.0 the option could also being named {@code --verbose}. So this name is decided accordingly. + */ + public static final String VERBOSE = "-X"; + /** * {@code --no-transfer-progress} */ diff --git a/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenDebug.java b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenDebug.java index adb3ab1b6a..ec6e56814a 100644 --- a/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenDebug.java +++ b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenDebug.java @@ -40,11 +40,13 @@ * @since 0.9.0 * @see MavenOption * @author Karl Heinz Marbaise + * @deprecated Will be removed with Release 0.14.0. Use {@link MavenVerbose} instead. */ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RUNTIME) @Inherited @MavenOption(value = MavenCLIOptions.DEBUG) @API(status = EXPERIMENTAL, since = "0.9.0") +@Deprecated public @interface MavenDebug { } diff --git a/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenVerbose.java b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenVerbose.java new file mode 100644 index 0000000000..f4c99e5e08 --- /dev/null +++ b/itf-jupiter-extension/src/main/java/com/soebes/itf/jupiter/extension/MavenVerbose.java @@ -0,0 +1,50 @@ +package com.soebes.itf.jupiter.extension; + +/* + * 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 org.apiguardian.api.API; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +/** + * {@code @MavenVerbose} is a meta annotation for convenience purposes + * to make it easier to activate verbose option for a Maven build + * just by simply adding {@code @MavenVerbose}. + * + *

When applied at the class level, all test methods within that class + * are automatically inheriting the given goal.

+ * + * @since 0.13.0 + * @see MavenOption + * @author Karl Heinz Marbaise + */ +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RUNTIME) +@Inherited +@MavenOption(value = MavenCLIOptions.VERBOSE) +@API(status = EXPERIMENTAL, since = "0.13.0") +public @interface MavenVerbose { +} diff --git a/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/BasicIT.java b/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/BasicIT.java index 4e7e09fb3a..98953b3412 100644 --- a/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/BasicIT.java +++ b/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/BasicIT.java @@ -29,15 +29,15 @@ import java.nio.file.Path; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; -import static com.soebes.itf.jupiter.extension.MavenCLIOptions.DEBUG; import static com.soebes.itf.jupiter.extension.MavenCLIOptions.NO_TRANSFER_PROGRESS; +import static com.soebes.itf.jupiter.extension.MavenCLIOptions.VERBOSE; @MavenJupiterExtension class BasicIT { @MavenTest @MavenOption(NO_TRANSFER_PROGRESS) - @MavenOption(DEBUG) + @MavenOption(VERBOSE) @DisplayName("Running a basic test which makes sure the groupId/artifact of the plugin are ok.") void groupid_artifactid_should_be_ok(MavenExecutionResult result) { assertThat(result).isSuccessful(); diff --git a/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/ResourcesIT.java b/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/ResourcesIT.java index 9a685e3488..7a2b7db665 100644 --- a/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/ResourcesIT.java +++ b/itf-maven-plugin/src/test/java/com/soebes/itf/maven/plugin/ResourcesIT.java @@ -29,15 +29,15 @@ import java.nio.file.Path; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; -import static com.soebes.itf.jupiter.extension.MavenCLIOptions.DEBUG; import static com.soebes.itf.jupiter.extension.MavenCLIOptions.NO_TRANSFER_PROGRESS; +import static com.soebes.itf.jupiter.extension.MavenCLIOptions.VERBOSE; @MavenJupiterExtension class ResourcesIT { @MavenTest @MavenOption(NO_TRANSFER_PROGRESS) - @MavenOption(DEBUG) + @MavenOption(VERBOSE) @MavenGoal("verify") @DisplayName("Running basic resources to see if resources are copied.") void basic_resources(MavenExecutionResult result) { diff --git a/pom.xml b/pom.xml index 3f412303da..14c8c3568f 100644 --- a/pom.xml +++ b/pom.xml @@ -176,6 +176,7 @@ **/.invisible-file .repository/** .repo/** + .mvn/** .maven/spy.log .mvn/* dependency-reduced-pom.xml